mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
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:
@@ -235,82 +235,27 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags)
|
||||
auto btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn_sizer->AddStretchSpacer();
|
||||
|
||||
StateColor ok_btn_bg(
|
||||
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)
|
||||
);
|
||||
|
||||
StateColor ok_btn_bd(
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor ok_btn_text(
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor cancel_btn_bg(
|
||||
std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor cancel_btn_bd_(
|
||||
std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor cancel_btn_text(
|
||||
std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Normal)
|
||||
);
|
||||
|
||||
|
||||
StateColor calc_btn_bg(
|
||||
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)
|
||||
);
|
||||
|
||||
StateColor calc_btn_bd(
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor calc_btn_text(
|
||||
std::pair<wxColour, int>(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(ButtonStyle::Confirm, ButtonType::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::ChoiceButtonGap()));
|
||||
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(ButtonStyle::Confirm, ButtonType::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::ChoiceButtonGap()));
|
||||
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(ButtonStyle::Regular, ButtonType::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::ChoiceButtonGap()));
|
||||
m_button_list[wxCANCEL] = cancel_btn;
|
||||
}
|
||||
|
||||
@@ -320,29 +265,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, 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)
|
||||
);
|
||||
|
||||
StateColor calc_btn_bd(
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor calc_btn_text(
|
||||
std::pair<wxColour, int>(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(ButtonStyle::Confirm, ButtonType::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::WindowButtonGap()));
|
||||
calc_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { calc_flushing_volumes(); });
|
||||
|
||||
return btn_sizer;
|
||||
@@ -353,8 +280,7 @@ 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->Rescale();
|
||||
}
|
||||
}
|
||||
m_panel_wiping->msw_rescale();
|
||||
|
||||
Reference in New Issue
Block a user