Skip to content

Commit f55b3f2

Browse files
committed
Bug 2524 - ENH: Macros "OK" button is confusing - doesn't do "what it says on the tin"
Removed redundant OK button. Also improved positioning of buttons. Also fixed issue where canceling change appeared to not be respected. (It was being respected, but display was not being refreshed)
1 parent 93c5525 commit f55b3f2

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/BatchProcessDialog.cpp

+20-3
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void ApplyMacroDialog::PopulateOrExchange(ShuttleGui &S)
169169
{
170170
/* i18n-hint: The Expand button makes the dialog bigger, with more in it */
171171
mResize = S.Id(ExpandID).AddButton(XXO("&Expand"));
172-
S.Prop(1).AddSpace( 10 );
172+
S.AddSpace( 10,10,1 );
173173
S.AddStandardButtons( eCancelButton | eHelpButton);
174174
}
175175
S.EndHorizontalLay();
@@ -666,8 +666,13 @@ void MacrosWindow::PopulateOrExchange(ShuttleGui & S)
666666
// so that name can be set on a standard control
667667
btn->SetAccessible(safenew WindowAccessible(btn));
668668
#endif
669-
S.Prop(1).AddSpace( 10 );
670-
S.AddStandardButtons( eOkButton | eCancelButton | eHelpButton);
669+
S.AddSpace( 10,10,1 );
670+
// Bug 2524 OK button does much the same as cancel, so remove it.
671+
// OnCancel prompts you if there has been a change.
672+
// OnOK saves without prompting.
673+
// That difference is too slight to merit a button, and with the OK
674+
// button, people might expect the dialog to apply the macro too.
675+
S.AddStandardButtons( /*eOkButton |*/ eCancelButton | eHelpButton);
671676
}
672677
S.EndHorizontalLay();
673678

@@ -813,6 +818,11 @@ void MacrosWindow::OnMacroSelected(wxListEvent & event)
813818
int item = event.GetIndex();
814819

815820
mActiveMacro = mMacros->GetItemText(item);
821+
ShowActiveMacro();
822+
}
823+
824+
void MacrosWindow::ShowActiveMacro()
825+
{
816826
mMacroCommands.ReadMacro(mActiveMacro);
817827
if( !mbExpanded )
818828
return;
@@ -1265,9 +1275,16 @@ void MacrosWindow::OnOK(wxCommandEvent & WXUNUSED(event))
12651275
///
12661276
void MacrosWindow::OnCancel(wxCommandEvent &WXUNUSED(event))
12671277
{
1278+
bool bWasChanged = mChanged;
12681279
if (!ChangeOK()) {
12691280
return;
12701281
}
1282+
// If we've rejected a change, we need to restore the display
1283+
// of the active macro.
1284+
// That's because next time we open this dialog we want to see the
1285+
// unedited macro.
1286+
if( bWasChanged )
1287+
ShowActiveMacro();
12711288
Hide();
12721289
}
12731290

src/BatchProcessDialog.h

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class MacrosWindow final : public ApplyMacroDialog
9494
void AddItem(const CommandID &command, wxString const &params);
9595
bool ChangeOK();
9696
void UpdateMenus();
97+
void ShowActiveMacro();
9798

9899
void OnMacroSelected(wxListEvent &event);
99100
void OnListSelected(wxListEvent &event);

0 commit comments

Comments
 (0)