class for DialogButtons (#9639)

* init

* match code

* update

* Update DialogButtons.hpp

* make Ok uppercase

* update

* fix and cleanup

* Update DialogButtons.cpp

* update

* Update DialogButtons.cpp

* update

* Update CreatePresetsDialog.cpp

* update

* update

* update
This commit is contained in:
yw4z 2025-06-04 04:30:36 +03:00 committed by GitHub
parent 91ffc79c7b
commit dd549a6c52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 486 additions and 548 deletions

View File

@ -14,6 +14,8 @@ set(SLIC3R_GUI_SOURCES
GUI/Widgets/Button.hpp GUI/Widgets/Button.hpp
GUI/Widgets/CheckBox.cpp GUI/Widgets/CheckBox.cpp
GUI/Widgets/CheckBox.hpp GUI/Widgets/CheckBox.hpp
GUI/Widgets/DialogButtons.cpp
GUI/Widgets/DialogButtons.hpp
GUI/Widgets/RadioBox.hpp GUI/Widgets/RadioBox.hpp
GUI/Widgets/RadioBox.cpp GUI/Widgets/RadioBox.cpp
GUI/Widgets/ProgressDialog.hpp GUI/Widgets/ProgressDialog.hpp

View File

@ -12,6 +12,8 @@
#include "libslic3r/Model.hpp" #include "libslic3r/Model.hpp"
#include "libslic3r/Polygon.hpp" #include "libslic3r/Polygon.hpp"
#include "Widgets/DialogButtons.hpp"
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
@ -143,7 +145,10 @@ void BedShapeDialog::build_dialog(const Pointfs& default_pt, const ConfigOptionS
auto main_sizer = new wxBoxSizer(wxVERTICAL); auto main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(m_panel, 1, wxEXPAND); main_sizer->Add(m_panel, 1, wxEXPAND);
main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10);
auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
main_sizer->Add(dlg_btns, 0, wxEXPAND);
wxGetApp().UpdateDlgDarkUI(this); wxGetApp().UpdateDlgDarkUI(this);

View File

@ -684,7 +684,7 @@ CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent)
m_scrolled_sizer->Add(0, 0, 0, wxTOP, FromDIP(5)); m_scrolled_sizer->Add(0, 0, 0, wxTOP, FromDIP(5));
m_scrolled_preset_panel->SetSizerAndFit(m_scrolled_sizer); m_scrolled_preset_panel->SetSizerAndFit(m_scrolled_sizer);
m_main_sizer->Add(m_scrolled_preset_panel, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10)); m_main_sizer->Add(m_scrolled_preset_panel, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(10));
m_main_sizer->Add(create_button_item(), 0, wxEXPAND | wxALL, FromDIP(10)); m_main_sizer->Add(create_dialog_buttons(), 0, wxEXPAND);
get_all_visible_printer_name(); get_all_visible_printer_name();
select_curr_radiobox(m_create_type_btns, 0); select_curr_radiobox(m_create_type_btns, 0);
@ -709,14 +709,6 @@ CreateFilamentPresetDialog::~CreateFilamentPresetDialog()
} }
void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { 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));
Layout(); Layout();
} }
@ -1018,25 +1010,13 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_for_printer_item(
return vertical_sizer; return vertical_sizer;
} }
wxBoxSizer *CreateFilamentPresetDialog::create_button_item() wxWindow *CreateFilamentPresetDialog::create_dialog_buttons()
{ {
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
bSizer_button->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), auto btn_ok = dlg_btns->GetOK();
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)); btn_ok->SetLabel(_L("Create"));
btn_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
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->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) {
//get vendor name //get vendor name
wxString vendor_str = m_filament_vendor_combobox->GetLabel(); wxString vendor_str = m_filament_vendor_combobox->GetLabel();
std::string vendor_name; std::string vendor_name;
@ -1194,23 +1174,11 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
EndModal(wxID_OK); EndModal(wxID_OK);
}); });
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
std::pair<wxColour, int>(*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));
bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10));
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
EndModal(wxID_CANCEL); EndModal(wxID_CANCEL);
}); });
return bSizer_button; return dlg_btns;
} }
wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices() wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
@ -1598,7 +1566,7 @@ CreatePrinterPresetDialog::CreatePrinterPresetDialog(wxWindow *parent)
page_sizer->Add(m_page1, 1, wxEXPAND, 0); page_sizer->Add(m_page1, 1, wxEXPAND, 0);
page_sizer->Add(m_page2, 1, wxEXPAND, 0); page_sizer->Add(m_page2, 1, wxEXPAND, 0);
m_main_sizer->Add(page_sizer, 0, wxEXPAND | wxRIGHT, FromDIP(10)); m_main_sizer->Add(page_sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(5)); // ORCA use equal border for both sides
select_curr_radiobox(m_create_type_btns, 0); select_curr_radiobox(m_create_type_btns, 0);
select_curr_radiobox(m_create_presets_btns, 0); select_curr_radiobox(m_create_presets_btns, 0);
@ -1627,21 +1595,6 @@ CreatePrinterPresetDialog::~CreatePrinterPresetDialog()
} }
void CreatePrinterPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { 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));
Layout(); Layout();
} }
@ -1702,7 +1655,7 @@ void CreatePrinterPresetDialog::create_printer_page1(wxWindow *parent)
m_printer_info_sizer->Add(create_max_print_height_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_printer_info_sizer->Add(create_max_print_height_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
m_printer_info_panel->SetSizer(m_printer_info_sizer); m_printer_info_panel->SetSizer(m_printer_info_sizer);
m_page1_sizer->Add(m_printer_info_panel, 0, wxEXPAND, 0); m_page1_sizer->Add(m_printer_info_panel, 0, wxEXPAND, 0);
m_page1_sizer->Add(create_page1_btns_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_page1_sizer->Add(create_page1_dialog_buttons(parent), 0, wxEXPAND);
parent->SetSizerAndFit(m_page1_sizer); parent->SetSizerAndFit(m_page1_sizer);
Layout(); Layout();
@ -2067,45 +2020,19 @@ wxBoxSizer *CreatePrinterPresetDialog::create_max_print_height_item(wxWindow *pa
return horizontal_sizer; return horizontal_sizer;
} }
wxBoxSizer *CreatePrinterPresetDialog::create_page1_btns_item(wxWindow *parent) wxWindow *CreatePrinterPresetDialog::create_page1_dialog_buttons(wxWindow *parent)
{ {
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); auto dlg_btns = new DialogButtons(parent, {"OK", "Cancel"});
bSizer_button->Add(0, 0, 1, wxEXPAND, 0);
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
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));
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));
bSizer_button->Add(m_button_OK, 0, wxRIGHT, FromDIP(10));
m_button_OK->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
if (!validate_input_valid()) return; if (!validate_input_valid()) return;
data_init(); data_init();
show_page2(); show_page2();
}); });
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
m_button_page1_cancel = new Button(parent, _L("Cancel")); return dlg_btns;
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));
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); });
return bSizer_button;
} }
static std::string last_directory = ""; static std::string last_directory = "";
void CreatePrinterPresetDialog::load_texture() { void CreatePrinterPresetDialog::load_texture() {
@ -2498,7 +2425,7 @@ void CreatePrinterPresetDialog::create_printer_page2(wxWindow *parent)
m_page2_sizer->Add(create_printer_preset_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_page2_sizer->Add(create_printer_preset_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
m_page2_sizer->Add(create_presets_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_page2_sizer->Add(create_presets_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
m_page2_sizer->Add(create_presets_template_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_page2_sizer->Add(create_presets_template_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
m_page2_sizer->Add(create_page2_btns_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_page2_sizer->Add(create_page2_dialog_buttons(parent), 0, wxEXPAND);
parent->SetSizerAndFit(m_page2_sizer); parent->SetSizerAndFit(m_page2_sizer);
Layout(); Layout();
@ -2648,39 +2575,15 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
return vertical_sizer; return vertical_sizer;
} }
wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent) wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *parent)
{ {
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); auto dlg_btns = new DialogButtons(parent, {"Back", "OK", "Cancel"});
bSizer_button->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), dlg_btns->GetBACK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { show_page1(); });
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), auto btn_ok = dlg_btns->GetOK();
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal)); btn_ok->SetLabel(_L("Create"));
btn_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
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));
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));
bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10));
m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
PresetBundle *preset_bundle = wxGetApp().preset_bundle; PresetBundle *preset_bundle = wxGetApp().preset_bundle;
const wxString curr_selected_printer_type = curr_create_printer_type(); const wxString curr_selected_printer_type = curr_create_printer_type();
@ -2925,18 +2828,9 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
}); });
m_button_page2_cancel = new Button(parent, _L("Cancel")); dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_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));
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); }); return dlg_btns;
return bSizer_button;
} }
void CreatePrinterPresetDialog::show_page1() void CreatePrinterPresetDialog::show_page1()
@ -3374,52 +3268,27 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
m_main_sizer->Add(horizontal_sizer, 0, wxALL, FromDIP(5)); m_main_sizer->Add(horizontal_sizer, 0, wxALL, FromDIP(5));
wxBoxSizer *btn_sizer = new wxBoxSizer(wxHORIZONTAL); bool is_cancel_needed = PRINTER == create_success_type || sync_user_preset_need_enabled;
btn_sizer->Add(0, 0, 1, wxEXPAND, 0);
switch (create_success_type) {
case PRINTER:
m_button_ok = new Button(this, _L("Printer Setting"));
break;
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, 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), auto dlg_btns = new DialogButtons(this, is_cancel_needed ? std::vector<wxString>{"OK", "Cancel"} : std::vector<wxString>{"OK"});
std::pair<wxColour, int>(*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));
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) { if (create_success_type == PRINTER)
dlg_btns->GetOK()->SetLabel(_L("Printer Setting"));
else if (create_success_type == FILAMENT && sync_user_preset_need_enabled)
dlg_btns->GetOK()->SetLabel(_L("Sync user presets"));
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this, sync_user_preset_need_enabled](wxMouseEvent &e) {
if (sync_user_preset_need_enabled) { if (sync_user_preset_need_enabled) {
wxGetApp().app_config->set("sync_user_preset", "true"); wxGetApp().app_config->set("sync_user_preset", "true");
wxGetApp().start_sync_user_preset(); wxGetApp().start_sync_user_preset();
} }
EndModal(wxID_OK); EndModal(wxID_OK);
}); });
if (PRINTER == create_success_type || sync_user_preset_need_enabled) { if (is_cancel_needed)
m_button_cancel = new Button(this, _L("Cancel")); dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_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));
btn_sizer->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10));
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
}
m_main_sizer->Add(btn_sizer, 0, wxEXPAND | wxALL, FromDIP(15)); m_main_sizer->Add(dlg_btns, 0, wxEXPAND);
m_main_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
SetSizer(m_main_sizer); SetSizer(m_main_sizer);
Layout(); Layout();
@ -3430,12 +3299,6 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
CreatePresetSuccessfulDialog::~CreatePresetSuccessfulDialog() {} CreatePresetSuccessfulDialog::~CreatePresetSuccessfulDialog() {}
void CreatePresetSuccessfulDialog::on_dpi_changed(const wxRect &suggested_rect) { 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));
Layout(); Layout();
} }
@ -3463,7 +3326,7 @@ ExportConfigsDialog::ExportConfigsDialog(wxWindow *parent)
m_main_sizer->Add(create_export_config_item(this), 0, wxEXPAND | wxALL, FromDIP(5)); m_main_sizer->Add(create_export_config_item(this), 0, wxEXPAND | wxALL, FromDIP(5));
m_main_sizer->Add(create_select_printer(this), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_main_sizer->Add(create_select_printer(this), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
m_main_sizer->Add(create_button_item(this), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_main_sizer->Add(create_dialog_buttons(this), 0, wxEXPAND);
data_init(); data_init();
@ -3517,12 +3380,6 @@ ExportConfigsDialog::~ExportConfigsDialog()
} }
void ExportConfigsDialog::on_dpi_changed(const wxRect &suggested_rect) { 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));
Layout(); Layout();
} }
@ -4168,25 +4025,10 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_process_preset_to_f
return ExportCase::EXPORT_SUCCESS; return ExportCase::EXPORT_SUCCESS;
} }
wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent) wxWindow *ExportConfigsDialog::create_dialog_buttons(wxWindow* parent)
{ {
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); auto dlg_btns = new DialogButtons(parent, {"OK", "Cancel"});
bSizer_button->Add(0, 0, 1, wxEXPAND, 0); dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
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));
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));
bSizer_button->Add(m_button_ok, 0, wxRIGHT, FromDIP(10));
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
if (!has_check_box_selected()) { if (!has_check_box_selected()) {
MessageDialog dlg(this, _L("Please select at least one printer or filament."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), MessageDialog dlg(this, _L("Please select at least one printer or filament."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
wxYES | wxYES_DEFAULT | wxCENTRE); wxYES | wxYES_DEFAULT | wxCENTRE);
@ -4223,21 +4065,9 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent)
EndModal(wxID_OK); EndModal(wxID_OK);
}); });
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
m_button_cancel = new Button(this, _L("Cancel")); return dlg_btns;
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));
bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10));
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
return bSizer_button;
} }
wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent) wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent)
@ -4422,7 +4252,7 @@ EditFilamentPresetDialog::EditFilamentPresetDialog(wxWindow *parent, Filamentinf
m_note_text = new wxStaticText(this, wxID_ANY, _L("Note: If the only preset under this filament is deleted, the filament will be deleted after exiting the dialog.")); m_note_text = new wxStaticText(this, wxID_ANY, _L("Note: If the only preset under this filament is deleted, the filament will be deleted after exiting the dialog."));
m_main_sizer->Add(m_note_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10)); m_main_sizer->Add(m_note_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, FromDIP(10));
m_note_text->Hide(); m_note_text->Hide();
m_main_sizer->Add(create_button_sizer(), 0, wxEXPAND | wxALL, 0); m_main_sizer->Add(create_dialog_buttons(), 0, wxEXPAND);
update_preset_tree(); update_preset_tree();
@ -4434,13 +4264,6 @@ EditFilamentPresetDialog::EditFilamentPresetDialog(wxWindow *parent, Filamentinf
EditFilamentPresetDialog::~EditFilamentPresetDialog() {} EditFilamentPresetDialog::~EditFilamentPresetDialog() {}
void EditFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) { 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));*/
Layout(); Layout();
} }
@ -4731,39 +4554,11 @@ wxBoxSizer *EditFilamentPresetDialog::create_preset_tree_sizer()
return filament_preset_tree_sizer; return filament_preset_tree_sizer;
} }
wxBoxSizer *EditFilamentPresetDialog::create_button_sizer() wxWindow *EditFilamentPresetDialog::create_dialog_buttons()
{ {
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); auto dlg_btns = new DialogButtons(this, {"Delete", "OK"});
m_del_filament_btn = new Button(this, _L("Delete Filament")); dlg_btns->GetButtonFromID(wxID_DELETE)->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) {
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));
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, 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));
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));
bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10));
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_del_filament_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent &e) {
WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted.\n" WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted.\n"
"If you are using this filament on your printer, please reset the filament information for that slot."), "If you are using this filament on your printer, please reset the filament information for that slot."),
_L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE); _L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE);
@ -4803,10 +4598,9 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer()
e.Skip(); e.Skip();
})); }));
m_ok_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); }); dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); });
return bSizer_button;
return dlg_btns;
} }
CreatePresetForPrinterDialog::CreatePresetForPrinterDialog(wxWindow *parent, std::string filament_type, std::string filament_id, std::string filament_vendor, std::string filament_name) CreatePresetForPrinterDialog::CreatePresetForPrinterDialog(wxWindow *parent, std::string filament_type, std::string filament_id, std::string filament_vendor, std::string filament_name)
@ -4837,7 +4631,7 @@ CreatePresetForPrinterDialog::CreatePresetForPrinterDialog(wxWindow *parent, std
main_sizer->Add(create_selected_printer_preset_sizer(), 0, wxALL, FromDIP(10)); main_sizer->Add(create_selected_printer_preset_sizer(), 0, wxALL, FromDIP(10));
main_sizer->Add(create_selected_filament_preset_sizer(), 0, wxALL, FromDIP(10)); main_sizer->Add(create_selected_filament_preset_sizer(), 0, wxALL, FromDIP(10));
main_sizer->Add(create_button_sizer(), 0, wxEXPAND | wxALL, FromDIP(10)); main_sizer->Add(create_dialog_buttons(), 0, wxEXPAND);
this->SetSizer(main_sizer); this->SetSizer(main_sizer);
this->Layout(); this->Layout();
@ -4848,12 +4642,6 @@ CreatePresetForPrinterDialog::CreatePresetForPrinterDialog(wxWindow *parent, std
CreatePresetForPrinterDialog::~CreatePresetForPrinterDialog() {} CreatePresetForPrinterDialog::~CreatePresetForPrinterDialog() {}
void CreatePresetForPrinterDialog::on_dpi_changed(const wxRect &suggested_rect) { 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));
Layout(); Layout();
} }
@ -4943,38 +4731,10 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_selected_filament_preset_sizer(
return select_filament_preset_sizer; return select_filament_preset_sizer;
} }
wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer() wxWindow *CreatePresetForPrinterDialog::create_dialog_buttons()
{ {
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
bSizer_button->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));
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));
bSizer_button->Add(m_ok_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10));
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(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));
bSizer_button->Add(m_cancel_btn, 0, wxRIGHT | wxBOTTOM, FromDIP(10));
m_ok_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
wxString selected_printer_name = m_selected_printer->GetStringSelection(); wxString selected_printer_name = m_selected_printer->GetStringSelection();
std::string printer_name = into_u8(selected_printer_name); std::string printer_name = into_u8(selected_printer_name);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " add preset: get compatible printer name:"; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " add preset: get compatible printer name:";
@ -5015,10 +4775,12 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer()
} }
EndModal(wxID_OK); EndModal(wxID_OK);
}); });
m_cancel_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); }); dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
EndModal(wxID_CANCEL);
return bSizer_button; });
return dlg_btns;
} }
PresetTree::PresetTree(EditFilamentPresetDialog * dialog) PresetTree::PresetTree(EditFilamentPresetDialog * dialog)

