diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index e78525d21..cd8ab6694 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4362,6 +4362,9 @@ void GLCanvas3D::update_ui_from_settings() _refresh_if_shown_on_screen(); } #endif + + bool enable_collapse = wxGetApp().app_config->get("show_collapse_button") == "1"; + enable_collapse_toolbar(enable_collapse); } @@ -5062,10 +5065,23 @@ bool GLCanvas3D::_init_main_toolbar() if (!m_main_toolbar.add_separator()) return false; + item.name = "settings"; + item.icon_filename = "cog.svg"; + item.tooltip = _utf8(L("Switch to Settings")); + item.sprite_id = 10; + item.enabling_callback = GLToolbarItem::Default_Enabling_Callback; + item.visibility_callback = [this]() { return wxGetApp().app_config->get("old_settings_layout_mode") != "1"; }; + item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(); }; + if (!m_main_toolbar.add_item(item)) + return false; + + if (!m_main_toolbar.add_separator()) + return false; + item.name = "layersediting"; item.icon_filename = "layers_white.svg"; item.tooltip = _utf8(L("Variable layer height")); - item.sprite_id = 10; + item.sprite_id = /*10*/11; item.left.toggable = true; item.left.action_callback = [this]() { if (m_canvas != nullptr) wxPostEvent(m_canvas, SimpleEvent(EVT_GLTOOLBAR_LAYERSEDITING)); }; item.visibility_callback = [this]()->bool @@ -5087,7 +5103,7 @@ bool GLCanvas3D::_init_main_toolbar() item.name = "search"; item.icon_filename = "search_.svg"; item.tooltip = _utf8(L("Search")) + " [" + GUI::shortkey_ctrl_prefix() + "F]"; - item.sprite_id = 11; + item.sprite_id = /*11*/12; item.left.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) { @@ -5264,61 +5280,10 @@ bool GLCanvas3D::_init_collapse_toolbar() wxGetApp().plater()->collapse_sidebar(!wxGetApp().plater()->is_sidebar_collapsed()); }; - if (!m_collapse_toolbar.add_item(item)) - return false; - - if (!m_collapse_toolbar.add_separator()) - return false; - - item.name = "print"; - item.icon_filename = "cog.svg"; - item.tooltip = _utf8(L("Switch to Print Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "2]"; - item.sprite_id = 1; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*0*/1); }; - - if (!m_collapse_toolbar.add_item(item)) - return false; - - item.name = "filament"; - item.icon_filename = "spool.svg"; - item.tooltip = _utf8(L("Switch to Filament Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]"; - item.sprite_id = 2; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); }; - item.visibility_callback = [this]() { return wxGetApp().plater()->printer_technology() == ptFFF; }; - - if (!m_collapse_toolbar.add_item(item)) - return false; - - item.name = "printer"; - item.icon_filename = "printer.svg"; - item.tooltip = _utf8(L("Switch to Printer Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "4]"; - item.sprite_id = 3; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*2*/3); }; - - if (!m_collapse_toolbar.add_item(item)) - return false; - - item.name = "resin"; - item.icon_filename = "resin.svg"; - item.tooltip = _utf8(L("Switch to SLA Material Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]"; - item.sprite_id = 4; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); }; - item.visibility_callback = [this]() { return m_process->current_printer_technology() == ptSLA; }; - - if (!m_collapse_toolbar.add_item(item)) - return false; - - item.name = "sla_printer"; - item.icon_filename = "sla_printer.svg"; - item.tooltip = _utf8(L("Switch to Printer Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "4]"; - item.sprite_id = 5; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*2*/3); }; - if (!m_collapse_toolbar.add_item(item)) return false; return true; - } bool GLCanvas3D::_set_current() diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 0bd087814..88ed1d476 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -252,7 +252,7 @@ bool GLToolbar::is_enabled() const void GLToolbar::set_enabled(bool enable) { - m_enabled = true; + m_enabled = enable;//true; etFIXME } bool GLToolbar::add_item(const GLToolbarItem::Data& data) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 0774f3208..6790c4c8a 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -413,7 +413,8 @@ bool GUI_App::on_init_inner() if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr) wxImage::AddHandler(new wxPNGHandler()); mainframe = new MainFrame(); - mainframe->switch_to(true); // hide settings tabs after first Layout + // hide settings tabs after first Layout + mainframe->select_tab(0); sidebar().obj_list()->init_objects(); // propagate model objects to object list // update_mode(); // !!! do that later @@ -602,6 +603,8 @@ void GUI_App::recreate_GUI() MainFrame *old_main_frame = mainframe; mainframe = new MainFrame(); + // hide settings tabs after first Layout + mainframe->select_tab(0); // Propagate model objects to object list. sidebar().obj_list()->init_objects(); SetTopWindow(mainframe); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index d3bd2720e..5d72dcc8b 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -90,10 +90,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S // initialize layout auto sizer = new wxBoxSizer(wxVERTICAL); - if (m_plater) + if (m_plater && m_layout != slOld) sizer->Add(m_plater, 1, wxEXPAND); - if (m_tabpanel) + + if (m_tabpanel && m_layout != slDlg) sizer->Add(m_tabpanel, 1, wxEXPAND); + sizer->SetSizeHints(this); SetSizer(sizer); Fit(); @@ -289,12 +291,22 @@ void MainFrame::update_title() void MainFrame::init_tabpanel() { - // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10 - // with multiple high resolution displays connected. - m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); + m_layout = wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? slOld : + wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? slNew : + wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? slDlg : slOld; + + if (m_layout == slDlg) { + m_settings_dialog = new SettingsDialog(); + m_tabpanel = m_settings_dialog->get_tabpanel(); + } + else { + // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10 + // with multiple high resolution displays connected. + m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); #ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList - m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font()); #endif + } m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, [this](wxEvent&) { auto panel = m_tabpanel->GetCurrentPage(); @@ -307,17 +319,22 @@ void MainFrame::init_tabpanel() // On GTK, the wxEVT_NOTEBOOK_PAGE_CHANGED event is triggered // before the MainFrame is fully set up. static_cast(panel)->OnActivate(); + m_last_selected_tab = m_tabpanel->GetSelection(); } else select_tab(0); }); -//! m_plater = new Slic3r::GUI::Plater(m_tabpanel, this); - m_plater = new Plater(this, this); - + if (m_layout == slOld) { + m_plater = new Plater(m_tabpanel, this); + m_tabpanel->AddPage(m_plater, _L("Plater")); + } + else { + m_plater = new Plater(this, this); + if (m_layout == slNew) + m_tabpanel->AddPage(new wxPanel(m_tabpanel), _L("Plater")); // empty panel just for Plater tab + } wxGetApp().plater_ = m_plater; -// m_tabpanel->AddPage(m_plater, _(L("Plater"))); - m_tabpanel->AddPage(new wxPanel(m_tabpanel), _L("Plater")); // empty panel just for Plater tab wxGetApp().obj_list()->create_popup_menus(); @@ -343,13 +360,6 @@ void MainFrame::init_tabpanel() } } -void MainFrame::switch_to(bool plater) -{ - this->m_plater->Show(plater); - this->m_tabpanel->Show(!plater); - this->Layout(); -} - void MainFrame::create_preset_tabs() { wxGetApp().update_label_colours_from_appconfig(); @@ -763,25 +773,21 @@ void MainFrame::init_menubar() // Window menu auto windowMenu = new wxMenu(); { -//! 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/*, tab_offset*/](wxCommandEvent&) { select_tab(/*(size_t)(-1)*/0); }, "plater", nullptr, + [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*/1); }, "cog", nullptr, + [this/*, tab_offset*/](wxCommandEvent&) { select_tab(1); }, "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*/2); }, "spool", nullptr, + [this/*, tab_offset*/](wxCommandEvent&) { select_tab(2); }, "spool", nullptr, [this]() {return true; }, this); m_changeable_menu_items.push_back(item_material_tab); wxMenuItem* item_printer_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*/3); }, "printer", nullptr, + [this/*, tab_offset*/](wxCommandEvent&) { select_tab(3); }, "printer", nullptr, [this]() {return true; }, this); m_changeable_menu_items.push_back(item_printer_tab); if (m_plater) { @@ -1245,17 +1251,25 @@ void MainFrame::load_config(const DynamicPrintConfig& config) #endif } -void MainFrame::select_tab(size_t tab) +void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) { - if (tab == /*(size_t)(-1)*/0) { - if (m_plater && !m_plater->IsShown()) - this->switch_to(true); + if (m_layout == slDlg) { + if (tab==0) + return; + // Show/Activate Settings Dialog + if (m_settings_dialog->IsShown()) + m_settings_dialog->SetFocus(); + else + m_settings_dialog->Show(); } - else { - if (m_plater && m_plater->IsShown()) - switch_to(false); - m_tabpanel->SetSelection(tab); + else if (m_layout == slNew) { + m_plater->Show(tab == 0); + m_tabpanel->Show(tab != 0); + Layout(); } + + // when tab == -1, it means we should to show the last selected tab + m_tabpanel->SetSelection(tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == slDlg && tab != 0) ? tab-1 : tab); } // Set a camera direction, zoom to all objects. @@ -1360,5 +1374,66 @@ std::string MainFrame::get_dir_name(const wxString &full_name) const return boost::filesystem::path(full_name.wx_str()).parent_path().string(); } + +// ---------------------------------------------------------------------------- +// SettingsDialog +// ---------------------------------------------------------------------------- + +SettingsDialog::SettingsDialog() +: DPIDialog(nullptr, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Settings")) +{ + this->SetFont(wxGetApp().normal_font()); + + wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + this->SetBackgroundColour(bgr_clr); + + // Load the icon either from the exe, or from the ico file. +#if _WIN32 + { + TCHAR szExeFileName[MAX_PATH]; + GetModuleFileName(nullptr, szExeFileName, MAX_PATH); + SetIcon(wxIcon(szExeFileName, wxBITMAP_TYPE_ICO)); + } +#else + SetIcon(wxIcon(var("PrusaSlicer_128px.png"), wxBITMAP_TYPE_PNG)); +#endif // _WIN32 + + // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10 + // with multiple high resolution displays connected. + m_tabpanel = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); +#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList + m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font()); +#endif + + // initialize layout + auto sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(m_tabpanel, 1, wxEXPAND); + sizer->SetSizeHints(this); + SetSizer(sizer); + Fit(); + + const wxSize min_size = wxSize(85 * em_unit(), 50 * em_unit()); +#ifdef __APPLE__ + // Using SetMinSize() on Mac messes up the window position in some cases + // cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0 + SetSize(min_size); +#else + SetMinSize(min_size); + SetSize(GetMinSize()); +#endif + Layout(); +} + +void SettingsDialog::on_dpi_changed(const wxRect& suggested_rect) +{ + const int& em = em_unit(); + const wxSize& size = wxSize(85 * em, 50 * em); + + SetMinSize(size); + Fit(); + Refresh(); +} + + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 8fc0ed1f2..536191700 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -43,6 +43,22 @@ struct PresetTab { PrinterTechnology technology; }; +// ---------------------------------------------------------------------------- +// SettingsDialog +// ---------------------------------------------------------------------------- + +class SettingsDialog : public DPIDialog +{ + wxNotebook* m_tabpanel { nullptr }; +public: + SettingsDialog(); + ~SettingsDialog() {} + wxNotebook* get_tabpanel() { return m_tabpanel; } + +protected: + void on_dpi_changed(const wxRect& suggested_rect) override; +}; + class MainFrame : public DPIFrame { bool m_loaded {false}; @@ -57,6 +73,8 @@ class MainFrame : public DPIFrame PrintHostQueueDialog *m_printhost_queue_dlg; + size_t m_last_selected_tab {1}; + std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const; std::string get_dir_name(const wxString &full_name) const; @@ -94,6 +112,12 @@ class MainFrame : public DPIFrame wxFileHistory m_recent_projects; + enum SettingsLayout { + slOld = 0, + slNew, + slDlg, + } m_layout; + protected: virtual void on_dpi_changed(const wxRect &suggested_rect); @@ -109,7 +133,6 @@ public: void update_title(); void init_tabpanel(); - void switch_to(bool plater); void create_preset_tabs(); void add_created_tab(Tab* panel); void init_menubar(); @@ -130,7 +153,9 @@ public: void export_configbundle(); void load_configbundle(wxString file = wxEmptyString); void load_config(const DynamicPrintConfig& config); - void select_tab(size_t tab); + // Select tab in m_tabpanel + // When tab == -1, will be selected last selected tab + void select_tab(size_t tab = size_t(-1)); void select_view(const std::string& direction); // Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig void on_config_changed(DynamicPrintConfig* cfg) const ; @@ -141,6 +166,7 @@ public: Plater* m_plater { nullptr }; wxNotebook* m_tabpanel { nullptr }; + SettingsDialog* m_settings_dialog { nullptr }; wxProgressDialog* m_progress_dialog { nullptr }; std::shared_ptr m_statusbar; diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 83eb6c76f..5b2b5703b 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -105,6 +105,7 @@ void OptionsGroup::add_undo_buttuns_to_sizer(wxSizer* sizer, const t_field& fiel if (!m_show_modified_btns) { field->m_Undo_btn->set_as_hidden(); field->m_Undo_to_sys_btn->set_as_hidden(); + field->m_blinking_bmp->Hide(); return; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 02baaa17e..a6430e472 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -355,10 +355,10 @@ PresetBitmapComboBox(parent, wxSize(15 * wxGetApp().em_unit(), -1)), if (page_id == wxNOT_FOUND) return; - wxGetApp().tab_panel()->ChangeSelection(page_id); + wxGetApp().tab_panel()->SetSelection(page_id); // Switch to Settings NotePad - wxGetApp().mainframe->switch_to(false); + wxGetApp().mainframe->select_tab(); /* In a case of a multi-material printing, for editing another Filament Preset * it's needed to select this preset for the "Filament settings" Tab @@ -1100,9 +1100,8 @@ void Sidebar::jump_to_option(size_t selected) const Search::Option& opt = p->searcher.get_option(selected); wxGetApp().get_tab(opt.type)->activate_option(opt.opt_key, opt.category); - // Switch to the Settings NotePad, if plater is shown - if (p->plater->IsShown()) - wxGetApp().mainframe->switch_to(false); + // Switch to the Settings NotePad + wxGetApp().mainframe->select_tab(); } ObjectManipulation* Sidebar::obj_manipul() diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index e2bccb1c7..5963a1637 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -117,6 +117,13 @@ void PreferencesDialog::build() m_optgroup_general->append_single_option_line(option); #endif + def.label = L("Show the button for the collapse sidebar"); + def.type = coBool; + def.tooltip = L("If enabled, the button for the collapse sidebar will be appeared in top right corner of the 3D Scene"); + def.set_default_value(new ConfigOptionBool{ app_config->get("show_collapse_button") == "1" }); + option = Option(def, "show_collapse_button"); + m_optgroup_general->append_single_option_line(option); + m_optgroup_camera = std::make_shared(this, _(L("Camera"))); m_optgroup_camera->label_width = 40; m_optgroup_camera->m_on_change = [this](t_config_option_key opt_key, boost::any value) { @@ -157,6 +164,8 @@ void PreferencesDialog::build() create_icon_size_slider(); m_icon_size_sizer->ShowItems(app_config->get("use_custom_toolbar_size") == "1"); + create_settings_mode_widget(); + auto sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(m_optgroup_general->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10); sizer->Add(m_optgroup_camera->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10); @@ -167,7 +176,7 @@ void PreferencesDialog::build() auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); wxButton* btn = static_cast(FindWindowById(wxID_OK, this)); btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { accept(); }); - sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); + sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 5); SetSizer(sizer); sizer->SetSizeHints(this); @@ -179,8 +188,33 @@ void PreferencesDialog::accept() warning_catcher(this, wxString::Format(_(L("You need to restart %s to make the changes effective.")), SLIC3R_APP_NAME)); } - auto app_config = get_app_config(); - for (std::map::iterator it = m_values.begin(); it != m_values.end(); ++it) { + bool settings_layout_changed = m_values.find("old_settings_layout_mode") != m_values.end() || + m_values.find("new_settings_layout_mode") != m_values.end() || + m_values.find("dlg_settings_layout_mode") != m_values.end(); + + bool canceled = false; + if (settings_layout_changed) { + // the dialog needs to be destroyed before the call to recreate_gui() + // or sometimes the application crashes into wxDialogBase() destructor + // so we put it into an inner scope + wxMessageDialog dialog(nullptr, + _L("Switching the settings layout mode will trigger application restart.\n" + "You will lose content of the plater.") + "\n\n" + + _L("Do you want to proceed?"), + wxString(SLIC3R_APP_NAME) + " - " + _L("Switching the settings layout mode"), + wxICON_QUESTION | wxOK | wxCANCEL); + + if (dialog.ShowModal() == wxID_CANCEL) + canceled = true; + } + + auto app_config = get_app_config(); + for (std::map::iterator it = m_values.begin(); it != m_values.end(); ++it) + { + if (canceled && (it->first == "old_settings_layout_mode" || + it->first == "new_settings_layout_mode" || + it->first == "dlg_settings_layout_mode" )) + continue; app_config->set(it->first, it->second); } @@ -188,8 +222,12 @@ void PreferencesDialog::accept() EndModal(wxID_OK); - // Nothify the UI to update itself from the ini file. - wxGetApp().update_ui_from_settings(); + if (settings_layout_changed && !canceled) + // recreate application, if settings layout was changed + wxGetApp().recreate_GUI(); + else + // Nothify the UI to update itself from the ini file. + wxGetApp().update_ui_from_settings(); } void PreferencesDialog::on_dpi_changed(const wxRect &suggested_rect) @@ -272,6 +310,38 @@ void PreferencesDialog::create_icon_size_slider() m_optgroup_gui->sizer->Add(m_icon_size_sizer, 0, wxEXPAND | wxALL, em); } +void PreferencesDialog::create_settings_mode_widget() +{ + wxString choices[] = { _L("Old regular layout with tab bar"), + _L("New layout without the tab bar on the platter"), + _L("Settings will be shown in non-modal dialog") }; + + auto app_config = get_app_config(); + int selection = app_config->get("old_settings_layout_mode") == "1" ? 0 : + app_config->get("new_settings_layout_mode") == "1" ? 1 : + app_config->get("dlg_settings_layout_mode") == "1" ? 2 : 0; + + wxWindow* parent = m_optgroup_gui->ctrl_parent(); + + wxRadioBox* box = new wxRadioBox(parent, wxID_ANY, _L("Settings layout mode"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(choices), choices, + 3, wxRA_SPECIFY_ROWS); + box->SetButtonFont(wxGetApp().normal_font()); + box->SetSelection(selection); + + box->Bind(wxEVT_RADIOBOX, [this](wxCommandEvent& e) { + int selection = e.GetSelection(); + + m_values["old_settings_layout_mode"] = boost::any_cast(selection == 0) ? "1" : "0"; + m_values["new_settings_layout_mode"] = boost::any_cast(selection == 1) ? "1" : "0"; + m_values["dlg_settings_layout_mode"] = boost::any_cast(selection == 2) ? "1" : "0"; + }); + + auto sizer = new wxBoxSizer(wxHORIZONTAL); + sizer->Add(box, 1, wxALIGN_CENTER_VERTICAL); + + m_optgroup_gui->sizer->Add(sizer, 0, wxEXPAND | wxALL, em_unit()); +} + } // GUI } // Slic3r \ No newline at end of file diff --git a/src/slic3r/GUI/Preferences.hpp b/src/slic3r/GUI/Preferences.hpp index 35bf2b8c5..7a6de8377 100644 --- a/src/slic3r/GUI/Preferences.hpp +++ b/src/slic3r/GUI/Preferences.hpp @@ -31,6 +31,7 @@ protected: void on_dpi_changed(const wxRect &suggested_rect) override; void layout(); void create_icon_size_slider(); + void create_settings_mode_widget(); }; } // GUI