DialogButtons fixes and apply to more windows (#9809)

* step import dialog

* update

* update

* drop file dialog

* Update UnsavedChangesDialog.cpp

* update

* fix focus

* Update CreatePresetsDialog.cpp

* improve usage of return button

* fix first button not getting hover effects

* update

* update

* improve button styles

* update button events

* update button events

* update button events

* remove Raise()
This commit is contained in:
yw4z
2025-06-14 05:27:10 +03:00
committed by GitHub
parent 33dc7bc1f2
commit 0999cb057d
15 changed files with 98 additions and 279 deletions

View File

@@ -1016,7 +1016,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons()
auto btn_ok = dlg_btns->GetOK();
btn_ok->SetLabel(_L("Create"));
btn_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
btn_ok->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
//get vendor name
wxString vendor_str = m_filament_vendor_combobox->GetLabel();
std::string vendor_name;
@@ -1174,7 +1174,7 @@ wxWindow *CreateFilamentPresetDialog::create_dialog_buttons()
EndModal(wxID_OK);
});
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
EndModal(wxID_CANCEL);
});
@@ -2024,13 +2024,13 @@ wxWindow *CreatePrinterPresetDialog::create_page1_dialog_buttons(wxWindow *paren
{
auto dlg_btns = new DialogButtons(parent, {"OK", "Cancel"});
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
if (!validate_input_valid()) return;
data_init();
show_page2();
});
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
return dlg_btns;
}
@@ -2577,13 +2577,13 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *parent)
{
auto dlg_btns = new DialogButtons(parent, {"Back", "OK", "Cancel"});
auto dlg_btns = new DialogButtons(parent, {"Return", "OK", "Cancel"});
dlg_btns->GetBACK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { show_page1(); });
dlg_btns->GetRETURN()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { show_page1(); });
auto btn_ok = dlg_btns->GetOK();
btn_ok->SetLabel(_L("Create"));
btn_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
btn_ok->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
const wxString curr_selected_printer_type = curr_create_printer_type();
@@ -2828,7 +2828,7 @@ wxWindow *CreatePrinterPresetDialog::create_page2_dialog_buttons(wxWindow *paren
});
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
return dlg_btns;
}
@@ -3277,7 +3277,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
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) {
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this, sync_user_preset_need_enabled](wxCommandEvent &e) {
if (sync_user_preset_need_enabled) {
wxGetApp().app_config->set("sync_user_preset", "true");
wxGetApp().start_sync_user_preset();
@@ -3286,7 +3286,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
});
if (is_cancel_needed)
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
m_main_sizer->Add(dlg_btns, 0, wxEXPAND);
@@ -4028,7 +4028,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_process_preset_to_f
wxWindow *ExportConfigsDialog::create_dialog_buttons(wxWindow* parent)
{
auto dlg_btns = new DialogButtons(parent, {"OK", "Cancel"});
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
if (!has_check_box_selected()) {
MessageDialog dlg(this, _L("Please select at least one printer or filament."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
wxYES | wxYES_DEFAULT | wxCENTRE);
@@ -4065,7 +4065,7 @@ wxWindow *ExportConfigsDialog::create_dialog_buttons(wxWindow* parent)
EndModal(wxID_OK);
});
dlg_btns->GetCANCEL()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
dlg_btns->GetCANCEL()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
return dlg_btns;
}
@@ -4598,7 +4598,7 @@ wxWindow *EditFilamentPresetDialog::create_dialog_buttons()
e.Skip();
}));
dlg_btns->GetOK()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); });
dlg_btns->GetOK()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_OK); });
return dlg_btns;
}