From e2261d1473cbd268b1a53dcba44dd058cbfe602b Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Sun, 17 Oct 2010 23:00:01 +0000 Subject: [PATCH] // Note that History window should be available either for UndoAvailableFlag or RedoAvailableFlag, // but we can't make the AddItem flags and mask have both, because they'd both have to be true for the // command to be enabled. // If user has Undone the entire stack, RedoAvailableFlag is on but UndoAvailableFlag is off. // If user has done things but not Undone anything, RedoAvailableFlag is off but UndoAvailableFlag is on. // So in either of those cases, (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask // would fail. // The only way to fix this in the current architecture is to hack in special cases for RedoAvailableFlag // in AudacityProject::UpdateMenus() (ugly) and CommandManager::HandleCommandEntry() (*really* ugly -- // shouldn't know about particular command names and flags). // So for now, enable the command regardless of stack. It will just show empty (except for Created Project) sometimes. // FOR REDESIGN, clearly there are some limitations with the flags/mask bitmaps. --- src/Menus.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index fe0259193..9dfda2a2e 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -548,9 +548,30 @@ void AudacityProject::CreateMenusAndCommands() c->AddSeparator(); + // History window should be available either for UndoAvailableFlag or RedoAvailableFlag, + // but we can't make the AddItem flags and mask have both, because they'd both have to be true for the + // command to be enabled. + // If user has Undone the entire stack, RedoAvailableFlag is on but UndoAvailableFlag is off. + // If user has done things but not Undone anything, RedoAvailableFlag is off but UndoAvailableFlag is on. + // So in either of those cases, (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask + // would fail. + // The only way to fix this in the current architecture is to hack in special cases for RedoAvailableFlag + // in AudacityProject::UpdateMenus() (ugly) and CommandManager::HandleCommandEntry() (*really* ugly -- + // shouldn't know about particular command names and flags). + // Here's the hack that would be necessary in AudacityProject::UpdateMenus(), if somebody decides to do it: + // // Because EnableUsingFlags requires all the flag bits match the corresponding mask bits, + // // "UndoHistory" specifies only AudioIONotBusyFlag | UndoAvailableFlag, because that + // // covers the majority of cases where it should be enabled. + // // If history is not empty but we've Undone the whole stack, we also want to enable, + // // to show the Redo's on stack. + // // "UndoHistory" might already be enabled, but add this check for RedoAvailableFlag. + // if (flags & RedoAvailableFlag) + // mCommandManager.Enable(wxT("UndoHistory"), true); + // So for now, enable the command regardless of stack. It will just show empty sometimes. + // FOR REDESIGN, clearly there are some limitations with the flags/mask bitmaps. c->AddItem(wxT("UndoHistory"), _("&History..."), FN(OnHistory), - AudioIONotBusyFlag | UndoAvailableFlag, - AudioIONotBusyFlag | UndoAvailableFlag); + AudioIONotBusyFlag, + AudioIONotBusyFlag); c->AddItem(wxT("Karaoke"), _("&Karaoke..."), FN(OnKaraoke), LabelTracksExistFlag, LabelTracksExistFlag); c->AddItem(wxT("MixerBoard"), _("&Mixer Board..."), FN(OnMixerBoard), WaveTracksExistFlag, WaveTracksExistFlag);