From 67c4967900fbd6079ad5b87023dcbe40e44e9aa6 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 15:03:28 +0300 Subject: [PATCH 01/16] Add button styling --- src/slic3r/GUI/Tab.cpp | 13 +++++++++---- src/slic3r/GUI/Widgets/Button.cpp | 17 +++++++++++++++++ src/slic3r/GUI/Widgets/Button.hpp | 2 ++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 78162dfb6de..9773fcd9706 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3504,10 +3504,15 @@ void TabFilament::build() optgroup->append_single_option_line("filament_stamping_loading_speed"); optgroup->append_single_option_line("filament_stamping_distance"); 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().UpdateDarkUI(ramming_dialog_btn); - ramming_dialog_btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); - ramming_dialog_btn->SetSize(ramming_dialog_btn->GetBestSize()); + // auto ramming_dialog_btn = new wxButton(parent, wxID_ANY, _(L("Ramming settings"))+dots, wxDefaultPosition, wxDefaultSize, + // wxBU_EXACTFIT); wxGetApp().UpdateDarkUI(ramming_dialog_btn); + // ramming_dialog_btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + // ramming_dialog_btn->SetSize(ramming_dialog_btn->GetBestSize()); + + Button* ramming_dialog_btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style + ramming_dialog_btn->SetStyleDefault(Label::Body_14); // ORCA: Match Button Style + ramming_dialog_btn->SetSize(wxSize(FromDIP(120), FromDIP(26))); + auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(ramming_dialog_btn); diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 8ebddd95b66..239b03befd5 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -148,6 +148,23 @@ void Button::SetCenter(bool isCenter) this->isCenter = isCenter; } +// ORCA: Use style management for easier styling with less code repeats +void Button::SetStyleDefault(const wxFont& font /* Label::Body_14 */) +{ + this->SetFont(font); + this->SetCornerRadius(this->FromDIP(4)); + StateColor clr_bg = StateColor(std::pair(wxColour("#DFDFDF"), StateColor::Disabled), + std::pair(wxColour("#DFDFDF"), StateColor::Pressed), + std::pair(wxColour("#D4D4D4"), StateColor::Hovered), + std::pair(wxColour("#DFDFDF"), StateColor::Normal), + std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); + this->SetBackgroundColor(clr_bg); + this->SetBorderColor(clr_bg); + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + std::pair(wxColour("#262E30"), StateColor::Normal)); + this->Button::SetTextColor(clr_fg); +} + void Button::Rescale() { if (this->active_icon.bmp().IsOk()) diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index d3496c0e49e..309050b6af0 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -40,6 +40,8 @@ class Button : public StaticBox void SetMinSize(const wxSize& size) override; void SetPaddingSize(const wxSize& size); + + void SetStyleDefault(const wxFont& font); void SetTextColor(StateColor const &color); From 683132255050be6415952c7473158fdd223b833e Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 15:24:52 +0300 Subject: [PATCH 02/16] Fix dark mode compability --- src/slic3r/GUI/Widgets/StateColor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/slic3r/GUI/Widgets/StateColor.cpp b/src/slic3r/GUI/Widgets/StateColor.cpp index f2e1b07027d..bec8fe689eb 100644 --- a/src/slic3r/GUI/Widgets/StateColor.cpp +++ b/src/slic3r/GUI/Widgets/StateColor.cpp @@ -28,6 +28,8 @@ static std::map gDarkColors{ {"#DBDBDB", "#4A4A51"}, // rgb(219, 219, 219) Input/Combo Box Border Color {"#EDFAF2", "#283232"}, // rgb(229, 240, 238) Not Used anymore // Was used for BBS Combo / Dropdown focused background color {"#323A3C", "#E5E5E6"}, // rgb(50, 58, 60) Text color used on search list | + {"#DFDFDF", "#3E3E45"}, // rgb(223, 223, 223) Button default bg color + {"#D4D4D4", "#4D4D54"}, // rgb(212, 212, 212) Button hover bg color {"#6B6B6A", "#B3B3B5"}, // rgb(107, 107, 106) Button Dimmed text | Input box side text {"#303A3C", "#E5E5E5"}, // rgb(48, 58, 60) Object Table > Column header text color | StaticBox Border Color {"#FEFFFF", "#242428"}, // rgb(254, 255, 255) Side Tabbar bg | From 210a377a8d471340d40a5aa87a513093c56162f1 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 15:42:58 +0300 Subject: [PATCH 03/16] printable area button --- src/slic3r/GUI/Tab.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9773fcd9706..2536629f3a6 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -5918,10 +5918,14 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep // Return a callback to create a TabPrinter widget to edit bed shape wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent) { - ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer", " " + _(L("Set")) + " " + dots, - wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); - btn->SetFont(wxGetApp().normal_font()); - btn->SetSize(btn->GetBestSize()); + // ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer", " " + _(L("Set")) + " " + dots, + // wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); + // btn->SetFont(wxGetApp().normal_font()); + // btn->SetSize(btn->GetBestSize()); + + Button* btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style + btn->SetStyleDefault(Label::Body_14); // ORCA: Match Button Style + btn->SetSize(wxSize(FromDIP(120), FromDIP(26))); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL); From 2a5c3053e7f553c197baec900846acbe8b8f7f69 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 15:59:49 +0300 Subject: [PATCH 04/16] Connection dialog icons --- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 25 +++++++++++++++--------- src/slic3r/GUI/PhysicalPrinterDialog.hpp | 14 ++++++------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 1ec7b537e31..27fd92144b3 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -136,9 +136,16 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->append_single_option_line("host_type"); - auto create_sizer_with_btn = [](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) { - *btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT); - (*btn)->SetFont(wxGetApp().normal_font()); + auto create_sizer_with_btn = [](wxWindow* parent, Button** btn, const std::string& icon_name, const wxString& label) { + //*btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT); + //(*btn)->SetFont(wxGetApp().normal_font()); + + // ORCA: Match Button Style + *btn = new Button(parent, label, icon_name, 0, parent->FromDIP(16)); + (*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); + //(*btn)->SetContentAlignment("L"); + (*btn)->SetStyleDefault(Label::Body_14); + (*btn)->SetPaddingSize(wxSize(5, 5)); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(*btn); @@ -236,8 +243,8 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr auto print_host_printers = [this, create_sizer_with_btn](wxWindow* parent) { //add_scaled_button(parent, &m_printhost_port_browse_btn, "browse", _(L("Refresh Printers")), wxBU_LEFT | wxBU_EXACTFIT); auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, "monitor_signal_strong", _(L("Refresh Printers"))); - ScalableButton* btn = m_printhost_port_browse_btn; - btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + Button* btn = m_printhost_port_browse_btn; // ORCA + //btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); }); return sizer; }; @@ -712,11 +719,11 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect) { const int& em = em_unit(); - m_printhost_browse_btn->msw_rescale(); - m_printhost_test_btn->msw_rescale(); - m_printhost_logout_btn->msw_rescale(); + m_printhost_browse_btn->Rescale(); //ORCA + m_printhost_test_btn->Rescale(); //ORCA + m_printhost_logout_btn->Rescale(); //ORCA if (m_printhost_cafile_browse_btn) - m_printhost_cafile_browse_btn->msw_rescale(); + m_printhost_cafile_browse_btn->Rescale(); //ORCA m_optgroup->msw_rescale(); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.hpp b/src/slic3r/GUI/PhysicalPrinterDialog.hpp index b6faff82f96..d3bd9b5c761 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.hpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.hpp @@ -11,7 +11,7 @@ class wxTextCtrl; class wxStaticText; -class ScalableButton; +class Button; // ORCA replacing wxButtons class wxBoxSizer; namespace Slic3r { @@ -28,12 +28,12 @@ class PhysicalPrinterDialog : public DPIDialog DynamicPrintConfig* m_config { nullptr }; ConfigOptionsGroup* m_optgroup { nullptr }; - ScalableButton* m_printhost_browse_btn {nullptr}; - ScalableButton* m_printhost_test_btn {nullptr}; - ScalableButton* m_printhost_logout_btn {nullptr}; - ScalableButton* m_printhost_cafile_browse_btn {nullptr}; - ScalableButton* m_printhost_client_cert_browse_btn {nullptr}; - ScalableButton* m_printhost_port_browse_btn {nullptr}; + Button* m_printhost_browse_btn{nullptr}; + Button* m_printhost_test_btn{nullptr}; + Button* m_printhost_logout_btn{nullptr}; + Button* m_printhost_cafile_browse_btn{nullptr}; + Button* m_printhost_client_cert_browse_btn{nullptr}; + Button* m_printhost_port_browse_btn{nullptr}; RoundedRectangle* m_input_area {nullptr}; wxStaticText* m_valid_label {nullptr}; From c931fc3cb6a7b0f0110559f9d917f84552a70b32 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 16:09:56 +0300 Subject: [PATCH 05/16] Add aligment control --- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 2 +- src/slic3r/GUI/Widgets/Button.cpp | 6 ++++++ src/slic3r/GUI/Widgets/Button.hpp | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 27fd92144b3..c55d7dd4b0e 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -143,7 +143,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr // ORCA: Match Button Style *btn = new Button(parent, label, icon_name, 0, parent->FromDIP(16)); (*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); - //(*btn)->SetContentAlignment("L"); + (*btn)->SetContentAlignment("L"); (*btn)->SetStyleDefault(Label::Body_14); (*btn)->SetPaddingSize(wxSize(5, 5)); diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 239b03befd5..17e59fa069b 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -148,6 +148,12 @@ void Button::SetCenter(bool isCenter) this->isCenter = isCenter; } +// ORCA: add support for alignment +void Button::SetContentAlignment(const wxString& side /* "L" / "R" Center is default*/) +{ + alignment = (side == "L") ? 0 : (side == "R") ? 1 : 0; +} + // ORCA: Use style management for easier styling with less code repeats void Button::SetStyleDefault(const wxFont& font /* Label::Body_14 */) { diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index 309050b6af0..73d7b006d71 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -19,6 +19,8 @@ class Button : public StaticBox bool canFocus = true; bool isCenter = true; + int alignment = 1; + static const int buttonWidth = 200; static const int buttonHeight = 50; @@ -41,6 +43,8 @@ class Button : public StaticBox void SetPaddingSize(const wxSize& size); + void SetContentAlignment(const wxString& side); + void SetStyleDefault(const wxFont& font); void SetTextColor(StateColor const &color); From 39ff6cc3dcbd0626f89f2ddd1211de5875107623 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 16:21:59 +0300 Subject: [PATCH 06/16] Fix alignment --- src/slic3r/GUI/Widgets/Button.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 17e59fa069b..b7697f0fe1f 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -225,15 +225,26 @@ void Button::render(wxDC& dc) szContent.x -= d; } } - // move to center - wxRect rcContent = { {0, 0}, size }; - if (isCenter) { - wxSize offset = (size - szContent) / 2; - if (offset.x < 0) offset.x = 0; - rcContent.Deflate(offset.x, offset.y); - } - // start draw + + // ORCA Align content. Button content centered as default until use of SetContentAlignment("L") + wxRect rcContent = {{0, 0}, size}; + wxSize offset = (size - szContent) / 2; + if (offset.x < 0) + offset.x = 0; + rcContent.Deflate(offset.x, offset.y); + wxPoint pt = rcContent.GetLeftTop(); + + if (alignment == 0) { // to left + if (offset.x > 0) + pt.x = pt.x - offset.x + paddingSize.x; + } else if (alignment == 2) { // to right + if (offset.x > 0) + pt.x = pt.x + offset.x - paddingSize.x; + } + + // start draw + //wxPoint pt = rcContent.GetLeftTop(); if (icon.bmp().IsOk()) { pt.y += (rcContent.height - szIcon.y) / 2; dc.DrawBitmap(icon.bmp(), pt); From bc2a6cdd1e61e315f1f085e631268d8e6a65cb26 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 16:38:29 +0300 Subject: [PATCH 07/16] add new styles --- src/slic3r/GUI/Widgets/Button.cpp | 52 +++++++++++++++++++++++++++++++ src/slic3r/GUI/Widgets/Button.hpp | 5 ++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index b7697f0fe1f..d5bc2b2294f 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -171,6 +171,58 @@ void Button::SetStyleDefault(const wxFont& font /* Label::Body_14 */) this->Button::SetTextColor(clr_fg); } +// ORCA: Use style management +void Button::SetStyleConfirm(const wxFont& font /* Label::Body_14 */) +{ + this->SetFont(font); + this->SetCornerRadius(this->FromDIP(4)); + StateColor clr_bg = StateColor(std::pair(wxColour("#00897B"), StateColor::Disabled), + std::pair(wxColour("#00897B"), StateColor::Pressed), + std::pair(wxColour("#26A69A"), StateColor::Hovered), + std::pair(wxColour("#009688"), StateColor::Normal), + std::pair(wxColour("#009688"), StateColor::Enabled)); + this->SetBackgroundColor(clr_bg); + this->SetBorderColor(clr_bg); + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + std::pair(wxColour("#FEFEFE"), StateColor::Normal) // Always use with white text color + ); + this->Button::SetTextColor(clr_fg); +} + +// ORCA: Use style management +void Button::SetStyleAlert(const wxFont& font /* Label::Body_14 */) +{ + this->SetFont(font); + this->SetCornerRadius(this->FromDIP(4)); + StateColor clr_bg = StateColor(std::pair(wxColour("#DFDFDF"), StateColor::Disabled), + std::pair(wxColour("#DFDFDF"), StateColor::Pressed), + std::pair(wxColour("#D4D4D4"), StateColor::Hovered), + std::pair(wxColour("#DFDFDF"), StateColor::Normal), + std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); + this->SetBackgroundColor(clr_bg); + this->SetBorderColor(clr_bg); + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + std::pair(wxColour("#CD1F00"), StateColor::Normal)); + this->Button::SetTextColor(clr_fg); +} + +// ORCA: Use style management +void Button::SetStyleDisabled(const wxFont& font /* Label::Body_14 */) +{ + this->SetFont(font); + this->SetCornerRadius(this->FromDIP(4)); + StateColor clr_bg = StateColor(std::pair(wxColour("#DFDFDF"), StateColor::Disabled), + std::pair(wxColour("#DFDFDF"), StateColor::Pressed), + std::pair(wxColour("#DFDFDF"), StateColor::Hovered), + std::pair(wxColour("#DFDFDF"), StateColor::Normal), + std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); + this->SetBackgroundColor(clr_bg); + this->SetBorderColor(clr_bg); + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + std::pair(wxColour("#6B6B6A"), StateColor::Normal)); + this->Button::SetTextColor(clr_fg); +} + void Button::Rescale() { if (this->active_icon.bmp().IsOk()) diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index 73d7b006d71..44f272fa286 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -46,7 +46,10 @@ class Button : public StaticBox void SetContentAlignment(const wxString& side); void SetStyleDefault(const wxFont& font); - + void SetStyleConfirm(const wxFont& font); + void SetStyleDisabled(const wxFont& font); + void SetStyleAlert(const wxFont& font); + void SetTextColor(StateColor const &color); void SetTextColorNormal(wxColor const &color); From d8c81aaa185f92578e83030bda05512394376424 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 16:51:22 +0300 Subject: [PATCH 08/16] Update BedShapeDialog.cpp --- src/slic3r/GUI/BedShapeDialog.cpp | 33 +++++++------------------------ 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 2d229a3e398..9f463b2fad5 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -204,6 +204,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std: line.full_width = 1; line.widget = [this](wxWindow* parent) { Button* shape_btn = new Button(parent, _L("Load shape from STL...")); + shape_btn->SetStyleDefault(Label::Body_14); wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL); shape_sizer->Add(shape_btn, 1, wxEXPAND); @@ -285,16 +286,8 @@ wxPanel* BedShapePanel::init_texture_panel() line.full_width = 1; line.widget = [this](wxWindow* parent) { - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(206, 206, 206), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - - StateColor btn_bd_white(std::pair(*wxWHITE, StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - Button* load_btn = new Button(parent, _L("Load...")); - load_btn->SetBackgroundColor(btn_bg_white); - load_btn->SetBorderColor(btn_bd_white); - load_btn->SetBackgroundColour(*wxWHITE); + load_btn->SetStyleDefault(Label::Body_14); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -304,9 +297,7 @@ wxPanel* BedShapePanel::init_texture_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); - remove_btn->SetBackgroundColor(btn_bg_white); - remove_btn->SetBorderColor(btn_bd_white); - remove_btn->SetBackgroundColour(*wxWHITE); + remove_btn->SetStyleDefault(Label::Body_14); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); @@ -374,28 +365,18 @@ wxPanel* BedShapePanel::init_model_panel() Line line{ "", "" }; line.full_width = 1; line.widget = [this](wxWindow* parent) { - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(206, 206, 206), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - - StateColor btn_bd_white(std::pair(*wxWHITE, StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - Button* load_btn = new Button(parent, _L("Load...")); - load_btn->SetBackgroundColor(btn_bg_white); - load_btn->SetBorderColor(btn_bd_white); - load_btn->SetBackgroundColour(*wxWHITE); + load_btn->SetStyleDefault(Label::Body_14); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); - wxStaticText* filename_lbl = new wxStaticText(parent, wxID_ANY, _(NONE)); - wxSizer* filename_sizer = new wxBoxSizer(wxHORIZONTAL); + wxStaticText* filename_lbl = new wxStaticText(parent, wxID_ANY, _(NONE)); + wxSizer* filename_sizer = new wxBoxSizer(wxHORIZONTAL); filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); - remove_btn->SetBackgroundColor(btn_bg_white); - remove_btn->SetBorderColor(btn_bd_white); - remove_btn->SetBackgroundColour(*wxWHITE); + remove_btn->SetStyleDefault(Label::Body_14); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); From 7a0c72f708972edbf857cee8e19876c6551e2035 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 25 Jan 2025 17:03:57 +0300 Subject: [PATCH 09/16] Use darker text color on dark mode --- src/slic3r/GUI/Widgets/Button.cpp | 10 +++++----- src/slic3r/GUI/Widgets/StateColor.cpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index d5bc2b2294f..610c6d6bd3c 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -166,7 +166,7 @@ void Button::SetStyleDefault(const wxFont& font /* Label::Body_14 */) std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); this->SetBackgroundColor(clr_bg); this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), std::pair(wxColour("#262E30"), StateColor::Normal)); this->Button::SetTextColor(clr_fg); } @@ -183,7 +183,7 @@ void Button::SetStyleConfirm(const wxFont& font /* Label::Body_14 */) std::pair(wxColour("#009688"), StateColor::Enabled)); this->SetBackgroundColor(clr_bg); this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), std::pair(wxColour("#FEFEFE"), StateColor::Normal) // Always use with white text color ); this->Button::SetTextColor(clr_fg); @@ -201,7 +201,7 @@ void Button::SetStyleAlert(const wxFont& font /* Label::Body_14 */) std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); this->SetBackgroundColor(clr_bg); this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), std::pair(wxColour("#CD1F00"), StateColor::Normal)); this->Button::SetTextColor(clr_fg); } @@ -218,8 +218,8 @@ void Button::SetStyleDisabled(const wxFont& font /* Label::Body_14 */) std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); this->SetBackgroundColor(clr_bg); this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6B6A"), StateColor::Disabled), - std::pair(wxColour("#6B6B6A"), StateColor::Normal)); + StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), + std::pair(wxColour("#6B6A6A"), StateColor::Normal)); this->Button::SetTextColor(clr_fg); } diff --git a/src/slic3r/GUI/Widgets/StateColor.cpp b/src/slic3r/GUI/Widgets/StateColor.cpp index bec8fe689eb..f2fd24f605f 100644 --- a/src/slic3r/GUI/Widgets/StateColor.cpp +++ b/src/slic3r/GUI/Widgets/StateColor.cpp @@ -30,7 +30,8 @@ static std::map gDarkColors{ {"#323A3C", "#E5E5E6"}, // rgb(50, 58, 60) Text color used on search list | {"#DFDFDF", "#3E3E45"}, // rgb(223, 223, 223) Button default bg color {"#D4D4D4", "#4D4D54"}, // rgb(212, 212, 212) Button hover bg color - {"#6B6B6A", "#B3B3B5"}, // rgb(107, 107, 106) Button Dimmed text | Input box side text + {"#6B6A6A", "#909090"}, // rgb(107, 107, 106) Button Dimmed text + {"#6B6B6A", "#B3B3B5"}, // rgb(107, 107, 106) Input box side text {"#303A3C", "#E5E5E5"}, // rgb(48, 58, 60) Object Table > Column header text color | StaticBox Border Color {"#FEFFFF", "#242428"}, // rgb(254, 255, 255) Side Tabbar bg | {"#A6A9AA", "#2D2D29"}, // rgb(166, 169, 170) Seperator color From a9e69fdd89cf7d9ad8070b7eeaf8221df0770e57 Mon Sep 17 00:00:00 2001 From: yw4z Date: Wed, 5 Feb 2025 07:55:13 +0300 Subject: [PATCH 10/16] update code --- src/slic3r/GUI/AboutDialog.cpp | 10 --- src/slic3r/GUI/BedShapeDialog.cpp | 5 -- src/slic3r/GUI/CreatePresetsDialog.cpp | 9 +-- src/slic3r/GUI/EditGCodeDialog.cpp | 53 +-------------- src/slic3r/GUI/MsgDialog.cpp | 71 ++------------------ src/slic3r/GUI/PhysicalPrinterDialog.cpp | 2 - src/slic3r/GUI/Preferences.cpp | 20 ------ src/slic3r/GUI/Tab.cpp | 12 ---- src/slic3r/GUI/Widgets/Button.cpp | 84 +++++++----------------- src/slic3r/GUI/Widgets/Button.hpp | 9 +-- 10 files changed, 34 insertions(+), 241 deletions(-) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 435cc62bb44..ebf64eb960e 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -355,16 +355,6 @@ AboutDialog::AboutDialog() } //Add "Portions copyright" button Button* button_portions = new Button(this,_L("Portions copyright")); - StateColor report_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), - std::pair(wxColour(255, 255, 255), StateColor::Normal)); - button_portions->SetBackgroundColor(report_bg); - StateColor report_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - button_portions->SetBorderColor(report_bd); - StateColor report_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - button_portions->SetTextColor(report_text); - button_portions->SetFont(Label::Body_12); - button_portions->SetCornerRadius(FromDIP(12)); button_portions->SetMinSize(wxSize(FromDIP(120), FromDIP(24))); wxBoxSizer *copyright_button_ver = new wxBoxSizer(wxVERTICAL); diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 9f463b2fad5..9d2328b1bc0 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -204,7 +204,6 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std: line.full_width = 1; line.widget = [this](wxWindow* parent) { Button* shape_btn = new Button(parent, _L("Load shape from STL...")); - shape_btn->SetStyleDefault(Label::Body_14); wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL); shape_sizer->Add(shape_btn, 1, wxEXPAND); @@ -287,7 +286,6 @@ wxPanel* BedShapePanel::init_texture_panel() line.widget = [this](wxWindow* parent) { Button* load_btn = new Button(parent, _L("Load...")); - load_btn->SetStyleDefault(Label::Body_14); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -297,7 +295,6 @@ wxPanel* BedShapePanel::init_texture_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); - remove_btn->SetStyleDefault(Label::Body_14); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); @@ -367,7 +364,6 @@ wxPanel* BedShapePanel::init_model_panel() line.widget = [this](wxWindow* parent) { Button* load_btn = new Button(parent, _L("Load...")); - load_btn->SetStyleDefault(Label::Body_14); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -376,7 +372,6 @@ wxPanel* BedShapePanel::init_model_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); - remove_btn->SetStyleDefault(Label::Body_14); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index b2ba9615069..3af4ff46ea8 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -967,17 +967,10 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - m_button_create = new Button(this, _L("Create")); - m_button_create->SetBackgroundColor(btn_bg_green); - m_button_create->SetBorderColor(*wxWHITE); - m_button_create->SetTextColor(wxColour(0xFFFFFE)); - m_button_create->SetFont(Label::Body_12); + m_button_create->SetStyle("Confirm",Label::Body_12); m_button_create->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_button_create->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetCornerRadius(FromDIP(12)); bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10)); m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index 3e8548decde..16020b228b6 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -420,11 +420,9 @@ void EditGCodeDialog::on_dpi_changed(const wxRect&suggested_rect) { if (button_item.first == wxOK) { button_item.second->SetMinSize(BTN_SIZE); - button_item.second->SetCornerRadius(FromDIP(12)); } if (button_item.first == wxCANCEL) { button_item.second->SetMinSize(BTN_SIZE); - button_item.second->SetCornerRadius(FromDIP(12)); } } @@ -446,56 +444,11 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); btn_sizer->AddStretchSpacer(); - StateColor ok_btn_bg( - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor ok_btn_bd( - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor ok_btn_text( - std::pair(wxColour(255, 255, 254), StateColor::Normal) - ); - - StateColor cancel_btn_bg( - std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(255, 255, 255), StateColor::Normal) - ); - - StateColor cancel_btn_bd_( - std::pair(wxColour(38, 46, 48), StateColor::Normal) - ); - - StateColor cancel_btn_text( - std::pair(wxColour(38, 46, 48), StateColor::Normal) - ); - - - StateColor calc_btn_bg( - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor calc_btn_bd( - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor calc_btn_text( - std::pair(wxColour(255, 255, 254), StateColor::Normal) - ); if (flags & wxOK) { Button* ok_btn = new Button(this, _L("OK")); + ok_btn->SetStyle("Confirm", Label::Body_14); ok_btn->SetMinSize(BTN_SIZE); - ok_btn->SetCornerRadius(FromDIP(12)); - ok_btn->SetBackgroundColor(ok_btn_bg); - ok_btn->SetBorderColor(ok_btn_bd); - ok_btn->SetTextColor(ok_btn_text); ok_btn->SetFocus(); ok_btn->SetId(wxID_OK); btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); @@ -504,10 +457,6 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) if (flags & wxCANCEL) { Button* cancel_btn = new Button(this, _L("Cancel")); cancel_btn->SetMinSize(BTN_SIZE); - cancel_btn->SetCornerRadius(FromDIP(12)); - cancel_btn->SetBackgroundColor(cancel_btn_bg); - cancel_btn->SetBorderColor(cancel_btn_bd_); - cancel_btn->SetTextColor(cancel_btn_text); cancel_btn->SetId(wxID_CANCEL); btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP / 2); m_button_list[wxCANCEL] = cancel_btn; diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 3d67c5c2e52..3e413f75863 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -153,46 +153,9 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con type = ButtonSizeLong; btn->SetMinSize(MSG_DIALOG_LONGER_BUTTON_SIZE); } - - btn->SetCornerRadius(FromDIP(12)); - StateColor btn_bg_green( - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor btn_bd_green( - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor btn_text_green( - std::pair(wxColour(255, 255, 254), StateColor::Normal) - ); - - StateColor btn_bg_white( - std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(255, 255, 255), StateColor::Normal) - ); - - StateColor btn_bd_white( - std::pair(wxColour(38, 46, 48), StateColor::Normal) - ); - - StateColor btn_text_white( - std::pair(wxColour(38, 46, 48), StateColor::Normal) - ); if (btn_id == wxID_OK || btn_id == wxID_YES) { - btn->SetBackgroundColor(btn_bg_green); - btn->SetBorderColor(btn_bd_green); - btn->SetTextColor(btn_text_green); - } - - if (btn_id == wxID_CANCEL || btn_id == wxID_NO) { - btn->SetBackgroundColor(btn_bg_white); - btn->SetBorderColor(btn_bd_white); - btn->SetTextColor(btn_text_white); + btn->SetStyle("Confirm",Label::Body_14); } if (set_focus) @@ -501,27 +464,17 @@ DeleteConfirmDialog::DeleteConfirmDialog(wxWindow *parent, const wxString &title wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); + m_cancel_btn = new Button(this, _L("Cancel")); - m_cancel_btn->SetBackgroundColor(btn_bg_white); - m_cancel_btn->SetBorderColor(*wxBLACK); - m_cancel_btn->SetTextColor(wxColour(*wxBLACK)); m_cancel_btn->SetFont(Label::Body_12); m_cancel_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_cancel_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_cancel_btn->SetCornerRadius(FromDIP(12)); bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); - m_del_btn = new Button(this, _L("Delete")); - m_del_btn->SetBackgroundColor(*wxRED); - m_del_btn->SetBorderColor(*wxWHITE); - m_del_btn->SetTextColor(wxColour(0xFFFFFE)); - m_del_btn->SetFont(Label::Body_12); + m_del_btn->SetStyle("Alert", Label::Body_12); m_del_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_del_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_del_btn->SetCornerRadius(FromDIP(12)); bSizer_button->Add(m_del_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_main_sizer->Add(bSizer_button, 0, wxEXPAND, 0); @@ -611,20 +564,13 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() { wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); horizontal_sizer->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); + bool file_version_newer = (*m_file_version) > (*m_cloud_version); if (!file_version_newer) { m_update_btn = new Button(this, _L("Update")); - m_update_btn->SetBackgroundColor(btn_bg_green); - m_update_btn->SetBorderColor(*wxWHITE); - m_update_btn->SetTextColor(wxColour(0xFFFFFE)); m_update_btn->SetFont(Label::Body_12); m_update_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_update_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_update_btn->SetCornerRadius(FromDIP(12)); horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(10)); m_update_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -641,18 +587,13 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() if (!file_version_newer) { m_later_btn = new Button(this, _L("Not for now")); - m_later_btn->SetBackgroundColor(btn_bg_white); - m_later_btn->SetBorderColor(wxColour(38, 46, 48)); + m_later_btn->SetFont(Label::Body_12); } else { m_later_btn = new Button(this, _L("OK")); - m_later_btn->SetBackgroundColor(btn_bg_green); - m_later_btn->SetBorderColor(*wxWHITE); - m_later_btn->SetTextColor(wxColour(0xFFFFFE)); + m_later_btn->SetStyle("Confirm", Label::Body_12); } - m_later_btn->SetFont(Label::Body_12); m_later_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); m_later_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_later_btn->SetCornerRadius(FromDIP(12)); horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(10)); m_later_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index c55d7dd4b0e..54079d6b8bf 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -143,8 +143,6 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr // ORCA: Match Button Style *btn = new Button(parent, label, icon_name, 0, parent->FromDIP(16)); (*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); - (*btn)->SetContentAlignment("L"); - (*btn)->SetStyleDefault(Label::Body_14); (*btn)->SetPaddingSize(wxSize(5, 5)); auto sizer = new wxBoxSizer(wxHORIZONTAL); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 125183a6755..82f5c36dee8 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -760,19 +760,9 @@ wxBoxSizer* PreferencesDialog::create_item_button( m_staticTextPath->SetToolTip(tooltip); auto m_button_download = new Button(parent, title2); - - StateColor abort_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), - std::pair(wxColour(255, 255, 255), StateColor::Normal)); - m_button_download->SetBackgroundColor(abort_bg); - StateColor abort_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_download->SetBorderColor(abort_bd); - StateColor abort_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_download->SetTextColor(abort_text); m_button_download->SetFont(Label::Body_10); m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(22))); m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(22))); - m_button_download->SetCornerRadius(FromDIP(12)); m_button_download->SetToolTip(tooltip2); m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); @@ -803,19 +793,9 @@ wxWindow* PreferencesDialog::create_item_downloads(wxWindow* parent, int padding m_staticTextPath->Wrap(-1); auto m_button_download = new Button(item_panel, _L("Browse")); - - StateColor abort_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), - std::pair(wxColour(255, 255, 255), StateColor::Normal)); - m_button_download->SetBackgroundColor(abort_bg); - StateColor abort_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_download->SetBorderColor(abort_bd); - StateColor abort_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_download->SetTextColor(abort_text); m_button_download->SetFont(Label::Body_10); m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(22))); m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(22))); - m_button_download->SetCornerRadius(FromDIP(12)); m_button_download->Bind(wxEVT_BUTTON, [this, m_staticTextPath, item_panel](auto& e) { wxString defaultPath = wxT("/"); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 2536629f3a6..13112ca210f 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3504,13 +3504,7 @@ void TabFilament::build() optgroup->append_single_option_line("filament_stamping_loading_speed"); optgroup->append_single_option_line("filament_stamping_distance"); 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().UpdateDarkUI(ramming_dialog_btn); - // ramming_dialog_btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); - // ramming_dialog_btn->SetSize(ramming_dialog_btn->GetBestSize()); - Button* ramming_dialog_btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style - ramming_dialog_btn->SetStyleDefault(Label::Body_14); // ORCA: Match Button Style ramming_dialog_btn->SetSize(wxSize(FromDIP(120), FromDIP(26))); auto sizer = new wxBoxSizer(wxHORIZONTAL); @@ -5918,13 +5912,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep // Return a callback to create a TabPrinter widget to edit bed shape wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent) { - // ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer", " " + _(L("Set")) + " " + dots, - // wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); - // btn->SetFont(wxGetApp().normal_font()); - // btn->SetSize(btn->GetBestSize()); - Button* btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style - btn->SetStyleDefault(Label::Body_14); // ORCA: Match Button Style btn->SetSize(wxSize(FromDIP(120), FromDIP(26))); auto sizer = new wxBoxSizer(wxHORIZONTAL); diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 610c6d6bd3c..86401e7711f 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -48,11 +48,13 @@ bool Button::Create(wxWindow* parent, wxString text, wxString icon, long style, state_handler.attach({&text_color}); state_handler.update_binds(); //BBS set default font - SetFont(Label::Body_14); + //SetFont(Label::Body_14); + this->SetStyle("Default",Label::Body_14); wxWindow::SetLabel(text); if (!icon.IsEmpty()) { //BBS set button icon default size to 20 this->active_icon = ScalableBitmap(this, icon.ToStdString(), iconSize > 0 ? iconSize : 20); + this->SetContentAlignment("L"); // ORCA set button alignment to left if button has icon } messureSize(); return true; @@ -154,72 +156,32 @@ void Button::SetContentAlignment(const wxString& side /* "L" / "R" Center is de alignment = (side == "L") ? 0 : (side == "R") ? 1 : 0; } -// ORCA: Use style management for easier styling with less code repeats -void Button::SetStyleDefault(const wxFont& font /* Label::Body_14 */) -{ - this->SetFont(font); - this->SetCornerRadius(this->FromDIP(4)); - StateColor clr_bg = StateColor(std::pair(wxColour("#DFDFDF"), StateColor::Disabled), - std::pair(wxColour("#DFDFDF"), StateColor::Pressed), - std::pair(wxColour("#D4D4D4"), StateColor::Hovered), - std::pair(wxColour("#DFDFDF"), StateColor::Normal), - std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); - this->SetBackgroundColor(clr_bg); - this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), - std::pair(wxColour("#262E30"), StateColor::Normal)); - this->Button::SetTextColor(clr_fg); -} +// Button Colors bg-Disabled bg-Pressed bg-Hovered bg-Normal bg-Enabled fg-Disabled fg-Normal +wxString btn_default[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#262E30"}; +wxString btn_confirm[7] = {"#00897B", "#00897B", "#26A69A", "#009688", "#009688", "#6B6A6A", "#FEFEFE"}; +wxString btn_alert[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#CD1F00"}; +wxString btn_disabled[7] = {"#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#6B6A6A"}; -// ORCA: Use style management -void Button::SetStyleConfirm(const wxFont& font /* Label::Body_14 */) +void Button::SetStyle(const wxString& style /* Default/Confirm/Alert/Disabled */, const wxFont& font /* Label::Body_14 */) { this->SetFont(font); this->SetCornerRadius(this->FromDIP(4)); - StateColor clr_bg = StateColor(std::pair(wxColour("#00897B"), StateColor::Disabled), - std::pair(wxColour("#00897B"), StateColor::Pressed), - std::pair(wxColour("#26A69A"), StateColor::Hovered), - std::pair(wxColour("#009688"), StateColor::Normal), - std::pair(wxColour("#009688"), StateColor::Enabled)); - this->SetBackgroundColor(clr_bg); - this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), - std::pair(wxColour("#FEFEFE"), StateColor::Normal) // Always use with white text color + auto clr_arr = style == "Default" ? btn_default : + style == "Confirm" ? btn_confirm : + style == "Alert" ? btn_alert : + style == "Disabled" ? btn_disabled : + btn_default; + StateColor clr_bg = StateColor( std::pair(wxColour(clr_arr[0]), StateColor::Disabled), + std::pair(wxColour(clr_arr[1]), StateColor::Pressed), + std::pair(wxColour(clr_arr[2]), StateColor::Hovered), + std::pair(wxColour(clr_arr[3]), StateColor::Normal), + std::pair(wxColour(clr_arr[4]), StateColor::Enabled) ); - this->Button::SetTextColor(clr_fg); -} - -// ORCA: Use style management -void Button::SetStyleAlert(const wxFont& font /* Label::Body_14 */) -{ - this->SetFont(font); - this->SetCornerRadius(this->FromDIP(4)); - StateColor clr_bg = StateColor(std::pair(wxColour("#DFDFDF"), StateColor::Disabled), - std::pair(wxColour("#DFDFDF"), StateColor::Pressed), - std::pair(wxColour("#D4D4D4"), StateColor::Hovered), - std::pair(wxColour("#DFDFDF"), StateColor::Normal), - std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); - this->SetBackgroundColor(clr_bg); - this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), - std::pair(wxColour("#CD1F00"), StateColor::Normal)); - this->Button::SetTextColor(clr_fg); -} - -// ORCA: Use style management -void Button::SetStyleDisabled(const wxFont& font /* Label::Body_14 */) -{ - this->SetFont(font); - this->SetCornerRadius(this->FromDIP(4)); - StateColor clr_bg = StateColor(std::pair(wxColour("#DFDFDF"), StateColor::Disabled), - std::pair(wxColour("#DFDFDF"), StateColor::Pressed), - std::pair(wxColour("#DFDFDF"), StateColor::Hovered), - std::pair(wxColour("#DFDFDF"), StateColor::Normal), - std::pair(wxColour("#DFDFDF"), StateColor::Enabled)); this->SetBackgroundColor(clr_bg); this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor(std::pair(wxColour("#6B6A6A"), StateColor::Disabled), - std::pair(wxColour("#6B6A6A"), StateColor::Normal)); + StateColor clr_fg = StateColor( std::pair(wxColour(clr_arr[5]), StateColor::Disabled), + std::pair(wxColour(clr_arr[6]), StateColor::Normal) + ); this->Button::SetTextColor(clr_fg); } @@ -278,7 +240,7 @@ void Button::render(wxDC& dc) } } - // ORCA Align content. Button content centered as default until use of SetContentAlignment("L") + // ORCA Align content. Button content centered as default until use of SetContentAlignment("L") wxRect rcContent = {{0, 0}, size}; wxSize offset = (size - szContent) / 2; if (offset.x < 0) diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index 44f272fa286..b9e7e46a88a 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -19,7 +19,7 @@ class Button : public StaticBox bool canFocus = true; bool isCenter = true; - int alignment = 1; + int alignment = 1; static const int buttonWidth = 200; static const int buttonHeight = 50; @@ -43,12 +43,9 @@ class Button : public StaticBox void SetPaddingSize(const wxSize& size); - void SetContentAlignment(const wxString& side); + void SetContentAlignment(const wxString& side); - void SetStyleDefault(const wxFont& font); - void SetStyleConfirm(const wxFont& font); - void SetStyleDisabled(const wxFont& font); - void SetStyleAlert(const wxFont& font); + void SetStyle(const wxString& style, const wxFont& font); void SetTextColor(StateColor const &color); From c45f1e89765e95a4e13020161ac1c56543a361e4 Mon Sep 17 00:00:00 2001 From: yw4z Date: Wed, 5 Feb 2025 12:25:36 +0300 Subject: [PATCH 11/16] Update --- src/slic3r/GUI/AboutDialog.cpp | 2 +- src/slic3r/GUI/BedShapeDialog.cpp | 14 +- src/slic3r/GUI/CreatePresetsDialog.cpp | 170 +++++------------------ src/slic3r/GUI/EditGCodeDialog.cpp | 9 +- src/slic3r/GUI/MsgDialog.cpp | 32 ++--- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 11 +- src/slic3r/GUI/Preferences.cpp | 13 +- src/slic3r/GUI/Tab.cpp | 11 +- src/slic3r/GUI/Tab.hpp | 2 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 32 ++--- src/slic3r/GUI/Widgets/Button.cpp | 19 ++- src/slic3r/GUI/Widgets/Button.hpp | 4 +- 12 files changed, 91 insertions(+), 228 deletions(-) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index badd299e9f9..7afed7e73e3 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -355,7 +355,7 @@ AboutDialog::AboutDialog() } //Add "Portions copyright" button Button* button_portions = new Button(this,_L("Portions copyright")); - button_portions->SetMinSize(wxSize(FromDIP(120), FromDIP(24))); + button_portions->SetStyle("Regular", Label::Body_14, "Wide"); wxBoxSizer *copyright_button_ver = new wxBoxSizer(wxVERTICAL); copyright_button_ver->Add( 0, 0, 0, wxTOP, FromDIP(10)); diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 9d2328b1bc0..c29c09f5590 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -204,6 +204,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std: line.full_width = 1; line.widget = [this](wxWindow* parent) { Button* shape_btn = new Button(parent, _L("Load shape from STL...")); + shape_btn->SetStyle("Regular", Label::Body_14); wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL); shape_sizer->Add(shape_btn, 1, wxEXPAND); @@ -286,20 +287,21 @@ wxPanel* BedShapePanel::init_texture_panel() line.widget = [this](wxWindow* parent) { Button* load_btn = new Button(parent, _L("Load...")); + load_btn->SetStyle("Regular", Label::Body_14); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); wxStaticText* filename_lbl = new wxStaticText(parent, wxID_ANY, _(NONE)); - wxSizer* filename_sizer = new wxBoxSizer(wxHORIZONTAL); filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); + remove_btn->SetStyle("Regular", Label::Body_14); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); - wxGetApp().UpdateDarkUI(load_btn); - wxGetApp().UpdateDarkUI(remove_btn); + wxGetApp().UpdateDarkUI(load_btn); // ???? required? + wxGetApp().UpdateDarkUI(remove_btn); // ???? required? wxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(filename_sizer, 1, wxEXPAND); @@ -364,6 +366,7 @@ wxPanel* BedShapePanel::init_model_panel() line.widget = [this](wxWindow* parent) { Button* load_btn = new Button(parent, _L("Load...")); + load_btn->SetStyle("Regular", Label::Body_14); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -372,11 +375,12 @@ wxPanel* BedShapePanel::init_model_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); + remove_btn->SetStyle("Regular", Label::Body_14); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); - wxGetApp().UpdateDarkUI(load_btn); - wxGetApp().UpdateDarkUI(remove_btn); + wxGetApp().UpdateDarkUI(load_btn); // ???? Required + wxGetApp().UpdateDarkUI(remove_btn); // ???? wxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(filename_sizer, 1, wxEXPAND); diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 3af4ff46ea8..15043d153f7 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -968,9 +968,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_button_create = new Button(this, _L("Create")); - m_button_create->SetStyle("Confirm",Label::Body_12); - m_button_create->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_create->SetStyle("Confirm", Label::Body_12, "Compact"); bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10)); m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -1131,16 +1129,8 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() EndModal(wxID_OK); }); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_button_cancel = new Button(this, _L("Cancel")); - m_button_cancel->SetBackgroundColor(btn_bg_white); - m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); - m_button_cancel->SetFont(Label::Body_12); - m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetCornerRadius(FromDIP(12)); + m_button_cancel->SetStyle("Regular", Label::Body_12, "Compact"); bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -1883,21 +1873,11 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent) wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL); - StateColor flush_bg_col(std::pair(wxColour(219, 253, 231), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(238, 238, 238), StateColor::Normal)); - - StateColor flush_bd_col(std::pair(wxColour(0, 150, 136), StateColor::Pressed), std::pair(wxColour(0, 150, 136), StateColor::Hovered), - std::pair(wxColour(172, 172, 172), StateColor::Normal)); - m_button_bed_stl = new Button(parent, _L("Load stl")); - m_button_bed_stl->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) { load_model_stl(); })); - m_button_bed_stl->SetFont(Label::Body_10); - - m_button_bed_stl->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); - m_button_bed_stl->SetFont(Label::Body_13); - m_button_bed_stl->SetCornerRadius(FromDIP(8)); - m_button_bed_stl->SetBackgroundColor(flush_bg_col); - m_button_bed_stl->SetBorderColor(flush_bd_col); + m_button_bed_stl->SetStyle("Regular", Label::Body_12); + m_button_bed_stl->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); // ???? + m_button_bed_stl->Bind(wxEVT_BUTTON, ([this](wxCommandEvent& e) { load_model_stl(); })); + hot_bed_stl_sizer->Add(m_button_bed_stl, 0, wxEXPAND | wxALL, 0); horizontal_sizer->Add(hot_bed_stl_sizer, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10)); @@ -1927,14 +1907,10 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent) std::pair(wxColour(172, 172, 172), StateColor::Normal)); m_button_bed_svg = new Button(parent, _L("Load svg")); + m_button_bed_svg->SetStyle("Regular", Label::Body_12); + m_button_bed_svg->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); m_button_bed_svg->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) { load_texture(); })); - m_button_bed_svg->SetFont(Label::Body_10); - m_button_bed_svg->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); - m_button_bed_svg->SetFont(Label::Body_13); - m_button_bed_svg->SetCornerRadius(FromDIP(8)); - m_button_bed_svg->SetBackgroundColor(flush_bg_col); - m_button_bed_svg->SetBorderColor(flush_bd_col); hot_bed_stl_sizer->Add(m_button_bed_svg, 0, wxEXPAND | wxALL, 0); horizontal_sizer->Add(hot_bed_stl_sizer, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10)); @@ -1970,17 +1946,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - m_button_OK = new Button(parent, _L("OK")); - m_button_OK->SetBackgroundColor(btn_bg_green); - m_button_OK->SetBorderColor(*wxWHITE); - m_button_OK->SetTextColor(wxColour(0xFFFFFE)); - m_button_OK->SetFont(Label::Body_12); - m_button_OK->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_OK->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_OK->SetCornerRadius(FromDIP(12)); + m_button_OK->SetStyle("Confirm", Label::Body_12, "Compact"); bSizer_button->Add(m_button_OK, 0, wxRIGHT, FromDIP(10)); m_button_OK->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -1989,16 +1956,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) show_page2(); }); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_button_page1_cancel = new Button(parent, _L("Cancel")); - m_button_page1_cancel->SetBackgroundColor(btn_bg_white); - m_button_page1_cancel->SetBorderColor(wxColour(38, 46, 48)); - m_button_page1_cancel->SetFont(Label::Body_12); - m_button_page1_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page1_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page1_cancel->SetCornerRadius(FromDIP(12)); + m_button_page1_cancel->SetStyle("Regular", Label::Body_12, "Compact"); bSizer_button->Add(m_button_page1_cancel, 0, wxRIGHT, FromDIP(10)); m_button_page1_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -3280,18 +3239,8 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con case FILAMENT: m_button_ok = sync_user_preset_need_enabled ? new Button(this, _L("Sync user presets")) : new Button(this, _L("OK")); break; } - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_button_ok->SetBackgroundColor(btn_bg_green); - m_button_ok->SetBorderColor(wxColour(*wxWHITE)); - m_button_ok->SetTextColor(wxColour(*wxWHITE)); - m_button_ok->SetFont(Label::Body_12); - m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetCornerRadius(FromDIP(12)); + m_button_ok->SetStyle("Confirm", Label::Body_12, "Compact"); btn_sizer->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); m_button_ok->Bind(wxEVT_LEFT_DOWN, [this, sync_user_preset_need_enabled](wxMouseEvent &e) { @@ -3304,13 +3253,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con if (PRINTER == create_success_type || sync_user_preset_need_enabled) { m_button_cancel = new Button(this, _L("Cancel")); - m_button_cancel->SetBackgroundColor(btn_bg_white); - m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); - m_button_cancel->SetTextColor(wxColour(38, 46, 48)); - m_button_cancel->SetFont(Label::Body_12); - m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetCornerRadius(FromDIP(12)); + m_button_cancel->SetStyle("Regular", Label::Body_12, "Compact"); btn_sizer->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); } @@ -3327,12 +3270,10 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con CreatePresetSuccessfulDialog::~CreatePresetSuccessfulDialog() {} void CreatePresetSuccessfulDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetCornerRadius(FromDIP(12)); - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetCornerRadius(FromDIP(12)); + m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale + m_button_ok->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale + m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale + m_button_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale Layout(); } @@ -4068,17 +4009,8 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - m_button_ok = new Button(this, _L("OK")); - m_button_ok->SetBackgroundColor(btn_bg_green); - m_button_ok->SetBorderColor(*wxWHITE); - m_button_ok->SetTextColor(wxColour(0xFFFFFE)); - m_button_ok->SetFont(Label::Body_12); - m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetCornerRadius(FromDIP(12)); + m_button_ok->SetStyle("Confirm", Label::Body_12, "Compact"); bSizer_button->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -4118,16 +4050,8 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) EndModal(wxID_OK); }); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_button_cancel = new Button(this, _L("Cancel")); - m_button_cancel->SetBackgroundColor(btn_bg_white); - m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); - m_button_cancel->SetFont(Label::Body_12); - m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetCornerRadius(FromDIP(12)); + m_button_cancel->SetStyle("Regular", Label::Body_12, "Compact"); bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -4567,7 +4491,7 @@ wxBoxSizer *EditFilamentPresetDialog::create_filament_basic_info() wxBoxSizer *EditFilamentPresetDialog::create_add_filament_btn() { wxBoxSizer *add_filament_btn_sizer = new wxBoxSizer(wxHORIZONTAL); - m_add_filament_btn = new Button(this, _L("+ Add Preset")); + m_add_filament_btn = new Button(this, _L("+ Add Preset")); // ???? m_add_filament_btn->SetFont(Label::Body_10); m_add_filament_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3))); m_add_filament_btn->SetCornerRadius(FromDIP(8)); @@ -4626,32 +4550,17 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer() wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); m_del_filament_btn = new Button(this, _L("Delete Filament")); - m_del_filament_btn->SetBackgroundColor(*wxRED); - m_del_filament_btn->SetBorderColor(*wxWHITE); - m_del_filament_btn->SetTextColor(wxColour(0xFFFFFE)); - m_del_filament_btn->SetFont(Label::Body_12); - m_del_filament_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_del_filament_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_del_filament_btn->SetCornerRadius(FromDIP(12)); + m_del_filament_btn->SetStyle("Alert", Label::Body_12, "Compact"); + bSizer_button->Add(m_del_filament_btn, 0, wxLEFT | wxBOTTOM, FromDIP(10)); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - m_ok_btn = new Button(this, _L("OK")); - m_ok_btn->SetBackgroundColor(btn_bg_green); - m_ok_btn->SetBorderColor(*wxWHITE); - m_ok_btn->SetTextColor(wxColour(0xFFFFFE)); - m_ok_btn->SetFont(Label::Body_12); - m_ok_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetCornerRadius(FromDIP(12)); + m_ok_btn->SetStyle("Confirm", Label::Body_12, "Compact"); + bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); m_del_filament_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) { WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted. \nIf you are using this filament on your printer, please reset the filament information for that slot."), _L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE); @@ -4736,12 +4645,12 @@ CreatePresetForPrinterDialog::CreatePresetForPrinterDialog(wxWindow *parent, std CreatePresetForPrinterDialog::~CreatePresetForPrinterDialog() {} void CreatePresetForPrinterDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetCornerRadius(FromDIP(12)); - m_cancel_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_cancel_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_cancel_btn->SetCornerRadius(FromDIP(12)); + m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize + m_ok_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize + m_ok_btn->SetCornerRadius(FromDIP(12)); // ???? resize + m_cancel_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize + m_cancel_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize + m_cancel_btn->SetCornerRadius(FromDIP(12)); // ???? resize Layout(); } @@ -4837,29 +4746,12 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - m_ok_btn = new Button(this, _L("OK")); - m_ok_btn->SetBackgroundColor(btn_bg_green); - m_ok_btn->SetBorderColor(*wxWHITE); - m_ok_btn->SetTextColor(wxColour(0xFFFFFE)); - m_ok_btn->SetFont(Label::Body_12); - m_ok_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetCornerRadius(FromDIP(12)); + m_ok_btn->SetStyle("Confirm", Label::Body_12, "Compact"); bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_cancel_btn = new Button(this, _L("Cancel")); - m_cancel_btn->SetBackgroundColor(btn_bg_white); - m_cancel_btn->SetBorderColor(wxColour(38, 46, 48)); - m_cancel_btn->SetFont(Label::Body_12); - m_cancel_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_cancel_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_cancel_btn->SetCornerRadius(FromDIP(12)); + m_cancel_btn->SetStyle("Regular", Label::Body_12, "Compact"); bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_ok_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index 16020b228b6..50bbf27d369 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -419,10 +419,10 @@ void EditGCodeDialog::on_dpi_changed(const wxRect&suggested_rect) for (auto button_item : m_button_list) { if (button_item.first == wxOK) { - button_item.second->SetMinSize(BTN_SIZE); + button_item.second->SetMinSize(BTN_SIZE); //????? rescale } if (button_item.first == wxCANCEL) { - button_item.second->SetMinSize(BTN_SIZE); + button_item.second->SetMinSize(BTN_SIZE); //????? rescale } } @@ -447,8 +447,7 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) if (flags & wxOK) { Button* ok_btn = new Button(this, _L("OK")); - ok_btn->SetStyle("Confirm", Label::Body_14); - ok_btn->SetMinSize(BTN_SIZE); + ok_btn->SetStyle("Confirm", Label::Body_14, "Compact"); ok_btn->SetFocus(); ok_btn->SetId(wxID_OK); btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); @@ -456,7 +455,7 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) } if (flags & wxCANCEL) { Button* cancel_btn = new Button(this, _L("Cancel")); - cancel_btn->SetMinSize(BTN_SIZE); + cancel_btn->SetStyle("Regular", Label::Body_14, "Compact"); cancel_btn->SetId(wxID_CANCEL); btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP / 2); m_button_list[wxCANCEL] = cancel_btn; diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 5b24ca4c07e..1a042b31a66 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -158,6 +158,10 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con btn->SetStyle("Confirm",Label::Body_14); } + if (btn_id == wxID_CANCEL || btn_id == wxID_NO) { + btn->SetStyle("Regular", Label::Body_14); + } + if (set_focus) btn->SetFocus(); btn_sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_SPACING); @@ -466,15 +470,11 @@ DeleteConfirmDialog::DeleteConfirmDialog(wxWindow *parent, const wxString &title bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_cancel_btn = new Button(this, _L("Cancel")); - m_cancel_btn->SetFont(Label::Body_12); - m_cancel_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_cancel_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_cancel_btn->SetStyle("Regular", Label::Body_12, "Compact"); bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_del_btn = new Button(this, _L("Delete")); - m_del_btn->SetStyle("Alert", Label::Body_12); - m_del_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_del_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_del_btn->SetStyle("Alert", Label::Body_12, "Compact"); bSizer_button->Add(m_del_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_main_sizer->Add(bSizer_button, 0, wxEXPAND, 0); @@ -568,9 +568,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() bool file_version_newer = (*m_file_version) > (*m_cloud_version); if (!file_version_newer) { m_update_btn = new Button(this, _L("Update")); - m_update_btn->SetFont(Label::Body_12); - m_update_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_update_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_update_btn->SetStyle("Regular", Label::Body_12, "Compact"); horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(10)); m_update_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -587,13 +585,11 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() if (!file_version_newer) { m_later_btn = new Button(this, _L("Not for now")); - m_later_btn->SetFont(Label::Body_12); + m_later_btn->SetStyle("Regular", Label::Body_12, "Compact"); } else { m_later_btn = new Button(this, _L("OK")); - m_later_btn->SetStyle("Confirm", Label::Body_12); + m_later_btn->SetStyle("Confirm", Label::Body_12, "Compact"); } - m_later_btn->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_later_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(10)); m_later_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); @@ -670,16 +666,8 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) e.Skip(); }); - auto bt_enable = StateColor(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); - m_button_confirm = new Button(this, _L("Confirm")); - m_button_confirm->SetBackgroundColor(bt_enable); - m_button_confirm->SetBorderColor(bt_enable); - m_button_confirm->SetTextColor(StateColor::darkModeColorFor("#FFFFFE")); - m_button_confirm->SetMinSize(wxSize(FromDIP(68), FromDIP(23))); - m_button_confirm->SetMinSize(wxSize(FromDIP(68), FromDIP(23))); - m_button_confirm->SetCornerRadius(12); + m_button_confirm->SetStyle("Confirm", Label::Body_12, "Compact"); m_button_confirm->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {EndModal(wxCLOSE);}); sizer_button->Add(checkbox, 0, wxALL, 5); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 54079d6b8bf..57e8121dd7a 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -137,13 +137,11 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->append_single_option_line("host_type"); auto create_sizer_with_btn = [](wxWindow* parent, Button** btn, const std::string& icon_name, const wxString& label) { - //*btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT); - //(*btn)->SetFont(wxGetApp().normal_font()); - - // ORCA: Match Button Style *btn = new Button(parent, label, icon_name, 0, parent->FromDIP(16)); - (*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); + (*btn)->SetStyle("Regular", Label::Body_14, "Wide"); + (*btn)->SetContentAlignment("L"); (*btn)->SetPaddingSize(wxSize(5, 5)); + //(*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); // ???? auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(*btn); @@ -239,10 +237,9 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr }; auto print_host_printers = [this, create_sizer_with_btn](wxWindow* parent) { - //add_scaled_button(parent, &m_printhost_port_browse_btn, "browse", _(L("Refresh Printers")), wxBU_LEFT | wxBU_EXACTFIT); auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, "monitor_signal_strong", _(L("Refresh Printers"))); Button* btn = m_printhost_port_browse_btn; // ORCA - //btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); + btn->SetStyle("Regular", Label::Body_14); btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); }); return sizer; }; diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 82f5c36dee8..f1eeed6b6c9 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -760,9 +760,7 @@ wxBoxSizer* PreferencesDialog::create_item_button( m_staticTextPath->SetToolTip(tooltip); auto m_button_download = new Button(parent, title2); - m_button_download->SetFont(Label::Body_10); - m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(22))); - m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(22))); + m_button_download->SetStyle("Regular", Label::Body_12, "Compact"); m_button_download->SetToolTip(tooltip2); m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); @@ -793,9 +791,7 @@ wxWindow* PreferencesDialog::create_item_downloads(wxWindow* parent, int padding m_staticTextPath->Wrap(-1); auto m_button_download = new Button(item_panel, _L("Browse")); - m_button_download->SetFont(Label::Body_10); - m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(22))); - m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(22))); + m_button_download->SetStyle("Regular", Label::Body_12, "Compact"); m_button_download->Bind(wxEVT_BUTTON, [this, m_staticTextPath, item_panel](auto& e) { wxString defaultPath = wxT("/"); @@ -1359,10 +1355,7 @@ wxWindow* PreferencesDialog::create_debug_page() StateColor btn_bd_white(std::pair(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); Button* debug_button = new Button(page, _L("debug save button")); - debug_button->SetBackgroundColor(btn_bg_white); - debug_button->SetBorderColor(btn_bd_white); - debug_button->SetFont(Label::Body_13); - + debug_button->SetStyle("Regular", Label::Body_12, "Compact"); debug_button->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { // success message box diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 645a7c663ad..bc99458eb6a 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3509,7 +3509,7 @@ void TabFilament::build() optgroup->append_single_option_line("filament_stamping_distance"); create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) { Button* ramming_dialog_btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style - ramming_dialog_btn->SetSize(wxSize(FromDIP(120), FromDIP(26))); + ramming_dialog_btn->SetStyle("Regular", Label::Body_14, "Wide"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(ramming_dialog_btn); @@ -5841,10 +5841,9 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All"))); deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font()); wxGetApp().UpdateDarkUI(deps.checkbox, false, true); - deps.btn = new ScalableButton(parent, wxID_ANY, "printer", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()), - wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); - deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); - deps.btn->SetSize(deps.btn->GetBestSize()); + + deps.btn = new Button(parent, _(L("Set")) + " " + dots); + deps.btn->SetStyle("Regular", Label::Body_14, "Wide"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL); @@ -5917,7 +5916,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent) { Button* btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style - btn->SetSize(wxSize(FromDIP(120), FromDIP(26))); + btn->SetStyle("Regular", Label::Body_14, "Wide"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index cab9990bb46..5f5081fe542 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -164,7 +164,7 @@ class Tab: public wxPanel struct PresetDependencies { Preset::Type type = Preset::TYPE_INVALID; wxCheckBox *checkbox = nullptr; - ScalableButton *btn = nullptr; + Button *btn = nullptr; std::string key_list; // "compatible_printers" std::string key_condition; wxString dialog_title; diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 85b718d0b8c..94da3c7d7f7 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -964,25 +964,18 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_ m_sizer_button->Add(0, 0, 1, 0, 0); // Add Buttons - wxFont btn_font = this->GetFont().Scaled(1.4f); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - - auto add_btn = [this, m_sizer_button, btn_font, dependent_presets, btn_bg_green](Button **btn, int &btn_id, const std::string &icon_name, Action close_act, const wxString &label, + auto add_btn = [this, m_sizer_button, dependent_presets](Button **btn, int &btn_id, const std::string &icon_name, Action close_act, const wxString &label, bool focus, bool process_enable = true) { *btn = new Button(this, _L(label)); - if (focus) { - (*btn)->SetBackgroundColor(btn_bg_green); - (*btn)->SetBorderColor(wxColour(0, 150, 136)); - (*btn)->SetTextColor(wxColour("#FFFFFE")); + if (focus) { // ???? + (*btn)->SetStyle("Confirm", Label::Body_14); } else { - (*btn)->SetTextColor(wxColour(107, 107, 107)); + (*btn)->SetStyle("Regular", Label::Body_14); } //(*btn)->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); - (*btn)->SetMinSize(wxSize(-1,-1)); - (*btn)->SetCornerRadius(FromDIP(12)); + (*btn)->SetMinSize(wxSize(-1,-1)); // ???? AutoFit? (*btn)->Bind(wxEVT_BUTTON, [this, close_act, dependent_presets](wxEvent &) { bool save_names_and_types = close_act == Action::Save || (close_act == Action::Transfer && ActionButtons::KEEP & m_buttons); @@ -1931,11 +1924,6 @@ std::array DiffPresetDialog::types_list() const void DiffPresetDialog::create_buttons() { - wxFont font = this->GetFont().Scaled(1.4f); - StateColor btn_bg_green(std::pair(wxColour(206, 206, 206), StateColor::Disabled), - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); m_buttons = new wxBoxSizer(wxHORIZONTAL); auto show_in_bottom_info = [this](const wxString& ext_line, wxEvent* e = nullptr) { @@ -1947,11 +1935,8 @@ void DiffPresetDialog::create_buttons() // Transfer m_transfer_btn = new Button(this, L("Transfer")); - m_transfer_btn->SetBackgroundColor(btn_bg_green); - m_transfer_btn->SetBorderColor(wxColour(0, 150, 136)); - m_transfer_btn->SetTextColor(wxColour("#FFFFFE")); + m_transfer_btn->SetStyle("Confirm", Label::Body_14); m_transfer_btn->SetMinSize(wxSize(-1, -1)); - m_transfer_btn->SetCornerRadius(FromDIP(12)); m_transfer_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Transfer);}); @@ -1987,16 +1972,15 @@ void DiffPresetDialog::create_buttons() // Cancel m_cancel_btn = new Button(this, L("Cancel")); - m_cancel_btn->SetTextColor(wxColour(107, 107, 107)); + m_cancel_btn->SetStyle("Regular", Label::Body_14); m_cancel_btn->SetMinSize(wxSize(-1, -1)); - m_cancel_btn->SetCornerRadius(FromDIP(12)); m_cancel_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Discard);}); for (Button* btn : { m_transfer_btn, m_cancel_btn }) { btn->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { update_bottom_info(); Layout(); e.Skip(); }); m_buttons->Add(btn, 1, wxLEFT, 5); - btn->SetFont(font); + btn->SetStyle("Regular", Label::Body_14); } m_buttons->Show(false); diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 86401e7711f..6989375138f 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -48,13 +48,11 @@ bool Button::Create(wxWindow* parent, wxString text, wxString icon, long style, state_handler.attach({&text_color}); state_handler.update_binds(); //BBS set default font - //SetFont(Label::Body_14); - this->SetStyle("Default",Label::Body_14); + SetFont(Label::Body_14); wxWindow::SetLabel(text); if (!icon.IsEmpty()) { //BBS set button icon default size to 20 this->active_icon = ScalableBitmap(this, icon.ToStdString(), iconSize > 0 ? iconSize : 20); - this->SetContentAlignment("L"); // ORCA set button alignment to left if button has icon } messureSize(); return true; @@ -157,20 +155,20 @@ void Button::SetContentAlignment(const wxString& side /* "L" / "R" Center is de } // Button Colors bg-Disabled bg-Pressed bg-Hovered bg-Normal bg-Enabled fg-Disabled fg-Normal -wxString btn_default[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#262E30"}; +wxString btn_regular[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#262E30"}; wxString btn_confirm[7] = {"#00897B", "#00897B", "#26A69A", "#009688", "#009688", "#6B6A6A", "#FEFEFE"}; wxString btn_alert[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#CD1F00"}; wxString btn_disabled[7] = {"#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#6B6A6A"}; -void Button::SetStyle(const wxString& style /* Default/Confirm/Alert/Disabled */, const wxFont& font /* Label::Body_14 */) +void Button::SetStyle( const wxString style, const wxFont font, const wxString& size) { this->SetFont(font); this->SetCornerRadius(this->FromDIP(4)); - auto clr_arr = style == "Default" ? btn_default : + auto clr_arr = style == "Regular" ? btn_regular : style == "Confirm" ? btn_confirm : style == "Alert" ? btn_alert : style == "Disabled" ? btn_disabled : - btn_default; + btn_regular; StateColor clr_bg = StateColor( std::pair(wxColour(clr_arr[0]), StateColor::Disabled), std::pair(wxColour(clr_arr[1]), StateColor::Pressed), std::pair(wxColour(clr_arr[2]), StateColor::Hovered), @@ -183,6 +181,13 @@ void Button::SetStyle(const wxString& style /* Default/Confirm/Alert/Disabled */ std::pair(wxColour(clr_arr[6]), StateColor::Normal) ); this->Button::SetTextColor(clr_fg); + + if (size == "Compact"){ + this->SetSize(wxSize(FromDIP(58), FromDIP(24))); + this->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + } else if (size == "Wide") { + this->SetSize(wxSize(FromDIP(120), FromDIP(26))); + } } void Button::Rescale() diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index b9e7e46a88a..0e0c2fc6918 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -45,7 +45,9 @@ class Button : public StaticBox void SetContentAlignment(const wxString& side); - void SetStyle(const wxString& style, const wxFont& font); + void SetStyle(const wxString style /* Regular/Confirm/Alert/Disabled */, + const wxFont font /* Label::Body_14 */, + const wxString& size = "" /* Compact/Wide */); void SetTextColor(StateColor const &color); From c5a3d9a6c76686b01a3705b80e9938199c2326fc Mon Sep 17 00:00:00 2001 From: yw4z Date: Fri, 7 Feb 2025 05:43:06 +0300 Subject: [PATCH 12/16] update --- src/slic3r/GUI/AboutDialog.cpp | 2 +- src/slic3r/GUI/BedShapeDialog.cpp | 31 ++++- src/slic3r/GUI/BedShapeDialog.hpp | 2 + src/slic3r/GUI/CreatePresetsDialog.cpp | 169 ++++++----------------- src/slic3r/GUI/EditGCodeDialog.cpp | 4 +- src/slic3r/GUI/MsgDialog.cpp | 16 +-- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 4 +- src/slic3r/GUI/Preferences.cpp | 6 +- src/slic3r/GUI/Tab.cpp | 6 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 20 +-- src/slic3r/GUI/Widgets/Button.cpp | 27 +++- src/slic3r/GUI/Widgets/Button.hpp | 6 +- 12 files changed, 122 insertions(+), 171 deletions(-) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 7afed7e73e3..1ad4091980a 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -355,7 +355,7 @@ AboutDialog::AboutDialog() } //Add "Portions copyright" button Button* button_portions = new Button(this,_L("Portions copyright")); - button_portions->SetStyle("Regular", Label::Body_14, "Wide"); + button_portions->SetStyle("Regular", "Window"); wxBoxSizer *copyright_button_ver = new wxBoxSizer(wxVERTICAL); copyright_button_ver->Add( 0, 0, 0, wxTOP, FromDIP(10)); diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index c29c09f5590..d17e5998ef8 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -140,7 +140,23 @@ 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); + + auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); + + Button* ok_btn = new Button(this, _L("OK")); + ok_btn->SetStyle("Confirm", "Choice"); + ok_btn->SetFocus(); + ok_btn->SetId(wxID_OK); + btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10)); + m_button_list[wxOK] = ok_btn; + + Button* cancel_btn = new Button(this, _L("Cancel")); + cancel_btn->SetStyle("Regular", "Choice"); + cancel_btn->SetId(wxID_CANCEL); + btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 0); + m_button_list[wxCANCEL] = cancel_btn; + + main_sizer->Add(btn_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); wxGetApp().UpdateDlgDarkUI(this); @@ -161,6 +177,9 @@ void BedShapeDialog::on_dpi_changed(const wxRect &suggested_rect) for (auto og : m_panel->m_optgroups) og->msw_rescale(); + m_button_list[wxOK] ->SetType("Dialog"); + m_button_list[wxCANCEL] ->SetType("Dialog"); + const wxSize& size = wxSize(50 * em, -1); SetMinSize(size); @@ -204,7 +223,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std: line.full_width = 1; line.widget = [this](wxWindow* parent) { Button* shape_btn = new Button(parent, _L("Load shape from STL...")); - shape_btn->SetStyle("Regular", Label::Body_14); + shape_btn->SetStyle("Regular"); wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL); shape_sizer->Add(shape_btn, 1, wxEXPAND); @@ -287,7 +306,7 @@ wxPanel* BedShapePanel::init_texture_panel() line.widget = [this](wxWindow* parent) { Button* load_btn = new Button(parent, _L("Load...")); - load_btn->SetStyle("Regular", Label::Body_14); + load_btn->SetStyle("Regular"); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -296,7 +315,7 @@ wxPanel* BedShapePanel::init_texture_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); - remove_btn->SetStyle("Regular", Label::Body_14); + remove_btn->SetStyle("Regular"); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); @@ -366,7 +385,7 @@ wxPanel* BedShapePanel::init_model_panel() line.widget = [this](wxWindow* parent) { Button* load_btn = new Button(parent, _L("Load...")); - load_btn->SetStyle("Regular", Label::Body_14); + load_btn->SetStyle("Regular"); wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL); load_sizer->Add(load_btn, 1, wxEXPAND); @@ -375,7 +394,7 @@ wxPanel* BedShapePanel::init_model_panel() filename_sizer->Add(filename_lbl, 1, wxEXPAND); Button* remove_btn = new Button(parent, _L("Remove")); - remove_btn->SetStyle("Regular", Label::Body_14); + remove_btn->SetStyle("Regular"); wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL); remove_sizer->Add(remove_btn, 1, wxEXPAND); diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp index 912faf6bfb9..63fd6fcea60 100644 --- a/src/slic3r/GUI/BedShapeDialog.hpp +++ b/src/slic3r/GUI/BedShapeDialog.hpp @@ -8,6 +8,7 @@ #include "I18N.hpp" #include +#include #include #include @@ -104,6 +105,7 @@ class BedShapeDialog : public DPIDialog protected: void on_dpi_changed(const wxRect &suggested_rect) override; + std::unordered_map m_button_list; // ??? solve that without list. use sizer items as list and check their types to prevent errors }; } // GUI diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 15043d153f7..b025dc7a21f 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -668,12 +668,8 @@ CreateFilamentPresetDialog::~CreateFilamentPresetDialog() void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_create->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetCornerRadius(FromDIP(12)); - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetCornerRadius(FromDIP(12)); + m_button_create->SetType("Choice"); + m_button_cancel->SetType("Choice"); Layout(); } @@ -968,7 +964,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_button_create = new Button(this, _L("Create")); - m_button_create->SetStyle("Confirm", Label::Body_12, "Compact"); + m_button_create->SetStyle("Confirm", "Choice"); bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10)); m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -1130,7 +1126,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() }); m_button_cancel = new Button(this, _L("Cancel")); - m_button_cancel->SetStyle("Regular", Label::Body_12, "Compact"); + m_button_cancel->SetStyle("Regular", "Choice"); bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -1516,21 +1512,11 @@ CreatePrinterPresetDialog::~CreatePrinterPresetDialog() } void CreatePrinterPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_OK->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_OK->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_OK->SetCornerRadius(FromDIP(12)); - m_button_create->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetCornerRadius(FromDIP(12)); - m_button_page1_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page1_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page1_cancel->SetCornerRadius(FromDIP(12)); - m_button_page2_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_cancel->SetCornerRadius(FromDIP(12)); - m_button_page2_back->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_back->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_back->SetCornerRadius(FromDIP(12)); + m_button_OK->SetType("Choice"); + m_button_create->SetType("Choice"); + m_button_page1_cancel->SetType("Choice"); + m_button_page2_cancel->SetType("Choice"); + m_button_page2_back->SetType("Choice"); Layout(); } @@ -1873,8 +1859,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent) wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL); - m_button_bed_stl = new Button(parent, _L("Load stl")); - m_button_bed_stl->SetStyle("Regular", Label::Body_12); + m_button_bed_stl = new Button(parent, _L("Load...")); + m_button_bed_stl->SetStyle("Regular"); m_button_bed_stl->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); // ???? m_button_bed_stl->Bind(wxEVT_BUTTON, ([this](wxCommandEvent& e) { load_model_stl(); })); @@ -1900,15 +1886,9 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent) wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL); - StateColor flush_bg_col(std::pair(wxColour(219, 253, 231), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(238, 238, 238), StateColor::Normal)); - - StateColor flush_bd_col(std::pair(wxColour(0, 150, 136), StateColor::Pressed), std::pair(wxColour(0, 150, 136), StateColor::Hovered), - std::pair(wxColour(172, 172, 172), StateColor::Normal)); - - m_button_bed_svg = new Button(parent, _L("Load svg")); - m_button_bed_svg->SetStyle("Regular", Label::Body_12); - m_button_bed_svg->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); + m_button_bed_svg = new Button(parent, _L("Load...")); + m_button_bed_svg->SetStyle("Regular"); + m_button_bed_svg->SetPaddingSize(wxSize(FromDIP(30), FromDIP(8))); //???? m_button_bed_svg->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) { load_texture(); })); hot_bed_stl_sizer->Add(m_button_bed_svg, 0, wxEXPAND | wxALL, 0); @@ -1947,7 +1927,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_button_OK = new Button(parent, _L("OK")); - m_button_OK->SetStyle("Confirm", Label::Body_12, "Compact"); + m_button_OK->SetStyle("Confirm", "Choice"); bSizer_button->Add(m_button_OK, 0, wxRIGHT, FromDIP(10)); m_button_OK->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -1957,7 +1937,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) }); m_button_page1_cancel = new Button(parent, _L("Cancel")); - m_button_page1_cancel->SetStyle("Regular", Label::Body_12, "Compact"); + m_button_page1_cancel->SetStyle("Regular", "Choice"); bSizer_button->Add(m_button_page1_cancel, 0, wxRIGHT, FromDIP(10)); m_button_page1_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -2510,31 +2490,14 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - - StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(*wxWHITE, StateColor::Normal)); - m_button_page2_back = new Button(parent, _L("Back Page 1")); - m_button_page2_back->SetBackgroundColor(btn_bg_white); - m_button_page2_back->SetBorderColor(wxColour(38, 46, 48)); - m_button_page2_back->SetFont(Label::Body_12); - m_button_page2_back->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_back->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_back->SetCornerRadius(FromDIP(12)); + m_button_page2_back->SetStyle("Regular", "Choice"); bSizer_button->Add(m_button_page2_back, 0, wxRIGHT, FromDIP(10)); m_button_page2_back->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { show_page1(); }); m_button_create = new Button(parent, _L("Create")); - m_button_create->SetBackgroundColor(btn_bg_green); - m_button_create->SetBorderColor(*wxWHITE); - m_button_create->SetTextColor(wxColour(0xFFFFFE)); - m_button_create->SetFont(Label::Body_12); - m_button_create->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_create->SetCornerRadius(FromDIP(12)); + m_button_create->SetStyle("Confirm", "Choice"); bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10)); m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -2783,12 +2746,8 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) }); m_button_page2_cancel = new Button(parent, _L("Cancel")); - m_button_page2_cancel->SetBackgroundColor(btn_bg_white); - m_button_page2_cancel->SetBorderColor(wxColour(38, 46, 48)); - m_button_page2_cancel->SetFont(Label::Body_12); - m_button_page2_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_page2_cancel->SetCornerRadius(FromDIP(12)); + m_button_page2_cancel->SetStyle("Regular", "Choice"); + bSizer_button->Add(m_button_page2_cancel, 0, wxRIGHT, FromDIP(10)); m_button_page2_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -3240,7 +3199,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con break; } - m_button_ok->SetStyle("Confirm", Label::Body_12, "Compact"); + m_button_ok->SetStyle("Confirm", "Choice"); btn_sizer->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); m_button_ok->Bind(wxEVT_LEFT_DOWN, [this, sync_user_preset_need_enabled](wxMouseEvent &e) { @@ -3253,7 +3212,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con if (PRINTER == create_success_type || sync_user_preset_need_enabled) { m_button_cancel = new Button(this, _L("Cancel")); - m_button_cancel->SetStyle("Regular", Label::Body_12, "Compact"); + m_button_cancel->SetStyle("Regular", "Choice"); btn_sizer->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); } @@ -3270,10 +3229,8 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con CreatePresetSuccessfulDialog::~CreatePresetSuccessfulDialog() {} void CreatePresetSuccessfulDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale - m_button_ok->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale - m_button_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? Rescale + m_button_ok->SetType("Choice"); + m_button_cancel->SetType("Choice"); Layout(); } @@ -3355,12 +3312,8 @@ ExportConfigsDialog::~ExportConfigsDialog() } void ExportConfigsDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_ok->SetCornerRadius(FromDIP(12)); - m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_button_cancel->SetCornerRadius(FromDIP(12)); + m_button_ok->SetType("Choice"); + m_button_cancel->SetType("Choice"); Layout(); } @@ -4010,7 +3963,7 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_button_ok = new Button(this, _L("OK")); - m_button_ok->SetStyle("Confirm", Label::Body_12, "Compact"); + m_button_ok->SetStyle("Confirm", "Choice"); bSizer_button->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -4051,7 +4004,7 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) }); m_button_cancel = new Button(this, _L("Cancel")); - m_button_cancel->SetStyle("Regular", Label::Body_12, "Compact"); + m_button_cancel->SetStyle("Regular", "Choice"); bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -4492,22 +4445,9 @@ wxBoxSizer *EditFilamentPresetDialog::create_add_filament_btn() { wxBoxSizer *add_filament_btn_sizer = new wxBoxSizer(wxHORIZONTAL); m_add_filament_btn = new Button(this, _L("+ Add Preset")); // ???? - m_add_filament_btn->SetFont(Label::Body_10); - m_add_filament_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3))); - m_add_filament_btn->SetCornerRadius(FromDIP(8)); - - StateColor flush_bg_col(std::pair(wxColour(219, 253, 231), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(238, 238, 238), StateColor::Normal)); + m_add_filament_btn->SetStyle("Regular", "Window"); + //m_add_filament_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3))); - StateColor flush_fg_col(std::pair(wxColour(107, 107, 106), StateColor::Pressed), std::pair(wxColour(107, 107, 106), StateColor::Hovered), - std::pair(wxColour(107, 107, 106), StateColor::Normal)); - - StateColor flush_bd_col(std::pair(wxColour(0, 150, 136), StateColor::Pressed), std::pair(wxColour(0, 150, 136), StateColor::Hovered), - std::pair(wxColour(172, 172, 172), StateColor::Normal)); - - m_add_filament_btn->SetBackgroundColor(flush_bg_col); - m_add_filament_btn->SetBorderColor(flush_bd_col); - m_add_filament_btn->SetTextColor(flush_fg_col); add_filament_btn_sizer->Add(m_add_filament_btn, 0, wxEXPAND | wxALL, FromDIP(10)); m_add_filament_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { @@ -4550,14 +4490,14 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer() wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); m_del_filament_btn = new Button(this, _L("Delete Filament")); - m_del_filament_btn->SetStyle("Alert", Label::Body_12, "Compact"); + m_del_filament_btn->SetStyle("Alert", "Window"); bSizer_button->Add(m_del_filament_btn, 0, wxLEFT | wxBOTTOM, FromDIP(10)); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_ok_btn = new Button(this, _L("OK")); - m_ok_btn->SetStyle("Confirm", Label::Body_12, "Compact"); + m_ok_btn->SetStyle("Confirm", "Choice"); bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); @@ -4645,12 +4585,8 @@ CreatePresetForPrinterDialog::CreatePresetForPrinterDialog(wxWindow *parent, std CreatePresetForPrinterDialog::~CreatePresetForPrinterDialog() {} void CreatePresetForPrinterDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize - m_ok_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize - m_ok_btn->SetCornerRadius(FromDIP(12)); // ???? resize - m_cancel_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize - m_cancel_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); // ???? resize - m_cancel_btn->SetCornerRadius(FromDIP(12)); // ???? resize + m_ok_btn->SetType("Choice"); //reapply size + m_cancel_btn->SetType("Choice"); // reapply size Layout(); } @@ -4747,11 +4683,11 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer() bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_ok_btn = new Button(this, _L("OK")); - m_ok_btn->SetStyle("Confirm", Label::Body_12, "Compact"); + m_ok_btn->SetStyle("Confirm", "Choice"); bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_cancel_btn = new Button(this, _L("Cancel")); - m_cancel_btn->SetStyle("Regular", Label::Body_12, "Compact"); + m_cancel_btn->SetStyle("Regular", "Choice"); bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_ok_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { @@ -4870,41 +4806,18 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr pre } sizer->Add(0, 0, 1, wxEXPAND, 0); - StateColor flush_bg_col(std::pair(wxColour(219, 253, 231), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(238, 238, 238), StateColor::Normal)); - - StateColor flush_fg_col(std::pair(wxColour(107, 107, 106), StateColor::Pressed), std::pair(wxColour(107, 107, 106), StateColor::Hovered), - std::pair(wxColour(107, 107, 106), StateColor::Normal)); - - StateColor flush_bd_col(std::pair(wxColour(0, 150, 136), StateColor::Pressed), std::pair(wxColour(0, 150, 136), StateColor::Hovered), - std::pair(wxColour(172, 172, 172), StateColor::Normal)); - - StateColor btn_bg_green(std::pair(wxColour(0, 137, 123), StateColor::Pressed), std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal)); - - Button *edit_preset_btn = new Button(panel, _L("Edit Preset")); - edit_preset_btn->SetFont(Label::Body_10); - edit_preset_btn->SetPaddingSize(wxSize(8, 3)); - edit_preset_btn->SetCornerRadius(8); - edit_preset_btn->SetBackgroundColor(flush_bg_col); - edit_preset_btn->SetBorderColor(flush_bd_col); - edit_preset_btn->SetTextColor(flush_fg_col); + Button *edit_preset_btn = new Button(panel, _L("Edit Preset")); + edit_preset_btn->SetStyle("Regular", "Compact"); // ???? Small Button //edit_preset_btn->Hide(); sizer->Add(edit_preset_btn, 0, wxALL | wxALIGN_CENTER_VERTICAL, 0); sizer->Add(0, 0, 0, wxLEFT, 5); Button *del_preset_btn = new Button(panel, _L("Delete Preset")); - del_preset_btn->SetFont(Label::Body_10); - del_preset_btn->SetPaddingSize(wxSize(8, 3)); - del_preset_btn->SetCornerRadius(8); + del_preset_btn->SetStyle("Regular", "Compact"); // ???? Small Button if (base_id_error) { - del_preset_btn->SetBackgroundColor(btn_bg_green); - del_preset_btn->SetBorderColor(btn_bg_green); - del_preset_btn->SetTextColor(wxColour(0xFFFFFE)); + del_preset_btn->SetStyle("Confirm", "Compact"); // ???? } else { - del_preset_btn->SetBackgroundColor(flush_bg_col); - del_preset_btn->SetBorderColor(flush_bd_col); - del_preset_btn->SetTextColor(flush_fg_col); + del_preset_btn->SetStyle("Regular", "Compact"); // ???? } //del_preset_btn->Hide(); diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index 50bbf27d369..cf008c7e9de 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -447,7 +447,7 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) if (flags & wxOK) { Button* ok_btn = new Button(this, _L("OK")); - ok_btn->SetStyle("Confirm", Label::Body_14, "Compact"); + ok_btn->SetStyle("Confirm", "Choice"); ok_btn->SetFocus(); ok_btn->SetId(wxID_OK); btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); @@ -455,7 +455,7 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) } if (flags & wxCANCEL) { Button* cancel_btn = new Button(this, _L("Cancel")); - cancel_btn->SetStyle("Regular", Label::Body_14, "Compact"); + cancel_btn->SetStyle("Regular", "Choice"); cancel_btn->SetId(wxID_CANCEL); btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP / 2); m_button_list[wxCANCEL] = cancel_btn; diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 1a042b31a66..25c064b512e 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -155,11 +155,11 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con } if (btn_id == wxID_OK || btn_id == wxID_YES) { - btn->SetStyle("Confirm",Label::Body_14); + btn->SetStyle("Confirm", "Choice"); } if (btn_id == wxID_CANCEL || btn_id == wxID_NO) { - btn->SetStyle("Regular", Label::Body_14); + btn->SetStyle("Regular", "Choice"); } if (set_focus) @@ -470,11 +470,11 @@ DeleteConfirmDialog::DeleteConfirmDialog(wxWindow *parent, const wxString &title bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_cancel_btn = new Button(this, _L("Cancel")); - m_cancel_btn->SetStyle("Regular", Label::Body_12, "Compact"); + m_cancel_btn->SetStyle("Regular", "Choice"); bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_del_btn = new Button(this, _L("Delete")); - m_del_btn->SetStyle("Alert", Label::Body_12, "Compact"); + m_del_btn->SetStyle("Alert", "Choice"); bSizer_button->Add(m_del_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); m_main_sizer->Add(bSizer_button, 0, wxEXPAND, 0); @@ -568,7 +568,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() bool file_version_newer = (*m_file_version) > (*m_cloud_version); if (!file_version_newer) { m_update_btn = new Button(this, _L("Update")); - m_update_btn->SetStyle("Regular", Label::Body_12, "Compact"); + m_update_btn->SetStyle("Regular", "Choice"); horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(10)); m_update_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -585,10 +585,10 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() if (!file_version_newer) { m_later_btn = new Button(this, _L("Not for now")); - m_later_btn->SetStyle("Regular", Label::Body_12, "Compact"); + m_later_btn->SetStyle("Regular", "Choice"); } else { m_later_btn = new Button(this, _L("OK")); - m_later_btn->SetStyle("Confirm", Label::Body_12, "Compact"); + m_later_btn->SetStyle("Confirm", "Choice"); } horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(10)); m_later_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -667,7 +667,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) }); m_button_confirm = new Button(this, _L("Confirm")); - m_button_confirm->SetStyle("Confirm", Label::Body_12, "Compact"); + m_button_confirm->SetStyle("Confirm", "Choice"); m_button_confirm->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {EndModal(wxCLOSE);}); sizer_button->Add(checkbox, 0, wxALL, 5); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 57e8121dd7a..9f8cb67103f 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -138,7 +138,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr auto create_sizer_with_btn = [](wxWindow* parent, Button** btn, const std::string& icon_name, const wxString& label) { *btn = new Button(parent, label, icon_name, 0, parent->FromDIP(16)); - (*btn)->SetStyle("Regular", Label::Body_14, "Wide"); + (*btn)->SetStyle("Regular", "Window"); (*btn)->SetContentAlignment("L"); (*btn)->SetPaddingSize(wxSize(5, 5)); //(*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); // ???? @@ -239,7 +239,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr auto print_host_printers = [this, create_sizer_with_btn](wxWindow* parent) { auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, "monitor_signal_strong", _(L("Refresh Printers"))); Button* btn = m_printhost_port_browse_btn; // ORCA - btn->SetStyle("Regular", Label::Body_14); + btn->SetStyle("Regular", "Window"); btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); }); return sizer; }; diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index f1eeed6b6c9..99f9e6a036c 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -760,7 +760,7 @@ wxBoxSizer* PreferencesDialog::create_item_button( m_staticTextPath->SetToolTip(tooltip); auto m_button_download = new Button(parent, title2); - m_button_download->SetStyle("Regular", Label::Body_12, "Compact"); + m_button_download->SetStyle("Regular", "Window"); m_button_download->SetToolTip(tooltip2); m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); @@ -791,7 +791,7 @@ wxWindow* PreferencesDialog::create_item_downloads(wxWindow* parent, int padding m_staticTextPath->Wrap(-1); auto m_button_download = new Button(item_panel, _L("Browse")); - m_button_download->SetStyle("Regular", Label::Body_12, "Compact"); + m_button_download->SetStyle("Regular", "Window"); m_button_download->Bind(wxEVT_BUTTON, [this, m_staticTextPath, item_panel](auto& e) { wxString defaultPath = wxT("/"); @@ -1355,7 +1355,7 @@ wxWindow* PreferencesDialog::create_debug_page() StateColor btn_bd_white(std::pair(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); Button* debug_button = new Button(page, _L("debug save button")); - debug_button->SetStyle("Regular", Label::Body_12, "Compact"); + debug_button->SetStyle("Regular", "Window"); debug_button->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { // success message box diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index bc99458eb6a..098c7ad52aa 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3509,7 +3509,7 @@ void TabFilament::build() optgroup->append_single_option_line("filament_stamping_distance"); create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) { Button* ramming_dialog_btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style - ramming_dialog_btn->SetStyle("Regular", Label::Body_14, "Wide"); + ramming_dialog_btn->SetStyle("Regular", "Parameter"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(ramming_dialog_btn); @@ -5843,7 +5843,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep wxGetApp().UpdateDarkUI(deps.checkbox, false, true); deps.btn = new Button(parent, _(L("Set")) + " " + dots); - deps.btn->SetStyle("Regular", Label::Body_14, "Wide"); + deps.btn->SetStyle("Regular", "Parameter"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL); @@ -5916,7 +5916,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent) { Button* btn = new Button(parent, _(L("Set")) + " " + dots); // Use regular button to match style - btn->SetStyle("Regular", Label::Body_14, "Wide"); + btn->SetStyle("Regular", "Parameter"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL); diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 94da3c7d7f7..c0950e9a501 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -969,13 +969,13 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_ *btn = new Button(this, _L(label)); if (focus) { // ???? - (*btn)->SetStyle("Confirm", Label::Body_14); + (*btn)->SetStyle("Confirm", "Choice"); } else { - (*btn)->SetStyle("Regular", Label::Body_14); + (*btn)->SetStyle("Regular", "Choice"); } //(*btn)->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); - (*btn)->SetMinSize(wxSize(-1,-1)); // ???? AutoFit? + //(*btn)->SetMinSize(wxSize(-1,-1)); // ???? AutoFit? (*btn)->Bind(wxEVT_BUTTON, [this, close_act, dependent_presets](wxEvent &) { bool save_names_and_types = close_act == Action::Save || (close_act == Action::Transfer && ActionButtons::KEEP & m_buttons); @@ -1703,7 +1703,8 @@ void UnsavedChangesDialog::on_dpi_changed(const wxRect& suggested_rect) msw_buttons_rescale(this, em, { wxID_CANCEL, m_move_btn_id, m_continue_btn_id }); for (auto btn : {m_transfer_btn, m_discard_btn, m_save_btn}) - if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); + if (btn) btn->SetType("Choice"); + //if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); //m_cancel_btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); const wxSize& size = wxSize(70 * em, 30 * em); @@ -1935,8 +1936,7 @@ void DiffPresetDialog::create_buttons() // Transfer m_transfer_btn = new Button(this, L("Transfer")); - m_transfer_btn->SetStyle("Confirm", Label::Body_14); - m_transfer_btn->SetMinSize(wxSize(-1, -1)); + m_transfer_btn->SetStyle("Confirm", "Choice"); m_transfer_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Transfer);}); @@ -1972,15 +1972,14 @@ void DiffPresetDialog::create_buttons() // Cancel m_cancel_btn = new Button(this, L("Cancel")); - m_cancel_btn->SetStyle("Regular", Label::Body_14); - m_cancel_btn->SetMinSize(wxSize(-1, -1)); + m_cancel_btn->SetStyle("Regular", "Choice"); m_cancel_btn->Bind(wxEVT_BUTTON, [this](wxEvent&) { button_event(Action::Discard);}); for (Button* btn : { m_transfer_btn, m_cancel_btn }) { btn->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { update_bottom_info(); Layout(); e.Skip(); }); m_buttons->Add(btn, 1, wxLEFT, 5); - btn->SetStyle("Regular", Label::Body_14); + btn->SetStyle("Regular", "Choice"); } m_buttons->Show(false); @@ -2264,7 +2263,8 @@ void DiffPresetDialog::on_dpi_changed(const wxRect&) msw_buttons_rescale(this, em, {wxID_CANCEL}); for (auto btn : {m_transfer_btn, m_cancel_btn}) - if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); + if (btn) btn->SetType("Choice"); + //if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); const wxSize& size = wxSize(80 * em, 30 * em); SetMinSize(size); diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index 6989375138f..a24ded5d411 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -160,10 +160,14 @@ wxString btn_confirm[7] = {"#00897B", "#00897B", "#26A69A", "#009688", "#009688 wxString btn_alert[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#CD1F00"}; wxString btn_disabled[7] = {"#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#6B6A6A"}; -void Button::SetStyle( const wxString style, const wxFont font, const wxString& size) +void Button::SetStyle(const wxString style /* Regular/Confirm/Alert/Disabled */, const wxString& type /* Choice/Window/Parameter/Compact */) { - this->SetFont(font); - this->SetCornerRadius(this->FromDIP(4)); + if (type == "Compact") { + this->SetFont(Label::Body_10); + } else { + this->SetFont(Label::Body_14); + } + auto clr_arr = style == "Regular" ? btn_regular : style == "Confirm" ? btn_confirm : style == "Alert" ? btn_alert : @@ -182,12 +186,25 @@ void Button::SetStyle( const wxString style, const wxFont font, const wxString& ); this->Button::SetTextColor(clr_fg); - if (size == "Compact"){ + this->Button::SetType(type); + +} + +void Button::SetType(const wxString type) +{ + if (type == "Choice" || type == "Window") { this->SetSize(wxSize(FromDIP(58), FromDIP(24))); this->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - } else if (size == "Wide") { + } else if (type == "Parameter") { this->SetSize(wxSize(FromDIP(120), FromDIP(26))); } + if (type == "Compact") { + this->SetCornerRadius(this->FromDIP(8)); + this->SetPaddingSize(wxSize(8, 3)); + } else { + this->SetCornerRadius(this->FromDIP(4)); + } + } void Button::Rescale() diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index 0e0c2fc6918..86c51d4db4d 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -45,9 +45,9 @@ class Button : public StaticBox void SetContentAlignment(const wxString& side); - void SetStyle(const wxString style /* Regular/Confirm/Alert/Disabled */, - const wxFont font /* Label::Body_14 */, - const wxString& size = "" /* Compact/Wide */); + void SetStyle(const wxString style /* Regular/Confirm/Alert/Disabled */, const wxString& type = "" /* Choice/Window/Parameter */); + + void SetType(const wxString size); void SetTextColor(StateColor const &color); From 4b1a726fd375749b8ea286fa1069adcdda409a69 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 8 Feb 2025 04:54:50 +0300 Subject: [PATCH 13/16] Update --- src/slic3r/GUI/BedShapeDialog.cpp | 4 +- src/slic3r/GUI/CreatePresetsDialog.cpp | 45 ++++++------ src/slic3r/GUI/EditGCodeDialog.cpp | 12 ++-- src/slic3r/GUI/MsgDialog.cpp | 21 +++--- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 39 +++++----- src/slic3r/GUI/PhysicalPrinterDialog.hpp | 3 +- src/slic3r/GUI/Plater.cpp | 27 +++---- src/slic3r/GUI/UnsavedChangesDialog.cpp | 4 +- src/slic3r/GUI/Widgets/Button.cpp | 91 +++++++++++------------- src/slic3r/GUI/Widgets/Button.hpp | 10 +-- 10 files changed, 116 insertions(+), 140 deletions(-) diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index d17e5998ef8..d0e2b1b6735 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -147,13 +147,13 @@ void BedShapeDialog::build_dialog(const ConfigOptionPoints& default_pt, const Co ok_btn->SetStyle("Confirm", "Choice"); ok_btn->SetFocus(); ok_btn->SetId(wxID_OK); - btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10)); + btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxOK] = ok_btn; Button* cancel_btn = new Button(this, _L("Cancel")); cancel_btn->SetStyle("Regular", "Choice"); cancel_btn->SetId(wxID_CANCEL); - btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 0); + btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxCANCEL] = cancel_btn; main_sizer->Add(btn_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index b025dc7a21f..472db1accd1 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -965,7 +965,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() m_button_create = new Button(this, _L("Create")); m_button_create->SetStyle("Confirm", "Choice"); - bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { //get vendor name @@ -1127,7 +1127,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); @@ -1928,7 +1928,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) m_button_OK = new Button(parent, _L("OK")); m_button_OK->SetStyle("Confirm", "Choice"); - bSizer_button->Add(m_button_OK, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_OK, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_OK->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { if (!validate_input_valid()) return; @@ -1938,7 +1938,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) m_button_page1_cancel = new Button(parent, _L("Cancel")); m_button_page1_cancel->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_button_page1_cancel, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_page1_cancel, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_page1_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -2492,13 +2492,13 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) m_button_page2_back = new Button(parent, _L("Back Page 1")); m_button_page2_back->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_button_page2_back, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_page2_back, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_page2_back->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { show_page1(); }); m_button_create = new Button(parent, _L("Create")); m_button_create->SetStyle("Confirm", "Choice"); - bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { @@ -2748,7 +2748,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) m_button_page2_cancel = new Button(parent, _L("Cancel")); m_button_page2_cancel->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_button_page2_cancel, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_page2_cancel, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_page2_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -3200,7 +3200,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con } m_button_ok->SetStyle("Confirm", "Choice"); - btn_sizer->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); + btn_sizer->Add(m_button_ok, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_ok->Bind(wxEVT_LEFT_DOWN, [this, sync_user_preset_need_enabled](wxMouseEvent &e) { if (sync_user_preset_need_enabled) { @@ -3213,7 +3213,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con if (PRINTER == create_success_type || sync_user_preset_need_enabled) { m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel->SetStyle("Regular", "Choice"); - btn_sizer->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); + btn_sizer->Add(m_button_cancel, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); } @@ -3964,7 +3964,7 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) m_button_ok = new Button(this, _L("OK")); m_button_ok->SetStyle("Confirm", "Choice"); - bSizer_button->Add(m_button_ok, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_ok, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { if (!has_check_box_selected()) { @@ -4005,7 +4005,7 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10)); + bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); @@ -4202,13 +4202,9 @@ EditFilamentPresetDialog::EditFilamentPresetDialog(wxWindow *parent, Filamentinf EditFilamentPresetDialog::~EditFilamentPresetDialog() {} void EditFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { - /*m_add_filament_btn->Rescale(); - m_del_filament_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_del_filament_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_del_filament_btn->SetCornerRadius(FromDIP(12)); - m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24))); - m_ok_btn->SetCornerRadius(FromDIP(12));*/ + m_add_filament_btn->SetType("Window"); + m_del_filament_btn->SetType("Choice"); + m_ok_btn->SetType("Choice"); Layout(); } @@ -4444,9 +4440,8 @@ wxBoxSizer *EditFilamentPresetDialog::create_filament_basic_info() wxBoxSizer *EditFilamentPresetDialog::create_add_filament_btn() { wxBoxSizer *add_filament_btn_sizer = new wxBoxSizer(wxHORIZONTAL); - m_add_filament_btn = new Button(this, _L("+ Add Preset")); // ???? + m_add_filament_btn = new Button(this, _L("+ Add Preset")); m_add_filament_btn->SetStyle("Regular", "Window"); - //m_add_filament_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3))); add_filament_btn_sizer->Add(m_add_filament_btn, 0, wxEXPAND | wxALL, FromDIP(10)); @@ -4490,16 +4485,16 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer() wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); m_del_filament_btn = new Button(this, _L("Delete Filament")); - m_del_filament_btn->SetStyle("Alert", "Window"); + m_del_filament_btn->SetStyle("Alert", "Choice"); - bSizer_button->Add(m_del_filament_btn, 0, wxLEFT | wxBOTTOM, FromDIP(10)); + bSizer_button->Add(m_del_filament_btn, 0, wxLEFT | wxBOTTOM, FromDIP(ButtonProps::ChoiceGap())); bSizer_button->Add(0, 0, 1, wxEXPAND, 0); m_ok_btn = new Button(this, _L("OK")); m_ok_btn->SetStyle("Confirm", "Choice"); - bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); + bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceGap())); m_del_filament_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) { @@ -4684,11 +4679,11 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer() m_ok_btn = new Button(this, _L("OK")); m_ok_btn->SetStyle("Confirm", "Choice"); - bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); + bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceGap())); m_cancel_btn = new Button(this, _L("Cancel")); m_cancel_btn->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); + bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceGap())); m_ok_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { wxString selected_printer_name = m_selected_printer->GetStringSelection(); diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index cf008c7e9de..012cb8432f5 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -24,8 +24,8 @@ #include "libslic3r/Preset.hpp" #include "libslic3r/Print.hpp" -#define BTN_GAP FromDIP(20) -#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) +//#define BTN_GAP FromDIP(20) +//#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) namespace Slic3r { namespace GUI { @@ -419,10 +419,10 @@ void EditGCodeDialog::on_dpi_changed(const wxRect&suggested_rect) for (auto button_item : m_button_list) { if (button_item.first == wxOK) { - button_item.second->SetMinSize(BTN_SIZE); //????? rescale + button_item.second->SetType("Choice"); //????? rescale } if (button_item.first == wxCANCEL) { - button_item.second->SetMinSize(BTN_SIZE); //????? rescale + button_item.second->SetType("Choice"); //????? rescale } } @@ -450,14 +450,14 @@ wxBoxSizer* EditGCodeDialog::create_btn_sizer(long flags) ok_btn->SetStyle("Confirm", "Choice"); ok_btn->SetFocus(); ok_btn->SetId(wxID_OK); - btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); + btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxOK] = ok_btn; } if (flags & wxCANCEL) { Button* cancel_btn = new Button(this, _L("Cancel")); cancel_btn->SetStyle("Regular", "Choice"); cancel_btn->SetId(wxID_CANCEL); - btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP / 2); + btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxCANCEL] = cancel_btn; } diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 25c064b512e..13f39e6a7c2 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -141,17 +141,18 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con if (label.length() < 5) { type = ButtonSizeNormal; - btn->SetMinSize(MSG_DIALOG_BUTTON_SIZE); } + //btn->SetMinSize(MSG_DIALOG_BUTTON_SIZE); // ????? + } else if (label.length() >= 5 && label.length() < 8) { type = ButtonSizeMiddle; - btn->SetMinSize(MSG_DIALOG_MIDDLE_BUTTON_SIZE); + //btn->SetMinSize(MSG_DIALOG_MIDDLE_BUTTON_SIZE); } else if (label.length() >= 8 && label.length() < 12) { type = ButtonSizeMiddle; - btn->SetMinSize(MSG_DIALOG_LONG_BUTTON_SIZE); + //btn->SetMinSize(MSG_DIALOG_LONG_BUTTON_SIZE); } else { type = ButtonSizeLong; - btn->SetMinSize(MSG_DIALOG_LONGER_BUTTON_SIZE); + //btn->SetMinSize(MSG_DIALOG_LONGER_BUTTON_SIZE); } if (btn_id == wxID_OK || btn_id == wxID_YES) { @@ -164,7 +165,7 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con if (set_focus) btn->SetFocus(); - btn_sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_SPACING); + btn_sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { EndModal(btn_id); }); MsgButton *mb = new MsgButton; @@ -471,11 +472,11 @@ DeleteConfirmDialog::DeleteConfirmDialog(wxWindow *parent, const wxString &title m_cancel_btn = new Button(this, _L("Cancel")); m_cancel_btn->SetStyle("Regular", "Choice"); - bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); + bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceGap())); m_del_btn = new Button(this, _L("Delete")); m_del_btn->SetStyle("Alert", "Choice"); - bSizer_button->Add(m_del_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10)); + bSizer_button->Add(m_del_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceGap())); m_main_sizer->Add(bSizer_button, 0, wxEXPAND, 0); m_del_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); }); @@ -569,7 +570,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() if (!file_version_newer) { m_update_btn = new Button(this, _L("Update")); m_update_btn->SetStyle("Regular", "Choice"); - horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(10)); + horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_update_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); @@ -590,7 +591,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() m_later_btn = new Button(this, _L("OK")); m_later_btn->SetStyle("Confirm", "Choice"); } - horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(10)); + horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceGap())); m_later_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); }); @@ -673,7 +674,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent) sizer_button->Add(checkbox, 0, wxALL, 5); sizer_button->Add(checkbox_title, 0, wxALL, 5); sizer_button->Add(0, 0, 1, wxEXPAND, 5); - sizer_button->Add(m_button_confirm, 0, wxALL, 5); + sizer_button->Add(m_button_confirm, 0, wxALL, FromDIP(ButtonProps::ChoiceGap())); sizer_main->Add(m_line_top, 0, wxEXPAND, 0); sizer_main->Add(0, 0, 0, wxTOP, 20); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 9f8cb67103f..3dc0481c1e9 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -94,20 +94,16 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent) : m_optgroup = new ConfigOptionsGroup(this, _L("Print Host upload"), m_config); build_printhost_settings(m_optgroup); - wxStdDialogButtonSizer* btns = this->CreateStdDialogButtonSizer(wxOK | wxCANCEL); - btnOK = static_cast(this->FindWindowById(wxID_OK, this)); - wxGetApp().UpdateDarkUI(btnOK); + Button* btnOK = new Button(this, _L("Confirm")); + btnOK->SetStyle("Confirm", "Choice"); btnOK->Bind(wxEVT_BUTTON, &PhysicalPrinterDialog::OnOK, this); - wxGetApp().UpdateDarkUI(static_cast(this->FindWindowById(wxID_CANCEL, this))); - (static_cast(this->FindWindowById(wxID_CANCEL, this)))->Hide(); - wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); // topSizer->Add(label_top , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, BORDER_W); topSizer->Add(input_sizer , 0, wxEXPAND | wxALL, BORDER_W); topSizer->Add(m_optgroup->sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, BORDER_W); - topSizer->Add(btns , 0, wxEXPAND | wxALL, BORDER_W); + topSizer->Add(btnOK , 0, wxALL | wxALIGN_RIGHT, BORDER_W); Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->EndModal(wxID_NO);}); @@ -136,12 +132,9 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->append_single_option_line("host_type"); - auto create_sizer_with_btn = [](wxWindow* parent, Button** btn, const std::string& icon_name, const wxString& label) { - *btn = new Button(parent, label, icon_name, 0, parent->FromDIP(16)); - (*btn)->SetStyle("Regular", "Window"); - (*btn)->SetContentAlignment("L"); - (*btn)->SetPaddingSize(wxSize(5, 5)); - //(*btn)->SetMinSize(wxSize(parent->FromDIP(80), parent->FromDIP(26))); // ???? + auto create_sizer_with_btn = [](wxWindow* parent, Button** btn, const wxString& label) { + *btn = new Button(parent, label); + (*btn)->SetStyle("Regular", "Parameter"); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(*btn); @@ -150,7 +143,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr auto printhost_browse = [=](wxWindow* parent) { - auto sizer = create_sizer_with_btn(parent, &m_printhost_browse_btn, "printer_host_browser", _L("Browse") + " " + dots); + auto sizer = create_sizer_with_btn(parent, &m_printhost_browse_btn, _L("Browse") + " " + dots); m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) { BonjourDialog dialog(this, Preset::printer_technology(*m_config)); if (dialog.show_and_lookup()) { @@ -163,7 +156,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr }; auto print_host_test = [=](wxWindow* parent) { - auto sizer = create_sizer_with_btn(parent, &m_printhost_test_btn, "printer_host_test", _L("Test")); + auto sizer = create_sizer_with_btn(parent, &m_printhost_test_btn, _L("Test")); m_printhost_test_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) { std::unique_ptr host(PrintHost::get_print_host(m_config)); @@ -214,7 +207,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr }; auto print_host_logout = [&](wxWindow* parent) { - auto sizer = create_sizer_with_btn(parent, &m_printhost_logout_btn, "", _L("Log Out")); + auto sizer = create_sizer_with_btn(parent, &m_printhost_logout_btn, _L("Log Out")); m_printhost_logout_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) { std::unique_ptr host(PrintHost::get_print_host(m_config)); @@ -237,9 +230,9 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr }; auto print_host_printers = [this, create_sizer_with_btn](wxWindow* parent) { - auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, "monitor_signal_strong", _(L("Refresh Printers"))); + auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, _(L("Refresh Printers"))); Button* btn = m_printhost_port_browse_btn; // ORCA - btn->SetStyle("Regular", "Window"); + btn->SetStyle("Regular", "Parameter"); btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); }); return sizer; }; @@ -290,7 +283,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr Line cafile_line = m_optgroup->create_single_option_line(option); auto printhost_cafile_browse = [=](wxWindow* parent) { - auto sizer = create_sizer_with_btn(parent, &m_printhost_cafile_browse_btn, "monitor_signal_strong", _L("Browse") + " " + dots); + auto sizer = create_sizer_with_btn(parent, &m_printhost_cafile_browse_btn, _L("Browse") + " " + dots); m_printhost_cafile_browse_btn->Bind(wxEVT_BUTTON, [this, m_optgroup](wxCommandEvent e) { static const auto filemasks = _L("Certificate files (*.crt, *.pem)|*.crt;*.pem|All files|*.*"); wxFileDialog openFileDialog(this, _L("Open CA certificate file"), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST); @@ -714,11 +707,11 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect) { const int& em = em_unit(); - m_printhost_browse_btn->Rescale(); //ORCA - m_printhost_test_btn->Rescale(); //ORCA - m_printhost_logout_btn->Rescale(); //ORCA + m_printhost_browse_btn->Rescale(); + m_printhost_test_btn->Rescale(); + m_printhost_logout_btn->Rescale(); if (m_printhost_cafile_browse_btn) - m_printhost_cafile_browse_btn->Rescale(); //ORCA + m_printhost_cafile_browse_btn->Rescale(); m_optgroup->msw_rescale(); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.hpp b/src/slic3r/GUI/PhysicalPrinterDialog.hpp index d3bd9b5c761..7fb5976bc37 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.hpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.hpp @@ -8,6 +8,7 @@ #include "libslic3r/Preset.hpp" #include "GUI_Utils.hpp" #include "Widgets/RoundedRectangle.hpp" +#include "Widgets/Button.hpp" class wxTextCtrl; class wxStaticText; @@ -38,7 +39,7 @@ class PhysicalPrinterDialog : public DPIDialog RoundedRectangle* m_input_area {nullptr}; wxStaticText* m_valid_label {nullptr}; wxTextCtrl* m_input_ctrl {nullptr}; - wxButton* btnOK {nullptr}; + Button* btnOK {nullptr}; void build_printhost_settings(ConfigOptionsGroup* optgroup); void OnOK(wxEvent& event); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2fc5e9d26a3..54c5d094324 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -885,25 +885,18 @@ Sidebar::Sidebar(Plater *parent) // BBS // add wiping dialog //wiping_dialog_button->SetFont(wxGetApp().normal_font()); - p->m_flushing_volume_btn = new Button(p->m_panel_filament_title, _L("Flushing volumes")); + p->m_flushing_volume_btn = new Button(p->m_panel_filament_title, _L("Flushing volumes")); // ???? Match style with Global/Objects toggle on another commit p->m_flushing_volume_btn->SetFont(Label::Body_10); - p->m_flushing_volume_btn->SetPaddingSize(wxSize(FromDIP(8),FromDIP(3))); - p->m_flushing_volume_btn->SetCornerRadius(FromDIP(8)); - - StateColor flush_bg_col(std::pair(wxColour("#BFE1DE"), StateColor::Pressed), // ORCA - std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(238, 238, 238), StateColor::Normal)); - - StateColor flush_fg_col(std::pair(wxColour(107, 107, 106), StateColor::Pressed), - std::pair(wxColour(107, 107, 106), StateColor::Hovered), - std::pair(wxColour(107, 107, 106), StateColor::Normal)); - - StateColor flush_bd_col(std::pair(wxColour(0, 150, 136), StateColor::Pressed), - std::pair(wxColour(0, 150, 136), StateColor::Hovered), - std::pair(wxColour(172, 172, 172), StateColor::Normal)); - + p->m_flushing_volume_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(5))); + p->m_flushing_volume_btn->SetCornerRadius(FromDIP(12)); + StateColor flush_bg_col(std::pair(wxColour("#D9D9D9"), StateColor::Pressed), // ORCA + std::pair(wxColour("#D4D4D4"), StateColor::Hovered), + std::pair(wxColour("#D9D9D9"), StateColor::Normal)); + StateColor flush_fg_col(std::pair(wxColour("#6B6B6A"), StateColor::Pressed), + std::pair(wxColour("#6B6B6A"), StateColor::Hovered), + std::pair(wxColour("#6B6B6A"), StateColor::Normal)); p->m_flushing_volume_btn->SetBackgroundColor(flush_bg_col); - p->m_flushing_volume_btn->SetBorderColor(flush_bd_col); + p->m_flushing_volume_btn->SetBorderColor(flush_bg_col); p->m_flushing_volume_btn->SetTextColor(flush_fg_col); p->m_flushing_volume_btn->SetFocus(); p->m_flushing_volume_btn->SetId(wxID_RESET); diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index c0950e9a501..3ee97982646 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -989,7 +989,7 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_ e.Skip(); }); - m_sizer_button->Add(*btn, 0, wxLEFT, 5); + m_sizer_button->Add(*btn, 0, wxLEFT, FromDIP(ButtonProps::ChoiceGap())); }; // "Transfer" / "Keep" button @@ -1978,7 +1978,7 @@ void DiffPresetDialog::create_buttons() for (Button* btn : { m_transfer_btn, m_cancel_btn }) { btn->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { update_bottom_info(); Layout(); e.Skip(); }); - m_buttons->Add(btn, 1, wxLEFT, 5); + m_buttons->Add(btn, 1, wxLEFT, FromDIP(ButtonProps::ChoiceGap())); btn->SetStyle("Regular", "Choice"); } diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index a24ded5d411..a0d33c0138c 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -148,12 +148,6 @@ void Button::SetCenter(bool isCenter) this->isCenter = isCenter; } -// ORCA: add support for alignment -void Button::SetContentAlignment(const wxString& side /* "L" / "R" Center is default*/) -{ - alignment = (side == "L") ? 0 : (side == "R") ? 1 : 0; -} - // Button Colors bg-Disabled bg-Pressed bg-Hovered bg-Normal bg-Enabled fg-Disabled fg-Normal wxString btn_regular[7] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#262E30"}; wxString btn_confirm[7] = {"#00897B", "#00897B", "#26A69A", "#009688", "#009688", "#6B6A6A", "#FEFEFE"}; @@ -162,49 +156,51 @@ wxString btn_disabled[7] = {"#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF void Button::SetStyle(const wxString style /* Regular/Confirm/Alert/Disabled */, const wxString& type /* Choice/Window/Parameter/Compact */) { - if (type == "Compact") { - this->SetFont(Label::Body_10); - } else { - this->SetFont(Label::Body_14); - } - + this->SetFont( type == "Compact" ? Label::Body_10 : + type == "Window" ? Label::Body_12 : + Label::Body_14 + ); auto clr_arr = style == "Regular" ? btn_regular : style == "Confirm" ? btn_confirm : style == "Alert" ? btn_alert : style == "Disabled" ? btn_disabled : btn_regular; - StateColor clr_bg = StateColor( std::pair(wxColour(clr_arr[0]), StateColor::Disabled), - std::pair(wxColour(clr_arr[1]), StateColor::Pressed), - std::pair(wxColour(clr_arr[2]), StateColor::Hovered), - std::pair(wxColour(clr_arr[3]), StateColor::Normal), - std::pair(wxColour(clr_arr[4]), StateColor::Enabled) + StateColor clr_bg = StateColor(std::pair(wxColour(clr_arr[0]), StateColor::Disabled), + std::pair(wxColour(clr_arr[1]), StateColor::Pressed), + std::pair(wxColour(clr_arr[2]), StateColor::Hovered), + std::pair(wxColour(clr_arr[3]), StateColor::Normal), + std::pair(wxColour(clr_arr[4]), StateColor::Enabled) ); this->SetBackgroundColor(clr_bg); this->SetBorderColor(clr_bg); - StateColor clr_fg = StateColor( std::pair(wxColour(clr_arr[5]), StateColor::Disabled), - std::pair(wxColour(clr_arr[6]), StateColor::Normal) - ); - this->Button::SetTextColor(clr_fg); - - this->Button::SetType(type); - + this->SetTextColor( StateColor(std::pair(wxColour(clr_arr[5]), StateColor::Disabled), + std::pair(wxColour(clr_arr[6]), StateColor::Normal) + )); + this->SetType(type); } -void Button::SetType(const wxString type) +void Button::SetType(const wxString type /* Choice/Window/Parameter/Compact */) { - if (type == "Choice" || type == "Window") { - this->SetSize(wxSize(FromDIP(58), FromDIP(24))); - this->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); - } else if (type == "Parameter") { - this->SetSize(wxSize(FromDIP(120), FromDIP(26))); - } - if (type == "Compact") { + // Function also rescales button + if (type == "Compact") { // FontSize:10 FullyRounded Use for less spaced areas + this->SetPaddingSize(FromDIP(wxSize(8,3))); this->SetCornerRadius(this->FromDIP(8)); - this->SetPaddingSize(wxSize(8, 3)); - } else { + } else if (type == "Window") { // FontSize:12 FullyRounded Use for regular windows in windows + this->SetSize(FromDIP(wxSize(58,24))); + this->SetMinSize(FromDIP(wxSize(58,24))); + this->SetCornerRadius(this->FromDIP(12)); + } else if (type == "Choice") { // FontSize:14 SemiRounded Use for dialog/window choice buttons. + this->SetMinSize(FromDIP(wxSize(100,32))); + this->SetPaddingSize(FromDIP(wxSize(12,8))); + this->SetCornerRadius(this->FromDIP(4)); + } else if (type == "Parameter") { // FontSize:14 SemiRounded Use for buttons that near parameter boxes + this->SetMinSize(FromDIP(wxSize(120,26))); + this->SetSize(FromDIP(wxSize(120,26))); + this->SetCornerRadius(this->FromDIP(4)); + } else { // DEFAULTS FontSize:14 SemiRounded Dont specify type parameter on SetStyle(style, type) to get regular button this->SetCornerRadius(this->FromDIP(4)); } - + // ???? rescale } void Button::Rescale() @@ -261,24 +257,17 @@ void Button::render(wxDC& dc) szContent.x -= d; } } - - // ORCA Align content. Button content centered as default until use of SetContentAlignment("L") + // move to center wxRect rcContent = {{0, 0}, size}; - wxSize offset = (size - szContent) / 2; - if (offset.x < 0) - offset.x = 0; - rcContent.Deflate(offset.x, offset.y); - + if (isCenter) { + wxSize offset = (size - szContent) / 2; + if (offset.x < 0) + offset.x = 0; + rcContent.Deflate(offset.x, offset.y); + } + // start draw wxPoint pt = rcContent.GetLeftTop(); - if (alignment == 0) { // to left - if (offset.x > 0) - pt.x = pt.x - offset.x + paddingSize.x; - } else if (alignment == 2) { // to right - if (offset.x > 0) - pt.x = pt.x + offset.x - paddingSize.x; - } - // start draw //wxPoint pt = rcContent.GetLeftTop(); if (icon.bmp().IsOk()) { @@ -402,3 +391,5 @@ WXLRESULT Button::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) #endif bool Button::AcceptsFocus() const { return canFocus; } + +int ButtonProps::ChoiceGap() { return 10; } \ No newline at end of file diff --git a/src/slic3r/GUI/Widgets/Button.hpp b/src/slic3r/GUI/Widgets/Button.hpp index 86c51d4db4d..6c48e38655c 100644 --- a/src/slic3r/GUI/Widgets/Button.hpp +++ b/src/slic3r/GUI/Widgets/Button.hpp @@ -4,6 +4,12 @@ #include "../wxExtensions.hpp" #include "StaticBox.hpp" +class ButtonProps +{ +public: + static int ChoiceGap(); +}; + class Button : public StaticBox { wxRect textSize; @@ -19,8 +25,6 @@ class Button : public StaticBox bool canFocus = true; bool isCenter = true; - int alignment = 1; - static const int buttonWidth = 200; static const int buttonHeight = 50; @@ -43,8 +47,6 @@ class Button : public StaticBox void SetPaddingSize(const wxSize& size); - void SetContentAlignment(const wxString& side); - void SetStyle(const wxString style /* Regular/Confirm/Alert/Disabled */, const wxString& type = "" /* Choice/Window/Parameter */); void SetType(const wxString size); From 09935f3c054d5f765023d7ef85de067d1e66eecf Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 8 Feb 2025 05:18:58 +0300 Subject: [PATCH 14/16] Update WipeTowerDialog.cpp --- src/slic3r/GUI/WipeTowerDialog.cpp | 104 ++++------------------------- 1 file changed, 14 insertions(+), 90 deletions(-) diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 04c067f7d7e..171245d5901 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -31,8 +31,8 @@ static const wxColour g_text_color = wxColour(107, 107, 107, 255); #define ROW_BEG_PADDING FromDIP(20) #define EDIT_BOXES_GAP FromDIP(30) #define ROW_END_PADDING FromDIP(21) -#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) -#define BTN_GAP FromDIP(20) +//#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24)) +//#define BTN_GAP FromDIP(20) #define TEXT_BEG_PADDING FromDIP(30) #define MAX_FLUSH_VALUE 999 #define MIN_WIPING_DIALOG_WIDTH FromDIP(300) @@ -210,82 +210,27 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags) auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); btn_sizer->AddStretchSpacer(); - StateColor ok_btn_bg( - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor ok_btn_bd( - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor ok_btn_text( - std::pair(wxColour(255, 255, 254), StateColor::Normal) - ); - - StateColor cancel_btn_bg( - std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), - std::pair(wxColour(255, 255, 255), StateColor::Normal) - ); - - StateColor cancel_btn_bd_( - std::pair(wxColour(38, 46, 48), StateColor::Normal) - ); - - StateColor cancel_btn_text( - std::pair(wxColour(38, 46, 48), StateColor::Normal) - ); - - - StateColor calc_btn_bg( - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor calc_btn_bd( - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor calc_btn_text( - std::pair(wxColour(255, 255, 254), StateColor::Normal) - ); - if (flags & wxRESET) { Button *calc_btn = new Button(this, _L("Auto-Calc")); - calc_btn->SetMinSize(wxSize(FromDIP(75), FromDIP(24))); - calc_btn->SetCornerRadius(FromDIP(12)); - calc_btn->SetBackgroundColor(calc_btn_bg); - calc_btn->SetBorderColor(calc_btn_bd); - calc_btn->SetTextColor(calc_btn_text); + calc_btn->SetStyle("Confirm", "Choice"); calc_btn->SetFocus(); calc_btn->SetId(wxID_RESET); - btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); + btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxRESET] = calc_btn; } if (flags & wxOK) { Button* ok_btn = new Button(this, _L("OK")); - ok_btn->SetMinSize(BTN_SIZE); - ok_btn->SetCornerRadius(FromDIP(12)); - ok_btn->SetBackgroundColor(ok_btn_bg); - ok_btn->SetBorderColor(ok_btn_bd); - ok_btn->SetTextColor(ok_btn_text); + ok_btn->SetStyle("Confirm", "Choice"); ok_btn->SetFocus(); ok_btn->SetId(wxID_OK); - btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); + btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxOK] = ok_btn; } if (flags & wxCANCEL) { Button* cancel_btn = new Button(this, _L("Cancel")); - cancel_btn->SetMinSize(BTN_SIZE); - cancel_btn->SetCornerRadius(FromDIP(12)); - cancel_btn->SetBackgroundColor(cancel_btn_bg); - cancel_btn->SetBorderColor(cancel_btn_bd_); - cancel_btn->SetTextColor(cancel_btn_text); + cancel_btn->SetStyle("Regular", "Choice"); cancel_btn->SetId(wxID_CANCEL); - btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); + btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); m_button_list[wxCANCEL] = cancel_btn; } @@ -295,29 +240,11 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags) wxBoxSizer* WipingPanel::create_calc_btn_sizer(wxWindow* parent) { auto btn_sizer = new wxBoxSizer(wxHORIZONTAL); - StateColor calc_btn_bg( - std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor calc_btn_bd( - std::pair(wxColour(0, 150, 136), StateColor::Normal) - ); - - StateColor calc_btn_text( - std::pair(wxColour(255, 255, 254), StateColor::Normal) - ); Button* calc_btn = new Button(parent, _L("Re-calculate")); - calc_btn->SetFont(Label::Body_13); - calc_btn->SetMinSize(wxSize(FromDIP(75), FromDIP(24))); - calc_btn->SetCornerRadius(FromDIP(12)); - calc_btn->SetBackgroundColor(calc_btn_bg); - calc_btn->SetBorderColor(calc_btn_bd); - calc_btn->SetTextColor(calc_btn_text); + calc_btn->SetStyle("Confirm", "Window"); calc_btn->SetFocus(); - btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP); + btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceGap())); calc_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { calc_flushing_volumes(); }); return btn_sizer; @@ -328,16 +255,13 @@ void WipingDialog::on_dpi_changed(const wxRect &suggested_rect) { if (button_item.first == wxRESET) { - button_item.second->SetMinSize(wxSize(FromDIP(75), FromDIP(24))); - button_item.second->SetCornerRadius(FromDIP(12)); + button_item.second->SetType("Choice"); } if (button_item.first == wxOK) { - button_item.second->SetMinSize(BTN_SIZE); - button_item.second->SetCornerRadius(FromDIP(12)); + button_item.second->SetType("Choice"); } if (button_item.first == wxCANCEL) { - button_item.second->SetMinSize(BTN_SIZE); - button_item.second->SetCornerRadius(FromDIP(12)); + button_item.second->SetType("Choice"); } } m_panel_wiping->msw_rescale(); @@ -376,7 +300,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector& matrix, c main_sizer->Add(m_panel_wiping, 1, wxEXPAND | wxALL, 0); auto btn_sizer = create_btn_sizer(wxOK | wxCANCEL); - main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BTN_GAP); + main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxTOP | wxEXPAND, FromDIP(ButtonProps::ChoiceGap())); SetSizer(main_sizer); main_sizer->SetSizeHints(this); From 2e5716c6c993c1a7e1ae5d37c2387b026bcb335b Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 8 Feb 2025 05:26:13 +0300 Subject: [PATCH 15/16] update --- src/slic3r/GUI/BedShapeDialog.cpp | 4 ++-- src/slic3r/GUI/CreatePresetsDialog.cpp | 18 +++++++++--------- src/slic3r/GUI/EditGCodeDialog.cpp | 4 ++-- src/slic3r/GUI/UnsavedChangesDialog.cpp | 6 ++---- src/slic3r/GUI/WipeTowerDialog.cpp | 6 +++--- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index d0e2b1b6735..8a357312506 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -177,8 +177,8 @@ void BedShapeDialog::on_dpi_changed(const wxRect &suggested_rect) for (auto og : m_panel->m_optgroups) og->msw_rescale(); - m_button_list[wxOK] ->SetType("Dialog"); - m_button_list[wxCANCEL] ->SetType("Dialog"); + m_button_list[wxOK] ->SetType("Choice"); // Rescale Button + m_button_list[wxCANCEL] ->SetType("Choice"); // Rescale Button const wxSize& size = wxSize(50 * em, -1); diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 472db1accd1..3354a44a7ea 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -668,8 +668,8 @@ CreateFilamentPresetDialog::~CreateFilamentPresetDialog() void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_create->SetType("Choice"); - m_button_cancel->SetType("Choice"); + m_button_create->SetType("Choice"); // Rescale Button + m_button_cancel->SetType("Choice"); // Rescale Button Layout(); } @@ -1512,11 +1512,11 @@ CreatePrinterPresetDialog::~CreatePrinterPresetDialog() } void CreatePrinterPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { - m_button_OK->SetType("Choice"); - m_button_create->SetType("Choice"); - m_button_page1_cancel->SetType("Choice"); - m_button_page2_cancel->SetType("Choice"); - m_button_page2_back->SetType("Choice"); + m_button_OK->SetType("Choice"); // Rescale Button + m_button_create->SetType("Choice"); // Rescale Button + m_button_page1_cancel->SetType("Choice"); // Rescale Button + m_button_page2_cancel->SetType("Choice"); // Rescale Button + m_button_page2_back->SetType("Choice"); // Rescale Button Layout(); } @@ -4802,13 +4802,13 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr pre sizer->Add(0, 0, 1, wxEXPAND, 0); Button *edit_preset_btn = new Button(panel, _L("Edit Preset")); - edit_preset_btn->SetStyle("Regular", "Compact"); // ???? Small Button + edit_preset_btn->SetStyle("Regular", "Compact"); //edit_preset_btn->Hide(); sizer->Add(edit_preset_btn, 0, wxALL | wxALIGN_CENTER_VERTICAL, 0); sizer->Add(0, 0, 0, wxLEFT, 5); Button *del_preset_btn = new Button(panel, _L("Delete Preset")); - del_preset_btn->SetStyle("Regular", "Compact"); // ???? Small Button + del_preset_btn->SetStyle("Regular", "Compact"); if (base_id_error) { del_preset_btn->SetStyle("Confirm", "Compact"); // ???? } else { diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index 012cb8432f5..275d116f2b0 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -419,10 +419,10 @@ void EditGCodeDialog::on_dpi_changed(const wxRect&suggested_rect) for (auto button_item : m_button_list) { if (button_item.first == wxOK) { - button_item.second->SetType("Choice"); //????? rescale + button_item.second->SetType("Choice"); // Rescale Button } if (button_item.first == wxCANCEL) { - button_item.second->SetType("Choice"); //????? rescale + button_item.second->SetType("Choice"); // Rescale Button } } diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 3ee97982646..f0d1506ac84 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -1703,8 +1703,7 @@ void UnsavedChangesDialog::on_dpi_changed(const wxRect& suggested_rect) msw_buttons_rescale(this, em, { wxID_CANCEL, m_move_btn_id, m_continue_btn_id }); for (auto btn : {m_transfer_btn, m_discard_btn, m_save_btn}) - if (btn) btn->SetType("Choice"); - //if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); + if (btn) btn->SetType("Choice"); // Rescale Button //m_cancel_btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); const wxSize& size = wxSize(70 * em, 30 * em); @@ -2263,8 +2262,7 @@ void DiffPresetDialog::on_dpi_changed(const wxRect&) msw_buttons_rescale(this, em, {wxID_CANCEL}); for (auto btn : {m_transfer_btn, m_cancel_btn}) - if (btn) btn->SetType("Choice"); - //if (btn) btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE); + if (btn) btn->SetType("Choice"); // Rescale Button const wxSize& size = wxSize(80 * em, 30 * em); SetMinSize(size); diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 171245d5901..d735477107b 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -255,13 +255,13 @@ void WipingDialog::on_dpi_changed(const wxRect &suggested_rect) { if (button_item.first == wxRESET) { - button_item.second->SetType("Choice"); + button_item.second->SetType("Choice"); // Rescale Button } if (button_item.first == wxOK) { - button_item.second->SetType("Choice"); + button_item.second->SetType("Choice"); // Rescale Button } if (button_item.first == wxCANCEL) { - button_item.second->SetType("Choice"); + button_item.second->SetType("Choice"); // Rescale Button } } m_panel_wiping->msw_rescale(); From 83b58cf8a7136135c35ebbb61ef94bcba466f310 Mon Sep 17 00:00:00 2001 From: yw4z Date: Sat, 8 Feb 2025 05:34:46 +0300 Subject: [PATCH 16/16] Update Button.cpp --- src/slic3r/GUI/Widgets/Button.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/Widgets/Button.cpp b/src/slic3r/GUI/Widgets/Button.cpp index a0d33c0138c..da8ba691d3a 100644 --- a/src/slic3r/GUI/Widgets/Button.cpp +++ b/src/slic3r/GUI/Widgets/Button.cpp @@ -258,18 +258,14 @@ void Button::render(wxDC& dc) } } // move to center - wxRect rcContent = {{0, 0}, size}; + wxRect rcContent = { {0, 0}, size }; if (isCenter) { wxSize offset = (size - szContent) / 2; - if (offset.x < 0) - offset.x = 0; + if (offset.x < 0) offset.x = 0; rcContent.Deflate(offset.x, offset.y); } // start draw wxPoint pt = rcContent.GetLeftTop(); - - // start draw - //wxPoint pt = rcContent.GetLeftTop(); if (icon.bmp().IsOk()) { pt.y += (rcContent.height - szIcon.y) / 2; dc.DrawBitmap(icon.bmp(), pt);