mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 02:19:05 +08:00
Merge remote-tracking branch 'remotes/origin/master' into lm_sla_dialog_scaling
This commit is contained in:
commit
229ae454b0
@ -59,7 +59,8 @@ if (MSVC)
|
|||||||
endif ()
|
endif ()
|
||||||
# /bigobj (Increase Number of Sections in .Obj file)
|
# /bigobj (Increase Number of Sections in .Obj file)
|
||||||
# error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
|
# error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
|
||||||
add_compile_options(-bigobj -Zm316)
|
# Generate symbols at every build target, even for the release.
|
||||||
|
add_compile_options(-bigobj -Zm316 /Zi)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Display and check CMAKE_PREFIX_PATH
|
# Display and check CMAKE_PREFIX_PATH
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -121,6 +121,8 @@ if (SLIC3R_GUI)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
# Generate debug symbols even in release mode.
|
||||||
|
target_link_options(PrusaSlicer PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>")
|
||||||
target_link_libraries(PrusaSlicer user32.lib Setupapi.lib OpenGL32.Lib GlU32.Lib)
|
target_link_libraries(PrusaSlicer user32.lib Setupapi.lib OpenGL32.Lib GlU32.Lib)
|
||||||
elseif (MINGW)
|
elseif (MINGW)
|
||||||
target_link_libraries(PrusaSlicer -lopengl32)
|
target_link_libraries(PrusaSlicer -lopengl32)
|
||||||
@ -135,11 +137,15 @@ endif ()
|
|||||||
# Also the shim may load the Mesa software OpenGL renderer if the default renderer does not support OpenGL 2.0 and higher.
|
# Also the shim may load the Mesa software OpenGL renderer if the default renderer does not support OpenGL 2.0 and higher.
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
add_executable(PrusaSlicer_app_gui WIN32 PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc)
|
add_executable(PrusaSlicer_app_gui WIN32 PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc)
|
||||||
|
# Generate debug symbols even in release mode.
|
||||||
|
target_link_options(PrusaSlicer_app_gui PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>")
|
||||||
target_compile_definitions(PrusaSlicer_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE)
|
target_compile_definitions(PrusaSlicer_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE)
|
||||||
add_dependencies(PrusaSlicer_app_gui PrusaSlicer)
|
add_dependencies(PrusaSlicer_app_gui PrusaSlicer)
|
||||||
set_target_properties(PrusaSlicer_app_gui PROPERTIES OUTPUT_NAME "prusa-slicer")
|
set_target_properties(PrusaSlicer_app_gui PROPERTIES OUTPUT_NAME "prusa-slicer")
|
||||||
|
|
||||||
add_executable(PrusaSlicer_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc)
|
add_executable(PrusaSlicer_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer.rc)
|
||||||
|
# Generate debug symbols even in release mode.
|
||||||
|
target_link_options(PrusaSlicer_app_console PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>")
|
||||||
target_compile_definitions(PrusaSlicer_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE)
|
target_compile_definitions(PrusaSlicer_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE)
|
||||||
add_dependencies(PrusaSlicer_app_console PrusaSlicer)
|
add_dependencies(PrusaSlicer_app_console PrusaSlicer)
|
||||||
set_target_properties(PrusaSlicer_app_console PROPERTIES OUTPUT_NAME "prusa-slicer-console")
|
set_target_properties(PrusaSlicer_app_console PROPERTIES OUTPUT_NAME "prusa-slicer-console")
|
||||||
|
@ -568,7 +568,7 @@ bool CLI::setup(int argc, char **argv)
|
|||||||
void CLI::print_help(bool include_print_options, PrinterTechnology printer_technology) const
|
void CLI::print_help(bool include_print_options, PrinterTechnology printer_technology) const
|
||||||
{
|
{
|
||||||
boost::nowide::cout
|
boost::nowide::cout
|
||||||
<< SLIC3R_APP_NAME << " " << SLIC3R_BUILD << " " << "based on Slic3r"
|
<< SLIC3R_BUILD_ID << " " << "based on Slic3r"
|
||||||
#ifdef SLIC3R_GUI
|
#ifdef SLIC3R_GUI
|
||||||
<< " (with GUI support)"
|
<< " (with GUI support)"
|
||||||
#else /* SLIC3R_GUI */
|
#else /* SLIC3R_GUI */
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
#define SLIC3R_APP_NAME "@SLIC3R_APP_NAME@"
|
#define SLIC3R_APP_NAME "@SLIC3R_APP_NAME@"
|
||||||
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
||||||
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
|
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
|
||||||
#define SLIC3R_BUILD "@SLIC3R_BUILD@"
|
#define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@"
|
||||||
|
|
||||||
#endif /* __SLIC3R_VERSION_H */
|
#endif /* __SLIC3R_VERSION_H */
|
||||||
|
@ -174,7 +174,7 @@ wxBitmap* BitmapCache::insert(const std::string &bitmap_key, const wxBitmap *beg
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap* BitmapCache::insert_raw_rgba(const std::string &bitmap_key, unsigned width, unsigned height, const unsigned char *raw_data, float scale /* = 1.0f */)
|
wxBitmap* BitmapCache::insert_raw_rgba(const std::string &bitmap_key, unsigned width, unsigned height, const unsigned char *raw_data, float scale /* = 1.0f */, const bool grayscale/* = false*/)
|
||||||
{
|
{
|
||||||
wxImage image(width, height);
|
wxImage image(width, height);
|
||||||
image.InitAlpha();
|
image.InitAlpha();
|
||||||
@ -187,14 +187,20 @@ wxBitmap* BitmapCache::insert_raw_rgba(const std::string &bitmap_key, unsigned w
|
|||||||
*rgb ++ = *raw_data ++;
|
*rgb ++ = *raw_data ++;
|
||||||
*alpha ++ = *raw_data ++;
|
*alpha ++ = *raw_data ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (grayscale)
|
||||||
|
image.ConvertToGreyscale(m_gs, m_gs, m_gs);
|
||||||
|
|
||||||
return this->insert(bitmap_key, wxImage_to_wxBitmap_with_alpha(std::move(image), scale));
|
return this->insert(bitmap_key, wxImage_to_wxBitmap_with_alpha(std::move(image), scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned int width, unsigned int height)
|
wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned int width, unsigned int height,
|
||||||
|
const bool grayscale/* = false*/)
|
||||||
{
|
{
|
||||||
std::string bitmap_key = bitmap_name + ( height !=0 ?
|
std::string bitmap_key = bitmap_name + ( height !=0 ?
|
||||||
"-h" + std::to_string(height) :
|
"-h" + std::to_string(height) :
|
||||||
"-w" + std::to_string(width));
|
"-w" + std::to_string(width))
|
||||||
|
+ (grayscale ? "-gs" : "");
|
||||||
|
|
||||||
auto it = m_map.find(bitmap_key);
|
auto it = m_map.find(bitmap_key);
|
||||||
if (it != m_map.end())
|
if (it != m_map.end())
|
||||||
@ -213,15 +219,20 @@ wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned int wid
|
|||||||
if (height != 0 && width != 0)
|
if (height != 0 && width != 0)
|
||||||
image.Rescale(width, height, wxIMAGE_QUALITY_BILINEAR);
|
image.Rescale(width, height, wxIMAGE_QUALITY_BILINEAR);
|
||||||
|
|
||||||
|
if (grayscale)
|
||||||
|
image.ConvertToGreyscale(m_gs, m_gs, m_gs);
|
||||||
|
|
||||||
return this->insert(bitmap_key, wxImage_to_wxBitmap_with_alpha(std::move(image)));
|
return this->insert(bitmap_key, wxImage_to_wxBitmap_with_alpha(std::move(image)));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_width, unsigned target_height, float scale /* = 1.0f */)
|
wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_width, unsigned target_height,
|
||||||
|
float scale /* = 1.0f */, const bool grayscale/* = false*/)
|
||||||
{
|
{
|
||||||
std::string bitmap_key = bitmap_name + ( target_height !=0 ?
|
std::string bitmap_key = bitmap_name + ( target_height !=0 ?
|
||||||
"-h" + std::to_string(target_height) :
|
"-h" + std::to_string(target_height) :
|
||||||
"-w" + std::to_string(target_width))
|
"-w" + std::to_string(target_width))
|
||||||
+ (scale != 1.0f ? "-s" + std::to_string(scale) : "");
|
+ (scale != 1.0f ? "-s" + std::to_string(scale) : "")
|
||||||
|
+ (grayscale ? "-gs" : "");
|
||||||
|
|
||||||
target_height != 0 ? target_height *= scale : target_width *= scale;
|
target_height != 0 ? target_height *= scale : target_width *= scale;
|
||||||
|
|
||||||
@ -256,7 +267,7 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_
|
|||||||
::nsvgDeleteRasterizer(rast);
|
::nsvgDeleteRasterizer(rast);
|
||||||
::nsvgDelete(image);
|
::nsvgDelete(image);
|
||||||
|
|
||||||
return this->insert_raw_rgba(bitmap_key, width, height, data.data(), scale);
|
return this->insert_raw_rgba(bitmap_key, width, height, data.data(), scale, grayscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency)
|
wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency)
|
||||||
|
@ -29,12 +29,12 @@ public:
|
|||||||
wxBitmap* insert(const std::string &name, const wxBitmap &bmp, const wxBitmap &bmp2, const wxBitmap &bmp3);
|
wxBitmap* insert(const std::string &name, const wxBitmap &bmp, const wxBitmap &bmp2, const wxBitmap &bmp3);
|
||||||
wxBitmap* insert(const std::string &name, const std::vector<wxBitmap> &bmps) { return this->insert(name, &bmps.front(), &bmps.front() + bmps.size()); }
|
wxBitmap* insert(const std::string &name, const std::vector<wxBitmap> &bmps) { return this->insert(name, &bmps.front(), &bmps.front() + bmps.size()); }
|
||||||
wxBitmap* insert(const std::string &name, const wxBitmap *begin, const wxBitmap *end);
|
wxBitmap* insert(const std::string &name, const wxBitmap *begin, const wxBitmap *end);
|
||||||
wxBitmap* insert_raw_rgba(const std::string &bitmap_key, unsigned width, unsigned height, const unsigned char *raw_data, float scale = 1.0f);
|
wxBitmap* insert_raw_rgba(const std::string &bitmap_key, unsigned width, unsigned height, const unsigned char *raw_data, float scale = 1.0f, const bool grayscale = false);
|
||||||
|
|
||||||
// Load png from resources/icons. bitmap_key is given without the .png suffix. Bitmap will be rescaled to provided height/width if nonzero.
|
// Load png from resources/icons. bitmap_key is given without the .png suffix. Bitmap will be rescaled to provided height/width if nonzero.
|
||||||
wxBitmap* load_png(const std::string &bitmap_key, unsigned int width = 0, unsigned int height = 0);
|
wxBitmap* load_png(const std::string &bitmap_key, unsigned int width = 0, unsigned int height = 0, const bool grayscale = false);
|
||||||
// Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width.
|
// Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width.
|
||||||
wxBitmap* load_svg(const std::string &bitmap_key, unsigned int width = 0, unsigned int height = 0, float scale = 1.0f);
|
wxBitmap* load_svg(const std::string &bitmap_key, unsigned int width = 0, unsigned int height = 0, float scale = 1.0f, const bool grayscale = false);
|
||||||
|
|
||||||
static wxBitmap mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency);
|
static wxBitmap mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency);
|
||||||
static wxBitmap mksolid(size_t width, size_t height, const unsigned char rgb[3]) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE); }
|
static wxBitmap mksolid(size_t width, size_t height, const unsigned char rgb[3]) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE); }
|
||||||
@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, wxBitmap*> m_map;
|
std::map<std::string, wxBitmap*> m_map;
|
||||||
|
double m_gs = 0.2; // value, used for image.ConvertToGreyscale(m_gs, m_gs, m_gs)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // GUI
|
} // GUI
|
||||||
|
@ -1120,7 +1120,8 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu)
|
|||||||
wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
|
wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
|
||||||
{
|
{
|
||||||
return append_menu_item(menu, wxID_ANY, _(L("Split to parts")), "",
|
return append_menu_item(menu, wxID_ANY, _(L("Split to parts")), "",
|
||||||
[this](wxCommandEvent&) { split(); }, "split_parts_SMALL", menu);
|
[this](wxCommandEvent&) { split(); }, "split_parts_SMALL", menu,
|
||||||
|
[this]() { return is_splittable(); }, wxGetApp().plater());
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
||||||
@ -1199,10 +1200,10 @@ wxMenuItem* ObjectList::append_menu_item_change_type(wxMenu* menu)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem* ObjectList::append_menu_item_instance_to_object(wxMenu* menu)
|
wxMenuItem* ObjectList::append_menu_item_instance_to_object(wxMenu* menu, wxWindow* parent)
|
||||||
{
|
{
|
||||||
return append_menu_item(menu, wxID_ANY, _(L("Set as a Separated Object")), "",
|
return append_menu_item(menu, wxID_ANY, _(L("Set as a Separated Object")), "",
|
||||||
[this](wxCommandEvent&) { split_instances(); }, "", menu);
|
[this](wxCommandEvent&) { split_instances(); }, "", menu, [](){return wxGetApp().plater()->can_set_instance_to_object(); }, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::append_menu_items_osx(wxMenu* menu)
|
void ObjectList::append_menu_items_osx(wxMenu* menu)
|
||||||
@ -1217,8 +1218,10 @@ wxMenuItem* ObjectList::append_menu_item_fix_through_netfabb(wxMenu* menu)
|
|||||||
{
|
{
|
||||||
if (!is_windows10())
|
if (!is_windows10())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Plater* plater = wxGetApp().plater();
|
||||||
wxMenuItem* menu_item = append_menu_item(menu, wxID_ANY, _(L("Fix through the Netfabb")), "",
|
wxMenuItem* menu_item = append_menu_item(menu, wxID_ANY, _(L("Fix through the Netfabb")), "",
|
||||||
[this](wxCommandEvent&) { fix_through_netfabb(); }, "", menu);
|
[this](wxCommandEvent&) { fix_through_netfabb(); }, "", menu,
|
||||||
|
[plater]() {return plater->can_fix_through_netfabb(); }, plater);
|
||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
|
|
||||||
return menu_item;
|
return menu_item;
|
||||||
@ -1284,9 +1287,6 @@ void ObjectList::create_object_popupmenu(wxMenu *menu)
|
|||||||
// rest of a object_menu will be added later in:
|
// rest of a object_menu will be added later in:
|
||||||
// - append_menu_items_add_volume() -> for "Add (volumes)"
|
// - append_menu_items_add_volume() -> for "Add (volumes)"
|
||||||
// - append_menu_item_settings() -> for "Add (settings)"
|
// - append_menu_item_settings() -> for "Add (settings)"
|
||||||
|
|
||||||
wxGetApp().plater()->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) {
|
|
||||||
evt.Enable(is_splittable()); }, m_menu_item_split->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
|
void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
|
||||||
@ -1318,14 +1318,11 @@ void ObjectList::create_part_popupmenu(wxMenu *menu)
|
|||||||
|
|
||||||
// rest of a object_sla_menu will be added later in:
|
// rest of a object_sla_menu will be added later in:
|
||||||
// - append_menu_item_settings() -> for "Add (settings)"
|
// - append_menu_item_settings() -> for "Add (settings)"
|
||||||
|
|
||||||
wxGetApp().plater()->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) {
|
|
||||||
evt.Enable(is_splittable()); }, m_menu_item_split_part->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::create_instance_popupmenu(wxMenu*menu)
|
void ObjectList::create_instance_popupmenu(wxMenu*menu)
|
||||||
{
|
{
|
||||||
m_menu_item_split_instances = append_menu_item_instance_to_object(menu);
|
m_menu_item_split_instances = append_menu_item_instance_to_object(menu, wxGetApp().plater());
|
||||||
|
|
||||||
/* New behavior logic:
|
/* New behavior logic:
|
||||||
* 1. Split Object to several separated object, if ALL instances are selected
|
* 1. Split Object to several separated object, if ALL instances are selected
|
||||||
|
@ -199,7 +199,7 @@ public:
|
|||||||
wxMenuItem* append_menu_item_split(wxMenu* menu);
|
wxMenuItem* append_menu_item_split(wxMenu* menu);
|
||||||
wxMenuItem* append_menu_item_settings(wxMenu* menu);
|
wxMenuItem* append_menu_item_settings(wxMenu* menu);
|
||||||
wxMenuItem* append_menu_item_change_type(wxMenu* menu);
|
wxMenuItem* append_menu_item_change_type(wxMenu* menu);
|
||||||
wxMenuItem* append_menu_item_instance_to_object(wxMenu* menu);
|
wxMenuItem* append_menu_item_instance_to_object(wxMenu* menu, wxWindow* parent);
|
||||||
void append_menu_items_osx(wxMenu* menu);
|
void append_menu_items_osx(wxMenu* menu);
|
||||||
wxMenuItem* append_menu_item_fix_through_netfabb(wxMenu* menu);
|
wxMenuItem* append_menu_item_fix_through_netfabb(wxMenu* menu);
|
||||||
void append_menu_item_export_stl(wxMenu* menu) const ;
|
void append_menu_item_export_stl(wxMenu* menu) const ;
|
||||||
|
@ -33,7 +33,7 @@ namespace Slic3r {
|
|||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
MainFrame::MainFrame() :
|
MainFrame::MainFrame() :
|
||||||
DPIFrame(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " " + wxString(SLIC3R_BUILD) + " " + _(L("based on Slic3r")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "mainframe"),
|
DPIFrame(NULL, wxID_ANY, wxString(SLIC3R_BUILD_ID) + " " + _(L("based on Slic3r")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, "mainframe"),
|
||||||
m_printhost_queue_dlg(new PrintHostQueueDialog(this))
|
m_printhost_queue_dlg(new PrintHostQueueDialog(this))
|
||||||
{
|
{
|
||||||
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
||||||
@ -341,18 +341,22 @@ void MainFrame::init_menubar()
|
|||||||
// File menu
|
// File menu
|
||||||
wxMenu* fileMenu = new wxMenu;
|
wxMenu* fileMenu = new wxMenu;
|
||||||
{
|
{
|
||||||
wxMenuItem* item_open = append_menu_item(fileMenu, wxID_ANY, _(L("&Open Project")) + dots + "\tCtrl+O", _(L("Open a project file")),
|
append_menu_item(fileMenu, wxID_ANY, _(L("&Open Project")) + dots + "\tCtrl+O", _(L("Open a project file")),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, menu_icon("open"));
|
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, menu_icon("open"), nullptr,
|
||||||
wxMenuItem* item_save = append_menu_item(fileMenu, wxID_ANY, _(L("&Save Project")) + "\tCtrl+S", _(L("Save current project file")),
|
[this](){return m_plater != nullptr; }, this);
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(into_path(m_plater->get_project_filename())); }, menu_icon("save"));
|
append_menu_item(fileMenu, wxID_ANY, _(L("&Save Project")) + "\tCtrl+S", _(L("Save current project file")),
|
||||||
wxMenuItem* item_save_as = append_menu_item(fileMenu, wxID_ANY, _(L("Save Project &as")) + dots + "\tCtrl+Alt+S", _(L("Save current project file as")),
|
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(into_path(m_plater->get_project_filename())); }, menu_icon("save"), nullptr,
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(); }, menu_icon("save"));
|
[this](){return m_plater != nullptr && can_save(); }, this);
|
||||||
|
append_menu_item(fileMenu, wxID_ANY, _(L("Save Project &as")) + dots + "\tCtrl+Alt+S", _(L("Save current project file as")),
|
||||||
|
[this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(); }, menu_icon("save"), nullptr,
|
||||||
|
[this](){return m_plater != nullptr && can_save(); }, this);
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
|
|
||||||
wxMenu* import_menu = new wxMenu();
|
wxMenu* import_menu = new wxMenu();
|
||||||
wxMenuItem* item_import_model = append_menu_item(import_menu, wxID_ANY, _(L("Import STL/OBJ/AM&F/3MF")) + dots + "\tCtrl+I", _(L("Load a model")),
|
append_menu_item(import_menu, wxID_ANY, _(L("Import STL/OBJ/AM&F/3MF")) + dots + "\tCtrl+I", _(L("Load a model")),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->add_model(); }, menu_icon("import_plater"));
|
[this](wxCommandEvent&) { if (m_plater) m_plater->add_model(); }, menu_icon("import_plater"), nullptr,
|
||||||
|
[this](){return m_plater != nullptr; }, this);
|
||||||
import_menu->AppendSeparator();
|
import_menu->AppendSeparator();
|
||||||
append_menu_item(import_menu, wxID_ANY, _(L("Import &Config")) + dots + "\tCtrl+L", _(L("Load exported configuration file")),
|
append_menu_item(import_menu, wxID_ANY, _(L("Import &Config")) + dots + "\tCtrl+L", _(L("Load exported configuration file")),
|
||||||
[this](wxCommandEvent&) { load_config_file(); }, menu_icon("import_config"));
|
[this](wxCommandEvent&) { load_config_file(); }, menu_icon("import_config"));
|
||||||
@ -365,15 +369,19 @@ void MainFrame::init_menubar()
|
|||||||
|
|
||||||
wxMenu* export_menu = new wxMenu();
|
wxMenu* export_menu = new wxMenu();
|
||||||
wxMenuItem* item_export_gcode = append_menu_item(export_menu, wxID_ANY, _(L("Export &G-code")) + dots +"\tCtrl+G", _(L("Export current plate as G-code")),
|
wxMenuItem* item_export_gcode = append_menu_item(export_menu, wxID_ANY, _(L("Export &G-code")) + dots +"\tCtrl+G", _(L("Export current plate as G-code")),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(); }, menu_icon("export_gcode"));
|
[this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(); }, menu_icon("export_gcode"), nullptr,
|
||||||
|
[this](){return can_export_gcode(); }, this);
|
||||||
m_changeable_menu_items.push_back(item_export_gcode);
|
m_changeable_menu_items.push_back(item_export_gcode);
|
||||||
export_menu->AppendSeparator();
|
export_menu->AppendSeparator();
|
||||||
wxMenuItem* item_export_stl = append_menu_item(export_menu, wxID_ANY, _(L("Export plate as &STL")) + dots, _(L("Export current plate as STL")),
|
append_menu_item(export_menu, wxID_ANY, _(L("Export plate as &STL")) + dots, _(L("Export current plate as STL")),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, menu_icon("export_plater"));
|
[this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, menu_icon("export_plater"), nullptr,
|
||||||
wxMenuItem* item_export_stl_sla = append_menu_item(export_menu, wxID_ANY, _(L("Export plate as STL including supports")) + dots, _(L("Export current plate as STL including supports")),
|
[this](){return can_export_model(); }, this);
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(true); }, menu_icon("export_plater"));
|
append_menu_item(export_menu, wxID_ANY, _(L("Export plate as STL including supports")) + dots, _(L("Export current plate as STL including supports")),
|
||||||
wxMenuItem* item_export_amf = append_menu_item(export_menu, wxID_ANY, _(L("Export plate as &AMF")) + dots, _(L("Export current plate as AMF")),
|
[this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(true); }, menu_icon("export_plater"), nullptr,
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->export_amf(); }, menu_icon("export_plater"));
|
[this](){return can_export_supports(); }, this);
|
||||||
|
append_menu_item(export_menu, wxID_ANY, _(L("Export plate as &AMF")) + dots, _(L("Export current plate as AMF")),
|
||||||
|
[this](wxCommandEvent&) { if (m_plater) m_plater->export_amf(); }, menu_icon("export_plater"), nullptr,
|
||||||
|
[this](){return can_export_model(); }, this);
|
||||||
export_menu->AppendSeparator();
|
export_menu->AppendSeparator();
|
||||||
append_menu_item(export_menu, wxID_ANY, _(L("Export &Config")) +dots +"\tCtrl+E", _(L("Export current configuration to file")),
|
append_menu_item(export_menu, wxID_ANY, _(L("Export &Config")) +dots +"\tCtrl+E", _(L("Export current configuration to file")),
|
||||||
[this](wxCommandEvent&) { export_config(); }, menu_icon("export_config"));
|
[this](wxCommandEvent&) { export_config(); }, menu_icon("export_config"));
|
||||||
@ -413,16 +421,6 @@ void MainFrame::init_menubar()
|
|||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
append_menu_item(fileMenu, wxID_EXIT, _(L("&Quit")), wxString::Format(_(L("Quit %s")), SLIC3R_APP_NAME),
|
append_menu_item(fileMenu, wxID_EXIT, _(L("&Quit")), wxString::Format(_(L("Quit %s")), SLIC3R_APP_NAME),
|
||||||
[this](wxCommandEvent&) { Close(false); });
|
[this](wxCommandEvent&) { Close(false); });
|
||||||
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_plater != nullptr); }, item_open->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_save()); }, item_save->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_save()); }, item_save_as->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_plater != nullptr); }, item_import_model->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_export_gcode()); }, item_export_gcode->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_export_model()); }, item_export_stl->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_export_supports()); }, item_export_stl_sla->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_export_model()); }, item_export_amf->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_slice()); }, m_menu_item_reslice_now->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -446,26 +444,25 @@ void MainFrame::init_menubar()
|
|||||||
#else
|
#else
|
||||||
wxString hotkey_delete = "Del";
|
wxString hotkey_delete = "Del";
|
||||||
#endif
|
#endif
|
||||||
wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A", _(L("Selects all objects")),
|
append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A",
|
||||||
[this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->select_all(); }, "");
|
_(L("Selects all objects")), [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->select_all(); },
|
||||||
|
"", nullptr, [this](){return can_select(); }, this);
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete, _(L("Deletes the current selection")),
|
append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete,
|
||||||
[this](wxCommandEvent&) { m_plater->remove_selected(); }, menu_icon("remove_menu"));
|
_(L("Deletes the current selection")),[this](wxCommandEvent&) { m_plater->remove_selected(); },
|
||||||
wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + hotkey_delete, _(L("Deletes all objects")),
|
menu_icon("remove_menu"), nullptr, [this](){return can_delete(); }, this);
|
||||||
[this](wxCommandEvent&) { m_plater->reset_with_confirm(); }, menu_icon("delete_all_menu"));
|
append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + hotkey_delete,
|
||||||
|
_(L("Deletes all objects")), [this](wxCommandEvent&) { m_plater->reset_with_confirm(); },
|
||||||
|
menu_icon("delete_all_menu"), nullptr, [this](){return can_delete_all(); }, this);
|
||||||
|
|
||||||
editMenu->AppendSeparator();
|
editMenu->AppendSeparator();
|
||||||
|
|
||||||
wxMenuItem* item_copy = append_menu_item(editMenu, wxID_ANY, _(L("&Copy")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "C", _(L("Copy selection to clipboard")),
|
append_menu_item(editMenu, wxID_ANY, _(L("&Copy")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "C",
|
||||||
[this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); }, menu_icon("copy_menu"));
|
_(L("Copy selection to clipboard")), [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); },
|
||||||
wxMenuItem* item_paste = append_menu_item(editMenu, wxID_ANY, _(L("&Paste")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "V", _(L("Paste clipboard")),
|
menu_icon("copy_menu"), nullptr, [this](){return m_plater->can_copy(); }, this);
|
||||||
[this](wxCommandEvent&) { m_plater->paste_from_clipboard(); }, menu_icon("paste_menu"));
|
append_menu_item(editMenu, wxID_ANY, _(L("&Paste")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "V",
|
||||||
|
_(L("Paste clipboard")), [this](wxCommandEvent&) { m_plater->paste_from_clipboard(); },
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_select()); }, item_select_all->GetId());
|
menu_icon("paste_menu"), nullptr, [this](){return m_plater->can_paste(); }, this);
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete()); }, item_delete_sel->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_all()); }, item_delete_all->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_plater->can_copy()); }, item_copy->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_plater->can_paste()); }, item_paste->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window menu
|
// Window menu
|
||||||
@ -489,13 +486,12 @@ void MainFrame::init_menubar()
|
|||||||
[this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, menu_icon("printer"));
|
[this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, menu_icon("printer"));
|
||||||
if (m_plater) {
|
if (m_plater) {
|
||||||
windowMenu->AppendSeparator();
|
windowMenu->AppendSeparator();
|
||||||
wxMenuItem* item_3d = append_menu_item(windowMenu, wxID_HIGHEST + 5, _(L("3&D")) + "\tCtrl+5", _(L("Show the 3D editing view")),
|
append_menu_item(windowMenu, wxID_HIGHEST + 5, _(L("3&D")) + "\tCtrl+5", _(L("Show the 3D editing view")),
|
||||||
[this](wxCommandEvent&) { m_plater->select_view_3D("3D"); }, menu_icon("editor_menu"));
|
[this](wxCommandEvent&) { m_plater->select_view_3D("3D"); }, menu_icon("editor_menu"), nullptr,
|
||||||
wxMenuItem* item_preview = append_menu_item(windowMenu, wxID_HIGHEST + 6, _(L("Pre&view")) + "\tCtrl+6", _(L("Show the 3D slices preview")),
|
[this](){return can_change_view(); }, this);
|
||||||
[this](wxCommandEvent&) { m_plater->select_view_3D("Preview"); }, menu_icon("preview_menu"));
|
append_menu_item(windowMenu, wxID_HIGHEST + 6, _(L("Pre&view")) + "\tCtrl+6", _(L("Show the 3D slices preview")),
|
||||||
|
[this](wxCommandEvent&) { m_plater->select_view_3D("Preview"); }, menu_icon("preview_menu"), nullptr,
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_3d->GetId());
|
[this](){return can_change_view(); }, this);
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_preview->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
@ -521,24 +517,23 @@ void MainFrame::init_menubar()
|
|||||||
if (m_plater) {
|
if (m_plater) {
|
||||||
viewMenu = new wxMenu();
|
viewMenu = new wxMenu();
|
||||||
// The camera control accelerators are captured by GLCanvas3D::on_char().
|
// The camera control accelerators are captured by GLCanvas3D::on_char().
|
||||||
wxMenuItem* item_iso = append_menu_item(viewMenu, wxID_ANY, _(L("Iso")) + sep + "&0", _(L("Iso View")), [this](wxCommandEvent&) { select_view("iso"); });
|
append_menu_item(viewMenu, wxID_ANY, _(L("Iso")) + sep + "&0", _(L("Iso View")),[this](wxCommandEvent&) { select_view("iso"); },
|
||||||
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
//TRN To be shown in the main menu View->Top
|
//TRN To be shown in the main menu View->Top
|
||||||
wxMenuItem* item_top = append_menu_item(viewMenu, wxID_ANY, _(L("Top")) + sep + "&1", _(L("Top View")), [this](wxCommandEvent&) { select_view("top"); });
|
append_menu_item(viewMenu, wxID_ANY, _(L("Top")) + sep + "&1", _(L("Top View")), [this](wxCommandEvent&) { select_view("top"); },
|
||||||
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
//TRN To be shown in the main menu View->Bottom
|
//TRN To be shown in the main menu View->Bottom
|
||||||
wxMenuItem* item_bottom = append_menu_item(viewMenu, wxID_ANY, _(L("Bottom")) + sep + "&2", _(L("Bottom View")), [this](wxCommandEvent&) { select_view("bottom"); });
|
append_menu_item(viewMenu, wxID_ANY, _(L("Bottom")) + sep + "&2", _(L("Bottom View")), [this](wxCommandEvent&) { select_view("bottom"); },
|
||||||
wxMenuItem* item_front = append_menu_item(viewMenu, wxID_ANY, _(L("Front")) + sep + "&3", _(L("Front View")), [this](wxCommandEvent&) { select_view("front"); });
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
wxMenuItem* item_rear = append_menu_item(viewMenu, wxID_ANY, _(L("Rear")) + sep + "&4", _(L("Rear View")), [this](wxCommandEvent&) { select_view("rear"); });
|
append_menu_item(viewMenu, wxID_ANY, _(L("Front")) + sep + "&3", _(L("Front View")), [this](wxCommandEvent&) { select_view("front"); },
|
||||||
wxMenuItem* item_left = append_menu_item(viewMenu, wxID_ANY, _(L("Left")) + sep + "&5", _(L("Left View")), [this](wxCommandEvent&) { select_view("left"); });
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
wxMenuItem* item_right = append_menu_item(viewMenu, wxID_ANY, _(L("Right")) + sep + "&6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); });
|
append_menu_item(viewMenu, wxID_ANY, _(L("Rear")) + sep + "&4", _(L("Rear View")), [this](wxCommandEvent&) { select_view("rear"); },
|
||||||
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_iso->GetId());
|
append_menu_item(viewMenu, wxID_ANY, _(L("Left")) + sep + "&5", _(L("Left View")), [this](wxCommandEvent&) { select_view("left"); },
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_top->GetId());
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_bottom->GetId());
|
append_menu_item(viewMenu, wxID_ANY, _(L("Right")) + sep + "&6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); },
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_front->GetId());
|
"", nullptr, [this](){return can_change_view(); }, this);
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_rear->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_left->GetId());
|
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_right->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help menu
|
// Help menu
|
||||||
|
@ -445,7 +445,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
|
|||||||
|
|
||||||
option = m_og->get_option("fill_density");
|
option = m_og->get_option("fill_density");
|
||||||
option.opt.label = L("Infill");
|
option.opt.label = L("Infill");
|
||||||
option.opt.width = 6;
|
option.opt.width = 7/*6*/;
|
||||||
option.opt.sidetext = " ";
|
option.opt.sidetext = " ";
|
||||||
line.append_option(option);
|
line.append_option(option);
|
||||||
|
|
||||||
@ -1336,6 +1336,8 @@ struct Plater::priv
|
|||||||
bool can_arrange() const;
|
bool can_arrange() const;
|
||||||
bool can_layers_editing() const;
|
bool can_layers_editing() const;
|
||||||
bool can_fix_through_netfabb() const;
|
bool can_fix_through_netfabb() const;
|
||||||
|
bool can_set_instance_to_object() const;
|
||||||
|
bool can_mirror() const;
|
||||||
|
|
||||||
void msw_rescale_object_menu();
|
void msw_rescale_object_menu();
|
||||||
|
|
||||||
@ -1347,10 +1349,8 @@ private:
|
|||||||
bool complit_init_part_menu();
|
bool complit_init_part_menu();
|
||||||
void init_view_toolbar();
|
void init_view_toolbar();
|
||||||
|
|
||||||
bool can_set_instance_to_object() const;
|
|
||||||
bool can_split() const;
|
bool can_split() const;
|
||||||
bool layers_height_allowed() const;
|
bool layers_height_allowed() const;
|
||||||
bool can_mirror() const;
|
|
||||||
|
|
||||||
void update_fff_scene();
|
void update_fff_scene();
|
||||||
void update_sla_scene();
|
void update_sla_scene();
|
||||||
@ -2928,39 +2928,31 @@ void Plater::priv::msw_rescale_object_menu()
|
|||||||
|
|
||||||
bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/)
|
bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/)
|
||||||
{
|
{
|
||||||
wxMenuItem* item_delete = nullptr;
|
|
||||||
if (is_part) {
|
if (is_part) {
|
||||||
item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
|
append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
|
||||||
[this](wxCommandEvent&) { q->remove_selected(); }, "delete");
|
[this](wxCommandEvent&) { q->remove_selected(); }, "delete", nullptr, [this]() { return can_delete(); }, q);
|
||||||
|
|
||||||
sidebar->obj_list()->append_menu_item_export_stl(menu);
|
sidebar->obj_list()->append_menu_item_export_stl(menu);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wxMenuItem* item_increase = append_menu_item(menu, wxID_ANY, _(L("Increase copies")) + "\t+", _(L("Place one more copy of the selected object")),
|
wxMenuItem* item_increase = append_menu_item(menu, wxID_ANY, _(L("Increase copies")) + "\t+", _(L("Place one more copy of the selected object")),
|
||||||
[this](wxCommandEvent&) { q->increase_instances(); }, "add_copies");
|
[this](wxCommandEvent&) { q->increase_instances(); }, "add_copies", nullptr, [this]() { return can_increase_instances(); }, q);
|
||||||
wxMenuItem* item_decrease = append_menu_item(menu, wxID_ANY, _(L("Decrease copies")) + "\t-", _(L("Remove one copy of the selected object")),
|
wxMenuItem* item_decrease = append_menu_item(menu, wxID_ANY, _(L("Decrease copies")) + "\t-", _(L("Remove one copy of the selected object")),
|
||||||
[this](wxCommandEvent&) { q->decrease_instances(); }, "remove_copies");
|
[this](wxCommandEvent&) { q->decrease_instances(); }, "remove_copies", nullptr, [this]() { return can_decrease_instances(); }, q);
|
||||||
wxMenuItem* item_set_number_of_copies = append_menu_item(menu, wxID_ANY, _(L("Set number of copies")) + dots, _(L("Change the number of copies of the selected object")),
|
wxMenuItem* item_set_number_of_copies = append_menu_item(menu, wxID_ANY, _(L("Set number of copies")) + dots, _(L("Change the number of copies of the selected object")),
|
||||||
[this](wxCommandEvent&) { q->set_number_of_copies(); }, "number_of_copies");
|
[this](wxCommandEvent&) { q->set_number_of_copies(); }, "number_of_copies", nullptr, [this]() { return can_increase_instances(); }, q);
|
||||||
|
|
||||||
|
|
||||||
items_increase.push_back(item_increase);
|
items_increase.push_back(item_increase);
|
||||||
items_decrease.push_back(item_decrease);
|
items_decrease.push_back(item_decrease);
|
||||||
items_set_number_of_copies.push_back(item_set_number_of_copies);
|
items_set_number_of_copies.push_back(item_set_number_of_copies);
|
||||||
|
|
||||||
// Delete menu was moved to be after +/- instace to make it more difficult to be selected by mistake.
|
// Delete menu was moved to be after +/- instace to make it more difficult to be selected by mistake.
|
||||||
item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
|
append_menu_item(menu, wxID_ANY, _(L("Delete")) + "\tDel", _(L("Remove the selected object")),
|
||||||
[this](wxCommandEvent&) { q->remove_selected(); }, "delete");
|
[this](wxCommandEvent&) { q->remove_selected(); }, "delete", nullptr, [this]() { return can_delete(); }, q);
|
||||||
|
|
||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
wxMenuItem* item_instance_to_object = sidebar->obj_list()->append_menu_item_instance_to_object(menu);
|
sidebar->obj_list()->append_menu_item_instance_to_object(menu, q);
|
||||||
|
|
||||||
if (q != nullptr)
|
|
||||||
{
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId());
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId());
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_set_number_of_copies->GetId());
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_set_instance_to_object()); }, item_instance_to_object->GetId());
|
|
||||||
}
|
|
||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
|
|
||||||
append_menu_item(menu, wxID_ANY, _(L("Reload from Disk")), _(L("Reload the selected file from Disk")),
|
append_menu_item(menu, wxID_ANY, _(L("Reload from Disk")), _(L("Reload the selected file from Disk")),
|
||||||
@ -2972,7 +2964,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
|
|||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem* item_fix_through_netfabb = sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu);
|
sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu);
|
||||||
|
|
||||||
wxMenu* mirror_menu = new wxMenu();
|
wxMenu* mirror_menu = new wxMenu();
|
||||||
if (mirror_menu == nullptr)
|
if (mirror_menu == nullptr)
|
||||||
@ -2985,16 +2977,8 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/
|
|||||||
append_menu_item(mirror_menu, wxID_ANY, _(L("Along Z axis")), _(L("Mirror the selected object along the Z axis")),
|
append_menu_item(mirror_menu, wxID_ANY, _(L("Along Z axis")), _(L("Mirror the selected object along the Z axis")),
|
||||||
[this](wxCommandEvent&) { mirror(Z); }, "mark_Z", menu);
|
[this](wxCommandEvent&) { mirror(Z); }, "mark_Z", menu);
|
||||||
|
|
||||||
wxMenuItem* item_mirror = append_submenu(menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object")));
|
append_submenu(menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object")), "",
|
||||||
|
[this]() { return can_mirror(); }, q);
|
||||||
// ui updates needs to be bound to the parent panel
|
|
||||||
if (q != nullptr)
|
|
||||||
{
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId());
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete()); }, item_delete->GetId());
|
|
||||||
if (item_fix_through_netfabb)
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_fix_through_netfabb()); }, item_fix_through_netfabb->GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3005,30 +2989,24 @@ bool Plater::priv::complit_init_object_menu()
|
|||||||
if (split_menu == nullptr)
|
if (split_menu == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxMenuItem* item_split_objects = append_menu_item(split_menu, wxID_ANY, _(L("To objects")), _(L("Split the selected object into individual objects")),
|
append_menu_item(split_menu, wxID_ANY, _(L("To objects")), _(L("Split the selected object into individual objects")),
|
||||||
[this](wxCommandEvent&) { split_object(); }, "split_object_SMALL", &object_menu);
|
[this](wxCommandEvent&) { split_object(); }, "split_object_SMALL", &object_menu, [this]() { return can_split(); }, q);
|
||||||
wxMenuItem* item_split_volumes = append_menu_item(split_menu, wxID_ANY, _(L("To parts")), _(L("Split the selected object into individual sub-parts")),
|
append_menu_item(split_menu, wxID_ANY, _(L("To parts")), _(L("Split the selected object into individual sub-parts")),
|
||||||
[this](wxCommandEvent&) { split_volume(); }, "split_parts_SMALL", &object_menu);
|
[this](wxCommandEvent&) { split_volume(); }, "split_parts_SMALL", &object_menu, [this]() { return can_split(); }, q);
|
||||||
|
|
||||||
wxMenuItem* item_split = append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object"))/*, "shape_ungroup.png"*/);
|
append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object")), "",
|
||||||
|
[this]() { return can_split() && wxGetApp().get_mode() > comSimple; }, q);
|
||||||
object_menu.AppendSeparator();
|
object_menu.AppendSeparator();
|
||||||
|
|
||||||
// "Add (volumes)" popupmenu will be added later in append_menu_items_add_volume()
|
// "Add (volumes)" popupmenu will be added later in append_menu_items_add_volume()
|
||||||
|
|
||||||
// ui updates needs to be binded to the parent panel
|
|
||||||
if (q != nullptr)
|
|
||||||
{
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split()); }, item_split->GetId());
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split()); }, item_split_objects->GetId());
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split() && wxGetApp().get_mode() > comSimple); }, item_split_volumes->GetId());
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Plater::priv::complit_init_sla_object_menu()
|
bool Plater::priv::complit_init_sla_object_menu()
|
||||||
{
|
{
|
||||||
wxMenuItem* item_split = append_menu_item(&sla_object_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual objects")),
|
append_menu_item(&sla_object_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual objects")),
|
||||||
[this](wxCommandEvent&) { split_object(); }, "split_object_SMALL");
|
[this](wxCommandEvent&) { split_object(); }, "split_object_SMALL", nullptr, [this]() { return can_split(); }, q);
|
||||||
|
|
||||||
sla_object_menu.AppendSeparator();
|
sla_object_menu.AppendSeparator();
|
||||||
|
|
||||||
@ -3036,31 +3014,19 @@ bool Plater::priv::complit_init_sla_object_menu()
|
|||||||
append_menu_item(&sla_object_menu, wxID_ANY, _(L("Optimize orientation")), _(L("Optimize the rotation of the object for better print results.")),
|
append_menu_item(&sla_object_menu, wxID_ANY, _(L("Optimize orientation")), _(L("Optimize the rotation of the object for better print results.")),
|
||||||
[this](wxCommandEvent&) { sla_optimize_rotation(); });
|
[this](wxCommandEvent&) { sla_optimize_rotation(); });
|
||||||
|
|
||||||
// ui updates needs to be binded to the parent panel
|
|
||||||
if (q != nullptr)
|
|
||||||
{
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split()); }, item_split->GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Plater::priv::complit_init_part_menu()
|
bool Plater::priv::complit_init_part_menu()
|
||||||
{
|
{
|
||||||
wxMenuItem* item_split = append_menu_item(&part_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual sub-parts")),
|
append_menu_item(&part_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual sub-parts")),
|
||||||
[this](wxCommandEvent&) { split_volume(); }, "split_parts_SMALL");
|
[this](wxCommandEvent&) { split_volume(); }, "split_parts_SMALL", nullptr, [this]() { return can_split(); }, q);
|
||||||
|
|
||||||
part_menu.AppendSeparator();
|
part_menu.AppendSeparator();
|
||||||
|
|
||||||
auto obj_list = sidebar->obj_list();
|
auto obj_list = sidebar->obj_list();
|
||||||
obj_list->append_menu_item_change_type(&part_menu);
|
obj_list->append_menu_item_change_type(&part_menu);
|
||||||
|
|
||||||
// ui updates needs to be binded to the parent panel
|
|
||||||
if (q != nullptr)
|
|
||||||
{
|
|
||||||
q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split()); }, item_split->GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3965,6 +3931,8 @@ bool Plater::can_delete() const { return p->can_delete(); }
|
|||||||
bool Plater::can_delete_all() const { return p->can_delete_all(); }
|
bool Plater::can_delete_all() const { return p->can_delete_all(); }
|
||||||
bool Plater::can_increase_instances() const { return p->can_increase_instances(); }
|
bool Plater::can_increase_instances() const { return p->can_increase_instances(); }
|
||||||
bool Plater::can_decrease_instances() const { return p->can_decrease_instances(); }
|
bool Plater::can_decrease_instances() const { return p->can_decrease_instances(); }
|
||||||
|
bool Plater::can_set_instance_to_object() const { return p->can_set_instance_to_object(); }
|
||||||
|
bool Plater::can_fix_through_netfabb() const { return p->can_fix_through_netfabb(); }
|
||||||
bool Plater::can_split_to_objects() const { return p->can_split_to_objects(); }
|
bool Plater::can_split_to_objects() const { return p->can_split_to_objects(); }
|
||||||
bool Plater::can_split_to_volumes() const { return p->can_split_to_volumes(); }
|
bool Plater::can_split_to_volumes() const { return p->can_split_to_volumes(); }
|
||||||
bool Plater::can_arrange() const { return p->can_arrange(); }
|
bool Plater::can_arrange() const { return p->can_arrange(); }
|
||||||
|
@ -200,6 +200,8 @@ public:
|
|||||||
bool can_delete_all() const;
|
bool can_delete_all() const;
|
||||||
bool can_increase_instances() const;
|
bool can_increase_instances() const;
|
||||||
bool can_decrease_instances() const;
|
bool can_decrease_instances() const;
|
||||||
|
bool can_set_instance_to_object() const;
|
||||||
|
bool can_fix_through_netfabb() const;
|
||||||
bool can_split_to_objects() const;
|
bool can_split_to_objects() const;
|
||||||
bool can_split_to_volumes() const;
|
bool can_split_to_volumes() const;
|
||||||
bool can_arrange() const;
|
bool can_arrange() const;
|
||||||
|
@ -24,7 +24,7 @@ std::string get_main_info(bool format_as_html)
|
|||||||
if (!format_as_html)
|
if (!format_as_html)
|
||||||
out << b_start << SLIC3R_APP_NAME << b_end << line_end;
|
out << b_start << SLIC3R_APP_NAME << b_end << line_end;
|
||||||
out << b_start << "Version: " << b_end << SLIC3R_VERSION << line_end;
|
out << b_start << "Version: " << b_end << SLIC3R_VERSION << line_end;
|
||||||
out << b_start << "Build: " << b_end << SLIC3R_BUILD << line_end;
|
out << b_start << "Build: " << b_end << SLIC3R_BUILD_ID << line_end;
|
||||||
out << line_end;
|
out << line_end;
|
||||||
out << b_start << "Operating System: " << b_end << wxPlatformInfo::Get().GetOperatingSystemFamilyName() << line_end;
|
out << b_start << "Operating System: " << b_end << wxPlatformInfo::Get().GetOperatingSystemFamilyName() << line_end;
|
||||||
out << b_start << "System Architecture: " << b_end << wxPlatformInfo::Get().GetArchName() << line_end;
|
out << b_start << "System Architecture: " << b_end << wxPlatformInfo::Get().GetArchName() << line_end;
|
||||||
|
@ -25,8 +25,9 @@ using Slic3r::GUI::from_u8;
|
|||||||
wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);
|
wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);
|
||||||
wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
|
wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifndef __WXGTK__// msw_menuitem_bitmaps is used for MSW and OSX
|
||||||
static std::map<int, std::string> msw_menuitem_bitmaps;
|
static std::map<int, std::string> msw_menuitem_bitmaps;
|
||||||
|
#ifdef __WXMSW__
|
||||||
void msw_rescale_menu(wxMenu* menu)
|
void msw_rescale_menu(wxMenu* menu)
|
||||||
{
|
{
|
||||||
struct update_icons {
|
struct update_icons {
|
||||||
@ -47,9 +48,27 @@ void msw_rescale_menu(wxMenu* menu)
|
|||||||
update_icons::run(item);
|
update_icons::run(item);
|
||||||
}
|
}
|
||||||
#endif /* __WXMSW__ */
|
#endif /* __WXMSW__ */
|
||||||
|
#endif /* no __WXGTK__ */
|
||||||
|
|
||||||
|
void enable_menu_item(wxUpdateUIEvent& evt, std::function<bool()> const cb_condition, wxMenuItem* item)
|
||||||
|
{
|
||||||
|
const bool enable = cb_condition();
|
||||||
|
evt.Enable(enable);
|
||||||
|
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
const auto it = msw_menuitem_bitmaps.find(item->GetId());
|
||||||
|
if (it != msw_menuitem_bitmaps.end())
|
||||||
|
{
|
||||||
|
const wxBitmap& item_icon = create_scaled_bitmap(nullptr, it->second, 16, false, !enable);
|
||||||
|
if (item_icon.IsOk())
|
||||||
|
item->SetBitmap(item_icon);
|
||||||
|
}
|
||||||
|
#endif // __WXOSX__
|
||||||
|
}
|
||||||
|
|
||||||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||||
std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler)
|
std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler,
|
||||||
|
std::function<bool()> const cb_condition, wxWindow* parent)
|
||||||
{
|
{
|
||||||
if (id == wxID_ANY)
|
if (id == wxID_ANY)
|
||||||
id = wxNewId();
|
id = wxNewId();
|
||||||
@ -67,25 +86,33 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
|
|||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
menu->Bind(wxEVT_MENU, cb, id);
|
menu->Bind(wxEVT_MENU, cb, id);
|
||||||
|
|
||||||
|
if (parent) {
|
||||||
|
parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item](wxUpdateUIEvent& evt) {
|
||||||
|
enable_menu_item(evt, cb_condition, item); }, id);
|
||||||
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||||
std::function<void(wxCommandEvent& event)> cb, const std::string& icon, wxEvtHandler* event_handler)
|
std::function<void(wxCommandEvent& event)> cb, const std::string& icon, wxEvtHandler* event_handler,
|
||||||
|
std::function<bool()> const cb_condition, wxWindow* parent)
|
||||||
{
|
{
|
||||||
if (id == wxID_ANY)
|
if (id == wxID_ANY)
|
||||||
id = wxNewId();
|
id = wxNewId();
|
||||||
|
|
||||||
const wxBitmap& bmp = !icon.empty() ? create_scaled_bitmap(nullptr, icon) : wxNullBitmap; // FIXME: pass window ptr
|
const wxBitmap& bmp = !icon.empty() ? create_scaled_bitmap(nullptr, icon) : wxNullBitmap; // FIXME: pass window ptr
|
||||||
#ifdef __WXMSW__
|
//#ifdef __WXMSW__
|
||||||
|
#ifndef __WXGTK__
|
||||||
if (bmp.IsOk())
|
if (bmp.IsOk())
|
||||||
msw_menuitem_bitmaps[id] = icon;
|
msw_menuitem_bitmaps[id] = icon;
|
||||||
#endif /* __WXMSW__ */
|
#endif /* __WXMSW__ */
|
||||||
|
|
||||||
return append_menu_item(menu, id, string, description, cb, bmp, event_handler);
|
return append_menu_item(menu, id, string, description, cb, bmp, event_handler, cb_condition, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description, const std::string& icon)
|
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description, const std::string& icon,
|
||||||
|
std::function<bool()> const cb_condition, wxWindow* parent)
|
||||||
{
|
{
|
||||||
if (id == wxID_ANY)
|
if (id == wxID_ANY)
|
||||||
id = wxNewId();
|
id = wxNewId();
|
||||||
@ -93,7 +120,8 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
|
|||||||
wxMenuItem* item = new wxMenuItem(menu, id, string, description);
|
wxMenuItem* item = new wxMenuItem(menu, id, string, description);
|
||||||
if (!icon.empty()) {
|
if (!icon.empty()) {
|
||||||
item->SetBitmap(create_scaled_bitmap(nullptr, icon)); // FIXME: pass window ptr
|
item->SetBitmap(create_scaled_bitmap(nullptr, icon)); // FIXME: pass window ptr
|
||||||
#ifdef __WXMSW__
|
//#ifdef __WXMSW__
|
||||||
|
#ifndef __WXGTK__
|
||||||
msw_menuitem_bitmaps[id] = icon;
|
msw_menuitem_bitmaps[id] = icon;
|
||||||
#endif /* __WXMSW__ */
|
#endif /* __WXMSW__ */
|
||||||
}
|
}
|
||||||
@ -101,6 +129,11 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
|
|||||||
item->SetSubMenu(sub_menu);
|
item->SetSubMenu(sub_menu);
|
||||||
menu->Append(item);
|
menu->Append(item);
|
||||||
|
|
||||||
|
if (parent) {
|
||||||
|
parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item](wxUpdateUIEvent& evt) {
|
||||||
|
enable_menu_item(evt, cb_condition, item); }, id);
|
||||||
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +383,8 @@ int em_unit(wxWindow* win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If an icon has horizontal orientation (width > height) call this function with is_horizontal = true
|
// If an icon has horizontal orientation (width > height) call this function with is_horizontal = true
|
||||||
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in, const int px_cnt/* = 16*/, const bool is_horizontal /* = false*/)
|
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in,
|
||||||
|
const int px_cnt/* = 16*/, const bool is_horizontal /* = false*/, const bool grayscale/* = false*/)
|
||||||
{
|
{
|
||||||
static Slic3r::GUI::BitmapCache cache;
|
static Slic3r::GUI::BitmapCache cache;
|
||||||
|
|
||||||
@ -370,9 +404,9 @@ wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in, con
|
|||||||
boost::replace_last(bmp_name, ".png", "");
|
boost::replace_last(bmp_name, ".png", "");
|
||||||
|
|
||||||
// Try loading an SVG first, then PNG if SVG is not found:
|
// Try loading an SVG first, then PNG if SVG is not found:
|
||||||
wxBitmap *bmp = cache.load_svg(bmp_name, width, height, scale_factor);
|
wxBitmap *bmp = cache.load_svg(bmp_name, width, height, scale_factor, grayscale);
|
||||||
if (bmp == nullptr) {
|
if (bmp == nullptr) {
|
||||||
bmp = cache.load_png(bmp_name, width, height);
|
bmp = cache.load_png(bmp_name, width, height, grayscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bmp == nullptr) {
|
if (bmp == nullptr) {
|
||||||
@ -2456,7 +2490,6 @@ ModeButton::ModeButton( wxWindow * parent,
|
|||||||
const wxString& mode /* = wxEmptyString*/,
|
const wxString& mode /* = wxEmptyString*/,
|
||||||
const wxSize& size /* = wxDefaultSize*/,
|
const wxSize& size /* = wxDefaultSize*/,
|
||||||
const wxPoint& pos /* = wxDefaultPosition*/) :
|
const wxPoint& pos /* = wxDefaultPosition*/) :
|
||||||
// wxButton(parent, id, mode, pos, wxDefaultSize/*size*/, wxBU_EXACTFIT | wxNO_BORDER),
|
|
||||||
ScalableButton(parent, id, icon_name, mode, size, pos)
|
ScalableButton(parent, id, icon_name, mode, size, pos)
|
||||||
{
|
{
|
||||||
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
|
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
|
||||||
@ -2513,7 +2546,14 @@ ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 10*/) :
|
|||||||
|
|
||||||
m_mode_btns.reserve(3);
|
m_mode_btns.reserve(3);
|
||||||
for (const auto& button : buttons) {
|
for (const auto& button : buttons) {
|
||||||
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first));
|
#ifdef __WXOSX__
|
||||||
|
wxSize sz = parent->GetTextExtent(button.first);
|
||||||
|
// set default width for ModeButtons to correct rendering on OnFocus under OSX
|
||||||
|
sz.x += 2 * em_unit(parent);
|
||||||
|
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first, sz));
|
||||||
|
#else
|
||||||
|
m_mode_btns.push_back(new ModeButton(parent, wxID_ANY, button.second, button.first));;
|
||||||
|
#endif // __WXOSX__
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto btn : m_mode_btns)
|
for (auto btn : m_mode_btns)
|
||||||
|
@ -27,12 +27,15 @@ inline void msw_rescale_menu(wxMenu* /* menu */) {}
|
|||||||
#endif /* __WXMSW__ */
|
#endif /* __WXMSW__ */
|
||||||
|
|
||||||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||||
std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler = nullptr);
|
std::function<void(wxCommandEvent& event)> cb, const wxBitmap& icon, wxEvtHandler* event_handler = nullptr,
|
||||||
|
std::function<bool()> const cb_condition = []() { return true;}, wxWindow* parent = nullptr);
|
||||||
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||||
std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr);
|
std::function<void(wxCommandEvent& event)> cb, const std::string& icon = "", wxEvtHandler* event_handler = nullptr,
|
||||||
|
std::function<bool()> const cb_condition = []() { return true; }, wxWindow* parent = nullptr);
|
||||||
|
|
||||||
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description,
|
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description,
|
||||||
const std::string& icon = "");
|
const std::string& icon = "",
|
||||||
|
std::function<bool()> const cb_condition = []() { return true; }, wxWindow* parent = nullptr);
|
||||||
|
|
||||||
wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||||
std::function<void(wxCommandEvent& event)> cb, wxEvtHandler* event_handler);
|
std::function<void(wxCommandEvent& event)> cb, wxEvtHandler* event_handler);
|
||||||
@ -42,7 +45,8 @@ void edit_tooltip(wxString& tooltip);
|
|||||||
void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids);
|
void msw_buttons_rescale(wxDialog* dlg, const int em_unit, const std::vector<int>& btn_ids);
|
||||||
int em_unit(wxWindow* win);
|
int em_unit(wxWindow* win);
|
||||||
|
|
||||||
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name, const int px_cnt = 16, const bool is_horizontal = false);
|
wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name,
|
||||||
|
const int px_cnt = 16, const bool is_horizontal = false, const bool grayscale = false);
|
||||||
|
|
||||||
class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
|
class wxCheckListBoxComboPopup : public wxCheckListBox, public wxComboPopup
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
set(SLIC3R_APP_NAME "PrusaSlicer")
|
set(SLIC3R_APP_NAME "PrusaSlicer")
|
||||||
set(SLIC3R_APP_KEY "PrusaSlicer")
|
set(SLIC3R_APP_KEY "PrusaSlicer")
|
||||||
set(SLIC3R_VERSION "1.42.0-beta2")
|
set(SLIC3R_VERSION "1.42.0-beta2")
|
||||||
set(SLIC3R_BUILD "${SLIC3R_VERSION}+UNKNOWN")
|
set(SLIC3R_BUILD_ID "PrusaSlicer-${SLIC3R_VERSION}+UNKNOWN")
|
||||||
set(SLIC3R_BUILD_ID "${SLIC3R_BUILD_ID}")
|
|
||||||
set(SLIC3R_RC_VERSION "1,42,0,0")
|
set(SLIC3R_RC_VERSION "1,42,0,0")
|
||||||
set(SLIC3R_RC_VERSION_DOTS "1.42.0.0")
|
set(SLIC3R_RC_VERSION_DOTS "1.42.0.0")
|
||||||
|
@ -20,7 +20,7 @@ VERSION()
|
|||||||
SV*
|
SV*
|
||||||
BUILD()
|
BUILD()
|
||||||
CODE:
|
CODE:
|
||||||
RETVAL = newSVpv(SLIC3R_BUILD, 0);
|
RETVAL = newSVpv(SLIC3R_BUILD_ID, 0);
|
||||||
OUTPUT: RETVAL
|
OUTPUT: RETVAL
|
||||||
|
|
||||||
SV*
|
SV*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user