Author Topic: Don't annoy me again!  (Read 24767 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Don't annoy me again!
« Reply #15 on: May 20, 2013, 02:58:11 am »
As there seem to be no objections, I will commit the conversion soon (including contrib plugins).

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Don't annoy me again!
« Reply #16 on: May 23, 2013, 04:45:27 pm »
Hmm... I just discovered a rather major design flaw in my plan.  If I set the "Layout changed" dialogue to rtSAVE_CHOICE, the user could potentially save rtCANCEL, which would cause strange errors of sometimes not being able to switch layouts.  If I do the following, the behavior will be inconsistent:
Code
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp    (revision 9113)
+++ src/src/main.cpp    (working copy)
@@ -1488,7 +1488,9 @@
         AnnoyingDialog dlg(_("Layout changed"),
                             wxString::Format(_("The perspective '%s' has changed. Do you want to save it?"), m_LastLayoutName.wx_str()),
                             wxART_QUESTION,
-                            canCancel ? AnnoyingDialog::YES_NO_CANCEL : AnnoyingDialog::YES_NO);
+                            canCancel ? AnnoyingDialog::YES_NO_CANCEL : AnnoyingDialog::YES_NO,
+                            // do not let the user save 'rtCANCEL' otherwise we will have problems...
+                            canCancel ? AnnoyingDialog::rtYES : AnnoyingDialog::rtSAVE_CHOICE);
         switch (dlg.ShowModal())
         {
             case AnnoyingDialog::rtYES:
Also, in this situation, if the user checked do not annoy, and pressed 'No' (such that rtNO is saved), then the layout will still be saved when cancel is enabled because the previous return type is only read if the dialogue specifies rtSAVE_CHOICE.

Ideas?