Fix for #8091 - Design bug: Yes/No response to save dialogue

This commit is contained in:
YuSanka 2022-03-31 14:34:53 +02:00
parent 0763a48ce5
commit 807f380d3f
2 changed files with 12 additions and 10 deletions

View File

@ -160,8 +160,8 @@ public:
// customization of the message box buttons // customization of the message box buttons
virtual bool SetYesNoLabels(const wxMD::ButtonLabel& yes, const wxMD::ButtonLabel& no) virtual bool SetYesNoLabels(const wxMD::ButtonLabel& yes, const wxMD::ButtonLabel& no)
{ {
DoSetCustomLabel(m_yes, yes); DoSetCustomLabel(m_yes, yes, wxID_YES);
DoSetCustomLabel(m_no, no); DoSetCustomLabel(m_no, no, wxID_NO);
return true; return true;
} }
@ -169,29 +169,29 @@ public:
const wxMD::ButtonLabel& no, const wxMD::ButtonLabel& no,
const wxMD::ButtonLabel& cancel) const wxMD::ButtonLabel& cancel)
{ {
DoSetCustomLabel(m_yes, yes); DoSetCustomLabel(m_yes, yes, wxID_YES);
DoSetCustomLabel(m_no, no); DoSetCustomLabel(m_no, no, wxID_NO);
DoSetCustomLabel(m_cancel, cancel); DoSetCustomLabel(m_cancel, cancel, wxID_CANCEL);
return true; return true;
} }
virtual bool SetOKLabel(const wxMD::ButtonLabel& ok) virtual bool SetOKLabel(const wxMD::ButtonLabel& ok)
{ {
DoSetCustomLabel(m_ok, ok); DoSetCustomLabel(m_ok, ok, wxID_OK);
return true; return true;
} }
virtual bool SetOKCancelLabels(const wxMD::ButtonLabel& ok, virtual bool SetOKCancelLabels(const wxMD::ButtonLabel& ok,
const wxMD::ButtonLabel& cancel) const wxMD::ButtonLabel& cancel)
{ {
DoSetCustomLabel(m_ok, ok); DoSetCustomLabel(m_ok, ok, wxID_OK);
DoSetCustomLabel(m_cancel, cancel); DoSetCustomLabel(m_cancel, cancel, wxID_CANCEL);
return true; return true;
} }
virtual bool SetHelpLabel(const wxMD::ButtonLabel& help) virtual bool SetHelpLabel(const wxMD::ButtonLabel& help)
{ {
DoSetCustomLabel(m_help, help); DoSetCustomLabel(m_help, help, wxID_HELP);
return true; return true;
} }
// test if any custom labels were set // test if any custom labels were set
@ -230,9 +230,10 @@ protected:
// the value to var with possibly some transformation (e.g. Cocoa version // the value to var with possibly some transformation (e.g. Cocoa version
// currently uses this to remove any accelerators from the button strings // currently uses this to remove any accelerators from the button strings
// while GTK+ one handles stock items specifically here) // while GTK+ one handles stock items specifically here)
void DoSetCustomLabel(wxString& var, const wxMD::ButtonLabel& label) void DoSetCustomLabel(wxString& var, const wxMD::ButtonLabel& label, wxWindowID btn_id)
{ {
var = label.GetAsString(); var = label.GetAsString();
SetButtonLabel(btn_id, var);
} }
// these functions return the custom label or empty string and should be // these functions return the custom label or empty string and should be

View File

@ -1692,6 +1692,7 @@ struct Plater::priv
std::string act = wxGetApp().app_config->get(act_key); std::string act = wxGetApp().app_config->get(act_key);
if (act.empty()) { if (act.empty()) {
RichMessageDialog dialog(mainframe, reason + "\n" + format_wxstr(_L("Do you want to save the changes to \"%1%\"?"), suggested_project_name), wxString(SLIC3R_APP_NAME), wxYES_NO | wxCANCEL); RichMessageDialog dialog(mainframe, reason + "\n" + format_wxstr(_L("Do you want to save the changes to \"%1%\"?"), suggested_project_name), wxString(SLIC3R_APP_NAME), wxYES_NO | wxCANCEL);
dialog.SetYesNoLabels(_L("Save"), _L("Discard"));
dialog.ShowCheckBox(_L("Remember my choice")); dialog.ShowCheckBox(_L("Remember my choice"));
res = dialog.ShowModal(); res = dialog.ShowModal();
if (res != wxID_CANCEL) if (res != wxID_CANCEL)