Modernize wxButtons on Parameters & Physical Printer window (#9459)

* update

* Update Tab.hpp
This commit is contained in:
yw4z 2025-04-24 11:09:39 +03:00 committed by GitHub
parent 2a6c15d15a
commit 07634d2ba2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 101 additions and 34 deletions

View file

@ -136,9 +136,26 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_single_option_line("host_type"); 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) { 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 = new Button(parent, label, ""/*icon_name*/, 0, parent->FromDIP(16));
(*btn)->SetFont(wxGetApp().normal_font()); (*btn)->SetFont(Label::Body_14);
(*btn)->SetMinSize(wxSize(parent->FromDIP(120), parent->FromDIP(26)));
(*btn)->SetSize(wxSize(parent->FromDIP(120), parent->FromDIP(26)));
(*btn)->SetCornerRadius(parent->FromDIP(4));
StateColor clr_bg = StateColor(
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Pressed),
std::pair(wxColour("#D4D4D4"), (int)StateColor::Hovered),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Normal),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Enabled)
);
(*btn)->SetBackgroundColor(clr_bg);
(*btn)->SetBorderColor(clr_bg);
(*btn)->SetTextColor(StateColor(
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
));
auto sizer = new wxBoxSizer(wxHORIZONTAL); auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(*btn); sizer->Add(*btn);
@ -235,9 +252,8 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
auto print_host_printers = [this, create_sizer_with_btn](wxWindow* parent) { 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); //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"))); auto sizer = create_sizer_with_btn(parent, &m_printhost_port_browse_btn, "monitor_signal_strong", _L("Refresh") + " " + dots);
ScalableButton* btn = m_printhost_port_browse_btn; Button* btn = m_printhost_port_browse_btn;
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); }); btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); });
return sizer; return sizer;
}; };
@ -712,11 +728,11 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
{ {
const int& em = em_unit(); const int& em = em_unit();
m_printhost_browse_btn->msw_rescale(); m_printhost_browse_btn->Rescale();
m_printhost_test_btn->msw_rescale(); m_printhost_test_btn->Rescale();
m_printhost_logout_btn->msw_rescale(); m_printhost_logout_btn->Rescale();
if (m_printhost_cafile_browse_btn) if (m_printhost_cafile_browse_btn)
m_printhost_cafile_browse_btn->msw_rescale(); m_printhost_cafile_browse_btn->Rescale();
m_optgroup->msw_rescale(); m_optgroup->msw_rescale();

View file

@ -11,7 +11,7 @@
class wxTextCtrl; class wxTextCtrl;
class wxStaticText; class wxStaticText;
class ScalableButton; class Button;
class wxBoxSizer; class wxBoxSizer;
namespace Slic3r { namespace Slic3r {
@ -28,12 +28,12 @@ class PhysicalPrinterDialog : public DPIDialog
DynamicPrintConfig* m_config { nullptr }; DynamicPrintConfig* m_config { nullptr };
ConfigOptionsGroup* m_optgroup { nullptr }; ConfigOptionsGroup* m_optgroup { nullptr };
ScalableButton* m_printhost_browse_btn {nullptr}; Button* m_printhost_browse_btn {nullptr};
ScalableButton* m_printhost_test_btn {nullptr}; Button* m_printhost_test_btn {nullptr};
ScalableButton* m_printhost_logout_btn {nullptr}; Button* m_printhost_logout_btn {nullptr};
ScalableButton* m_printhost_cafile_browse_btn {nullptr}; Button* m_printhost_cafile_browse_btn {nullptr};
ScalableButton* m_printhost_client_cert_browse_btn {nullptr}; Button* m_printhost_client_cert_browse_btn {nullptr};
ScalableButton* m_printhost_port_browse_btn {nullptr}; Button* m_printhost_port_browse_btn {nullptr};
RoundedRectangle* m_input_area {nullptr}; RoundedRectangle* m_input_area {nullptr};
wxStaticText* m_valid_label {nullptr}; wxStaticText* m_valid_label {nullptr};

View file

@ -3545,14 +3545,30 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_stamping_loading_speed"); optgroup->append_single_option_line("filament_stamping_loading_speed");
optgroup->append_single_option_line("filament_stamping_distance"); optgroup->append_single_option_line("filament_stamping_distance");
create_line_with_widget(optgroup.get(), "filament_ramming_parameters", "", [this](wxWindow* parent) { 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); // ORCA modernize button style
wxGetApp().UpdateDarkUI(ramming_dialog_btn); Button* btn = new Button(parent, _(L("Set")) + " " + dots);
ramming_dialog_btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); btn->SetFont(Label::Body_14);
ramming_dialog_btn->SetSize(ramming_dialog_btn->GetBestSize()); btn->SetSize(wxSize(FromDIP(120), FromDIP(26)));
auto sizer = new wxBoxSizer(wxHORIZONTAL); btn->SetCornerRadius(FromDIP(4));
sizer->Add(ramming_dialog_btn); StateColor clr_bg = StateColor(
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Pressed),
std::pair(wxColour("#D4D4D4"), (int)StateColor::Hovered),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Normal),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Enabled)
);
btn->SetBackgroundColor(clr_bg);
btn->SetBorderColor(clr_bg);
btn->SetTextColor(StateColor(
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
));
ramming_dialog_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) { auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn);
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {
RammingDialog dlg(this,(m_config->option<ConfigOptionStrings>("filament_ramming_parameters"))->get_at(0)); RammingDialog dlg(this,(m_config->option<ConfigOptionStrings>("filament_ramming_parameters"))->get_at(0));
if (dlg.ShowModal() == wxID_OK) { if (dlg.ShowModal() == wxID_OK) {
load_key_value("filament_ramming_parameters", dlg.get_parameters()); load_key_value("filament_ramming_parameters", dlg.get_parameters());
@ -5907,10 +5923,27 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All"))); deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font()); deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
wxGetApp().UpdateDarkUI(deps.checkbox, false, true); 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); // ORCA modernize button style
deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); Button* btn = new Button(parent, _(L("Set")) + " " + dots);
deps.btn->SetSize(deps.btn->GetBestSize()); btn->SetFont(Label::Body_14);
btn->SetSize(wxSize(FromDIP(120), FromDIP(26)));
btn->SetCornerRadius(FromDIP(4));
StateColor clr_bg = StateColor(
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Pressed),
std::pair(wxColour("#D4D4D4"), (int)StateColor::Hovered),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Normal),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Enabled)
);
btn->SetBackgroundColor(clr_bg);
btn->SetBorderColor(clr_bg);
btn->SetTextColor(StateColor(
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
));
deps.btn = btn;
auto sizer = new wxBoxSizer(wxHORIZONTAL); auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL); sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL);
@ -5994,10 +6027,25 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
// Return a callback to create a TabPrinter widget to edit bed shape // Return a callback to create a TabPrinter widget to edit bed shape
wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent) wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
{ {
ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer", " " + _(L("Set")) + " " + dots, // ORCA modernize button style
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); Button* btn = new Button(parent, _(L("Set")) + " " + dots);
btn->SetFont(wxGetApp().normal_font()); btn->SetFont(Label::Body_14);
btn->SetSize(btn->GetBestSize()); btn->SetSize(wxSize(FromDIP(120), FromDIP(26)));
btn->SetCornerRadius(FromDIP(4));
StateColor clr_bg = StateColor(
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Pressed),
std::pair(wxColour("#D4D4D4"), (int)StateColor::Hovered),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Normal),
std::pair(wxColour("#DFDFDF"), (int)StateColor::Enabled)
);
btn->SetBackgroundColor(clr_bg);
btn->SetBorderColor(clr_bg);
btn->SetTextColor(StateColor(
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
));
auto sizer = new wxBoxSizer(wxHORIZONTAL); auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL); sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL);

