diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 0f69b3ad51..919c21a5be 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -70,7 +70,7 @@ CopyrightsDialog::CopyrightsDialog() m_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(40 * em_unit(), 20 * em_unit()), wxHW_SCROLLBAR_AUTO); - wxFont font = get_default_font(this); + wxFont font = this->GetFont();// get_default_font(this); const int fs = font.GetPointSize(); const int fs2 = static_cast(1.2f*fs); int size[] = { fs, fs, fs, fs, fs2, fs2, fs2 }; @@ -244,7 +244,7 @@ AboutDialog::AboutDialog() wxStaticText* title = new wxStaticText(this, wxID_ANY, wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME, wxDefaultPosition, wxDefaultSize); wxFont title_font = GUI::wxGetApp().bold_font(); title_font.SetFamily(wxFONTFAMILY_ROMAN); - title_font.SetPointSize(24); + title_font.SetPointSize(int(2.5 * title_font.GetPointSize()));//title_font.SetPointSize(24); title->SetFont(title_font); vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 10); } @@ -267,7 +267,7 @@ AboutDialog::AboutDialog() m_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/); { m_html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit())); - wxFont font = get_default_font(this); + wxFont font = wxGetApp().normal_font();// get_default_font(this); const auto text_clr = wxGetApp().get_label_clr_default(); const auto text_clr_str = encode_color(ColorRGB(text_clr.Red(), text_clr.Green(), text_clr.Blue())); const auto bgr_clr_str = encode_color(ColorRGB(bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue())); diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp index 619ed8d737..d8b5dacb19 100644 --- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp +++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp @@ -141,7 +141,7 @@ ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db // text html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO); { - wxFont font = get_default_font(this); + wxFont font = this->GetFont();// get_default_font(this); #ifdef __WXMSW__ const int fs = font.GetPointSize(); const int fs1 = static_cast(0.8f*fs); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 741ab7be00..94cb52e0f8 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1342,8 +1342,7 @@ PageUpdate::PageUpdate(ConfigWizard *parent) , preset_update(true) { const AppConfig *app_config = wxGetApp().app_config; - auto boldfont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - boldfont.SetWeight(wxFONTWEIGHT_BOLD); + auto boldfont = wxGetApp().bold_font(); auto *box_slic3r = new wxCheckBox(this, wxID_ANY, _L("Check for application updates")); box_slic3r->SetValue(app_config->get("notify_release") != "none"); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 86505c1dea..013c07e892 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -6247,7 +6247,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() #if ENABLE_RETINA_GL new_scale /= m_retina_helper->get_scale_factor(); #endif - if (fabs(new_scale - scale) > 0.01) // scale is changed by 1% and more + if (fabs(new_scale - scale) > 0.015) // scale is changed by 1.5% and more wxGetApp().set_auto_toolbar_icon_scale(new_scale); } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 04c2c5c506..a173b621d2 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1758,7 +1758,7 @@ bool GUI_App::tabs_as_menu() const bool GUI_App::suppress_round_corners() const { - return app_config->get("suppress_round_corners") == "1"; + return true;// app_config->get("suppress_round_corners") == "1"; } wxSize GUI_App::get_min_size() const @@ -2129,6 +2129,9 @@ int GUI_App::GetSingleChoiceIndex(const wxString& message, #ifdef _WIN32 wxSingleChoiceDialog dialog(nullptr, message, caption, choices); wxGetApp().UpdateDlgDarkUI(&dialog); + auto children = dialog.GetChildren(); + for (auto child : children) + child->SetFont(normal_font()); dialog.SetSelection(initialSelection); return dialog.ShowModal() == wxID_OK ? dialog.GetSelection() : -1; @@ -2960,7 +2963,8 @@ ObjectSettings* GUI_App::obj_settings() ObjectList* GUI_App::obj_list() { - return sidebar().obj_list(); + // If this method is called before plater_ has been initialized, return nullptr (to avoid a crash) + return plater_ ? sidebar().obj_list() : nullptr; } ObjectLayers* GUI_App::obj_layers() diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index 7d22a3370d..10821038f3 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -96,6 +96,8 @@ public: if (font_point_size > 0) m_normal_font.SetPointSize(font_point_size); + else if (parent) + m_normal_font.SetPointSize(parent->GetFont().GetPointSize()); /* Because of default window font is a primary display font, * We should set correct font for window before getting em_unit value. diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index b979d8c8b6..e68d94348f 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -742,9 +742,7 @@ void MainFrame::init_tabpanel() wxGetApp().UpdateDarkUI(m_tabpanel); -#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font()); -#endif m_tabpanel->Hide(); m_settings_dialog.set_tabpanel(m_tabpanel); @@ -2305,8 +2303,6 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe) if (wxGetApp().is_gcode_viewer()) return; -// this->SetFont(wxGetApp().normal_font()); - // Load the icon either from the exe, or from the ico file. #if _WIN32 { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ddbe95a156..12368e3484 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -789,6 +789,7 @@ void Sidebar::priv::hide_rich_tip(wxButton* btn) Sidebar::Sidebar(Plater *parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(42 * wxGetApp().em_unit(), -1)), p(new priv(parent)) { + SetFont(wxGetApp().normal_font()); p->scrolled = new wxScrolledWindow(this); // p->scrolled->SetScrollbars(0, 100, 1, 2); // ys_DELETE_after_testing. pixelsPerUnitY = 100 from https://github.com/prusa3d/PrusaSlicer/commit/8f019e5fa992eac2c9a1e84311c990a943f80b01, // but this cause the bad layout of the sidebar, when all infoboxes appear. @@ -796,7 +797,6 @@ Sidebar::Sidebar(Plater *parent) // But if we set this value to 5, layout will be better p->scrolled->SetScrollRate(0, 5); - SetFont(wxGetApp().normal_font()); #ifndef __APPLE__ #ifdef _WIN32 wxGetApp().UpdateDarkUI(this); @@ -2092,8 +2092,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) , collapse_toolbar(GLToolbar::Normal, "Collapse") , m_project_filename(wxEmptyString) { - this->q->SetFont(Slic3r::GUI::wxGetApp().normal_font()); - background_process.set_fff_print(&fff_print); background_process.set_sla_print(&sla_print); background_process.set_gcode_result(&gcode_result); @@ -4472,7 +4470,10 @@ void Plater::priv::on_action_layersediting(SimpleEvent&) void Plater::priv::on_object_select(SimpleEvent& evt) { - wxGetApp().obj_list()->update_selections(); + if (auto obj_list = wxGetApp().obj_list()) + obj_list->update_selections(); + else + return; selection_changed(); } diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 30a2c67c8b..a41f67c21b 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -21,6 +21,8 @@ #include "GLCanvas3D.hpp" #include "ConfigWizard.hpp" +#include "Widgets/SpinInput.hpp" + #include #ifdef WIN32 @@ -151,6 +153,8 @@ static void activate_options_tab(std::shared_ptr optgroup) wxBoxSizer* sizer = static_cast(static_cast(optgroup->parent())->GetSizer()); sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 10); + optgroup->parent()->Layout(); + // apply sercher wxGetApp().sidebar().get_searcher().append_preferences_options(optgroup->get_lines()); } @@ -526,14 +530,14 @@ void PreferencesDialog::build() #endif m_optgroup_gui->append_separator(); - +/* append_bool_option(m_optgroup_gui, "suppress_round_corners", L("Suppress round corners for controls (experimental)"), L("If enabled, Settings Tabs will be placed as menu items. If disabled, old UI will be used."), app_config->get("suppress_round_corners") == "1"); m_optgroup_gui->append_separator(); - +*/ append_bool_option(m_optgroup_gui, "show_hints", L("Show \"Tip of the day\" notification after start"), L("If enabled, useful hints are displayed at startup."), @@ -1079,16 +1083,17 @@ void PreferencesDialog::create_settings_font_widget() wxStaticText* font_example = new wxStaticText(parent, wxID_ANY, "Application text"); int val = wxGetApp().normal_font().GetPointSize(); - wxSpinCtrl* size_sc = new wxSpinCtrl(parent, wxID_ANY, format_wxstr("%1%", val), wxDefaultPosition, wxSize(15*em_unit(), -1), wxTE_PROCESS_ENTER | wxSP_ARROW_KEYS + SpinInput* size_sc = new SpinInput(parent, format_wxstr("%1%", val), "", wxDefaultPosition, wxSize(15 * em_unit(), -1), wxTE_PROCESS_ENTER | wxSP_ARROW_KEYS #ifdef _WIN32 | wxBORDER_SIMPLE #endif , 8, 20); wxGetApp().UpdateDarkUI(size_sc); - auto apply_font = [this, font_example, opt_key](const int val, const wxFont& font) { + auto apply_font = [this, font_example, opt_key, stb_sizer](const int val, const wxFont& font) { font_example->SetFont(font); m_values[opt_key] = format("%1%", val); + stb_sizer->Layout(); refresh_og(m_optgroup_other); }; diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index b8c7646b5d..603bfe9870 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -122,13 +122,13 @@ SysInfoDialog::SysInfoDialog() wxStaticText* title = new wxStaticText(this, wxID_ANY, wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME, wxDefaultPosition, wxDefaultSize); wxFont title_font = wxGetApp().bold_font(); title_font.SetFamily(wxFONTFAMILY_ROMAN); - title_font.SetPointSize(22); + title_font.SetPointSize(int(2.5 * title_font.GetPointSize()));//title_font.SetPointSize(22); title->SetFont(title_font); vsizer->Add(title, 0, wxEXPAND | wxALIGN_LEFT | wxTOP, wxGetApp().em_unit()/*50*/); } // main_info_text - wxFont font = get_default_font(this); + wxFont font = GetFont();// get_default_font(this); const auto text_clr = wxGetApp().get_label_clr_default(); auto text_clr_str = encode_color(ColorRGB(text_clr.Red(), text_clr.Green(), text_clr.Blue())); auto bgr_clr_str = encode_color(ColorRGB(bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue()));