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:
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?