View file

@ -164,7 +164,7 @@ protected:
struct PresetDependencies { struct PresetDependencies {
Preset::Type type = Preset::TYPE_INVALID; Preset::Type type = Preset::TYPE_INVALID;
wxCheckBox *checkbox = nullptr; wxCheckBox *checkbox = nullptr;
ScalableButton *btn = nullptr; Button *btn = nullptr;
std::string key_list; // "compatible_printers" std::string key_list; // "compatible_printers"
std::string key_condition; std::string key_condition;
wxString dialog_title; wxString dialog_title;

View file

@ -11,6 +11,10 @@ static std::map<wxColour, wxColour> gDarkColors{
{"#FF6F00", "#D15B00"}, // rgb(255, 111, 0) Secondary color {"#FF6F00", "#D15B00"}, // rgb(255, 111, 0) Secondary color
{"#D01B1B", "#BB2A3A"}, // rgb(208, 27, 27) ??? {"#D01B1B", "#BB2A3A"}, // rgb(208, 27, 27) ???
{"#262E30", "#EFEFF0"}, // rgb(38, 46, 48) Button text color | Input Text Color {"#262E30", "#EFEFF0"}, // rgb(38, 46, 48) Button text color | Input Text Color
{"#DFDFDF", "#3E3E45"}, // rgb(223, 223, 223) Button Background color
{"#D4D4D4", "#4D4D54"}, // rgb(212, 212, 212) Button Background color on Hover
{"#6B6A6A", "#909090"}, // rgb(107, 107, 106) Button Dimmed text
{"#6B6B6A", "#B3B3B5"}, // rgb(107, 107, 106) Input box side text
{"#2C2C2E", "#B3B3B4"}, // rgb(44, 44, 46) ??? {"#2C2C2E", "#B3B3B4"}, // rgb(44, 44, 46) ???
{"#6B6B6B", "#818183"}, // rgb(107, 107, 107) Disabled Text {"#6B6B6B", "#818183"}, // rgb(107, 107, 107) Disabled Text
{"#ACACAC", "#65656A"}, // rgb(172, 172, 172) Disabled Text on boxes | Dimmed Elements {"#ACACAC", "#65656A"}, // rgb(172, 172, 172) Disabled Text on boxes | Dimmed Elements
@ -28,7 +32,6 @@ static std::map<wxColour, wxColour> gDarkColors{
{"#DBDBDB", "#4A4A51"}, // rgb(219, 219, 219) Input/Combo Box Border Color {"#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 {"#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 | {"#323A3C", "#E5E5E6"}, // rgb(50, 58, 60) Text color used on search list |
{"#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 {"#303A3C", "#E5E5E5"}, // rgb(48, 58, 60) Object Table > Column header text color | StaticBox Border Color
{"#FEFFFF", "#242428"}, // rgb(254, 255, 255) Side Tabbar bg | {"#FEFFFF", "#242428"}, // rgb(254, 255, 255) Side Tabbar bg |
{"#A6A9AA", "#2D2D29"}, // rgb(166, 169, 170) Seperator color {"#A6A9AA", "#2D2D29"}, // rgb(166, 169, 170) Seperator color