From 168dadc0fae444fb9f3054020a393643ad53cba2 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 16 Oct 2023 11:10:11 +0200 Subject: [PATCH] OSX specific: Set window variant for regular buttons to correct rendering with big font --- src/slic3r/GUI/AboutDialog.cpp | 4 ++++ src/slic3r/GUI/BedShapeDialog.cpp | 10 +++++++++- src/slic3r/GUI/ConfigSnapshotDialog.cpp | 3 ++- src/slic3r/GUI/ConfigWizard.cpp | 21 +++++++++++++++------ src/slic3r/GUI/FirmwareDialog.cpp | 4 ++++ src/slic3r/GUI/GUI_App.cpp | 13 +++++++++++++ src/slic3r/GUI/GUI_App.hpp | 1 + src/slic3r/GUI/GalleryDialog.cpp | 7 +++++-- src/slic3r/GUI/KBShortcutsDialog.cpp | 3 ++- src/slic3r/GUI/MsgDialog.cpp | 1 + src/slic3r/GUI/Plater.cpp | 12 +++++++----- src/slic3r/GUI/Preferences.cpp | 2 ++ src/slic3r/GUI/SysInfoDialog.cpp | 2 ++ src/slic3r/GUI/Tab.cpp | 1 + src/slic3r/GUI/WipeTowerDialog.cpp | 11 +++++++++-- 15 files changed, 77 insertions(+), 18 deletions(-) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 919c21a5be..1da5faf2b6 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -83,6 +83,7 @@ CopyrightsDialog::CopyrightsDialog() m_html->Bind(wxEVT_HTML_LINK_CLICKED, &CopyrightsDialog::onLinkClicked, this); wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE); + wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); wxGetApp().UpdateDlgDarkUI(this, true); this->SetEscapeId(wxID_CLOSE); this->Bind(wxEVT_BUTTON, &CopyrightsDialog::onCloseDialog, this, wxID_CLOSE); @@ -309,16 +310,19 @@ AboutDialog::AboutDialog() wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE); + wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); m_copy_rights_btn_id = NewControlId(); auto copy_rights_btn = new wxButton(this, m_copy_rights_btn_id, _L("Portions copyright")+dots); buttons->Insert(0, copy_rights_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5); copy_rights_btn->Bind(wxEVT_BUTTON, &AboutDialog::onCopyrightBtn, this); + wxGetApp().SetWindowVariantForButton(copy_rights_btn); m_copy_version_btn_id = NewControlId(); auto copy_version_btn = new wxButton(this, m_copy_version_btn_id, _L("Copy Version Info")); buttons->Insert(1, copy_version_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5); copy_version_btn->Bind(wxEVT_BUTTON, &AboutDialog::onCopyToClipboard, this); + wxGetApp().SetWindowVariantForButton(copy_version_btn); wxGetApp().UpdateDlgDarkUI(this, true); diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index b7e32151cd..a8bbacf6e6 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -150,7 +150,10 @@ void BedShapeDialog::build_dialog(const ConfigOptionPoints& default_pt, const Co auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(m_panel, 1, wxEXPAND); - main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); + wxStdDialogButtonSizer* buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); + wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); + wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); + main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); wxGetApp().UpdateDlgDarkUI(this, true); @@ -214,6 +217,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf line.full_width = 1; line.widget = [this](wxWindow* parent) { wxButton* shape_btn = new wxButton(parent, wxID_ANY, _L("Load shape from STL...")); + wxGetApp().SetWindowVariantForButton(shape_btn); wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL); shape_sizer->Add(shape_btn, 1, wxEXPAND); @@ -294,6 +298,7 @@ wxPanel* BedShapePanel::init_texture_panel() line.full_width = 1; line.widget = [this](wxWindow* parent) { wxButton* load_btn = new wxButton(parent, wxID_ANY, _L("Load...")); + wxGetApp().SetWindowVariantForButton(load_btn); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -303,6 +308,7 @@ wxPanel* BedShapePanel::init_texture_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); wxButton* remove_btn = new wxButton(parent, wxID_ANY, _L("Remove")); + wxGetApp().SetWindowVariantForButton(remove_btn); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); @@ -365,6 +371,7 @@ wxPanel* BedShapePanel::init_model_panel() line.full_width = 1; line.widget = [this](wxWindow* parent) { wxButton* load_btn = new wxButton(parent, wxID_ANY, _L("Load...")); + wxGetApp().SetWindowVariantForButton(load_btn); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -373,6 +380,7 @@ wxPanel* BedShapePanel::init_model_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); wxButton* remove_btn = new wxButton(parent, wxID_ANY, _L("Remove")); + wxGetApp().SetWindowVariantForButton(remove_btn); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp index d8b5dacb19..fb78b0d253 100644 --- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp +++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp @@ -160,7 +160,8 @@ ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db } wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE); - wxGetApp().UpdateDarkUI(static_cast(this->FindWindowById(wxID_CLOSE, this))); + wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); + wxGetApp().UpdateDarkUI(buttons->GetCancelButton()); this->SetEscapeId(wxID_CLOSE); this->Bind(wxEVT_BUTTON, &ConfigSnapshotDialog::onCloseDialog, this, wxID_CLOSE); vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 94cb52e0f8..7c9c696efa 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -423,6 +423,10 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt title_sizer->Add(sel_all, 0, wxRIGHT, BTN_SPACING); title_sizer->Add(sel_none); + wxGetApp().SetWindowVariantForButton(sel_all_std); + wxGetApp().SetWindowVariantForButton(sel_all); + wxGetApp().SetWindowVariantForButton(sel_none); + wxGetApp().UpdateDarkUI(sel_all_std); wxGetApp().UpdateDarkUI(sel_all); wxGetApp().UpdateDarkUI(sel_none); @@ -748,6 +752,9 @@ PageMaterials::PageMaterials(ConfigWizard *parent, Materials *materials, wxStrin wxGetApp().UpdateDarkUI(sel_all); wxGetApp().UpdateDarkUI(sel_none); + wxGetApp().SetWindowVariantForButton(sel_all); + wxGetApp().SetWindowVariantForButton(sel_none); + grid->Add(new wxBoxSizer(wxHORIZONTAL)); grid->Add(new wxBoxSizer(wxHORIZONTAL)); grid->Add(new wxBoxSizer(wxHORIZONTAL)); @@ -861,10 +868,8 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector" "" "" - "" "%s

%s" "
" - "
" "" "" , bgr_clr_str @@ -886,7 +891,6 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector" "" "" - "" "%s

%s" "" "" @@ -907,15 +911,13 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector" "
" "
" - "
" "" "" ); } } - - wxFont font = get_default_font_for_dpi(this, get_dpi_for_window(this)); + wxFont font = wxGetApp().normal_font();// get_default_font_for_dpi(this, get_dpi_for_window(this)); const int fs = font.GetPointSize(); int size[] = { fs,fs,fs,fs,fs,fs,fs }; html_window->SetFonts(font.GetFaceName(), font.GetFaceName(), size); @@ -1421,6 +1423,7 @@ Worker::Worker(wxWindow* parent) this->Add(m_input_path, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); auto* button_path = new wxButton(m_parent, wxID_ANY, _L("Browse")); + wxGetApp().SetWindowVariantForButton(button_path); this->Add(button_path, 0, wxEXPAND | wxTOP | wxLEFT, 5); button_path->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { boost::filesystem::path chosen_dest(boost::nowide::narrow(m_input_path->GetValue())); @@ -3351,6 +3354,12 @@ ConfigWizard::ConfigWizard(wxWindow *parent) wxGetApp().UpdateDarkUI(p->btn_finish); wxGetApp().UpdateDarkUI(p->btn_cancel); + wxGetApp().SetWindowVariantForButton(p->btn_sel_all); + wxGetApp().SetWindowVariantForButton(p->btn_prev); + wxGetApp().SetWindowVariantForButton(p->btn_next); + wxGetApp().SetWindowVariantForButton(p->btn_finish); + wxGetApp().SetWindowVariantForButton(p->btn_cancel); + const auto prusa_it = p->bundles.find("PrusaResearch"); wxCHECK_RET(prusa_it != p->bundles.cend(), "Vendor PrusaResearch not found"); const VendorProfile *vendor_prusa = prusa_it->second.vendor_profile; diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index fa035abf66..9d6dc2c979 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -817,11 +817,13 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) : p->hex_picker = new wxFilePickerCtrl(panel, wxID_ANY, wxEmptyString, /*wxFileSelectorPromptStr*/_L("Select a file"), "Hex files (*.hex)|*.hex|All files|*.*"); p->hex_picker->GetPickerCtrl()->SetLabelText(_(L("Browse"))); + GUI::wxGetApp().SetWindowVariantForButton(static_cast(p->hex_picker->GetPickerCtrl())); auto *label_port_picker = new wxStaticText(panel, wxID_ANY, _(L("Serial port:"))); p->port_picker = new wxComboBox(panel, wxID_ANY); p->txt_port_autodetect = new wxStaticText(panel, wxID_ANY, _(L("Autodetected"))); p->btn_rescan = new wxButton(panel, wxID_ANY, _(L("Rescan"))); + GUI::wxGetApp().SetWindowVariantForButton(p->btn_rescan); auto *port_sizer = new wxBoxSizer(wxHORIZONTAL); port_sizer->Add(p->port_picker, 1, wxEXPAND | wxRIGHT, SPACING); port_sizer->Add(p->btn_rescan, 0); @@ -864,7 +866,9 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) : vsizer->Add(p->spoiler, 1, wxEXPAND | wxBOTTOM, SPACING); p->btn_close = new wxButton(panel, wxID_CLOSE, _(L("Close"))); // Note: The label needs to be present, otherwise we get accelerator bugs on Mac + GUI::wxGetApp().SetWindowVariantForButton(p->btn_close); p->btn_flash = new wxButton(panel, wxID_ANY, p->btn_flash_label_ready); + GUI::wxGetApp().SetWindowVariantForButton(p->btn_flash); p->btn_flash->Disable(); auto *bsizer = new wxBoxSizer(wxHORIZONTAL); bsizer->Add(p->btn_close); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 23d556fced..7c69131c80 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1649,6 +1649,19 @@ void GUI_App::UpdateAllStaticTextDarkUI(wxWindow* parent) #endif } +void GUI_App::SetWindowVariantForButton(wxButton* btn) +{ +#ifdef __APPLE__ + // This is a limit imposed by OSX. The way the native button widget is drawn only allows it to be stretched horizontally, + // and the vertical size is fixed. (see https://stackoverflow.com/questions/29083891/wxpython-button-size-being-ignored-on-osx) + // But standard height is possible to change using SetWindowVariant method (see https://docs.wxwidgets.org/3.0/window_8h.html#a879bccd2c987fedf06030a8abcbba8ac) + if (m_normal_font.GetPointSize() > 15) { + btn->SetWindowVariant(wxWINDOW_VARIANT_LARGE); + btn->SetFont(m_normal_font); + } +#endif +} + void GUI_App::init_fonts() { m_small_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index e9e7dc17c0..66c259b813 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -214,6 +214,7 @@ public: void UpdateDVCDarkUI(wxDataViewCtrl* dvc, bool highlited = false); // update color mode for panel including all static texts controls void UpdateAllStaticTextDarkUI(wxWindow* parent); + void SetWindowVariantForButton(wxButton* btn); void init_fonts(); void update_fonts(const MainFrame *main_frame = nullptr); void set_label_clr_modified(const wxColour& clr); diff --git a/src/slic3r/GUI/GalleryDialog.cpp b/src/slic3r/GUI/GalleryDialog.cpp index dd7ac911bf..2060769ead 100644 --- a/src/slic3r/GUI/GalleryDialog.cpp +++ b/src/slic3r/GUI/GalleryDialog.cpp @@ -98,10 +98,12 @@ GalleryDialog::GalleryDialog(wxWindow* parent) : #endif wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK | wxCLOSE); - m_ok_btn = static_cast(FindWindowById(wxID_OK, this)); + wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); + m_ok_btn = buttons->GetAffirmativeButton(); + wxGetApp().SetWindowVariantForButton(m_ok_btn); m_ok_btn->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(!m_selected_items.empty()); }); - static_cast(FindWindowById(wxID_CLOSE, this))->Bind(wxEVT_BUTTON, [this](wxCommandEvent&){ this->EndModal(wxID_CLOSE); }); + buttons->GetCancelButton()->Bind(wxEVT_BUTTON, [this](wxCommandEvent&){ this->EndModal(wxID_CLOSE); }); this->SetEscapeId(wxID_CLOSE); auto add_btn = [this, buttons]( size_t pos, int& ID, wxString title, wxString tooltip, void (GalleryDialog::* method)(wxEvent&), @@ -109,6 +111,7 @@ GalleryDialog::GalleryDialog(wxWindow* parent) : ID = NewControlId(); wxButton* btn = new wxButton(this, ID, title); btn->SetToolTip(tooltip); + wxGetApp().SetWindowVariantForButton(btn); btn->Bind(wxEVT_UPDATE_UI, [enable_fn](wxUpdateUIEvent& evt) { evt.Enable(enable_fn()); }); buttons->Insert(pos, btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, BORDER_W); this->Bind(wxEVT_BUTTON, method, this, ID); diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 49876674a7..e425016cd6 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -50,7 +50,8 @@ KBShortcutsDialog::KBShortcutsDialog() } wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK); - wxGetApp().UpdateDarkUI(static_cast(this->FindWindowById(wxID_OK, this))); + wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); + wxGetApp().UpdateDarkUI(buttons->GetAffirmativeButton()); this->SetEscapeId(wxID_OK); main_sizer->Add(buttons, 0, wxEXPAND | wxALL, 5); diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index b8c4151ad0..0b8d609b94 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -85,6 +85,7 @@ void MsgDialog::SetButtonLabel(wxWindowID btn_id, const wxString& label, bool se wxButton* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, const wxString& label/* = wxString()*/) { wxButton* btn = new wxButton(this, btn_id, label); + wxGetApp().SetWindowVariantForButton(btn); if (set_focus) { btn->SetFocus(); // For non-MSW platforms SetFocus is not enought to use it as default, when the dialog is closed by ENTER diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 12368e3484..a3971cd51c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -511,7 +511,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) : auto wiping_dialog_btn = [this](wxWindow* parent) { m_wiping_dialog_button = new wxButton(parent, wxID_ANY, _L("Purging volumes") + dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); - m_wiping_dialog_button->SetFont(wxGetApp().normal_font()); + wxGetApp().SetWindowVariantForButton(m_wiping_dialog_button); wxGetApp().UpdateDarkUI(m_wiping_dialog_button, true); auto sizer = new wxBoxSizer(wxHORIZONTAL); @@ -939,6 +939,7 @@ Sidebar::Sidebar(Plater *parent) #endif //__APPLE__ ScalableBitmap bmp = ScalableBitmap(this, icon_name, bmp_px_cnt); *btn = new ScalableButton(this, wxID_ANY, bmp, "", wxBU_EXACTFIT); + wxGetApp().SetWindowVariantForButton((*btn)); #ifdef _WIN32 (*btn)->Bind(wxEVT_ENTER_WINDOW, [tooltip, btn, this](wxMouseEvent& event) { @@ -970,6 +971,7 @@ Sidebar::Sidebar(Plater *parent) auto init_btn = [this](wxButton **btn, wxString label, const int button_height) { *btn = new wxButton(this, wxID_ANY, label, wxDefaultPosition, wxSize(-1, button_height), wxBU_EXACTFIT); + wxGetApp().SetWindowVariantForButton((*btn)); (*btn)->SetFont(wxGetApp().bold_font()); wxGetApp().UpdateDarkUI((*btn), true); }; @@ -979,7 +981,7 @@ Sidebar::Sidebar(Plater *parent) enable_buttons(false); - auto *btns_sizer = new wxBoxSizer(wxVERTICAL); + auto *btns_sizer = new wxBoxSizer(wxHORIZONTAL); auto* complect_btns_sizer = new wxBoxSizer(wxHORIZONTAL); complect_btns_sizer->Add(p->btn_export_gcode, 1, wxEXPAND); @@ -988,8 +990,8 @@ Sidebar::Sidebar(Plater *parent) // complect_btns_sizer->Add(p->btn_eject_device); - btns_sizer->Add(p->btn_reslice, 0, wxEXPAND | wxTOP, margin_5); - btns_sizer->Add(complect_btns_sizer, 0, wxEXPAND | wxTOP, margin_5); + btns_sizer->Add(p->btn_reslice, 1, wxEXPAND | wxTOP | wxBOTTOM, margin_5); + btns_sizer->Add(complect_btns_sizer, 1, wxEXPAND | wxTOP | wxBOTTOM, margin_5); auto *sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(p->scrolled, 1, wxEXPAND); @@ -5301,7 +5303,7 @@ void Sidebar::set_btn_label(const ActionButtonType btn_type, const wxString& lab // Plater / Public Plater::Plater(wxWindow *parent, MainFrame *main_frame) - : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size()) + : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxGetApp().get_min_size(parent)) , p(new priv(this, main_frame)) { // Initialization performed in the private c-tor diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 07322b849e..f63b5e8ca5 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -687,6 +687,8 @@ void PreferencesDialog::build() sizer->Add(tabs, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); + wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); + wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); this->Bind(wxEVT_BUTTON, &PreferencesDialog::accept, this, wxID_OK); this->Bind(wxEVT_BUTTON, &PreferencesDialog::revert, this, wxID_CANCEL); diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 603bfe9870..ff768d94e8 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -182,7 +182,9 @@ SysInfoDialog::SysInfoDialog() } wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK); + wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); m_btn_copy_to_clipboard = new wxButton(this, wxID_ANY, _L("Copy to Clipboard"), wxDefaultPosition, wxDefaultSize); + wxGetApp().SetWindowVariantForButton(m_btn_copy_to_clipboard); buttons->Insert(0, m_btn_copy_to_clipboard, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5); m_btn_copy_to_clipboard->Bind(wxEVT_BUTTON, &SysInfoDialog::onCopyToClipboard, this); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 46eaf3ed9d..24e5798356 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2249,6 +2249,7 @@ void TabFilament::build() create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) { auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+dots, wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); + wxGetApp().SetWindowVariantForButton(ramming_dialog_btn); wxGetApp().UpdateDarkUI(ramming_dialog_btn); ramming_dialog_btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); ramming_dialog_btn->SetSize(ramming_dialog_btn->GetBestSize()); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 6671b68d8a..51d77d7c9c 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -42,7 +42,10 @@ RammingDialog::RammingDialog(wxWindow* parent,const std::string& parameters) auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(m_panel_ramming, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5); - main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, 10); + auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); + Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); + Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); + main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP | wxBOTTOM, 10); SetSizer(main_sizer); main_sizer->SetSizeHints(this); @@ -181,6 +184,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c update_ui(this); auto widget_button = new wxButton(this,wxID_ANY,"-",wxPoint(0,0),wxDefaultSize); update_ui(widget_button); + Slic3r::GUI::wxGetApp().SetWindowVariantForButton(widget_button); m_panel_wiping = new WipingPanel(this,matrix,extruders, extruder_colours, widget_button); auto main_sizer = new wxBoxSizer(wxVERTICAL); @@ -191,7 +195,10 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c main_sizer->Add(m_panel_wiping, 0, wxEXPAND | wxALL, 5); main_sizer->Add(widget_button, 0, wxALIGN_CENTER_HORIZONTAL | wxCENTER | wxBOTTOM, 5); - main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); + auto buttons = CreateStdDialogButtonSizer(wxOK | wxCANCEL); + Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetAffirmativeButton()); + Slic3r::GUI::wxGetApp().SetWindowVariantForButton(buttons->GetCancelButton()); + main_sizer->Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); SetSizer(main_sizer); main_sizer->SetSizeHints(this);