View File

@ -10,6 +10,7 @@
#include "Widgets/RadioBox.hpp" #include "Widgets/RadioBox.hpp"
#include "Widgets/CheckBox.hpp" #include "Widgets/CheckBox.hpp"
#include "Widgets/ComboBox.hpp" #include "Widgets/ComboBox.hpp"
#include "Widgets/DialogButtons.hpp"
#include "miniz.h" #include "miniz.h"
#include "ParamsDialog.hpp" #include "ParamsDialog.hpp"
@ -41,7 +42,7 @@ protected:
wxBoxSizer *create_serial_item(); wxBoxSizer *create_serial_item();
wxBoxSizer *create_filament_preset_item(); wxBoxSizer *create_filament_preset_item();
wxBoxSizer *create_filament_preset_for_printer_item(); wxBoxSizer *create_filament_preset_for_printer_item();
wxBoxSizer *create_button_item(); wxWindow *create_dialog_buttons();
private: private:
void clear_filament_preset_map(); void clear_filament_preset_map();
@ -112,13 +113,13 @@ protected:
wxBoxSizer *create_hot_bed_stl_item(wxWindow *parent); wxBoxSizer *create_hot_bed_stl_item(wxWindow *parent);
wxBoxSizer *create_hot_bed_svg_item(wxWindow *parent); wxBoxSizer *create_hot_bed_svg_item(wxWindow *parent);
wxBoxSizer *create_max_print_height_item(wxWindow *parent); wxBoxSizer *create_max_print_height_item(wxWindow *parent);
wxBoxSizer *create_page1_btns_item(wxWindow *parent); wxWindow *create_page1_dialog_buttons(wxWindow *parent);
//Improt Presets Page2 //Improt Presets Page2
void create_printer_page2(wxWindow *parent); void create_printer_page2(wxWindow *parent);
wxBoxSizer *create_printer_preset_item(wxWindow *parent); wxBoxSizer *create_printer_preset_item(wxWindow *parent);
wxBoxSizer *create_presets_item(wxWindow *parent); wxBoxSizer *create_presets_item(wxWindow *parent);
wxBoxSizer *create_presets_template_item(wxWindow *parent); wxBoxSizer *create_presets_template_item(wxWindow *parent);
wxBoxSizer *create_page2_btns_item(wxWindow *parent); wxWindow *create_page2_dialog_buttons(wxWindow *parent);
void show_page1(); void show_page1();
void show_page2(); void show_page2();
@ -168,11 +169,6 @@ private:
Preset * m_printer_preset = nullptr; Preset * m_printer_preset = nullptr;
wxStaticBitmap * m_step_1 = nullptr; wxStaticBitmap * m_step_1 = nullptr;
wxStaticBitmap * m_step_2 = nullptr; wxStaticBitmap * m_step_2 = nullptr;
Button * m_button_OK = nullptr;
Button * m_button_create = nullptr;
Button * m_button_page1_cancel = nullptr;
Button * m_button_page2_cancel = nullptr;
Button * m_button_page2_back = nullptr;
Button * m_button_bed_stl = nullptr; Button * m_button_bed_stl = nullptr;
Button * m_button_bed_svg = nullptr; Button * m_button_bed_svg = nullptr;
wxScrolledWindow * m_page1 = nullptr; wxScrolledWindow * m_page1 = nullptr;
@ -224,9 +220,6 @@ public:
protected: protected:
void on_dpi_changed(const wxRect &suggested_rect) override; void on_dpi_changed(const wxRect &suggested_rect) override;
private:
Button *m_button_ok = nullptr;
Button *m_button_cancel = nullptr;
}; };
class ExportConfigsDialog : public DPIDialog class ExportConfigsDialog : public DPIDialog
@ -267,7 +260,7 @@ private:
std::string initial_file_path(const wxString &path, const std::string &sub_file_path); std::string initial_file_path(const wxString &path, const std::string &sub_file_path);
std::string initial_file_name(const wxString &path, const std::string file_name); std::string initial_file_name(const wxString &path, const std::string file_name);
wxBoxSizer *create_export_config_item(wxWindow *parent); wxBoxSizer *create_export_config_item(wxWindow *parent);
wxBoxSizer *create_button_item(wxWindow *parent); wxWindow *create_dialog_buttons(wxWindow *parent);
wxBoxSizer *create_select_printer(wxWindow *parent); wxBoxSizer *create_select_printer(wxWindow *parent);
wxBoxSizer *create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list); wxBoxSizer *create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list);
int initial_zip_archive(mz_zip_archive &zip_archive, const std::string &file_path); int initial_zip_archive(mz_zip_archive &zip_archive, const std::string &file_path);
@ -292,8 +285,6 @@ private:
wxScrolledWindow * m_scrolled_preset_window = nullptr; wxScrolledWindow * m_scrolled_preset_window = nullptr;
wxGridSizer * m_preset_sizer = nullptr; wxGridSizer * m_preset_sizer = nullptr;
wxPanel * m_presets_window = nullptr; wxPanel * m_presets_window = nullptr;
Button * m_button_ok = nullptr;
Button * m_button_cancel = nullptr;
wxStaticText * m_serial_text = nullptr; wxStaticText * m_serial_text = nullptr;
}; };
@ -308,7 +299,7 @@ private:
void get_visible_printer_and_compatible_filament_presets(); void get_visible_printer_and_compatible_filament_presets();
wxBoxSizer *create_selected_printer_preset_sizer(); wxBoxSizer *create_selected_printer_preset_sizer();
wxBoxSizer *create_selected_filament_preset_sizer(); wxBoxSizer *create_selected_filament_preset_sizer();
wxBoxSizer *create_button_sizer(); wxWindow *create_dialog_buttons();
private: private:
std::string m_filament_id; std::string m_filament_id;
@ -318,11 +309,8 @@ private:
std::shared_ptr<PresetBundle> m_preset_bundle; std::shared_ptr<PresetBundle> m_preset_bundle;
ComboBox * m_selected_printer = nullptr; ComboBox * m_selected_printer = nullptr;
ComboBox * m_selected_filament = nullptr; ComboBox * m_selected_filament = nullptr;
Button * m_ok_btn = nullptr;
Button * m_cancel_btn = nullptr;
std::unordered_map<wxString, std::shared_ptr<Preset>> filament_choice_to_filament_preset; std::unordered_map<wxString, std::shared_ptr<Preset>> filament_choice_to_filament_preset;
std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>> m_printer_compatible_filament_presets; // need be used when add presets std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>> m_printer_compatible_filament_presets; // need be used when add presets
}; };
class EditFilamentPresetDialog; class EditFilamentPresetDialog;
@ -370,7 +358,7 @@ private:
wxBoxSizer *create_filament_basic_info(); wxBoxSizer *create_filament_basic_info();
wxBoxSizer *create_add_filament_btn(); wxBoxSizer *create_add_filament_btn();
wxBoxSizer *create_preset_tree_sizer(); wxBoxSizer *create_preset_tree_sizer();
wxBoxSizer *create_button_sizer(); wxWindow *create_dialog_buttons();
private: private:
PresetTree * m_preset_tree_creater = nullptr; PresetTree * m_preset_tree_creater = nullptr;
@ -380,8 +368,6 @@ private:
std::string m_filament_type; std::string m_filament_type;
std::string m_filament_serial; std::string m_filament_serial;
Button * m_add_filament_btn = nullptr; Button * m_add_filament_btn = nullptr;
Button * m_del_filament_btn = nullptr;
Button * m_ok_btn = nullptr;
wxBoxSizer * m_preset_tree_sizer = nullptr; wxBoxSizer * m_preset_tree_sizer = nullptr;
wxPanel * m_preset_tree_panel = nullptr; wxPanel * m_preset_tree_panel = nullptr;
wxScrolledWindow * m_preset_tree_window = nullptr; wxScrolledWindow * m_preset_tree_window = nullptr;

