From 603b8c2a2be8878b510e8bc3e493a38195b5f8ec Mon Sep 17 00:00:00 2001 From: remi durand Date: Tue, 30 Mar 2021 20:04:28 +0200 Subject: [PATCH] #1043 Can set the icon size (or remove them) --- src/libslic3r/AppConfig.cpp | 3 +++ src/slic3r/GUI/MainFrame.cpp | 31 ++++++++++++++++++++----------- src/slic3r/GUI/Preferences.cpp | 13 ++++++++++++- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index c19c784a4..aa56cba9b 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -63,6 +63,9 @@ void AppConfig::set_defaults() if (get("freecad_path").empty()) set("freecad_path", "."); + if (get("tab_icon_size").empty()) + set("tab_icon_size", "32"); + if (get("color_very_dark").empty()) set("color_very_dark", "0047c7"); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index e32959c2a..8bef69fc3 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -365,12 +365,18 @@ void MainFrame::update_layout() }); // icons for ESettingsLayout::Old wxImageList* img_list = nullptr; - for (std::string icon_name : {"editor_menu", "layers", "preview_menu", "cog"}) { - const wxBitmap& bmp = create_scaled_bitmap(icon_name, this, 32); - if (img_list == nullptr) - img_list = new wxImageList(bmp.GetWidth(), bmp.GetHeight()); - img_list->Add(bmp); + int icon_size = 0; + try { + icon_size = atoi(wxGetApp().app_config->get("tab_icon_size").c_str()); } + catch (std::exception e) {} + if(icon_size >= 8) + for (std::string icon_name : {"editor_menu", "layers", "preview_menu", "cog"}) { + const wxBitmap& bmp = create_scaled_bitmap(icon_name, this, icon_size); + if (img_list == nullptr) + img_list = new wxImageList(bmp.GetWidth(), bmp.GetHeight()); + img_list->Add(bmp); + } m_tabpanel->AssignImageList(img_list); m_tabpanel->InsertPage(0, new wxPanel(m_tabpanel), _L("3D view")); m_tabpanel->InsertPage(1, new wxPanel(m_tabpanel), _L("Sliced preview")); @@ -378,12 +384,15 @@ void MainFrame::update_layout() m_tabpanel->GetPage(0)->SetSizer(new wxBoxSizer(wxVERTICAL)); m_tabpanel->GetPage(1)->SetSizer(new wxBoxSizer(wxVERTICAL)); m_tabpanel->GetPage(2)->SetSizer(new wxBoxSizer(wxVERTICAL)); - m_tabpanel->SetPageImage(0, 0); - m_tabpanel->SetPageImage(1, 1); - m_tabpanel->SetPageImage(2, 2); - m_tabpanel->SetPageImage(3, 3); - m_tabpanel->SetPageImage(4, 3); - m_tabpanel->SetPageImage(5, 3); + if (icon_size >= 8) + { + m_tabpanel->SetPageImage(0, 0); + m_tabpanel->SetPageImage(1, 1); + m_tabpanel->SetPageImage(2, 2); + m_tabpanel->SetPageImage(3, 3); + m_tabpanel->SetPageImage(4, 3); + m_tabpanel->SetPageImage(5, 3); + } m_plater->Reparent(m_tabpanel->GetPage(0)); m_tabpanel->GetPage(0)->GetSizer()->Add(m_plater, 1, wxEXPAND); m_main_sizer->Add(m_tabpanel, 1, wxEXPAND); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index b90b3ea73..15bcc3f25 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -304,6 +304,8 @@ void PreferencesDialog::build() m_values[opt_key] = boost::any_cast(value) ? "1" : ""; else if (opt_key.find("color") != std::string::npos) m_values[opt_key] = boost::any_cast(value); + else if (opt_key.find("tab_icon_size") != std::string::npos) + m_values[opt_key] = std::to_string(boost::any_cast(value)); else m_values[opt_key] = boost::any_cast(value) ? "1" : "0"; @@ -345,6 +347,15 @@ void PreferencesDialog::build() def.set_default_value(new ConfigOptionBool{ app_config->get("use_custom_toolbar_size") == "1" }); option = Option(def, "use_custom_toolbar_size"); m_optgroup_gui->append_single_option_line(option); + + def.label = L("Tab icon size"); + def.type = coInt; + def.tooltip = std::string(L("Size of the tab icons, in pixels. Set to 0 to remove icons.")) + + std::string(L("\nYou have to restart the application before any change will be taken into account.")); + def.set_default_value(new ConfigOptionInt{ atoi(app_config->get("tab_icon_size").c_str()) }); + option = Option(def, "tab_icon_size"); + option.opt.width = 6; + m_optgroup_gui->append_single_option_line(option); } @@ -469,7 +480,7 @@ void PreferencesDialog::accept() if (it != m_values.end() && app_config->get(key) != it->second) { m_settings_layout_changed = true; break; - } + } } for (const std::string& key : {"default_action_on_close_application", "default_action_on_select_preset"}) {