mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-16 09:31:14 +01:00
Reduce number of shortcuts provided by default.
The full list of shortcuts, the maxList, is still available, and can be set in KeyboardPreferences.
This commit is contained in:
@@ -425,6 +425,9 @@ CommandManager::CommandManager():
|
|||||||
bMakingOccultCommands( false )
|
bMakingOccultCommands( false )
|
||||||
{
|
{
|
||||||
mbSeparatorAllowed = false;
|
mbSeparatorAllowed = false;
|
||||||
|
SetMaxList();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -436,6 +439,75 @@ CommandManager::~CommandManager()
|
|||||||
PurgeData();
|
PurgeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommandManager needs to know which defaults are standard and which are in the
|
||||||
|
// full (max) list.
|
||||||
|
void CommandManager::SetMaxList()
|
||||||
|
{
|
||||||
|
|
||||||
|
// This list is a DUPLICATE of the list in
|
||||||
|
// KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
||||||
|
|
||||||
|
// TODO: At a later date get rid of the maxList entirely and
|
||||||
|
// instead use flags in the menu entrys to indicate whether the default
|
||||||
|
// shortcut is standard or full.
|
||||||
|
|
||||||
|
mMaxListOnly.Clear();
|
||||||
|
// These short cuts are for the max list only....
|
||||||
|
//mMaxListOnly.Add( "Ctrl+I" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Alt+I" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+J" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Alt+J" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Alt+V" );
|
||||||
|
mMaxListOnly.Add( "Alt+X" );
|
||||||
|
mMaxListOnly.Add( "Alt+K" );
|
||||||
|
mMaxListOnly.Add( "Shift+Alt+X" );
|
||||||
|
mMaxListOnly.Add( "Shift+Alt+K" );
|
||||||
|
mMaxListOnly.Add( "Alt+L" );
|
||||||
|
mMaxListOnly.Add( "Shift+Alt+C" );
|
||||||
|
mMaxListOnly.Add( "Alt+I" );
|
||||||
|
mMaxListOnly.Add( "Alt+J" );
|
||||||
|
mMaxListOnly.Add( "Shift+Alt+J" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Shift+A" );
|
||||||
|
mMaxListOnly.Add( "Q" );
|
||||||
|
mMaxListOnly.Add( "Shift+J" );
|
||||||
|
mMaxListOnly.Add( "Shift+K" );
|
||||||
|
//mMaxListOnly.Add( "Shift+Home" );
|
||||||
|
//mMaxListOnly.Add( "Shift+End" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+[" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+]" );
|
||||||
|
mMaxListOnly.Add( "1" );
|
||||||
|
mMaxListOnly.Add( "Shift+F5" );
|
||||||
|
mMaxListOnly.Add( "Shift+F6" );
|
||||||
|
mMaxListOnly.Add( "Shift+F7" );
|
||||||
|
mMaxListOnly.Add( "Shift+F8" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Shift+F5" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Shift+F7" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Shift+N" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Shift+M" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Home" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+End" );
|
||||||
|
mMaxListOnly.Add( "Shift+C" );
|
||||||
|
mMaxListOnly.Add( "Alt+Shift+Up" );
|
||||||
|
mMaxListOnly.Add( "Alt+Shift+Down" );
|
||||||
|
mMaxListOnly.Add( "Shift+P" );
|
||||||
|
mMaxListOnly.Add( "Alt+Shift+Left" );
|
||||||
|
mMaxListOnly.Add( "Alt+Shift+Right" );
|
||||||
|
mMaxListOnly.Add( "Ctrl+Shift+T" );
|
||||||
|
//mMaxListOnly.Add( "Command+M" );
|
||||||
|
//mMaxListOnly.Add( "Option+Command+M" );
|
||||||
|
mMaxListOnly.Add( "Shift+H" );
|
||||||
|
mMaxListOnly.Add( "Shift+O" );
|
||||||
|
mMaxListOnly.Add( "Shift+I" );
|
||||||
|
mMaxListOnly.Add( "Shift+N" );
|
||||||
|
mMaxListOnly.Add( "D" );
|
||||||
|
mMaxListOnly.Add( "A" );
|
||||||
|
mMaxListOnly.Add( "Alt+Shift+F6" );
|
||||||
|
mMaxListOnly.Add( "Alt+F6" );
|
||||||
|
|
||||||
|
mMaxListOnly.Sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CommandManager::PurgeData()
|
void CommandManager::PurgeData()
|
||||||
{
|
{
|
||||||
// mCommandList contains pointers to CommandListEntrys
|
// mCommandList contains pointers to CommandListEntrys
|
||||||
@@ -908,6 +980,14 @@ CommandListEntry *CommandManager::NewIdentifier(const wxString & name,
|
|||||||
entry->isGlobal = false;
|
entry->isGlobal = false;
|
||||||
entry->isOccult = bMakingOccultCommands;
|
entry->isOccult = bMakingOccultCommands;
|
||||||
|
|
||||||
|
// Exclude accelerators that are in the MaxList.
|
||||||
|
// Note that the default is unaffected, intentionally so.
|
||||||
|
// There are effectively two levels of default, the full (max) list
|
||||||
|
// and the normal reduced list.
|
||||||
|
if( mMaxListOnly.Index( entry->key ) !=-1)
|
||||||
|
entry->key = wxT("");
|
||||||
|
|
||||||
|
|
||||||
// For key bindings for commands with a list, such as effects,
|
// For key bindings for commands with a list, such as effects,
|
||||||
// the name in prefs is the category name plus the effect name.
|
// the name in prefs is the category name plus the effect name.
|
||||||
if (multi) {
|
if (multi) {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
|||||||
CommandManager(const CommandManager&) PROHIBITED;
|
CommandManager(const CommandManager&) PROHIBITED;
|
||||||
CommandManager &operator= (const CommandManager&) PROHIBITED;
|
CommandManager &operator= (const CommandManager&) PROHIBITED;
|
||||||
|
|
||||||
|
void SetMaxList();
|
||||||
void PurgeData();
|
void PurgeData();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -316,6 +317,9 @@ protected:
|
|||||||
XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
|
XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// mMaxList only holds shortcuts that should not be added (by default).
|
||||||
|
wxSortedArrayString mMaxListOnly;
|
||||||
|
|
||||||
MenuBarList mMenuBarList;
|
MenuBarList mMenuBarList;
|
||||||
SubMenuList mSubMenuList;
|
SubMenuList mSubMenuList;
|
||||||
CommandList mCommandList;
|
CommandList mCommandList;
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ void KeyConfigPrefs::RefreshBindings(bool bSort)
|
|||||||
mNames.Clear();
|
mNames.Clear();
|
||||||
mKeys.Clear();
|
mKeys.Clear();
|
||||||
mDefaultKeys.Clear();
|
mDefaultKeys.Clear();
|
||||||
|
mStandardDefaultKeys.Clear();
|
||||||
mManager->GetAllCommandData(
|
mManager->GetAllCommandData(
|
||||||
mNames,
|
mNames,
|
||||||
mKeys,
|
mKeys,
|
||||||
@@ -314,6 +315,9 @@ void KeyConfigPrefs::RefreshBindings(bool bSort)
|
|||||||
Prefixes,
|
Prefixes,
|
||||||
true); // True to include effects (list items), false otherwise.
|
true); // True to include effects (list items), false otherwise.
|
||||||
|
|
||||||
|
mStandardDefaultKeys = mDefaultKeys;
|
||||||
|
FilterKeys( mStandardDefaultKeys );
|
||||||
|
|
||||||
mView->RefreshBindings(mNames,
|
mView->RefreshBindings(mNames,
|
||||||
Categories,
|
Categories,
|
||||||
Prefixes,
|
Prefixes,
|
||||||
@@ -401,10 +405,8 @@ void KeyConfigPrefs::OnDefaults(wxCommandEvent & event)
|
|||||||
PopupMenu(&Menu);//, wxPoint(0, 0));
|
PopupMenu(&Menu);//, wxPoint(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
void KeyConfigPrefs::FilterKeys( wxArrayString & arr )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
|
||||||
mNewKeys = mDefaultKeys;
|
|
||||||
wxSortedArrayString MaxListOnly;
|
wxSortedArrayString MaxListOnly;
|
||||||
|
|
||||||
// These short cuts are for the max list only....
|
// These short cuts are for the max list only....
|
||||||
@@ -460,14 +462,21 @@ void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
|||||||
MaxListOnly.Add( "Alt+F6" );
|
MaxListOnly.Add( "Alt+F6" );
|
||||||
|
|
||||||
MaxListOnly.Sort();
|
MaxListOnly.Sort();
|
||||||
|
// Remove items that are in MaxList.
|
||||||
|
for (size_t i = 0; i < arr.GetCount(); i++) {
|
||||||
|
if( MaxListOnly.Index( arr[i] ) != wxNOT_FOUND )
|
||||||
|
arr[i]= wxT("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeyConfigPrefs::OnImportDefaults(wxCommandEvent & event)
|
||||||
|
{
|
||||||
|
mNewKeys = mDefaultKeys;
|
||||||
|
if( event.GetId() == 0 )
|
||||||
|
FilterKeys( mNewKeys );
|
||||||
|
|
||||||
for (size_t i = 0; i < mNewKeys.GetCount(); i++) {
|
for (size_t i = 0; i < mNewKeys.GetCount(); i++) {
|
||||||
// Proof of concept for idea for freeing up some unwanted bindings.
|
mManager->SetKeyFromIndex(i, mNewKeys[i]);
|
||||||
// There will be neater code idioms we can use.
|
|
||||||
bool bDeleteBinding = false;
|
|
||||||
if( id == 0 )
|
|
||||||
bDeleteBinding |= ( MaxListOnly.Index( mNewKeys[i] ) != wxNOT_FOUND );
|
|
||||||
mManager->SetKeyFromIndex(i, bDeleteBinding ? "" : mNewKeys[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshBindings(true);
|
RefreshBindings(true);
|
||||||
@@ -703,7 +712,7 @@ bool KeyConfigPrefs::Commit()
|
|||||||
PopulateOrExchange(S);
|
PopulateOrExchange(S);
|
||||||
|
|
||||||
for (size_t i = 0; i < mNames.GetCount(); i++) {
|
for (size_t i = 0; i < mNames.GetCount(); i++) {
|
||||||
wxString dkey = KeyStringNormalize(mDefaultKeys[i]);
|
wxString dkey = KeyStringNormalize(mStandardDefaultKeys[i]);
|
||||||
wxString name = wxT("/NewKeys/") + mNames[i];
|
wxString name = wxT("/NewKeys/") + mNames[i];
|
||||||
wxString key = KeyStringNormalize(mNewKeys[i]);
|
wxString key = KeyStringNormalize(mNewKeys[i]);
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ private:
|
|||||||
void Populate();
|
void Populate();
|
||||||
void PopulateOrExchange(ShuttleGui & S);
|
void PopulateOrExchange(ShuttleGui & S);
|
||||||
void RefreshBindings(bool bSort);
|
void RefreshBindings(bool bSort);
|
||||||
|
void FilterKeys( wxArrayString & arr );
|
||||||
wxString NameFromKey(const wxString & key);
|
wxString NameFromKey(const wxString & key);
|
||||||
void SetKeyForSelected(const wxString & key);
|
void SetKeyForSelected(const wxString & key);
|
||||||
|
|
||||||
@@ -86,7 +87,8 @@ private:
|
|||||||
int mCommandSelected;
|
int mCommandSelected;
|
||||||
|
|
||||||
wxArrayString mNames;
|
wxArrayString mNames;
|
||||||
wxArrayString mDefaultKeys;
|
wxArrayString mDefaultKeys; // The full set.
|
||||||
|
wxArrayString mStandardDefaultKeys; // The reduced set.
|
||||||
wxArrayString mKeys;
|
wxArrayString mKeys;
|
||||||
wxArrayString mNewKeys; // Used for work in progress.
|
wxArrayString mNewKeys; // Used for work in progress.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user