View File

@ -20,6 +20,8 @@
#include "MsgDialog.hpp" #include "MsgDialog.hpp"
#include "Plater.hpp" #include "Plater.hpp"
#include "Widgets/DialogButtons.hpp"
#include "libslic3r/PlaceholderParser.hpp" #include "libslic3r/PlaceholderParser.hpp"
#include "libslic3r/Preset.hpp" #include "libslic3r/Preset.hpp"
#include "libslic3r/Print.hpp" #include "libslic3r/Print.hpp"
@ -98,10 +100,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const
m_param_description = new wxStaticText(this, wxID_ANY, wxEmptyString); m_param_description = new wxStaticText(this, wxID_ANY, wxEmptyString);
//Orca: use custom buttons auto dlg_btns = new DialogButtons(this, {"OK", "Cancel"});
auto btn_sizer = create_btn_sizer(wxOK | wxCANCEL);
for(auto btn : m_button_list)
wxGetApp().UpdateDarkUI(btn.second);
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
@ -109,7 +108,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const
topSizer->Add(grid_sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(grid_sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(m_param_label , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(m_param_label , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(m_param_description , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border); topSizer->Add(m_param_description , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(btn_sizer , 0, wxEXPAND | wxALL, border); topSizer->Add(dlg_btns , 0, wxEXPAND);
SetSizer(topSizer); SetSizer(topSizer);
topSizer->SetSizeHints(this); topSizer->SetSizeHints(this);
@ -417,20 +416,6 @@ void EditGCodeDialog::bind_list_and_button()
void EditGCodeDialog::on_dpi_changed(const wxRect&suggested_rect) void EditGCodeDialog::on_dpi_changed(const wxRect&suggested_rect)
{ {
const int& em = em_unit(); const int& em = em_unit();
//Orca: use custom buttons
for (auto button_item : m_button_list)
{
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));
}
}
const wxSize& size = wxSize(45 * em, 35 * em); const wxSize& size = wxSize(45 * em, 35 * em);
SetMinSize(size); SetMinSize(size);
@ -443,83 +428,6 @@ void EditGCodeDialog::on_sys_color_changed()
m_add_btn->msw_rescale(); m_add_btn->msw_rescale();
} }
//Orca
wxBoxSizer* EditGCodeDialog::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 & 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->SetFocus();
ok_btn->SetId(wxID_OK);
btn_sizer->Add(ok_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
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->SetId(wxID_CANCEL);
btn_sizer->Add(cancel_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP / 2);
m_button_list[wxCANCEL] = cancel_btn;
}
return btn_sizer;
}
const std::map<ParamType, std::string> ParamsInfo { const std::map<ParamType, std::string> ParamsInfo {
// Type BitmapName // Type BitmapName
{ ParamType::Scalar, "custom-gcode_single" }, { ParamType::Scalar, "custom-gcode_single" },

View File

@ -65,8 +65,6 @@ protected:
void on_sys_color_changed() override; void on_sys_color_changed() override;
void selection_changed(wxDataViewEvent& evt); void selection_changed(wxDataViewEvent& evt);
wxBoxSizer* create_btn_sizer(long flags);
}; };

View File

@ -19,6 +19,8 @@
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
#include "Widgets/DialogButtons.hpp"
#include "GUI.hpp" #include "GUI.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
@ -94,20 +96,17 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent) :
m_optgroup = new ConfigOptionsGroup(this, _L("Print Host upload"), m_config); m_optgroup = new ConfigOptionsGroup(this, _L("Print Host upload"), m_config);
build_printhost_settings(m_optgroup); build_printhost_settings(m_optgroup);
wxStdDialogButtonSizer* btns = this->CreateStdDialogButtonSizer(wxOK | wxCANCEL); auto dlg_btns = new DialogButtons(this, {"OK"});
btnOK = static_cast<wxButton*>(this->FindWindowById(wxID_OK, this));
wxGetApp().UpdateDarkUI(btnOK);
btnOK->Bind(wxEVT_BUTTON, &PhysicalPrinterDialog::OnOK, this);
wxGetApp().UpdateDarkUI(static_cast<wxButton*>(this->FindWindowById(wxID_CANCEL, this))); btnOK = dlg_btns->GetOK();
(static_cast<wxButton*>(this->FindWindowById(wxID_CANCEL, this)))->Hide(); btnOK->Bind(wxEVT_BUTTON, &PhysicalPrinterDialog::OnOK, this);
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
// topSizer->Add(label_top , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, BORDER_W); // topSizer->Add(label_top , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, BORDER_W);
topSizer->Add(input_sizer , 0, wxEXPAND | wxALL, 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(m_optgroup->sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, BORDER_W);
topSizer->Add(btns , 0, wxEXPAND | wxALL, BORDER_W); topSizer->Add(dlg_btns, 0, wxEXPAND);
Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->EndModal(wxID_NO);}); Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->EndModal(wxID_NO);});
@ -736,8 +735,6 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect)
m_optgroup->msw_rescale(); m_optgroup->msw_rescale();
msw_buttons_rescale(this, em, { wxID_OK, wxID_CANCEL });
const wxSize& size = wxSize(45 * em, 35 * em); const wxSize& size = wxSize(45 * em, 35 * em);
SetMinSize(size); SetMinSize(size);

