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);