diff --git a/CMakeLists.txt b/CMakeLists.txt index 39d9298e5..be07b5216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,7 +102,7 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/) enable_testing () # Enable C++11 language standard. -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) if(NOT WIN32) diff --git a/deps/CGAL/CGAL.cmake b/deps/CGAL/CGAL.cmake index 96a629258..285d819ab 100644 --- a/deps/CGAL/CGAL.cmake +++ b/deps/CGAL/CGAL.cmake @@ -8,8 +8,13 @@ prusaslicer_add_cmake_project( DEPENDS dep_boost dep_GMP dep_MPFR ) +include(GNUInstallDirs) + +# CGAL, for whatever reason, makes itself non-relocatable by writing the build directory into +# CGALConfig-installation-dirs.cmake and including it in configure time. +# If this file is not present, it will not consider the stored absolute path ExternalProject_Add_Step(dep_CGAL dep_CGAL_relocation_fix DEPENDEES install COMMAND ${CMAKE_COMMAND} -E remove CGALConfig-installation-dirs.cmake - WORKING_DIRECTORY "${DESTDIR}/usr/local/lib/cmake/CGAL" + WORKING_DIRECTORY "${DESTDIR}/usr/local/${CMAKE_INSTALL_LIBDIR}/cmake/CGAL" ) \ No newline at end of file diff --git a/deps/MPFR/MPFR.cmake b/deps/MPFR/MPFR.cmake index 7873bc0d6..17ac283ea 100644 --- a/deps/MPFR/MPFR.cmake +++ b/deps/MPFR/MPFR.cmake @@ -19,7 +19,7 @@ if (MSVC) else () ExternalProject_Add(dep_MPFR - URL https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 + URL http://ftp.vim.org/ftp/gnu/mpfr/mpfr-3.1.6.tar.bz2 https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 # mirrors are allowed BUILD_IN_SOURCE ON CONFIGURE_COMMAND ./configure --prefix=${DESTDIR}/usr/local --with-gmp=${DESTDIR}/usr/local --with-pic BUILD_COMMAND make -j diff --git a/resources/icons/white/edit_layers_all.svg b/resources/icons/white/edit_layers_all.svg new file mode 100644 index 000000000..efb7d609f --- /dev/null +++ b/resources/icons/white/edit_layers_all.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + diff --git a/resources/icons/white/edit_layers_some.svg b/resources/icons/white/edit_layers_some.svg new file mode 100644 index 000000000..585a8df2f --- /dev/null +++ b/resources/icons/white/edit_layers_some.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/resources/icons/white/funnel.svg b/resources/icons/white/funnel.svg new file mode 100644 index 000000000..b8a3408a7 --- /dev/null +++ b/resources/icons/white/funnel.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/resources/icons/white/mirroring_off.svg b/resources/icons/white/mirroring_off.svg new file mode 100644 index 000000000..2011d8f1b --- /dev/null +++ b/resources/icons/white/mirroring_off.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/resources/icons/white/mirroring_on.svg b/resources/icons/white/mirroring_on.svg new file mode 100644 index 000000000..1773b78ad --- /dev/null +++ b/resources/icons/white/mirroring_on.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/resources/icons/white/note.svg b/resources/icons/white/note.svg new file mode 100644 index 000000000..07c2a14cf --- /dev/null +++ b/resources/icons/white/note.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/icons/white/redo_menu.svg b/resources/icons/white/redo_menu.svg new file mode 100644 index 000000000..749f49a42 --- /dev/null +++ b/resources/icons/white/redo_menu.svg @@ -0,0 +1,13 @@ + + + + + diff --git a/resources/icons/white/undo_menu.svg b/resources/icons/white/undo_menu.svg new file mode 100644 index 000000000..4e2b69a60 --- /dev/null +++ b/resources/icons/white/undo_menu.svg @@ -0,0 +1,13 @@ + + + + + diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index aefff5c85..74bc529ae 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -106,7 +106,7 @@ compatible_printers = complete_objects = 0 default_acceleration = 1000 dont_support_bridges = 1 -elefant_foot_compensation = 0 +elefant_foot_compensation = 0.2 ensure_vertical_shell_thickness = 1 external_fill_pattern = rectilinear external_perimeters_first = 0 @@ -223,6 +223,7 @@ extruder_clearance_radius = 35 # Print parameters common to a 0.25mm diameter nozzle. [print:*0.25nozzle*] +elefant_foot_compensation = 0 external_perimeter_extrusion_width = 0.25 extrusion_width = 0.25 first_layer_extrusion_width = 0.3 @@ -238,6 +239,7 @@ support_material_xy_spacing = 150% output_filename_format = {input_filename_base}_{nozzle_diameter[0]}n_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode [print:*0.25nozzleMK3*] +elefant_foot_compensation = 0 external_perimeter_extrusion_width = 0.25 extrusion_width = 0.25 first_layer_extrusion_width = 0.3 @@ -271,6 +273,7 @@ fill_density = 20% output_filename_format = {input_filename_base}_{nozzle_diameter[0]}n_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode [print:*0.25nozzleMINI*] +elefant_foot_compensation = 0 external_perimeter_extrusion_width = 0.25 extrusion_width = 0.25 first_layer_extrusion_width = 0.3 @@ -2993,21 +2996,21 @@ inherits = *common 0.025* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Grey Tough @0.025] inherits = *common 0.025* exposure_time = 7 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Azure Blue Tough @0.025] inherits = *common 0.025* exposure_time = 7 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Maroon Tough @0.025] @@ -3015,56 +3018,56 @@ inherits = *common 0.025* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Beige Tough @0.025] inherits = *common 0.025* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Pink Tough @0.025] inherits = *common 0.025* exposure_time = 7 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa White Tough @0.025] inherits = *common 0.025* exposure_time = 6.5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Tough @0.025] inherits = *common 0.025* exposure_time = 6 initial_exposure_time = 15 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Green Dental Casting @0.025] inherits = *common 0.025* exposure_time = 12 initial_exposure_time = 40 material_type = Casting -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Green Tough @0.025] inherits = *common 0.025* exposure_time = 5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Clear ABS like @0.025] inherits = *common 0.025* exposure_time = 6 initial_exposure_time = 30 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa ABS like White @0.025] ## inherits = *common 0.025* @@ -3076,35 +3079,35 @@ inherits = *common 0.025* exposure_time = 5 initial_exposure_time = 30 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Super Low Odor Cyan Tough @0.025] inherits = *common 0.025* exposure_time = 5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Super Low Odor Magenta Tough @0.025] inherits = *common 0.025* exposure_time = 5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Super Low Odor Yellow Tough @0.025] inherits = *common 0.025* exposure_time = 5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Orange-Yellow Teeth Model @0.025] inherits = *common 0.025* exposure_time = 5 initial_exposure_time = 30 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ########### Materials 0.05 @@ -3333,91 +3336,91 @@ inherits = *common 0.05* exposure_time = 7 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Orange Tough @0.05] inherits = *common 0.05* exposure_time = 7.5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Grey Tough @0.05] inherits = *common 0.05* exposure_time = 8.5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Black Tough @0.05] inherits = *common 0.05* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa Super Low Odor Beige Tough @0.05] ## inherits = *common 0.05* ## exposure_time = 7.5 ## initial_exposure_time = 35 ## material_type = Tough -## material_vendor = Prusa +## material_vendor = Made for Prusa ## [sla_material:Prusa Super Low Odor White Tough @0.05] ## inherits = *common 0.05* ## exposure_time = 6.5 ## initial_exposure_time = 35 ## material_type = Tough -## material_vendor = Prusa +## material_vendor = Made for Prusa ## [sla_material:Prusa Super Low Odor Grey Tough @0.05] ## inherits = *common 0.05* ## exposure_time = 6.5 ## initial_exposure_time = 35 ## material_type = Tough -## material_vendor = Prusa +## material_vendor = Made for Prusa [sla_material:Prusa Super Low Odor Cyan Tough @0.05] inherits = *common 0.05* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Super Low Odor Magenta Tough @0.05] inherits = *common 0.05* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Super Low Odor Yellow Tough @0.05] inherits = *common 0.05* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa Black High Tenacity @0.05] ## inherits = *common 0.05* ## exposure_time = 7 ## initial_exposure_time = 35 ## material_type = Tough -## material_vendor = Prusa +## material_vendor = Made for Prusa [sla_material:Prusa Orange-Yellow Teeth Model @0.05] inherits = *common 0.05* exposure_time = 7 initial_exposure_time = 30 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Green Dental Casting @0.05] inherits = *common 0.05* exposure_time = 13 initial_exposure_time = 50 material_type = Casting -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa Yellow Solid @0.05] ## inherits = *common 0.05* @@ -3429,49 +3432,49 @@ inherits = *common 0.05* exposure_time = 7.5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Green Tough @0.05] inherits = *common 0.05* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Red Tough @0.05] inherits = *common 0.05* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Maroon Tough @0.05] inherits = *common 0.05* exposure_time = 7.5 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Pink Tough @0.05] inherits = *common 0.05* exposure_time = 8 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Azure Blue Tough @0.05] inherits = *common 0.05* exposure_time = 8 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Tough @0.05] inherits = *common 0.05* exposure_time = 7 initial_exposure_time = 15 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa Yellow Flexible @0.05] ## inherits = *common 0.05* @@ -3483,7 +3486,7 @@ inherits = *common 0.05* exposure_time = 5 initial_exposure_time = 15 material_type = Flexible -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa White Flexible @0.05] ## inherits = *common 0.05* @@ -3495,7 +3498,7 @@ inherits = *common 0.05* exposure_time = 5 initial_exposure_time = 15 material_type = Flexible -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa Black Flexible @0.05] ## inherits = *common 0.05* @@ -3512,7 +3515,7 @@ inherits = *common 0.05* exposure_time = 8 initial_exposure_time = 30 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ## [sla_material:Prusa ABS like White @0.05] ## inherits = *common 0.05* @@ -3524,14 +3527,14 @@ inherits = *common 0.05* exposure_time = 13 initial_exposure_time = 45 material_type = Casting -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Grey High Tenacity @0.05] inherits = *common 0.05* exposure_time = 7 initial_exposure_time = 30 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ########### Materials 0.035 @@ -3540,7 +3543,7 @@ inherits = *common 0.035* exposure_time = 6 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa ########### Materials 0.1 @@ -3565,70 +3568,70 @@ inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 45 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Beige Tough @0.1] inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 45 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Pink Tough @0.1] inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 45 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Azure Blue Tough @0.1] inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 45 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Maroon Tough @0.1] inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 45 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa White Tough @0.1] inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 45 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Black Tough @0.1] inherits = *common 0.1* exposure_time = 13 initial_exposure_time = 55 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Tough @0.1] inherits = *common 0.1* exposure_time = 8 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Green Dental Casting @0.1] inherits = *common 0.1* exposure_time = 15 initial_exposure_time = 50 material_type = Casting -material_vendor = Prusa +material_vendor = Made for Prusa [sla_material:Prusa Transparent Green Tough @0.1] inherits = *common 0.1* exposure_time = 7 initial_exposure_time = 35 material_type = Tough -material_vendor = Prusa +material_vendor = Made for Prusa [printer:*common*] printer_technology = FFF diff --git a/src/avrdude/CMakeLists.txt b/src/avrdude/CMakeLists.txt index 889720021..fc01b7d8d 100644 --- a/src/avrdude/CMakeLists.txt +++ b/src/avrdude/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.0) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - add_definitions(-D_BSD_SOURCE -D_DEFAULT_SOURCE) # To enable various useful macros and functions on Unices remove_definitions(-D_UNICODE -DUNICODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 9d24d8cb7..a81e9521a 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -612,7 +612,7 @@ void ConfigBase::load_from_gcode_file(const std::string &file) } ifs.seekg(0, ifs.end); auto file_length = ifs.tellg(); - auto data_length = std::min(65535, file_length); + auto data_length = std::min(65535, file_length); ifs.seekg(file_length - data_length, ifs.beg); std::vector data(size_t(data_length) + 1, 0); ifs.read(data.data(), data_length); diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 7137527e9..8c281318e 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -1302,6 +1302,8 @@ void ModelObject::split(ModelObjectPtrs* new_objects) } new_vol->set_offset(Vec3d::Zero()); + // reset the source to disable reload from disk + new_vol->source = ModelVolume::Source(); new_objects->emplace_back(new_object); delete mesh; } @@ -1668,6 +1670,8 @@ size_t ModelVolume::split(unsigned int max_extruders) this->calculate_convex_hull(); // Assign a new unique ID, so that a new GLVolume will be generated. this->set_new_unique_id(); + // reset the source to disable reload from disk + this->source = ModelVolume::Source(); } else this->object->volumes.insert(this->object->volumes.begin() + (++ivolume), new ModelVolume(object, *this, std::move(*mesh))); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f601cd4bc..9574cdb8e 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -341,17 +341,12 @@ unsigned GUI_App::get_colour_approx_luma(const wxColour &colour) } bool GUI_App::dark_mode() -{ - const unsigned luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - return luma < 128; -} - -bool GUI_App::dark_mode_menus() { #if __APPLE__ return mac_dark_mode(); #else - return dark_mode(); + const unsigned luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + return luma < 128; #endif } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index a730ff95f..250d8122a 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -109,7 +109,6 @@ public: static unsigned get_colour_approx_luma(const wxColour &colour); static bool dark_mode(); - static bool dark_mode_menus(); void init_label_colours(); void update_label_colours_from_appconfig(); void init_fonts(); diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index a058de805..0505d748e 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1623,7 +1623,8 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const void ObjectList::append_menu_item_reload_from_disk(wxMenu* menu) const { append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")), - [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater()); + [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, + []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater()); } void ObjectList::append_menu_item_change_extruder(wxMenu* menu) const @@ -1756,7 +1757,8 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu) for (auto cat : settings_menu) { append_menu_item(menu, wxID_ANY, _(cat.first), "", [menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); }, - CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu); + CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu, + [this]() { return true; }, wxGetApp().plater()); } return menu; @@ -1776,7 +1778,8 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje append_menu_item(menu, wxID_ANY, _(it.first), "", [menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); }, - CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu); + CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu, + [this]() { return true; }, wxGetApp().plater()); } #if 0 // Add "Quick" settings bundles @@ -1789,7 +1792,8 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje append_menu_item(menu, wxID_ANY, wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)), "", [menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); }, - CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu); + CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu, + [this]() { return true; }, wxGetApp().plater()); } #endif } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index e613e6915..2b7fc3740 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -379,16 +379,6 @@ void MainFrame::on_dpi_changed(const wxRect &suggested_rect) this->Maximize(is_maximized); } -static std::string menu_icon(const std::string& icon_name) -{ -#ifdef __WXMSW__ - const std::string folder = "white\\"; -#else - const std::string folder = "white/"; -#endif - return wxGetApp().dark_mode_menus() ? folder+icon_name : icon_name; -} - void MainFrame::init_menubar() { #ifdef __APPLE__ @@ -402,7 +392,7 @@ void MainFrame::init_menubar() [this](wxCommandEvent&) { if (m_plater) m_plater->new_project(); }, "", nullptr, [this](){return m_plater != nullptr && can_start_new_project(); }, this); 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"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "open", nullptr, [this](){return m_plater != nullptr; }, this); wxMenu* recent_projects_menu = new wxMenu(); @@ -440,60 +430,65 @@ void MainFrame::init_menubar() Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(m_recent_projects.GetCount() > 0); }, recent_projects_submenu->GetId()); append_menu_item(fileMenu, wxID_ANY, _(L("&Save Project")) + "\tCtrl+S", _(L("Save current project file")), - [this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(into_path(m_plater->get_project_filename(".3mf"))); }, menu_icon("save"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(into_path(m_plater->get_project_filename(".3mf"))); }, "save", nullptr, [this](){return m_plater != nullptr && can_save(); }, this); #ifdef __APPLE__ append_menu_item(fileMenu, wxID_ANY, _(L("Save Project &as")) + dots + "\tCtrl+Shift+S", _(L("Save current project file as")), #else append_menu_item(fileMenu, wxID_ANY, _(L("Save Project &as")) + dots + "\tCtrl+Alt+S", _(L("Save current project file as")), #endif // __APPLE__ - [this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(); }, menu_icon("save"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->export_3mf(); }, "save", nullptr, [this](){return m_plater != nullptr && can_save(); }, this); fileMenu->AppendSeparator(); wxMenu* import_menu = new wxMenu(); 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"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->add_model(); }, "import_plater", nullptr, [this](){return m_plater != nullptr; }, this); import_menu->AppendSeparator(); 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(); }, "import_config", nullptr, + [this]() {return true; }, this); append_menu_item(import_menu, wxID_ANY, _(L("Import Config from &project")) + dots +"\tCtrl+Alt+L", _(L("Load configuration from project file")), - [this](wxCommandEvent&) { if (m_plater) m_plater->extract_config_from_project(); }, menu_icon("import_config")); + [this](wxCommandEvent&) { if (m_plater) m_plater->extract_config_from_project(); }, "import_config", nullptr, + [this]() {return true; }, this); import_menu->AppendSeparator(); append_menu_item(import_menu, wxID_ANY, _(L("Import Config &Bundle")) + dots, _(L("Load presets from a bundle")), - [this](wxCommandEvent&) { load_configbundle(); }, menu_icon("import_config_bundle")); + [this](wxCommandEvent&) { load_configbundle(); }, "import_config_bundle", nullptr, + [this]() {return true; }, this); append_submenu(fileMenu, import_menu, wxID_ANY, _(L("&Import")), ""); 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")), - [this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(); }, menu_icon("export_gcode"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(); }, "export_gcode", nullptr, [this](){return can_export_gcode(); }, this); m_changeable_menu_items.push_back(item_export_gcode); wxMenuItem* item_send_gcode = append_menu_item(export_menu, wxID_ANY, _(L("S&end G-code")) + dots +"\tCtrl+Shift+G", _(L("Send to print current plate as G-code")), - [this](wxCommandEvent&) { if (m_plater) m_plater->send_gcode(); }, menu_icon("export_gcode"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->send_gcode(); }, "export_gcode", nullptr, [this](){return can_send_gcode(); }, this); m_changeable_menu_items.push_back(item_send_gcode); export_menu->AppendSeparator(); 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"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, "export_plater", nullptr, [this](){return can_export_model(); }, this); append_menu_item(export_menu, wxID_ANY, _(L("Export plate as STL &including supports")) + dots, _(L("Export current plate as STL including supports")), - [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(true); }, menu_icon("export_plater"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(true); }, "export_plater", nullptr, [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](wxCommandEvent&) { if (m_plater) m_plater->export_amf(); }, "export_plater", nullptr, [this](){return can_export_model(); }, this); export_menu->AppendSeparator(); append_menu_item(export_menu, wxID_ANY, _(L("Export &toolpaths as OBJ")) + dots, _(L("Export toolpaths as OBJ")), - [this](wxCommandEvent&) { if (m_plater) m_plater->export_toolpaths_to_obj(); }, menu_icon("export_plater"), nullptr, + [this](wxCommandEvent&) { if (m_plater) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr, [this]() {return can_export_toolpaths(); }, this); export_menu->AppendSeparator(); 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(); }, "export_config", nullptr, + [this]() {return true; }, this); append_menu_item(export_menu, wxID_ANY, _(L("Export Config &Bundle")) + dots, _(L("Export all presets to file")), - [this](wxCommandEvent&) { export_configbundle(); }, menu_icon("export_config_bundle")); + [this](wxCommandEvent&) { export_configbundle(); }, "export_config_bundle", nullptr, + [this]() {return true; }, this); append_submenu(fileMenu, export_menu, wxID_ANY, _(L("&Export")), ""); fileMenu->AppendSeparator(); @@ -521,11 +516,12 @@ void MainFrame::init_menubar() fileMenu->AppendSeparator(); #endif m_menu_item_reslice_now = append_menu_item(fileMenu, wxID_ANY, _(L("(Re)Slice No&w")) + "\tCtrl+R", _(L("Start new slicing process")), - [this](wxCommandEvent&) { reslice_now(); }, menu_icon("re_slice"), nullptr, + [this](wxCommandEvent&) { reslice_now(); }, "re_slice", nullptr, [this](){return m_plater != nullptr && can_reslice(); }, this); fileMenu->AppendSeparator(); append_menu_item(fileMenu, wxID_ANY, _(L("&Repair STL file")) + dots, _(L("Automatically repair an STL file")), - [this](wxCommandEvent&) { repair_stl(); }, menu_icon("wrench")); + [this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr, + [this]() {return true; }, this); fileMenu->AppendSeparator(); append_menu_item(fileMenu, wxID_EXIT, _(L("&Quit")), wxString::Format(_(L("Quit %s")), SLIC3R_APP_NAME), [this](wxCommandEvent&) { Close(false); }); @@ -561,10 +557,10 @@ void MainFrame::init_menubar() editMenu->AppendSeparator(); append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete, _(L("Deletes the current selection")),[this](wxCommandEvent&) { m_plater->remove_selected(); }, - menu_icon("remove_menu"), nullptr, [this](){return can_delete(); }, this); + "remove_menu", nullptr, [this](){return can_delete(); }, this); 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); + "delete_all_menu", nullptr, [this](){return can_delete_all(); }, this); editMenu->AppendSeparator(); append_menu_item(editMenu, wxID_ANY, _(L("&Undo")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "Z", @@ -577,10 +573,10 @@ void MainFrame::init_menubar() editMenu->AppendSeparator(); append_menu_item(editMenu, wxID_ANY, _(L("&Copy")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "C", _(L("Copy selection to clipboard")), [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); }, - menu_icon("copy_menu"), nullptr, [this](){return m_plater->can_copy_to_clipboard(); }, this); + "copy_menu", nullptr, [this](){return m_plater->can_copy_to_clipboard(); }, this); 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(); }, - menu_icon("paste_menu"), nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this); + "paste_menu", nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this); } // Window menu @@ -589,26 +585,30 @@ void MainFrame::init_menubar() size_t tab_offset = 0; if (m_plater) { append_menu_item(windowMenu, wxID_HIGHEST + 1, _(L("&Plater Tab")) + "\tCtrl+1", _(L("Show the plater")), - [this](wxCommandEvent&) { select_tab(0); }, menu_icon("plater")); + [this](wxCommandEvent&) { select_tab(0); }, "plater", nullptr, + [this]() {return true; }, this); tab_offset += 1; } if (tab_offset > 0) { windowMenu->AppendSeparator(); } append_menu_item(windowMenu, wxID_HIGHEST + 2, _(L("P&rint Settings Tab")) + "\tCtrl+2", _(L("Show the print settings")), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 0); }, menu_icon("cog")); + [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 0); }, "cog", nullptr, + [this]() {return true; }, this); wxMenuItem* item_material_tab = append_menu_item(windowMenu, wxID_HIGHEST + 3, _(L("&Filament Settings Tab")) + "\tCtrl+3", _(L("Show the filament settings")), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 1); }, menu_icon("spool")); + [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 1); }, "spool", nullptr, + [this]() {return true; }, this); m_changeable_menu_items.push_back(item_material_tab); append_menu_item(windowMenu, wxID_HIGHEST + 4, _(L("Print&er Settings Tab")) + "\tCtrl+4", _(L("Show the printer settings")), - [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, menu_icon("printer")); + [this, tab_offset](wxCommandEvent&) { select_tab(tab_offset + 2); }, "printer", nullptr, + [this]() {return true; }, this); if (m_plater) { windowMenu->AppendSeparator(); 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"), nullptr, + [this](wxCommandEvent&) { m_plater->select_view_3D("3D"); }, "editor_menu", nullptr, [this](){return can_change_view(); }, this); 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, + [this](wxCommandEvent&) { m_plater->select_view_3D("Preview"); }, "preview_menu", nullptr, [this](){return can_change_view(); }, this); } @@ -627,7 +627,8 @@ void MainFrame::init_menubar() windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, _(L("Print &Host Upload Queue")) + "\tCtrl+J", _(L("Display the Print Host Upload Queue window")), - [this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, menu_icon("upload_queue")); + [this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, "upload_queue", nullptr, + [this]() {return true; }, this); } // View menu @@ -726,7 +727,7 @@ void MainFrame::update_menubar() m_changeable_menu_items[miSend] ->SetItemLabel((is_fff ? _(L("S&end G-code")) : _(L("S&end to print"))) + dots + "\tCtrl+Shift+G"); m_changeable_menu_items[miMaterialTab] ->SetItemLabel((is_fff ? _(L("&Filament Settings Tab")) : _(L("Mate&rial Settings Tab"))) + "\tCtrl+3"); - m_changeable_menu_items[miMaterialTab] ->SetBitmap(create_scaled_bitmap(this, menu_icon(is_fff ? "spool": "resin"))); + m_changeable_menu_items[miMaterialTab] ->SetBitmap(create_scaled_bitmap(this, is_fff ? "spool": "resin")); } // To perform the "Quck Slice", "Quick Slice and Save As", "Repeat last Quick Slice" and "Slice to SVG". diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 96492d25a..174d6b189 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3271,7 +3271,13 @@ void Plater::priv::reload_from_disk() { // ask user to select the missing file std::string search = missing_input_paths.back().string(); - wxFileDialog dialog(q, _(L("Please select the file to reload:")), "", from_u8(fs::path(search).filename().string()), file_wildcards(FT_MODEL), wxFD_OPEN | wxFD_FILE_MUST_EXIST); + wxString title = _(L("Please select the file to reload")); +#if defined(__APPLE__) + title += " (" + from_u8(fs::path(search).filename().string()) + "):"; +#else + title += ":"; +#endif // __APPLE__ + wxFileDialog dialog(q, title, "", from_u8(fs::path(search).filename().string()), file_wildcards(FT_MODEL), wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (dialog.ShowModal() != wxID_OK) return; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 6721e8a33..7c63e96c6 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -14,6 +14,7 @@ #include #include +#include #include "BitmapCache.hpp" #include "GUI.hpp" @@ -57,7 +58,7 @@ void msw_rescale_menu(wxMenu* menu) #endif /* __WXMSW__ */ #endif /* no __WXGTK__ */ -void enable_menu_item(wxUpdateUIEvent& evt, std::function const cb_condition, wxMenuItem* item) +void enable_menu_item(wxUpdateUIEvent& evt, std::function const cb_condition, wxMenuItem* item, wxWindow* win) { const bool enable = cb_condition(); evt.Enable(enable); @@ -66,7 +67,7 @@ void enable_menu_item(wxUpdateUIEvent& evt, std::function const cb_condi 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); + const wxBitmap& item_icon = create_scaled_bitmap(win, it->second, 16, false, !enable); if (item_icon.IsOk()) item->SetBitmap(item_icon); } @@ -94,8 +95,8 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const 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); + parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item, parent](wxUpdateUIEvent& evt) { + enable_menu_item(evt, cb_condition, item, parent); }, id); } return item; @@ -108,7 +109,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const if (id == wxID_ANY) 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(parent, icon) : wxNullBitmap; // FIXME: pass window ptr //#ifdef __WXMSW__ #ifndef __WXGTK__ if (bmp.IsOk()) @@ -126,7 +127,7 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin wxMenuItem* item = new wxMenuItem(menu, id, string, description); if (!icon.empty()) { - item->SetBitmap(create_scaled_bitmap(nullptr, icon)); // FIXME: pass window ptr + item->SetBitmap(create_scaled_bitmap(parent, icon)); // FIXME: pass window ptr //#ifdef __WXMSW__ #ifndef __WXGTK__ msw_menuitem_bitmaps[id] = icon; @@ -137,8 +138,8 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin menu->Append(item); if (parent) { - parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item](wxUpdateUIEvent& evt) { - enable_menu_item(evt, cb_condition, item); }, id); + parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item, parent](wxUpdateUIEvent& evt) { + enable_menu_item(evt, cb_condition, item, parent); }, id); } return item; @@ -424,6 +425,28 @@ static float get_svg_scale_factor(wxWindow *win) #endif } +// in the Dark mode of any platform, we should draw icons in respect to OS background +static std::string icon_name_respected_to_mode(const std::string& bmp_name_in) +{ +#ifdef __WXMSW__ + const std::string folder = "white\\"; +#else + const std::string folder = "white/"; +#endif + std::string bmp_name = Slic3r::GUI::wxGetApp().dark_mode() ? folder + bmp_name_in : bmp_name_in; + boost::replace_last(bmp_name, ".png", ""); + FILE* fp = NULL; + fp = boost::nowide::fopen(Slic3r::var(bmp_name + ".svg").c_str(), "rb"); + if (!fp) + { + bmp_name = bmp_name_in; + boost::replace_last(bmp_name, ".png", ""); + if (fp) fclose(fp); + } + + return bmp_name; +} + // 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*/, const bool grayscale/* = false*/) @@ -450,8 +473,10 @@ wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in, scale_base = (unsigned int)(em_unit(win) * px_cnt * 0.1f + 0.5f); - std::string bmp_name = bmp_name_in; - boost::replace_last(bmp_name, ".png", ""); +// std::string bmp_name = bmp_name_in; +// boost::replace_last(bmp_name, ".png", ""); + + std::string bmp_name = icon_name_respected_to_mode(bmp_name_in); // Try loading an SVG first, then PNG if SVG is not found: wxBitmap *bmp = cache.load_svg(bmp_name, width, height, scale_factor, grayscale);