View File

@ -38,7 +38,7 @@ class PhysicalPrinterDialog : public DPIDialog
RoundedRectangle* m_input_area {nullptr}; RoundedRectangle* m_input_area {nullptr};
wxStaticText* m_valid_label {nullptr}; wxStaticText* m_valid_label {nullptr};
wxTextCtrl* m_input_ctrl {nullptr}; wxTextCtrl* m_input_ctrl {nullptr};
wxButton* btnOK {nullptr}; Button* btnOK {nullptr};
void build_printhost_settings(ConfigOptionsGroup* optgroup); void build_printhost_settings(ConfigOptionsGroup* optgroup);
void OnOK(wxEvent& event); void OnOK(wxEvent& event);

View File

@ -0,0 +1,247 @@
#include "DialogButtons.hpp"
#include "slic3r/GUI/I18N.hpp"
namespace Slic3r { namespace GUI {
// ORCA standardize dialog buttons
DialogButtons::DialogButtons(wxWindow* parent, std::vector<wxString> non_translated_labels, const wxString& primary_btn_translated_label)
: wxWindow(parent, wxID_ANY)
{
m_parent = parent;
m_sizer = new wxBoxSizer(wxHORIZONTAL);
m_primary = primary_btn_translated_label;
m_alert = wxEmptyString;
SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#FFFFFF")));
// Add all to array
for (wxString label : non_translated_labels) {
Button* btn = new Button(this, _L(label));
wxString l = label;
l.LowerCase();
auto f = m_standardIDs.find(l);
if (f != m_standardIDs.end())
btn->SetId(f->second);
m_buttons.push_back(btn);
}
m_parent->Bind(wxEVT_DPI_CHANGED, &DialogButtons::on_dpi_changed, this);
SetSizer(m_sizer);
UpdateButtons();
}
DialogButtons::~DialogButtons() {
m_parent->Unbind(wxEVT_DPI_CHANGED, &DialogButtons::on_dpi_changed, this);
}
void DialogButtons::on_dpi_changed(wxDPIChangedEvent& event) {
UpdateButtons();
event.Skip();
}
Button* DialogButtons::GetButtonFromID(wxStandardID id) {
for (Button* btn : m_buttons)
if (btn->GetId() == id)
return btn;
return nullptr;
}
Button* DialogButtons::GetButtonFromLabel(wxString translated_label) {
for (Button* btn : m_buttons)
if (btn->GetLabel() == translated_label)
return btn;
return nullptr;
}
Button* DialogButtons::PickFromList(std::set<wxStandardID> ID_list) {
// Picks first button from given list
Button* b;
for (auto itr : ID_list) {
b = GetButtonFromID(itr);
if (b != nullptr)
return b;
}
return nullptr;
}
// shorthands for common buttons
Button* DialogButtons::GetOK() {return GetButtonFromID(wxID_OK) ;}
Button* DialogButtons::GetYES() {return GetButtonFromID(wxID_YES) ;}
Button* DialogButtons::GetAPPLY() {return GetButtonFromID(wxID_APPLY) ;}
Button* DialogButtons::GetCONFIRM(){return GetButtonFromID(wxID_APPLY) ;}
Button* DialogButtons::GetNO() {return GetButtonFromID(wxID_NO) ;}
Button* DialogButtons::GetCANCEL() {return GetButtonFromID(wxID_CANCEL) ;}
Button* DialogButtons::GetBACK() {return GetButtonFromID(wxID_BACKWARD);}
Button* DialogButtons::GetFORWARD(){return GetButtonFromID(wxID_FORWARD) ;}
void DialogButtons::SetPrimaryButton(wxString translated_label) {
// use _L("Create") translated text for custom buttons
// use non existing button name to disable primary styled button
Button* btn;
if(translated_label.IsEmpty()){ // prefer standard primary buttons if label empty
if(m_buttons.size() == 1)
btn = m_buttons.front();
else
btn = PickFromList(m_primaryIDs);
}else
btn = GetButtonFromLabel(translated_label);
if(btn == nullptr) return;
m_primary = translated_label;
btn->SetFocus();
// we won't need color definations after button style management
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("#26A69A"), (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);
}
void DialogButtons::SetAlertButton(wxString translated_label) {
// use _L("Create") translated text for custom buttons
// use non existing button name to disable alert styled button
if(m_buttons.size() == 1)
return;
Button* btn;
if(translated_label.IsEmpty()){ // prefer standard alert buttons if label empty
btn = PickFromList(m_alertIDs);
}else
btn = GetButtonFromLabel(translated_label);
if(btn == nullptr) return;
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("#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);
}
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("#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->Bind(wxEVT_KEY_DOWN, &DialogButtons::on_keydown, this);
}
int btn_gap = FromDIP(10);
auto list = m_left_align_IDs;
auto on_left = [list](int id){
return list.find(wxStandardID(id)) != list.end();
};
for (Button* btn : m_buttons) // Left aligned
if(on_left(btn->GetId()))
m_sizer->Add(btn, 0, wxLEFT | wxTOP | wxBOTTOM | wxALIGN_CENTER_VERTICAL, btn_gap);
m_sizer->AddStretchSpacer();
for (Button* btn : m_buttons) // Right aligned
if(!on_left(btn->GetId()))
m_sizer->Add(btn, 0, wxRIGHT | wxTOP | wxBOTTOM | wxALIGN_CENTER_VERTICAL, btn_gap);
SetPrimaryButton(m_primary);
SetAlertButton(m_alert);
Layout();
Fit();
}
int DialogButtons::FromDIP(int d) {
return m_parent->FromDIP(d);
}
// This might be helpful for future use
// Append Button
// Prepend Button
void DialogButtons::on_keydown(wxKeyEvent& e) {
wxObject* current = e.GetEventObject();
int key = e.GetKeyCode();
int cnt = m_buttons.size();
if(cnt > 1){
int i = -1;
for (Button* btn : m_buttons){
i++;
if(btn->HasFocus())
break;
}
// possible issue if button hidden
if (key == WXK_LEFT) {m_buttons[i - 1 < 0 ? (cnt - 1) : i - 1]->SetFocus();}
else if (key == WXK_RIGHT) {m_buttons[i + 1 > (cnt - 1) ? 0 : i + 1]->SetFocus();}
}
e.Skip();
}
}} // namespace Slic3r::GUI

