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:
@@ -342,17 +342,7 @@ AboutDialog::AboutDialog()
|
||||
}
|
||||
//Add "Portions copyright" button
|
||||
Button* button_portions = new Button(this,_L("Portions copyright"));
|
||||
StateColor report_bg(std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Disabled), 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::Enabled),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
||||
button_portions->SetBackgroundColor(report_bg);
|
||||
StateColor report_bd(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
|
||||
button_portions->SetBorderColor(report_bd);
|
||||
StateColor report_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(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)));
|
||||
button_portions->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
|
||||
wxBoxSizer *copyright_button_ver = new wxBoxSizer(wxVERTICAL);
|
||||
copyright_button_ver->Add( 0, 0, 0, wxTOP, FromDIP(10));
|
||||
|
||||
@@ -228,22 +228,9 @@ void BedShapePanel::build_panel(const Pointfs& default_pt, const std::string& cu
|
||||
Line line{ "", "" };
|
||||
line.full_width = 1;
|
||||
line.widget = [this](wxWindow* parent) {
|
||||
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)
|
||||
);
|
||||
StateColor clr_tx = StateColor(
|
||||
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
|
||||
);
|
||||
Button* shape_btn = new Button(parent, _L("Load shape from STL..."));
|
||||
shape_btn->SetBackgroundColor(clr_bg);
|
||||
shape_btn->SetBorderColor(clr_bg);
|
||||
shape_btn->SetTextColor(clr_tx);
|
||||
shape_btn->SetStyle(ButtonStyle::Regular, ButtonType::Expanded);
|
||||
|
||||
wxSizer* shape_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
shape_sizer->Add(shape_btn, 1, wxEXPAND);
|
||||
|
||||
@@ -324,41 +311,22 @@ wxPanel* BedShapePanel::init_texture_panel()
|
||||
Line line{ "", "" };
|
||||
line.full_width = 1;
|
||||
line.widget = [this](wxWindow* parent) {
|
||||
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)
|
||||
);
|
||||
StateColor clr_tx = StateColor(
|
||||
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
|
||||
);
|
||||
|
||||
Button* load_btn = new Button(parent, _L("Load..."));
|
||||
load_btn->SetBackgroundColor(clr_bg);
|
||||
load_btn->SetBorderColor(clr_bg);
|
||||
load_btn->SetTextColor(clr_tx);
|
||||
load_btn->SetStyle(ButtonStyle::Regular, ButtonType::Expanded);
|
||||
|
||||
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->SetBackgroundColor(clr_bg);
|
||||
remove_btn->SetBorderColor(clr_bg);
|
||||
remove_btn->SetTextColor(clr_tx);
|
||||
remove_btn->SetStyle(ButtonStyle::Regular, ButtonType::Expanded);
|
||||
|
||||
wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
remove_sizer->Add(remove_btn, 1, wxEXPAND);
|
||||
|
||||
wxGetApp().UpdateDarkUI(load_btn);
|
||||
wxGetApp().UpdateDarkUI(remove_btn);
|
||||
|
||||
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(filename_sizer, 1, wxEXPAND);
|
||||
sizer->Add(load_sizer, 1, wxEXPAND);
|
||||
@@ -420,23 +388,9 @@ wxPanel* BedShapePanel::init_model_panel()
|
||||
Line line{ "", "" };
|
||||
line.full_width = 1;
|
||||
line.widget = [this](wxWindow* parent) {
|
||||
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)
|
||||
);
|
||||
StateColor clr_tx = StateColor(
|
||||
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
|
||||
);
|
||||
|
||||
Button* load_btn = new Button(parent, _L("Load..."));
|
||||
load_btn->SetBackgroundColor(clr_bg);
|
||||
load_btn->SetBorderColor(clr_bg);
|
||||
load_btn->SetTextColor(clr_tx);
|
||||
load_btn->SetStyle(ButtonStyle::Regular, ButtonType::Expanded);
|
||||
|
||||
wxSizer* load_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
load_sizer->Add(load_btn, 1, wxEXPAND);
|
||||
|
||||
@@ -445,15 +399,11 @@ wxPanel* BedShapePanel::init_model_panel()
|
||||
filename_sizer->Add(filename_lbl, 1, wxEXPAND);
|
||||
|
||||
Button* remove_btn = new Button(parent, _L("Remove"));
|
||||
remove_btn->SetBackgroundColor(clr_bg);
|
||||
remove_btn->SetBorderColor(clr_bg);
|
||||
remove_btn->SetTextColor(clr_tx);
|
||||
remove_btn->SetStyle(ButtonStyle::Regular, ButtonType::Expanded);
|
||||
|
||||
wxSizer* remove_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
remove_sizer->Add(remove_btn, 1, wxEXPAND);
|
||||
|
||||
wxGetApp().UpdateDarkUI(load_btn);
|
||||
wxGetApp().UpdateDarkUI(remove_btn);
|
||||
|
||||
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(filename_sizer, 1, wxEXPAND);
|
||||
sizer->Add(load_sizer, 1, wxEXPAND);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -378,62 +378,33 @@ wxBoxSizer* FileArchiveDialog::create_btn_sizer()
|
||||
{
|
||||
auto btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
auto apply_highlighted_btn_colors = [](Button* btn) {
|
||||
btn->SetBackgroundColor(StateColor(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)));
|
||||
|
||||
btn->SetBorderColor(StateColor(std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)));
|
||||
|
||||
btn->SetTextColor(StateColor(std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Normal)));
|
||||
};
|
||||
|
||||
auto apply_std_btn_colors = [](Button* btn) {
|
||||
btn->SetBackgroundColor(StateColor(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)));
|
||||
|
||||
btn->SetBorderColor(StateColor(std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Normal)));
|
||||
|
||||
btn->SetTextColor(StateColor(std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Normal)));
|
||||
};
|
||||
|
||||
auto style_btn = [this, apply_highlighted_btn_colors, apply_std_btn_colors](Button* btn, bool highlight) {
|
||||
btn->SetMinSize(BTN_SIZE);
|
||||
btn->SetCornerRadius(FromDIP(12));
|
||||
if (highlight)
|
||||
apply_highlighted_btn_colors(btn);
|
||||
else
|
||||
apply_std_btn_colors(btn);
|
||||
};
|
||||
|
||||
Button* all_btn = new Button(this, _L("All"));
|
||||
style_btn(all_btn, false);
|
||||
all_btn->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
all_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) { on_all_button(); });
|
||||
btn_sizer->Add(all_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_button_list.push_back(all_btn);
|
||||
|
||||
Button* none_btn = new Button(this, _L("None"));
|
||||
style_btn(none_btn, false);
|
||||
none_btn->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
none_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) { on_none_button(); });
|
||||
btn_sizer->Add(none_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
|
||||
btn_sizer->Add(none_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::WindowButtonGap()));
|
||||
m_button_list.push_back(none_btn);
|
||||
|
||||
btn_sizer->AddStretchSpacer();
|
||||
|
||||
Button* open_btn = new Button(this, _L("Open"));
|
||||
style_btn(open_btn, true);
|
||||
open_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Choice);
|
||||
open_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) { on_open_button(); });
|
||||
open_btn->SetFocus();
|
||||
open_btn->SetId(wxID_OK);
|
||||
btn_sizer->Add(open_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
|
||||
btn_sizer->Add(open_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceButtonGap()));
|
||||
m_button_list.push_back(open_btn);
|
||||
|
||||
Button* cancel_btn = new Button(this, _L("Cancel"));
|
||||
style_btn(cancel_btn, false);
|
||||
cancel_btn->SetStyle(ButtonStyle::Regular, ButtonType::Choice);
|
||||
cancel_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) { this->EndModal(wxID_CANCEL); });
|
||||
cancel_btn->SetId(wxID_CANCEL);
|
||||
btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
|
||||
btn_sizer->Add(cancel_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_button_list.push_back(cancel_btn);
|
||||
|
||||
return btn_sizer;
|
||||
|
||||
@@ -109,6 +109,7 @@ void MsgDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
|
||||
while (i != m_buttons.end()) {
|
||||
MsgButton *bd = i->second;
|
||||
/* ORCA not required since all buttons has same size and Rescale re applies its style
|
||||
wxSize bsize;
|
||||
|
||||
|
||||
@@ -120,6 +121,8 @@ void MsgDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
}
|
||||
|
||||
bd->buttondata->button->SetMinSize(bsize);
|
||||
*/
|
||||
bd->buttondata->button->Rescale();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -137,11 +140,13 @@ void MsgDialog::SetButtonLabel(wxWindowID btn_id, const wxString& label, bool se
|
||||
Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, const wxString& label/* = wxString()*/)
|
||||
{
|
||||
Button* btn = new Button(this, label, "", 0, 0, btn_id);
|
||||
/* ORCA not required since all buttons has same size and Rescale re applies its style
|
||||
ButtonSizeType type;
|
||||
|
||||
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);
|
||||
@@ -153,58 +158,26 @@ 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, 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 btn_bd_green(
|
||||
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor btn_text_green(
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor btn_bg_white(
|
||||
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 btn_bd_white(
|
||||
std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Normal)
|
||||
);
|
||||
|
||||
StateColor btn_text_white(
|
||||
std::pair<wxColour, int>(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);
|
||||
btn->SetStyle(ButtonStyle::Confirm, ButtonType::Choice);
|
||||
}
|
||||
|
||||
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(ButtonStyle::Regular, ButtonType::Choice);
|
||||
}
|
||||
|
||||
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::ChoiceButtonGap()));
|
||||
btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { EndModal(btn_id); });
|
||||
|
||||
MsgButton *mb = new MsgButton;
|
||||
ButtonData *bd = new ButtonData;
|
||||
|
||||
bd->button = btn;
|
||||
bd->type = type;
|
||||
//bd->type = type;
|
||||
|
||||
mb->id = wxString::Format("%d", m_buttons.size());
|
||||
mb->buttondata = bd;
|
||||
@@ -499,28 +472,14 @@ 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, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*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_cancel_btn = new Button(this, _L("Cancel"));
|
||||
m_cancel_btn->SetStyle(ButtonStyle::Regular, ButtonType::Choice);
|
||||
bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceButtonGap()));
|
||||
|
||||
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->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_del_btn->SetStyle(ButtonStyle::Alert, ButtonType::Choice);
|
||||
bSizer_button->Add(m_del_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(ButtonProps::ChoiceButtonGap()));
|
||||
|
||||
m_main_sizer->Add(bSizer_button, 0, wxEXPAND, 0);
|
||||
m_del_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); });
|
||||
@@ -607,21 +566,12 @@ 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, 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 btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(*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->SetStyle(ButtonStyle::Regular, ButtonType::Choice);
|
||||
horizontal_sizer->Add(m_update_btn, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceButtonGap()));
|
||||
|
||||
m_update_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_OK);
|
||||
@@ -637,19 +587,12 @@ 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->SetStyle(ButtonStyle::Regular, ButtonType::Choice);
|
||||
} 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(ButtonStyle::Confirm, ButtonType::Choice);
|
||||
}
|
||||
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));
|
||||
horizontal_sizer->Add(m_later_btn, 0, wxRIGHT, FromDIP(ButtonProps::ChoiceButtonGap()));
|
||||
m_later_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_OK);
|
||||
});
|
||||
@@ -723,22 +666,14 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent)
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
auto bt_enable = StateColor(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(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(ButtonStyle::Confirm, ButtonType::Choice);
|
||||
m_button_confirm->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {EndModal(wxCLOSE);});
|
||||
|
||||
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::ChoiceButtonGap()));
|
||||
|
||||
sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
|
||||
sizer_main->Add(0, 0, 0, wxTOP, 20);
|
||||
|
||||
@@ -56,21 +56,20 @@ NetworkTestDialog::NetworkTestDialog(wxWindow* parent, wxWindowID id, const wxSt
|
||||
|
||||
wxBoxSizer* NetworkTestDialog::create_top_sizer(wxWindow* parent)
|
||||
{
|
||||
StateColor 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(255, 255, 255), StateColor::Enabled));
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
auto line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn_start = new Button(this, _L("Start Test Multi-Thread"));
|
||||
btn_start->SetBackgroundColor(btn_bg);
|
||||
btn_start->SetStyle(ButtonStyle::Confirm, ButtonType::Window);
|
||||
line_sizer->Add(btn_start, 0, wxALL, 5);
|
||||
|
||||
btn_start_sequence = new Button(this, _L("Start Test Single-Thread"));
|
||||
btn_start_sequence->SetBackgroundColor(btn_bg);
|
||||
btn_start_sequence->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
|
||||
line_sizer->Add(btn_start_sequence, 0, wxALL, 5);
|
||||
|
||||
btn_download_log = new Button(this, _L("Export Log"));
|
||||
btn_download_log->SetBackgroundColor(btn_bg);
|
||||
btn_download_log->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
line_sizer->Add(btn_download_log, 0, wxALL, 5);
|
||||
btn_download_log->Hide();
|
||||
|
||||
@@ -138,31 +137,30 @@ wxBoxSizer* NetworkTestDialog::create_content_sizer(wxWindow* parent)
|
||||
grid_sizer->SetFlexibleDirection(wxBOTH);
|
||||
grid_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||
|
||||
StateColor 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(255,255,255), StateColor::Enabled));
|
||||
btn_link = new Button(this, _L("Test OrcaSlicer (GitHub)"));
|
||||
btn_link->SetBackgroundColor(btn_bg);
|
||||
btn_link->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
grid_sizer->Add(btn_link, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_link_title = new wxStaticText(this, wxID_ANY, _L("Test OrcaSlicer (GitHub):"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_link_title->Wrap(-1);
|
||||
grid_sizer->Add(text_link_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
grid_sizer->Add(text_link_title, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
text_link_val = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_link_val->Wrap(-1);
|
||||
grid_sizer->Add(text_link_val, 0, wxALL, 5);
|
||||
grid_sizer->Add(text_link_val, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
btn_bing = new Button(this, _L("Test bing.com"));
|
||||
btn_bing->SetBackgroundColor(btn_bg);
|
||||
btn_bing->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
grid_sizer->Add(btn_bing, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
text_bing_title = new wxStaticText(this, wxID_ANY, _L("Test bing.com:"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
|
||||
text_bing_title->Wrap(-1);
|
||||
grid_sizer->Add(text_bing_title, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
grid_sizer->Add(text_bing_title, 0, wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
text_bing_val = new wxStaticText(this, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
text_bing_val->Wrap(-1);
|
||||
grid_sizer->Add(text_bing_val, 0, wxALL, 5);
|
||||
grid_sizer->Add(text_bing_val, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
sizer->Add(grid_sizer, 1, wxEXPAND, 5);
|
||||
|
||||
btn_link->Bind(wxEVT_BUTTON, [this](wxCommandEvent& evt) {
|
||||
|
||||
@@ -136,25 +136,8 @@ 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)->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)
|
||||
));
|
||||
*btn = new Button(parent, label);
|
||||
(*btn)->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
|
||||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(*btn);
|
||||
@@ -253,6 +236,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||
//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") + " " + dots);
|
||||
Button* btn = m_printhost_port_browse_btn;
|
||||
btn->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
|
||||
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent e) { update_printers(); });
|
||||
return sizer;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "Widgets/RoundedRectangle.hpp"
|
||||
#include "Widgets/Button.hpp"
|
||||
|
||||
class wxTextCtrl;
|
||||
class wxStaticText;
|
||||
|
||||
@@ -887,29 +887,8 @@ Sidebar::Sidebar(Plater *parent)
|
||||
// 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->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, int>(wxColour("#BFE1DE"), StateColor::Pressed), // ORCA
|
||||
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));
|
||||
|
||||
p->m_flushing_volume_btn->SetBackgroundColor(flush_bg_col);
|
||||
p->m_flushing_volume_btn->SetBorderColor(flush_bd_col);
|
||||
p->m_flushing_volume_btn->SetTextColor(flush_fg_col);
|
||||
p->m_flushing_volume_btn->SetFocus();
|
||||
p->m_flushing_volume_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Compact);
|
||||
p->m_flushing_volume_btn->SetId(wxID_RESET);
|
||||
p->m_flushing_volume_btn->Rescale();
|
||||
|
||||
p->m_flushing_volume_btn->Bind(wxEVT_BUTTON, ([parent](wxCommandEvent &e)
|
||||
{
|
||||
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||
|
||||
@@ -860,19 +860,7 @@ wxBoxSizer* PreferencesDialog::create_item_button(
|
||||
m_staticTextPath->SetToolTip(tooltip);
|
||||
|
||||
auto m_button_download = new Button(parent, title2);
|
||||
|
||||
StateColor abort_bg(std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Disabled), 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::Enabled),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
||||
m_button_download->SetBackgroundColor(abort_bg);
|
||||
StateColor abort_bd(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
|
||||
m_button_download->SetBorderColor(abort_bd);
|
||||
StateColor abort_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(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->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
m_button_download->SetToolTip(tooltip2);
|
||||
|
||||
m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); });
|
||||
@@ -903,19 +891,7 @@ 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, int>(wxColour(255, 255, 255), StateColor::Disabled), 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::Enabled),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
||||
m_button_download->SetBackgroundColor(abort_bg);
|
||||
StateColor abort_bd(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
|
||||
m_button_download->SetBorderColor(abort_bd);
|
||||
StateColor abort_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(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->SetStyle(ButtonStyle::Regular, ButtonType::Window);
|
||||
|
||||
m_button_download->Bind(wxEVT_BUTTON, [this, m_staticTextPath, item_panel](auto& e) {
|
||||
wxString defaultPath = wxT("/");
|
||||
@@ -1491,10 +1467,7 @@ wxWindow* PreferencesDialog::create_debug_page()
|
||||
StateColor btn_bd_white(std::pair<wxColour, int>(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(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(ButtonStyle::Regular, ButtonType::Window);
|
||||
|
||||
debug_button->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
// success message box
|
||||
|
||||
@@ -3611,25 +3611,10 @@ 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) {
|
||||
|
||||
// ORCA modernize button style
|
||||
Button* btn = new Button(parent, _(L("Set")) + " " + dots);
|
||||
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)
|
||||
));
|
||||
btn->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
|
||||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(btn);
|
||||
@@ -6011,23 +5996,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||
|
||||
// ORCA modernize button style
|
||||
Button* btn = new Button(parent, _(L("Set")) + " " + dots);
|
||||
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)
|
||||
));
|
||||
btn->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
|
||||
deps.btn = btn;
|
||||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
@@ -6138,25 +6107,9 @@ 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)
|
||||
{
|
||||
// ORCA modernize button style
|
||||
// ORCA modernize button style
|
||||
Button* btn = new Button(parent, _(L("Set")) + " " + dots);
|
||||
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)
|
||||
));
|
||||
btn->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
|
||||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
@@ -962,25 +962,11 @@ 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, 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));
|
||||
|
||||
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"));
|
||||
} else {
|
||||
(*btn)->SetTextColor(wxColour(107, 107, 107));
|
||||
}
|
||||
|
||||
//(*btn)->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE);
|
||||
(*btn)->SetMinSize(wxSize(-1,-1));
|
||||
(*btn)->SetCornerRadius(FromDIP(12));
|
||||
(*btn)->SetStyle(focus ? ButtonStyle::Confirm : ButtonStyle::Regular, ButtonType::Choice);
|
||||
|
||||
(*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);
|
||||
@@ -994,7 +980,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::ChoiceButtonGap()));
|
||||
};
|
||||
|
||||
// "Transfer" / "Keep" button
|
||||
@@ -1706,9 +1692,9 @@ void UnsavedChangesDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
{
|
||||
int em = em_unit();
|
||||
|
||||
msw_buttons_rescale(this, em, { wxID_CANCEL, m_move_btn_id, m_continue_btn_id });
|
||||
//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->Rescale();
|
||||
|
||||
//m_cancel_btn->SetMinSize(UNSAVE_CHANGE_DIALOG_BUTTON_SIZE);
|
||||
const wxSize& size = wxSize(70 * em, 30 * em);
|
||||
|
||||
@@ -151,6 +151,79 @@ void Button::SetCenter(bool isCenter)
|
||||
this->isCenter = isCenter;
|
||||
}
|
||||
|
||||
// Background Foreground Border on focus
|
||||
// Button Colors 0-Disabled 1-Pressed 2-Hover 3-Normal 4-Enabled 5-Disabled 6-Normal 7-Hover 8-Dark 9-Light
|
||||
wxString btn_regular[10] = {"#DFDFDF", "#DFDFDF", "#D4D4D4", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#262E30", "#262E30", "#009688", "#009688"};
|
||||
wxString btn_confirm[10] = {"#DFDFDF", "#009688", "#26A69A", "#009688", "#009688", "#6B6A6A", "#FEFEFE", "#FEFEFE", "#26A69A", "#00FFD4"};
|
||||
wxString btn_alert[10] = {"#DFDFDF", "#DFDFDF", "#E14747", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#262E30", "#FFFFFD", "#009688", "#009688"};
|
||||
wxString btn_disabled[10] = {"#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#DFDFDF", "#6B6A6A", "#6B6A6A", "#262E30", "#DFDFDF", "#DFDFDF"};
|
||||
|
||||
void Button::SetStyle(const ButtonStyle style, const ButtonType type)
|
||||
{
|
||||
if (type == ButtonType::Compact) {
|
||||
this->SetPaddingSize(FromDIP(wxSize(8,3)));
|
||||
this->SetCornerRadius(this->FromDIP(8));
|
||||
this->SetFont(Label::Body_10);
|
||||
}
|
||||
else if (type == ButtonType::Window) {
|
||||
this->SetSize(FromDIP(wxSize(58,24)));
|
||||
this->SetMinSize(FromDIP(wxSize(58,24)));
|
||||
this->SetCornerRadius(this->FromDIP(12));
|
||||
this->SetFont(Label::Body_12);
|
||||
}
|
||||
else if (type == ButtonType::Choice) {
|
||||
this->SetMinSize(FromDIP(wxSize(100,32)));
|
||||
this->SetPaddingSize(FromDIP(wxSize(12,8)));
|
||||
this->SetCornerRadius(this->FromDIP(4));
|
||||
this->SetFont(Label::Body_14);
|
||||
}
|
||||
else if (type == ButtonType::Parameter) {
|
||||
this->SetMinSize(FromDIP(wxSize(120,26)));
|
||||
this->SetSize(FromDIP(wxSize(120,26)));
|
||||
this->SetCornerRadius(this->FromDIP(4));
|
||||
this->SetFont(Label::Body_14);
|
||||
}
|
||||
else if (type == ButtonType::Expanded) {
|
||||
this->SetMinSize(FromDIP(wxSize(-1,32)));
|
||||
this->SetPaddingSize(FromDIP(wxSize(12,8)));
|
||||
this->SetCornerRadius(this->FromDIP(4));
|
||||
this->SetFont(Label::Body_14);
|
||||
}
|
||||
|
||||
this->SetBorderWidth(this->FromDIP(1));
|
||||
|
||||
bool is_dark = StateColor::darkModeColorFor("#FFFFFF") != wxColour("#FFFFFF");
|
||||
|
||||
auto clr_arr = style == ButtonStyle::Regular ? btn_regular :
|
||||
style == ButtonStyle::Confirm ? btn_confirm :
|
||||
style == ButtonStyle::Alert ? btn_alert :
|
||||
style == ButtonStyle::Disabled ? btn_disabled :
|
||||
btn_regular ;
|
||||
|
||||
this->SetBackgroundColor(StateColor(
|
||||
std::pair(wxColour(clr_arr[3]), (int)StateColor::NotHovered),
|
||||
std::pair(wxColour(clr_arr[0]), (int)StateColor::Disabled),
|
||||
std::pair(wxColour(clr_arr[1]), (int)StateColor::Pressed),
|
||||
std::pair(wxColour(clr_arr[2]), (int)StateColor::Hovered),
|
||||
std::pair(wxColour(clr_arr[3]), (int)StateColor::Normal),
|
||||
std::pair(wxColour(clr_arr[4]), (int)StateColor::Enabled)
|
||||
));
|
||||
this->SetBorderColor(StateColor(
|
||||
std::pair(wxColour(clr_arr[3]), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour(clr_arr[0]), (int)StateColor::Disabled),
|
||||
std::pair(wxColour(clr_arr[is_dark ? 8 : 9]), (int)StateColor::Focused)
|
||||
));
|
||||
this->SetTextColor(StateColor(
|
||||
std::pair(wxColour(clr_arr[5]), (int)StateColor::Disabled),
|
||||
std::pair(wxColour(clr_arr[7]), (int)StateColor::Hovered),
|
||||
std::pair(wxColour(clr_arr[6]), (int)StateColor::Normal)
|
||||
));
|
||||
|
||||
m_has_style = true;
|
||||
m_style = style;
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
void Button::Rescale()
|
||||
{
|
||||
if (this->active_icon.bmp().IsOk())
|
||||
@@ -160,6 +233,9 @@ void Button::Rescale()
|
||||
this->inactive_icon.msw_rescale();
|
||||
|
||||
messureSize();
|
||||
|
||||
if(m_has_style)
|
||||
SetStyle(m_style, m_type);
|
||||
}
|
||||
|
||||
void Button::paintEvent(wxPaintEvent& evt)
|
||||
@@ -334,4 +410,4 @@ WXLRESULT Button::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
|
||||
#endif
|
||||
|
||||
bool Button::AcceptsFocus() const { return canFocus; }
|
||||
bool Button::AcceptsFocus() const { return canFocus; }
|
||||
@@ -4,6 +4,28 @@
|
||||
#include "../wxExtensions.hpp"
|
||||
#include "StaticBox.hpp"
|
||||
|
||||
class ButtonProps
|
||||
{
|
||||
public:
|
||||
static int ChoiceButtonGap(){return 10;};
|
||||
static int WindowButtonGap(){return 10;};
|
||||
};
|
||||
|
||||
enum class ButtonStyle{
|
||||
Regular,
|
||||
Confirm,
|
||||
Alert,
|
||||
Disabled,
|
||||
};
|
||||
|
||||
enum class ButtonType{
|
||||
Compact , // Font10 FullyRounded For spaces with less areas
|
||||
Window , // Font12 FullyRounded For regular buttons in windows and not related with parameter boxes
|
||||
Choice , // Font14 Semi-Rounded For dialog/window choice buttons
|
||||
Parameter, // Font14 Semi-Rounded For buttons that near parameter boxes
|
||||
Expanded , // Font14 Semi-Rounded For full length buttons. ex. buttons in static box
|
||||
};
|
||||
|
||||
class Button : public StaticBox
|
||||
{
|
||||
wxRect textSize;
|
||||
@@ -40,7 +62,9 @@ public:
|
||||
void SetMinSize(const wxSize& size) override;
|
||||
|
||||
void SetPaddingSize(const wxSize& size);
|
||||
|
||||
|
||||
void SetStyle(const ButtonStyle style /*= ButtonStyle::Regular*/, const ButtonType type /*= ButtonType::None*/);
|
||||
|
||||
void SetTextColor(StateColor const &color);
|
||||
|
||||
void SetTextColorNormal(wxColor const &color);
|
||||
@@ -67,6 +91,10 @@ protected:
|
||||
bool AcceptsFocus() const override;
|
||||
|
||||
private:
|
||||
bool m_has_style = false;
|
||||
ButtonStyle m_style;
|
||||
ButtonType m_type;
|
||||
|
||||
void paintEvent(wxPaintEvent& evt);
|
||||
|
||||
void render(wxDC& dc);
|
||||
|
||||
@@ -95,30 +95,8 @@ void DialogButtons::SetPrimaryButton(wxString translated_label) {
|
||||
// apply focus only if there is no focused element exist. this prevents stealing focus from input boxes
|
||||
if(m_parent->FindFocus() == nullptr)
|
||||
btn->SetFocus();
|
||||
|
||||
// we won't need color definations after button style management
|
||||
bool is_dark = wxGetApp().dark_mode();
|
||||
StateColor clr_bg = StateColor(
|
||||
std::pair(wxColour("#009688"), (int)StateColor::NotHovered),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#009688"), (int)StateColor::Pressed),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#009688"), (int)StateColor::Normal),
|
||||
std::pair(wxColour("#009688"), (int)StateColor::Enabled)
|
||||
);
|
||||
btn->SetBackgroundColor(clr_bg);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#009688"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour(is_dark ? "#26A69A" : "#00FFD4"), (int)StateColor::Focused)
|
||||
);
|
||||
btn->SetBorderColor(clr_br);
|
||||
StateColor clr_tx = StateColor(
|
||||
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#FEFEFE"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#FEFEFE"), (int)StateColor::Normal)
|
||||
);
|
||||
btn->SetTextColor(clr_tx);
|
||||
|
||||
btn->SetStyle(ButtonStyle::Confirm, ButtonType::Choice);
|
||||
}
|
||||
|
||||
void DialogButtons::SetAlertButton(wxString translated_label) {
|
||||
@@ -136,66 +114,16 @@ void DialogButtons::SetAlertButton(wxString translated_label) {
|
||||
|
||||
m_alert = translated_label;
|
||||
|
||||
// we won't need color definations after button style management
|
||||
StateColor clr_bg = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotHovered),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Pressed),
|
||||
std::pair(wxColour("#CD1F00"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Normal),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Enabled)
|
||||
);
|
||||
btn->SetBackgroundColor(clr_bg);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
);
|
||||
btn->SetBorderColor(clr_br);
|
||||
StateColor clr_tx = StateColor(
|
||||
std::pair(wxColour("#CD1F00"), (int)StateColor::NotHovered),
|
||||
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#CD1F00"), (int)StateColor::Pressed),
|
||||
std::pair(wxColour("#FFFFFD"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#CD1F00"), (int)StateColor::Focused),
|
||||
std::pair(wxColour("#CD1F00"), (int)StateColor::Normal)
|
||||
);
|
||||
btn->SetTextColor(clr_tx);
|
||||
btn->SetStyle(ButtonStyle::Alert, ButtonType::Choice);
|
||||
}
|
||||
|
||||
void DialogButtons::UpdateButtons() {
|
||||
m_sizer->Clear();
|
||||
SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#FFFFFF")));
|
||||
// we won't need color definations after button style management
|
||||
StateColor clr_bg = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotHovered),
|
||||
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)
|
||||
);
|
||||
StateColor clr_br = StateColor(
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::NotFocused),
|
||||
std::pair(wxColour("#DFDFDF"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#26A69A"), (int)StateColor::Focused)
|
||||
);
|
||||
StateColor clr_tx = StateColor(
|
||||
std::pair(wxColour("#6B6A6A"), (int)StateColor::Disabled),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Hovered),
|
||||
std::pair(wxColour("#262E30"), (int)StateColor::Normal)
|
||||
);
|
||||
|
||||
// Apply standard style to all
|
||||
for (Button* btn : m_buttons) {
|
||||
btn->SetFont(Label::Body_14);
|
||||
btn->SetMinSize(wxSize(FromDIP(100),FromDIP(32)));
|
||||
btn->SetPaddingSize(wxSize(FromDIP(12), FromDIP(8)));
|
||||
btn->SetCornerRadius(FromDIP(4));
|
||||
btn->SetBorderWidth(FromDIP(1));
|
||||
btn->SetBackgroundColor(clr_bg);
|
||||
btn->SetBorderColor(clr_br);
|
||||
btn->SetTextColor(clr_tx);
|
||||
btn->SetStyle(ButtonStyle::Regular, ButtonType::Choice);
|
||||
btn->Bind(wxEVT_KEY_DOWN, &DialogButtons::on_keydown, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,9 +243,7 @@ bool ProgressDialog::Create(const wxString &title, const wxString &message, int
|
||||
|
||||
if (HasPDFlag(wxPD_CAN_ABORT)) {
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetTextColor(PROGRESSDIALOG_GREY_700);
|
||||
m_button_cancel->SetMinSize(PROGRESSDIALOG_CANCEL_BUTTON_SIZE);
|
||||
m_button_cancel->SetCornerRadius(PROGRESSDIALOG_CANCEL_BUTTON_SIZE.y / 2);
|
||||
m_button_cancel->SetStyle(ButtonStyle::Regular, ButtonType::Choice);
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &event) {
|
||||
if (m_state == Finished) {
|
||||
event.Skip();
|
||||
|
||||
@@ -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