From fe8e43135667e285c0e535952fe5685b95cb7807 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 3 Dec 2018 15:06:02 +0100 Subject: [PATCH 1/2] New menu layout set as default --- src/libslic3r/Technologies.hpp | 2 - src/slic3r/GUI/GUI_App.cpp | 4 -- src/slic3r/GUI/GUI_App.hpp | 4 -- src/slic3r/GUI/GUI_ObjectList.cpp | 4 -- src/slic3r/GUI/MainFrame.cpp | 61 ------------------------ src/slic3r/GUI/MainFrame.hpp | 6 --- src/slic3r/GUI/Plater.cpp | 77 +------------------------------ src/slic3r/GUI/Plater.hpp | 14 ------ 8 files changed, 2 insertions(+), 170 deletions(-) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index c15d0a4ef..f0dde95ff 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -25,8 +25,6 @@ #define ENABLE_ENSURE_ON_BED_WHILE_SCALING (1 && ENABLE_MODELVOLUME_TRANSFORM) // Gizmos always rendered on top of objects #define ENABLE_GIZMOS_ON_TOP (1 && ENABLE_1_42_0) -// New menu layout (open/save/save as project + import/export) -#define ENABLE_NEW_MENU_LAYOUT (1 && ENABLE_1_42_0) // All rotations made using the rotate gizmo are done with respect to the world reference system #define ENABLE_WORLD_ROTATIONS (1 && ENABLE_1_42_0) // Enables shortcut keys for gizmos diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 5cf872589..52426c12d 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -318,7 +318,6 @@ void GUI_App::update_ui_from_settings() mainframe->update_ui_from_settings(); } -#if ENABLE_NEW_MENU_LAYOUT void GUI_App::load_project(wxWindow *parent, wxString& input_file) { input_file.Clear(); @@ -332,9 +331,6 @@ void GUI_App::load_project(wxWindow *parent, wxString& input_file) } void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files) -#else -void GUI_App::open_model(wxWindow *parent, wxArrayString& input_files) -#endif // ENABLE_NEW_MENU_LAYOUT { input_files.Clear(); wxFileDialog dialog(parent ? parent : GetTopWindow(), diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index f7c06a60a..55447428d 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -112,12 +112,8 @@ public: void recreate_GUI(); void system_info(); -#if ENABLE_NEW_MENU_LAYOUT void load_project(wxWindow *parent, wxString& input_file); void import_model(wxWindow *parent, wxArrayString& input_files); -#else - void open_model(wxWindow *parent, wxArrayString& input_files); -#endif // ENABLE_NEW_MENU_LAYOUT static bool catch_error(std::function cb, // wxMessageDialog* message_dialog, const std::string& err); diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 497b65a93..10d9d0eb3 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -763,11 +763,7 @@ void ObjectList::load_part( ModelObject* model_object, m_parts_changed = false; wxArrayString input_files; -#if ENABLE_NEW_MENU_LAYOUT wxGetApp().import_model(parent, input_files); -#else - wxGetApp().open_model(parent, input_files); -#endif // ENABLE_NEW_MENU_LAYOUT for (int i = 0; i < input_files.size(); ++i) { std::string input_file = input_files.Item(i).ToStdString(); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 55b2dca40..f75afa037 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -171,7 +171,6 @@ void MainFrame::add_created_tab(Tab* panel) m_tabpanel->AddPage(panel, panel->title()); } -#if ENABLE_NEW_MENU_LAYOUT bool MainFrame::can_save() const { return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false; @@ -218,14 +217,12 @@ bool MainFrame::can_delete_all() const { return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false; } -#endif // ENABLE_NEW_MENU_LAYOUT void MainFrame::init_menubar() { // File menu wxMenu* fileMenu = new wxMenu; { -#if ENABLE_NEW_MENU_LAYOUT wxMenuItem* item_open = append_menu_item(fileMenu, wxID_ANY, _(L("Open…\tCtrl+O")), _(L("Open a project file")), [this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "brick_add.png"); wxMenuItem* item_save = append_menu_item(fileMenu, wxID_ANY, _(L("Save\tCtrl+S")), _(L("Save current project file")), @@ -264,19 +261,6 @@ void MainFrame::init_menubar() append_submenu(fileMenu, export_menu, wxID_ANY, _(L("Export")), _(L(""))); fileMenu->AppendSeparator(); -#else - append_menu_item(fileMenu, wxID_ANY, _(L("Open STL/OBJ/AMF/3MF…\tCtrl+O")), _(L("Open a model")), - [this](wxCommandEvent&) { if (m_plater) m_plater->add(); }, "brick_add.png"); - append_menu_item(fileMenu, wxID_ANY, _(L("&Load Config…\tCtrl+L")), _(L("Load exported configuration file")), - [this](wxCommandEvent&) { load_config_file(); }, "plugin_add.png"); - append_menu_item(fileMenu, wxID_ANY, _(L("&Export Config…\tCtrl+E")), _(L("Export current configuration to file")), - [this](wxCommandEvent&) { export_config(); }, "plugin_go.png"); - append_menu_item(fileMenu, wxID_ANY, _(L("&Load Config Bundle…")), _(L("Load presets from a bundle")), - [this](wxCommandEvent&) { load_configbundle(); }, "lorry_add.png"); - append_menu_item(fileMenu, wxID_ANY, _(L("&Export Config Bundle…")), _(L("Export all presets to file")), - [this](wxCommandEvent&) { export_configbundle(); }, "lorry_go.png"); - fileMenu->AppendSeparator(); -#endif // ENABLE_NEW_MENU_LAYOUT m_menu_item_repeat = nullptr; append_menu_item(fileMenu, wxID_ANY, _(L("Quick Slice…\tCtrl+U")), _(L("Slice a file into a G-code")), @@ -307,7 +291,6 @@ void MainFrame::init_menubar() append_menu_item(fileMenu, wxID_EXIT, _(L("Quit")), _(L("Quit Slic3r")), [this](wxCommandEvent&) { Close(false); }); -#if ENABLE_NEW_MENU_LAYOUT 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()); @@ -315,10 +298,8 @@ void MainFrame::init_menubar() Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_gcode()); }, item_export_gcode->GetId()); Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_model()); }, item_export_stl->GetId()); Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_export_model()); }, item_export_amf->GetId()); -#endif // ENABLE_NEW_MENU_LAYOUT } -#if ENABLE_NEW_MENU_LAYOUT // Edit menu wxMenu* editMenu = nullptr; if (m_plater != nullptr) @@ -336,22 +317,6 @@ void MainFrame::init_menubar() 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()); } -#endif // ENABLE_NEW_MENU_LAYOUT - -#if !ENABLE_NEW_MENU_LAYOUT - // Plater menu - if (m_plater) { - m_plater_menu = new wxMenu(); - append_menu_item(m_plater_menu, wxID_ANY, _(L("Export G-code...")), _(L("Export current plate as G-code")), - [this](wxCommandEvent&) { m_plater->export_gcode(); }, "cog_go.png"); - append_menu_item(m_plater_menu, wxID_ANY, _(L("Export plate as STL...")), _(L("Export current plate as STL")), - [this](wxCommandEvent&) { m_plater->export_stl(); }, "brick_go.png"); - append_menu_item(m_plater_menu, wxID_ANY, _(L("Export plate as AMF...")), _(L("Export current plate as AMF")), - [this](wxCommandEvent&) { m_plater->export_amf(); }, "brick_go.png"); - append_menu_item(m_plater_menu, wxID_ANY, _(L("Export plate as 3MF...")), _(L("Export current plate as 3MF")), - [this](wxCommandEvent&) { m_plater->export_3mf(); }, "brick_go.png"); - } -#endif // !ENABLE_NEW_MENU_LAYOUT // Window menu auto windowMenu = new wxMenu(); @@ -374,7 +339,6 @@ void MainFrame::init_menubar() } // View menu -#if ENABLE_NEW_MENU_LAYOUT wxMenu* viewMenu = nullptr; if (m_plater) { viewMenu = new wxMenu(); @@ -398,22 +362,6 @@ void MainFrame::init_menubar() 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()); } -#else - if (m_plater) { - m_viewMenu = new wxMenu(); - // \xA0 is a non-breaing space. It is entered here to spoil the automatic accelerators, - // as the simple numeric accelerators spoil all numeric data entry. - // The camera control accelerators are captured by GLCanvas3D::on_char(). - append_menu_item(m_viewMenu, wxID_ANY, _(L("Iso")) + "\t\xA0" + "0", _(L("Iso View")), [this](wxCommandEvent&) { select_view("iso"); }); - m_viewMenu->AppendSeparator(); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Top")) + "\t\xA0" + "1", _(L("Top View")), [this](wxCommandEvent&) { select_view("top"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Bottom")) + "\t\xA0" + "2", _(L("Bottom View")), [this](wxCommandEvent&) { select_view("bottom"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Front")) + "\t\xA0" + "3", _(L("Front View")), [this](wxCommandEvent&) { select_view("front"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Rear")) + "\t\xA0" + "4", _(L("Rear View")), [this](wxCommandEvent&) { select_view("rear"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Left")) + "\t\xA0" + "5", _(L("Left View")), [this](wxCommandEvent&) { select_view("left"); }); - append_menu_item(m_viewMenu, wxID_ANY, _(L("Right")) + "\t\xA0" + "6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); }); - } -#endif // ENABLE_NEW_MENU_LAYOUT // Help menu auto helpMenu = new wxMenu(); @@ -447,18 +395,9 @@ void MainFrame::init_menubar() { auto menubar = new wxMenuBar(); menubar->Append(fileMenu, L("&File")); -#if ENABLE_NEW_MENU_LAYOUT if (editMenu) menubar->Append(editMenu, L("&Edit")); -#endif // ENABLE_NEW_MENU_LAYOUT -#if !ENABLE_NEW_MENU_LAYOUT - if (m_plater_menu) menubar->Append(m_plater_menu, L("&Plater")); -#endif // !ENABLE_NEW_MENU_LAYOUT menubar->Append(windowMenu, L("&Window")); -#if ENABLE_NEW_MENU_LAYOUT if (viewMenu) menubar->Append(viewMenu, L("&View")); -#else - if (m_viewMenu) menubar->Append(m_viewMenu, L("&View")); -#endif // !ENABLE_NEW_MENU_LAYOUT // Add additional menus from C++ wxGetApp().add_config_menu(menubar); menubar->Append(helpMenu, L("&Help")); diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 2cc9d0de9..eb7341366 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -56,10 +56,6 @@ class MainFrame : public wxFrame wxMenuItem* m_menu_item_repeat { nullptr }; wxMenuItem* m_menu_item_reslice_now { nullptr }; -#if !ENABLE_NEW_MENU_LAYOUT - wxMenu* m_plater_menu{ nullptr }; - wxMenu* m_viewMenu{ nullptr }; -#endif // !ENABLE_NEW_MENU_LAYOUT std::string get_base_name(const wxString full_name) const ; std::string get_dir_name(const wxString full_name) const ; @@ -67,7 +63,6 @@ class MainFrame : public wxFrame void on_presets_changed(SimpleEvent&); void on_value_changed(wxCommandEvent&); -#if ENABLE_NEW_MENU_LAYOUT bool can_save() const; bool can_export_model() const; bool can_export_gcode() const; @@ -75,7 +70,6 @@ class MainFrame : public wxFrame bool can_select() const; bool can_delete() const; bool can_delete_all() const; -#endif // ENABLE_NEW_MENU_LAYOUT public: MainFrame() {} diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 6dec67acf..4f578728a 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -926,9 +926,7 @@ struct Plater::priv GLCanvas3D *canvas3D; Preview *preview; -#if ENABLE_NEW_MENU_LAYOUT wxString project_filename; -#endif // ENABLE_NEW_MENU_LAYOUT BackgroundSlicingProcess background_process; std::atomic arranging; @@ -950,11 +948,7 @@ struct Plater::priv std::string get_config(const std::string &key) const; BoundingBoxf bed_shape_bb() const; BoundingBox scaled_bed_shape_bb() const; -#if ENABLE_NEW_MENU_LAYOUT std::vector load_files(const std::vector& input_files, bool load_model, bool load_config); -#else - std::vector load_files(const std::vector &input_files); -#endif // ENABLE_NEW_MENU_LAYOUT std::vector load_model_objects(const ModelObjectPtrs &model_objects); std::unique_ptr get_export_file(GUI::FileType file_type); @@ -1058,9 +1052,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) #endif // ENABLE_IMGUI , canvas3D(nullptr) , delayed_scene_refresh(false) -#if ENABLE_NEW_MENU_LAYOUT , project_filename(wxEmptyString) -#endif // ENABLE_NEW_MENU_LAYOUT { arranging.store(false); rotoptimizing.store(false); @@ -1245,11 +1237,7 @@ BoundingBox Plater::priv::scaled_bed_shape_bb() const return bed_shape.bounding_box(); } -#if ENABLE_NEW_MENU_LAYOUT std::vector Plater::priv::load_files(const std::vector& input_files, bool load_model, bool load_config) -#else -std::vector Plater::priv::load_files(const std::vector &input_files) -#endif // ENABLE_NEW_MENU_LAYOUT { if (input_files.empty()) { return std::vector(); } @@ -1269,11 +1257,7 @@ std::vector Plater::priv::load_files(const std::vector &input_ wxProgressDialog dlg(loading, loading); dlg.Pulse(); -#if ENABLE_NEW_MENU_LAYOUT auto *new_model = (!load_model || one_by_one) ? nullptr : new Slic3r::Model(); -#else - auto *new_model = one_by_one ? nullptr : new Slic3r::Model(); -#endif // ENABLE_NEW_MENU_LAYOUT std::vector obj_idxs; for (size_t i = 0; i < input_files.size(); i++) { @@ -1292,11 +1276,7 @@ std::vector Plater::priv::load_files(const std::vector &input_ { DynamicPrintConfig config_loaded; model = Slic3r::Model::read_from_archive(path.string(), &config_loaded, false); -#if ENABLE_NEW_MENU_LAYOUT if (load_config && !config_loaded.empty()) { -#else - if (!config_loaded.empty()) { -#endif // ENABLE_NEW_MENU_LAYOUT // Based on the printer technology field found in the loaded config, select the base for the config, PrinterTechnology printer_technology = Preset::printer_technology(config_loaded); config.apply(printer_technology == ptFFF ? @@ -1306,19 +1286,16 @@ std::vector Plater::priv::load_files(const std::vector &input_ config += std::move(config_loaded); } } -#if ENABLE_NEW_MENU_LAYOUT + if (load_config) { -#endif // ENABLE_NEW_MENU_LAYOUT if (!config.empty()) { Preset::normalize(config); wxGetApp().preset_bundle->load_config_model(filename.string(), std::move(config)); wxGetApp().load_current_presets(); } wxGetApp().app_config->update_config_dir(path.parent_path().string()); -#if ENABLE_NEW_MENU_LAYOUT } -#endif // ENABLE_NEW_MENU_LAYOUT } else { model = Slic3r::Model::read_from_file(path.string(), nullptr, false); @@ -1331,10 +1308,8 @@ std::vector Plater::priv::load_files(const std::vector &input_ continue; } -#if ENABLE_NEW_MENU_LAYOUT if (load_model) { -#endif // ENABLE_NEW_MENU_LAYOUT // The model should now be initialized if (model.looks_like_multipart_object()) { @@ -1364,9 +1339,7 @@ std::vector Plater::priv::load_files(const std::vector &input_ new_model->add_object(*model_object); } } -#if ENABLE_NEW_MENU_LAYOUT } -#endif // ENABLE_NEW_MENU_LAYOUT } if (new_model != nullptr) { @@ -1383,16 +1356,13 @@ std::vector Plater::priv::load_files(const std::vector &input_ obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end()); } -#if ENABLE_NEW_MENU_LAYOUT if (load_model) { -#endif // ENABLE_NEW_MENU_LAYOUT wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().string()); // XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames... statusbar()->set_status_text(_(L("Loaded"))); -#if ENABLE_NEW_MENU_LAYOUT } -#endif // ENABLE_NEW_MENU_LAYOUT + return obj_idxs; } @@ -1593,9 +1563,7 @@ void Plater::priv::delete_object_from_model(size_t obj_idx) void Plater::priv::reset() { -#if ENABLE_NEW_MENU_LAYOUT project_filename.Clear(); -#endif // ENABLE_NEW_MENU_LAYOUT // Prevent toolpaths preview from rendering while we modify the Print object preview->set_enabled(false); @@ -2117,11 +2085,7 @@ void Plater::priv::on_schedule_background_process(SimpleEvent&) void Plater::priv::on_action_add(SimpleEvent&) { if (q != nullptr) -#if ENABLE_NEW_MENU_LAYOUT q->add_model(); -#else - q->add(); -#endif // ENABLE_NEW_MENU_LAYOUT } void Plater::priv::on_action_split_objects(SimpleEvent&) @@ -2332,7 +2296,6 @@ Print& Plater::fff_print() { return p->fff_print; } const SLAPrint& Plater::sla_print() const { return p->sla_print; } SLAPrint& Plater::sla_print() { return p->sla_print; } -#if ENABLE_NEW_MENU_LAYOUT void Plater::load_project() { wxString input_file; @@ -2350,33 +2313,19 @@ void Plater::load_project() } void Plater::add_model() -#else -void Plater::add() -#endif // ENABLE_NEW_MENU_LAYOUT { wxArrayString input_files; -#if ENABLE_NEW_MENU_LAYOUT wxGetApp().import_model(this, input_files); -#else - wxGetApp().open_model(this, input_files); -#endif // ENABLE_NEW_MENU_LAYOUT -#if ENABLE_NEW_MENU_LAYOUT if (input_files.empty()) return; -#endif // ENABLE_NEW_MENU_LAYOUT std::vector input_paths; for (const auto &file : input_files) { input_paths.push_back(file.wx_str()); } -#if ENABLE_NEW_MENU_LAYOUT load_files(input_paths, true, false); -#else - load_files(input_paths); -#endif // ENABLE_NEW_MENU_LAYOUT } -#if ENABLE_NEW_MENU_LAYOUT void Plater::extract_config_from_project() { wxString input_file; @@ -2389,13 +2338,8 @@ void Plater::extract_config_from_project() input_paths.push_back(input_file.wx_str()); load_files(input_paths, false, true); } -#endif // ENABLE_NEW_MENU_LAYOUT -#if ENABLE_NEW_MENU_LAYOUT void Plater::load_files(const std::vector& input_files, bool load_model, bool load_config) { p->load_files(input_files, load_model, load_config); } -#else -void Plater::load_files(const std::vector &input_files) { p->load_files(input_files); } -#endif // ENABLE_NEW_MENU_LAYOUT void Plater::update() { p->update(); } @@ -2611,23 +2555,16 @@ void Plater::export_amf() } } -#if ENABLE_NEW_MENU_LAYOUT void Plater::export_3mf(const boost::filesystem::path& output_path) -#else -void Plater::export_3mf() -#endif // ENABLE_NEW_MENU_LAYOUT { if (p->model.objects.empty()) { return; } -#if ENABLE_NEW_MENU_LAYOUT wxString path; bool export_config = true; if (output_path.empty()) { -#endif // ENABLE_NEW_MENU_LAYOUT auto dialog = p->get_export_file(FT_3MF); if (!dialog) { return; } -#if ENABLE_NEW_MENU_LAYOUT path = dialog->GetPath(); export_config = dialog->get_checkbox_value(); } @@ -2636,17 +2573,9 @@ void Plater::export_3mf() if (!path.Lower().EndsWith(".3mf")) return; -#else - wxString path = dialog->GetPath(); - auto path_cstr = path.c_str(); -#endif // ENABLE_NEW_MENU_LAYOUT DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config(); -#if ENABLE_NEW_MENU_LAYOUT if (Slic3r::store_3mf(path.c_str(), &p->model, export_config ? &cfg : nullptr)) { -#else - if (Slic3r::store_3mf(path_cstr, &p->model, dialog->get_checkbox_value() ? &cfg : nullptr)) { -#endif // ENABLE_NEW_MENU_LAYOUT // Success p->statusbar()->set_status_text(wxString::Format(_(L("3MF file exported to %s")), path)); } else { @@ -2774,7 +2703,6 @@ void Plater::on_config_change(const DynamicPrintConfig &config) this->p->schedule_background_process(); } -#if ENABLE_NEW_MENU_LAYOUT const wxString& Plater::get_project_filename() const { return p->project_filename; @@ -2784,7 +2712,6 @@ bool Plater::is_export_gcode_scheduled() const { return p->background_process.is_export_scheduled(); } -#endif // ENABLE_NEW_MENU_LAYOUT int Plater::get_selected_object_idx() { diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index feb3bcb0f..31f209b4c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -116,19 +116,11 @@ public: const SLAPrint& sla_print() const; SLAPrint& sla_print(); -#if ENABLE_NEW_MENU_LAYOUT void load_project(); void add_model(); void extract_config_from_project(); -#else - void add(); -#endif // ENABLE_NEW_MENU_LAYOUT -#if ENABLE_NEW_MENU_LAYOUT void load_files(const std::vector& input_files, bool load_model = true, bool load_config = true); -#else - void load_files(const std::vector &input_files); -#endif // ENABLE_NEW_MENU_LAYOUT void update(); void select_view(const std::string& direction); @@ -149,11 +141,7 @@ public: void export_gcode(boost::filesystem::path output_path = boost::filesystem::path()); void export_stl(); void export_amf(); -#if ENABLE_NEW_MENU_LAYOUT void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path()); -#else - void export_3mf(); -#endif // ENABLE_NEW_MENU_LAYOUT void reslice(); void changed_object(int obj_idx); void fix_through_netfabb(const int obj_idx); @@ -162,10 +150,8 @@ public: void on_extruders_change(int extruders_count); void on_config_change(const DynamicPrintConfig &config); -#if ENABLE_NEW_MENU_LAYOUT const wxString& get_project_filename() const; bool is_export_gcode_scheduled() const; -#endif // ENABLE_NEW_MENU_LAYOUT int get_selected_object_idx(); bool is_single_full_object_selection() const; From b3c5a627093eb7b4d026a43246073db9fd80bc9d Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 3 Dec 2018 15:16:33 +0100 Subject: [PATCH 2/2] Check selection for PresetComboBox --- src/slic3r/GUI/Plater.cpp | 9 +++++++++ src/slic3r/GUI/Plater.hpp | 1 + 2 files changed, 10 insertions(+) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 4f578728a..03d816216 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -267,6 +267,12 @@ void PresetComboBox::set_label_marker(int item) this->SetClientData(item, (void*)LABEL_ITEM_MARKER); } +void PresetComboBox::check_selection() +{ + if (this->last_selected != GetSelection()) + this->last_selected = GetSelection(); +} + // Frequently changed parameters class FreqChangedParams : public OG_Settings @@ -641,7 +647,10 @@ void Sidebar::update_presets(Preset::Type preset_type) preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material); } // Update the printer choosers, update the dirty flags. + auto prev_selection = p->combo_printer->GetSelection(); preset_bundle.printers.update_platter_ui(p->combo_printer); + if (prev_selection != p->combo_printer->GetSelection()) + p->combo_printer->check_selection(); // Update the filament choosers to only contain the compatible presets, update the color preview, // update the dirty flags. if (p->plater->printer_technology() == ptFFF) { diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 31f209b4c..96925b0f7 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -44,6 +44,7 @@ public: void set_label_marker(int item); void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; } int get_extruder_idx() const { return extruder_idx; } + void check_selection(); private: typedef std::size_t Marker;