View File

@ -0,0 +1,125 @@
#ifndef slic3r_GUI_DialogButtons_hpp_
#define slic3r_GUI_DialogButtons_hpp_
#include "wx/wx.h"
#include "wx/sizer.h"
#include "map"
#include "set"
#include "Button.hpp"
#include "Label.hpp"
#include "slic3r/GUI/GUI_App.hpp"
namespace Slic3r { namespace GUI {
class DialogButtons : public wxWindow{
public:
DialogButtons(wxWindow* parent, std::vector<wxString> non_translated_labels, const wxString& primary_btn_label = "");
wxBoxSizer* GetSizer() const { return m_sizer; }
Button* GetButtonFromID(wxStandardID id);
Button* GetButtonFromLabel(wxString label);
Button* GetOK();
Button* GetYES();
Button* GetAPPLY();
Button* GetCONFIRM();
Button* GetNO();
Button* GetCANCEL();
Button* GetBACK();
Button* GetFORWARD();
void SetPrimaryButton(wxString label);
void SetAlertButton(wxString label);
void UpdateButtons();
~DialogButtons();
private:
wxWindow* m_parent;
wxBoxSizer* m_sizer;
std::vector<Button*> m_buttons;
wxString m_primary;
wxString m_alert;
// missing ones Transfer / Update / Create
const std::map<wxString, wxStandardID> m_standardIDs = {
// Choice
{"ok" , wxID_OK},
{"yes" , wxID_YES},
{"apply" , wxID_APPLY},
{"confirm" , wxID_APPLY}, // no id for confirm, reusing wxID_APPLY
{"no" , wxID_NO},
{"cancel" , wxID_CANCEL},
// Action
{"open" , wxID_PRINT},
{"open" , wxID_OPEN},
{"add" , wxID_ADD},
{"copy" , wxID_COPY},
{"new" , wxID_NEW},
{"save" , wxID_SAVE},
{"save as" , wxID_SAVEAS},
{"refresh" , wxID_REFRESH},
{"retry" , wxID_RETRY},
{"ignore" , wxID_IGNORE},
{"help" , wxID_HELP},
{"clone" , wxID_DUPLICATE},
{"duplicate" , wxID_DUPLICATE},
{"select all" , wxID_SELECTALL},
{"replace" , wxID_REPLACE},
{"replace all", wxID_REPLACE_ALL},
// Navigation
{"back" , wxID_BACKWARD},
{"next" , wxID_FORWARD},
// Alert / Negative
{"remove" , wxID_REMOVE},
{"delete" , wxID_DELETE},
{"abort" , wxID_ABORT},
{"stop" , wxID_STOP},
{"reset" , wxID_RESET},
{"clear" , wxID_CLEAR},
{"exit" , wxID_EXIT},
{"quit" , wxID_EXIT}
};
std::set<wxStandardID> m_primaryIDs {
wxID_OK,
wxID_YES,
wxID_APPLY,
wxID_SAVE,
wxID_PRINT
};
std::set<wxStandardID> m_alertIDs {
wxID_REMOVE,
wxID_DELETE,
wxID_ABORT,
wxID_STOP,
wxID_RESET,
wxID_CLEAR,
wxID_EXIT
};
std::set<wxStandardID> m_left_align_IDs {
wxID_DELETE,
wxID_BACKWARD,
wxID_FORWARD
};
Button* PickFromList(std::set<wxStandardID> ID_list);
int FromDIP(int d);
void on_dpi_changed(wxDPIChangedEvent& event);
void on_keydown(wxKeyEvent& event);
};
}} // namespace Slic3r::GUI
#endif // !slic3r_GUI_DialogButtons_hpp_

