mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Don't encode command options as part of accelerator string...
... also restore the intended meaning of "allowDup" (for debugging checks only), which had never been properly implemented because the label, not the accelerator, was scanned for it; see commit f2f7568
This commit is contained in:
parent
1efb10cf78
commit
1ef29b7a51
@ -694,8 +694,9 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn,
|
||||
entry->count = count;
|
||||
entry->flags = AlwaysEnabledFlag;
|
||||
entry->enabled = true;
|
||||
entry->skipKeydown = (accel.Find(wxT("\tskipKeydown")) != wxNOT_FOUND);
|
||||
entry->wantKeyup = (accel.Find(wxT("\twantKeyup")) != wxNOT_FOUND) || entry->skipKeydown;
|
||||
entry->skipKeydown = options.skipKeyDown;
|
||||
entry->wantKeyup = options.wantKeyUp || entry->skipKeydown;
|
||||
entry->allowDup = options.allowDup;
|
||||
entry->isGlobal = false;
|
||||
entry->isOccult = bMakingOccultCommands;
|
||||
entry->checkmarkFn = options.checker;
|
||||
@ -1484,6 +1485,9 @@ void CommandManager::CheckDups()
|
||||
if (mCommandList[j]->key.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mCommandList[j]->allowDup)
|
||||
continue;
|
||||
|
||||
for (size_t i = 0; (int)i < cnt; i++) {
|
||||
if (i == j) {
|
||||
|
@ -79,6 +79,7 @@ struct CommandListEntry
|
||||
bool enabled;
|
||||
bool skipKeydown;
|
||||
bool wantKeyup;
|
||||
bool allowDup;
|
||||
bool isGlobal;
|
||||
bool isOccult;
|
||||
bool isEffect;
|
||||
@ -165,6 +166,15 @@ class AUDACITY_DLL_API CommandManager final
|
||||
{ global = true; return std::move(*this); }
|
||||
Options &&UseStrictFlags () &&
|
||||
{ useStrictFlags = true; return std::move(*this); }
|
||||
Options &&WantKeyUp () &&
|
||||
{ wantKeyUp = true; return std::move(*this); }
|
||||
Options &&SkipKeyDown () &&
|
||||
{ skipKeyDown = true; return std::move(*this); }
|
||||
|
||||
// This option affects debugging only:
|
||||
Options &&AllowDup () &&
|
||||
{ allowDup = true; return std::move(*this); }
|
||||
|
||||
Options &&AllowInMacros ( int value = 1 ) &&
|
||||
{ allowInMacros = value; return std::move(*this); }
|
||||
|
||||
@ -185,6 +195,9 @@ class AUDACITY_DLL_API CommandManager final
|
||||
TranslatableString longName{};
|
||||
bool global{ false };
|
||||
bool useStrictFlags{ false };
|
||||
bool wantKeyUp{ false };
|
||||
bool skipKeyDown{ false };
|
||||
bool allowDup{ false };
|
||||
int allowInMacros{ -1 }; // 0 = never, 1 = always, -1 = deduce from label
|
||||
|
||||
private:
|
||||
|
@ -882,13 +882,14 @@ AttachedItem sAttachment2{
|
||||
|
||||
BaseItemSharedPtr ExtraClipCursorItems()
|
||||
{
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr items{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Clip"),
|
||||
Command( wxT("ClipLeft"), XXO("Clip L&eft"), FN(OnClipLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("\twantKeyup") ),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), Options{}.WantKeyUp() ),
|
||||
Command( wxT("ClipRight"), XXO("Clip Rig&ht"), FN(OnClipRight),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("\twantKeyup") )
|
||||
TracksExistFlag() | TrackPanelHasFocus(), Options{}.WantKeyUp() )
|
||||
) ) };
|
||||
return items;
|
||||
}
|
||||
|
@ -1143,6 +1143,7 @@ AttachedItem sAttachment1{
|
||||
|
||||
BaseItemSharedPtr ExtraSelectionMenu()
|
||||
{
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Select"), XXO("&Selection"),
|
||||
@ -1159,11 +1160,11 @@ BaseItemSharedPtr ExtraSelectionMenu()
|
||||
Command( wxT("SelExtLeft"), XXO("Selection Extend &Left"),
|
||||
FN(OnSelExtendLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
wxT("Shift+Left\twantKeyup\tallowDup") ),
|
||||
Options{ wxT("Shift+Left") }.WantKeyUp().AllowDup() ),
|
||||
Command( wxT("SelExtRight"), XXO("Selection Extend &Right"),
|
||||
FN(OnSelExtendRight),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
wxT("Shift+Right\twantKeyup\tallowDup") ),
|
||||
Options{ wxT("Shift+Right") }.WantKeyUp().AllowDup() ),
|
||||
Command( wxT("SelSetExtLeft"), XXO("Set (or Extend) Le&ft Selection"),
|
||||
FN(OnSelSetExtendLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus() ),
|
||||
@ -1173,11 +1174,11 @@ BaseItemSharedPtr ExtraSelectionMenu()
|
||||
Command( wxT("SelCntrLeft"), XXO("Selection Contract L&eft"),
|
||||
FN(OnSelContractLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
wxT("Ctrl+Shift+Right\twantKeyup") ),
|
||||
Options{ wxT("Ctrl+Shift+Right") }.WantKeyUp() ),
|
||||
Command( wxT("SelCntrRight"), XXO("Selection Contract R&ight"),
|
||||
FN(OnSelContractRight),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
wxT("Ctrl+Shift+Left\twantKeyup") )
|
||||
Options{ wxT("Ctrl+Shift+Left") }.WantKeyUp() )
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
@ -1238,15 +1239,16 @@ AttachedItem sAttachment0{
|
||||
|
||||
BaseItemSharedPtr ExtraCursorMenu()
|
||||
{
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Cursor"), XXO("&Cursor"),
|
||||
Command( wxT("CursorLeft"), XXO("Cursor &Left"), FN(OnCursorLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
wxT("Left\twantKeyup\tallowDup") ),
|
||||
Options{ wxT("Left") }.WantKeyUp().AllowDup() ),
|
||||
Command( wxT("CursorRight"), XXO("Cursor &Right"), FN(OnCursorRight),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
wxT("Right\twantKeyup\tallowDup") ),
|
||||
Options{ wxT("Right") }.WantKeyUp().AllowDup() ),
|
||||
Command( wxT("CursorShortJumpLeft"), XXO("Cursor Sh&ort Jump Left"),
|
||||
FN(OnCursorShortJumpLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT(",") ),
|
||||
@ -1270,18 +1272,23 @@ AttachedItem sAttachment4{
|
||||
|
||||
BaseItemSharedPtr ExtraSeekMenu()
|
||||
{
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Seek"), XXO("See&k"),
|
||||
Command( wxT("SeekLeftShort"), XXO("Short Seek &Left During Playback"),
|
||||
FN(OnSeekLeftShort), AudioIOBusyFlag(), wxT("Left\tallowDup") ),
|
||||
FN(OnSeekLeftShort), AudioIOBusyFlag(),
|
||||
Options{ wxT("Left") }.AllowDup() ),
|
||||
Command( wxT("SeekRightShort"),
|
||||
XXO("Short Seek &Right During Playback"), FN(OnSeekRightShort),
|
||||
AudioIOBusyFlag(), wxT("Right\tallowDup") ),
|
||||
AudioIOBusyFlag(),
|
||||
Options{ wxT("Right") }.AllowDup() ),
|
||||
Command( wxT("SeekLeftLong"), XXO("Long Seek Le&ft During Playback"),
|
||||
FN(OnSeekLeftLong), AudioIOBusyFlag(), wxT("Shift+Left\tallowDup") ),
|
||||
FN(OnSeekLeftLong), AudioIOBusyFlag(),
|
||||
Options{ wxT("Shift+Left") }.AllowDup() ),
|
||||
Command( wxT("SeekRightLong"), XXO("Long Seek Rig&ht During Playback"),
|
||||
FN(OnSeekRightLong), AudioIOBusyFlag(), wxT("Shift+Right\tallowDup") )
|
||||
FN(OnSeekRightLong), AudioIOBusyFlag(),
|
||||
Options{ wxT("Shift+Right") }.AllowDup() )
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
@ -1463,6 +1463,7 @@ AttachedItem sAttachment1{
|
||||
|
||||
BaseItemSharedPtr ExtraTrackMenu()
|
||||
{
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Track"), XXO("&Track"),
|
||||
@ -1486,7 +1487,8 @@ BaseItemSharedPtr ExtraTrackMenu()
|
||||
TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Down") ),
|
||||
Command( wxT("TrackMenu"), XXO("Op&en Menu on Focused Track..."),
|
||||
FN(OnTrackMenu),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+M\tskipKeydown") ),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
Options{ wxT("Shift+M") }.SkipKeyDown() ),
|
||||
Command( wxT("TrackMute"), XXO("M&ute/Unmute Focused Track"),
|
||||
FN(OnTrackMute),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+U") ),
|
||||
|
@ -1259,10 +1259,12 @@ BaseItemSharedPtr KeyboardScrubbingItems()
|
||||
Items( wxT("KeyboardScrubbing"),
|
||||
Command(wxT("KeyboardScrubBackwards"), XXO("Scrub Bac&kwards"),
|
||||
&Scrubber::OnKeyboardScrubBackwards,
|
||||
CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("U\twantKeyup")),
|
||||
CaptureNotBusyFlag() | CanStopAudioStreamFlag(),
|
||||
Options{ wxT("U") }.WantKeyUp() ),
|
||||
Command(wxT("KeyboardScrubForwards"), XXO("Scrub For&wards"),
|
||||
&Scrubber::OnKeyboardScrubForwards,
|
||||
CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("I\twantKeyup"))
|
||||
CaptureNotBusyFlag() | CanStopAudioStreamFlag(),
|
||||
Options{ wxT("I") }.WantKeyUp() )
|
||||
) ) };
|
||||
return items;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user