1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 08:30:06 +02:00

// 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.
This commit is contained in:
v.audacity 2010-10-17 23:00:01 +00:00
parent 1f48404e16
commit e2261d1473

View File

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