View File

@ -4,6 +4,7 @@
#include "I18N.hpp" #include "I18N.hpp"
#include <wx/dcgraph.h> #include <wx/dcgraph.h>
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "Widgets/DialogButtons.hpp"
#include <string> #include <string>
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@ -138,19 +139,11 @@ PA_Calibration_Dlg::PA_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plater*
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24))); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &PA_Calibration_Dlg::on_start, this);
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &PA_Calibration_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
PA_Calibration_Dlg::reset_params(); PA_Calibration_Dlg::reset_params();
@ -168,7 +161,6 @@ PA_Calibration_Dlg::~PA_Calibration_Dlg() {
// Disconnect Events // Disconnect Events
m_rbExtruderType->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_extruder_type_changed), NULL, this); m_rbExtruderType->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_extruder_type_changed), NULL, this);
m_rbMethod->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_method_changed), NULL, this); m_rbMethod->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(PA_Calibration_Dlg::on_method_changed), NULL, this);
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(PA_Calibration_Dlg::on_start), NULL, this);
} }
void PA_Calibration_Dlg::reset_params() { void PA_Calibration_Dlg::reset_params() {
@ -342,22 +334,13 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24))); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Temp_Calibration_Dlg::on_start, this);
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &Temp_Calibration_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_rbFilamentType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this); m_rbFilamentType->Connect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this);
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Temp_Calibration_Dlg::on_start), NULL, this);
//wxGetApp().UpdateDlgDarkUI(this); //wxGetApp().UpdateDlgDarkUI(this);
@ -396,7 +379,6 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
Temp_Calibration_Dlg::~Temp_Calibration_Dlg() { Temp_Calibration_Dlg::~Temp_Calibration_Dlg() {
// Disconnect Events // Disconnect Events
m_rbFilamentType->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this); m_rbFilamentType->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(Temp_Calibration_Dlg::on_filament_type_changed), NULL, this);
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Temp_Calibration_Dlg::on_start), NULL, this);
} }
void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) { void Temp_Calibration_Dlg::on_start(wxCommandEvent& event) {
@ -521,21 +503,11 @@ MaxVolumetricSpeed_Test_Dlg::MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &MaxVolumetricSpeed_Test_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MaxVolumetricSpeed_Test_Dlg::on_start), NULL, this); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &MaxVolumetricSpeed_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this); //wxGetApp().UpdateDlgDarkUI(this);
@ -545,7 +517,6 @@ MaxVolumetricSpeed_Test_Dlg::MaxVolumetricSpeed_Test_Dlg(wxWindow* parent, wxWin
MaxVolumetricSpeed_Test_Dlg::~MaxVolumetricSpeed_Test_Dlg() { MaxVolumetricSpeed_Test_Dlg::~MaxVolumetricSpeed_Test_Dlg() {
// Disconnect Events // Disconnect Events
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MaxVolumetricSpeed_Test_Dlg::on_start), NULL, this);
} }
void MaxVolumetricSpeed_Test_Dlg::on_start(wxCommandEvent& event) { void MaxVolumetricSpeed_Test_Dlg::on_start(wxCommandEvent& event) {
@ -629,21 +600,11 @@ VFA_Test_Dlg::VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &VFA_Test_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VFA_Test_Dlg::on_start), NULL, this); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &VFA_Test_Dlg::on_start, this);
// wxGetApp().UpdateDlgDarkUI(this); // wxGetApp().UpdateDlgDarkUI(this);
@ -654,7 +615,6 @@ VFA_Test_Dlg::VFA_Test_Dlg(wxWindow* parent, wxWindowID id, Plater* plater)
VFA_Test_Dlg::~VFA_Test_Dlg() VFA_Test_Dlg::~VFA_Test_Dlg()
{ {
// Disconnect Events // Disconnect Events
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(VFA_Test_Dlg::on_start), NULL, this);
} }
void VFA_Test_Dlg::on_start(wxCommandEvent& event) void VFA_Test_Dlg::on_start(wxCommandEvent& event)
@ -738,21 +698,11 @@ Retraction_Test_Dlg::Retraction_Test_Dlg(wxWindow* parent, wxWindowID id, Plater
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &Retraction_Test_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Retraction_Test_Dlg::on_start), NULL, this); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Retraction_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this); //wxGetApp().UpdateDlgDarkUI(this);
@ -762,7 +712,6 @@ Retraction_Test_Dlg::Retraction_Test_Dlg(wxWindow* parent, wxWindowID id, Plater
Retraction_Test_Dlg::~Retraction_Test_Dlg() { Retraction_Test_Dlg::~Retraction_Test_Dlg() {
// Disconnect Events // Disconnect Events
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Retraction_Test_Dlg::on_start), NULL, this);
} }
void Retraction_Test_Dlg::on_start(wxCommandEvent& event) { void Retraction_Test_Dlg::on_start(wxCommandEvent& event) {
@ -869,21 +818,11 @@ Input_Shaping_Freq_Test_Dlg::Input_Shaping_Freq_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &Input_Shaping_Freq_Test_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Input_Shaping_Freq_Test_Dlg::on_start), NULL, this); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Input_Shaping_Freq_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this);//FIXME: dark mode background color //wxGetApp().UpdateDlgDarkUI(this);//FIXME: dark mode background color
@ -893,7 +832,6 @@ Input_Shaping_Freq_Test_Dlg::Input_Shaping_Freq_Test_Dlg(wxWindow* parent, wxWin
Input_Shaping_Freq_Test_Dlg::~Input_Shaping_Freq_Test_Dlg() { Input_Shaping_Freq_Test_Dlg::~Input_Shaping_Freq_Test_Dlg() {
// Disconnect Events // Disconnect Events
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Input_Shaping_Freq_Test_Dlg::on_start), NULL, this);
} }
void Input_Shaping_Freq_Test_Dlg::on_start(wxCommandEvent& event) { void Input_Shaping_Freq_Test_Dlg::on_start(wxCommandEvent& event) {
@ -1005,21 +943,11 @@ Input_Shaping_Damp_Test_Dlg::Input_Shaping_Damp_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &Input_Shaping_Damp_Test_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Input_Shaping_Damp_Test_Dlg::on_start), NULL, this); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Input_Shaping_Damp_Test_Dlg::on_start, this);
//wxGetApp().UpdateDlgDarkUI(this);//FIXME: dark mode background color //wxGetApp().UpdateDlgDarkUI(this);//FIXME: dark mode background color
@ -1029,7 +957,6 @@ Input_Shaping_Damp_Test_Dlg::Input_Shaping_Damp_Test_Dlg(wxWindow* parent, wxWin
Input_Shaping_Damp_Test_Dlg::~Input_Shaping_Damp_Test_Dlg() { Input_Shaping_Damp_Test_Dlg::~Input_Shaping_Damp_Test_Dlg() {
// Disconnect Events // Disconnect Events
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Input_Shaping_Damp_Test_Dlg::on_start), NULL, this);
} }
void Input_Shaping_Damp_Test_Dlg::on_start(wxCommandEvent& event) { void Input_Shaping_Damp_Test_Dlg::on_start(wxCommandEvent& event) {
@ -1122,21 +1049,11 @@ Junction_Deviation_Test_Dlg::Junction_Deviation_Test_Dlg(wxWindow* parent, wxWin
v_sizer->Add(settings_sizer); v_sizer->Add(settings_sizer);
v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5); v_sizer->Add(0, FromDIP(10), 0, wxEXPAND, 5);
m_btnStart = new Button(this, _L("OK"));
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));
m_btnStart->SetBackgroundColor(btn_bg_green); auto dlg_btns = new DialogButtons(this, {"OK"});
m_btnStart->SetBorderColor(wxColour(0, 150, 136)); v_sizer->Add(dlg_btns , 0, wxEXPAND);
m_btnStart->SetTextColor(wxColour("#FFFFFE"));
m_btnStart->SetSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetMinSize(wxSize(FromDIP(48), FromDIP(24)));
m_btnStart->SetCornerRadius(FromDIP(3));
m_btnStart->Bind(wxEVT_BUTTON, &Junction_Deviation_Test_Dlg::on_start, this);
v_sizer->Add(m_btnStart, 0, wxALL | wxALIGN_RIGHT, FromDIP(5));
m_btnStart->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Junction_Deviation_Test_Dlg::on_start), NULL, this); dlg_btns->GetOK()->Bind(wxEVT_BUTTON, &Junction_Deviation_Test_Dlg::on_start, this);
Layout(); Layout();
Fit(); Fit();
@ -1144,7 +1061,6 @@ Junction_Deviation_Test_Dlg::Junction_Deviation_Test_Dlg(wxWindow* parent, wxWin
Junction_Deviation_Test_Dlg::~Junction_Deviation_Test_Dlg() { Junction_Deviation_Test_Dlg::~Junction_Deviation_Test_Dlg() {
// Disconnect Events // Disconnect Events
m_btnStart->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Junction_Deviation_Test_Dlg::on_start), NULL, this);
} }
void Junction_Deviation_Test_Dlg::on_start(wxCommandEvent& event) { void Junction_Deviation_Test_Dlg::on_start(wxCommandEvent& event) {

View File

@ -43,7 +43,6 @@ protected:
CheckBox* m_cbPrintNum; CheckBox* m_cbPrintNum;
TextInput* m_tiBMAccels; TextInput* m_tiBMAccels;
TextInput* m_tiBMSpeeds; TextInput* m_tiBMSpeeds;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -65,7 +64,6 @@ protected:
TextInput* m_tiStart; TextInput* m_tiStart;
TextInput* m_tiEnd; TextInput* m_tiEnd;
TextInput* m_tiStep; TextInput* m_tiStep;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -84,7 +82,6 @@ protected:
TextInput* m_tiStart; TextInput* m_tiStart;
TextInput* m_tiEnd; TextInput* m_tiEnd;
TextInput* m_tiStep; TextInput* m_tiStep;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -101,7 +98,6 @@ protected:
TextInput* m_tiStart; TextInput* m_tiStart;
TextInput* m_tiEnd; TextInput* m_tiEnd;
TextInput* m_tiStep; TextInput* m_tiStep;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -121,7 +117,6 @@ protected:
TextInput* m_tiStart; TextInput* m_tiStart;
TextInput* m_tiEnd; TextInput* m_tiEnd;
TextInput* m_tiStep; TextInput* m_tiStep;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -143,7 +138,6 @@ protected:
TextInput* m_tiFreqStartY; TextInput* m_tiFreqStartY;
TextInput* m_tiFreqEndY; TextInput* m_tiFreqEndY;
TextInput* m_tiDampingFactor; TextInput* m_tiDampingFactor;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -164,7 +158,6 @@ protected:
TextInput* m_tiFreqY; TextInput* m_tiFreqY;
TextInput* m_tiDampingFactorStart; TextInput* m_tiDampingFactorStart;
TextInput* m_tiDampingFactorEnd; TextInput* m_tiDampingFactorEnd;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
@ -182,7 +175,6 @@ protected:
wxRadioBox* m_rbModel; wxRadioBox* m_rbModel;
TextInput* m_tiJDStart; TextInput* m_tiJDStart;
TextInput* m_tiJDEnd; TextInput* m_tiJDEnd;
Button* m_btnStart;
Plater* m_plater; Plater* m_plater;
}; };
}} // namespace Slic3r::GUI }} // namespace Slic3r::GUI