Styling management for buttons and matching all button styles (#8184)

* Add button styling

* Fix dark mode compability

* printable area button

* Connection dialog icons

* Add aligment control

* Fix alignment

* add new styles

* Update BedShapeDialog.cpp

* Use darker text color on dark mode

* update code

* Update

* update

* Update

* Update WipeTowerDialog.cpp

* update

* Update Button.cpp

* update

* Update Button.cpp

* add enums for style and type

* update

* Update Button.cpp

* fix

* update

* Update DialogButtons.cpp

* Update UnsavedChangesDialog.cpp

* update

* update

* update

* Update Button.cpp

* cleanup

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
yw4z
2025-07-17 15:44:45 +03:00
committed by GitHub
parent 37d8bec3e1
commit e9e069c167
17 changed files with 199 additions and 583 deletions

View File

@@ -1933,21 +1933,10 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent)
wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL);
StateColor flush_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
m_button_bed_stl = new Button(parent, _L("Load..."));
m_button_bed_stl->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
m_button_bed_stl->Bind(wxEVT_BUTTON, ([this](wxCommandEvent& e) { load_model_stl(); }));
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Hovered),
std::pair<wxColour, int>(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);
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));
@@ -1970,21 +1959,10 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent)
wxBoxSizer *hot_bed_stl_sizer = new wxBoxSizer(wxVERTICAL);
StateColor flush_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
m_button_bed_svg = new Button(parent, _L("Load svg"));
m_button_bed_svg = new Button(parent, _L("Load..."));
m_button_bed_svg->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
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));
@@ -4488,22 +4466,8 @@ 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));
m_add_filament_btn->SetStyle(ButtonStyle::Regular, ButtonType::Window);
StateColor flush_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
StateColor flush_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed), std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Hovered),
std::pair<wxColour, int>(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) {
@@ -4836,41 +4800,17 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr<Preset> pre
}
sizer->Add(0, 0, 1, wxEXPAND, 0);
StateColor flush_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
StateColor flush_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed), std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
StateColor flush_bd_col(std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
std::pair<wxColour, int>(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(ButtonStyle::Regular, ButtonType::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->SetFont(Label::Body_10);
del_preset_btn->SetPaddingSize(wxSize(8, 3));
del_preset_btn->SetCornerRadius(8);
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(ButtonStyle::Confirm, ButtonType::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(ButtonStyle::Alert, ButtonType::Compact);
}
//del_preset_btn->Hide();