mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +02:00
CommandManager stores only stripped menu names (no & characters)...
... Keyboard preference dialog does not need to repeat the stripping
This commit is contained in:
parent
1ef29b7a51
commit
8ce72748bf
@ -643,7 +643,7 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn,
|
||||
|
||||
TranslatableString labelPrefix;
|
||||
if (!mSubMenuList.empty()) {
|
||||
labelPrefix = mSubMenuList.back()->name;
|
||||
labelPrefix = mSubMenuList.back()->name.Stripped();
|
||||
}
|
||||
|
||||
// For key bindings for commands with a list, such as align,
|
||||
@ -684,7 +684,7 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn,
|
||||
entry->key = NormalizedKeyString{ accel.BeforeFirst(wxT('\t')) };
|
||||
entry->defaultKey = entry->key;
|
||||
entry->labelPrefix = labelPrefix;
|
||||
entry->labelTop = wxMenuItem::GetLabelText(mCurrentMenuName.Translation());
|
||||
entry->labelTop = mCurrentMenuName.Stripped();
|
||||
entry->menu = menu;
|
||||
entry->finder = finder;
|
||||
entry->callback = callback;
|
||||
@ -1218,13 +1218,12 @@ CommandManager::HandleTextualCommand(const CommandID & Str,
|
||||
return CommandNotFound;
|
||||
}
|
||||
|
||||
void CommandManager::GetCategories(
|
||||
wxArrayString &cats, AudacityProject * /* p */)
|
||||
TranslatableStrings CommandManager::GetCategories( AudacityProject& )
|
||||
{
|
||||
cats.clear();
|
||||
TranslatableStrings cats;
|
||||
|
||||
for (const auto &entry : mCommandList) {
|
||||
wxString cat = entry->labelTop;
|
||||
auto &cat = entry->labelTop;
|
||||
if ( ! make_iterator_range( cats ).contains(cat) ) {
|
||||
cats.push_back(cat);
|
||||
}
|
||||
@ -1247,6 +1246,8 @@ void CommandManager::GetCategories(
|
||||
|
||||
cats.push_back(COMMAND);
|
||||
#endif
|
||||
|
||||
return cats;
|
||||
}
|
||||
|
||||
void CommandManager::GetAllCommandNames(CommandIDs &names,
|
||||
@ -1286,7 +1287,7 @@ void CommandManager::GetAllCommandData(
|
||||
std::vector<NormalizedKeyString> &keys,
|
||||
std::vector<NormalizedKeyString> &default_keys,
|
||||
TranslatableStrings &labels,
|
||||
wxArrayString &categories,
|
||||
TranslatableStrings &categories,
|
||||
#if defined(EXPERIMENTAL_KEY_VIEW)
|
||||
TranslatableStrings &prefixes,
|
||||
#endif
|
||||
@ -1297,18 +1298,7 @@ void CommandManager::GetAllCommandData(
|
||||
// It does need the effects.
|
||||
//if ( entry->isEffect )
|
||||
// continue;
|
||||
if (!entry->multi)
|
||||
{
|
||||
names.push_back(entry->name);
|
||||
keys.push_back(entry->key);
|
||||
default_keys.push_back(entry->defaultKey);
|
||||
labels.push_back(entry->label);
|
||||
categories.push_back(entry->labelTop);
|
||||
#if defined(EXPERIMENTAL_KEY_VIEW)
|
||||
prefixes.push_back(entry->labelPrefix);
|
||||
#endif
|
||||
}
|
||||
else if( includeMultis )
|
||||
if ( !entry->multi || includeMultis )
|
||||
{
|
||||
names.push_back(entry->name);
|
||||
keys.push_back(entry->key);
|
||||
@ -1352,11 +1342,11 @@ TranslatableString CommandManager::GetPrefixedLabelFromName(const CommandID &nam
|
||||
return entry->label;
|
||||
}
|
||||
|
||||
wxString CommandManager::GetCategoryFromName(const CommandID &name)
|
||||
TranslatableString CommandManager::GetCategoryFromName(const CommandID &name)
|
||||
{
|
||||
CommandListEntry *entry = mCommandNameHash[name];
|
||||
if (!entry)
|
||||
return wxT("");
|
||||
return {};
|
||||
|
||||
return entry->labelTop;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ struct CommandListEntry
|
||||
NormalizedKeyString defaultKey;
|
||||
TranslatableString label;
|
||||
TranslatableString labelPrefix;
|
||||
wxString labelTop;
|
||||
TranslatableString labelTop;
|
||||
wxMenu *menu;
|
||||
CommandHandlerFinder finder;
|
||||
CommandFunctorPointer callback;
|
||||
@ -270,7 +270,7 @@ class AUDACITY_DLL_API CommandManager final
|
||||
// Accessing
|
||||
//
|
||||
|
||||
void GetCategories(wxArrayString &cats, AudacityProject *);
|
||||
TranslatableStrings GetCategories( AudacityProject& );
|
||||
void GetAllCommandNames(CommandIDs &names, bool includeMultis) const;
|
||||
void GetAllCommandLabels(
|
||||
TranslatableStrings &labels, std::vector<bool> &vExcludeFromMacros,
|
||||
@ -279,7 +279,7 @@ class AUDACITY_DLL_API CommandManager final
|
||||
CommandIDs &names,
|
||||
std::vector<NormalizedKeyString> &keys,
|
||||
std::vector<NormalizedKeyString> &default_keys,
|
||||
TranslatableStrings &labels, wxArrayString &categories,
|
||||
TranslatableStrings &labels, TranslatableStrings &categories,
|
||||
#if defined(EXPERIMENTAL_KEY_VIEW)
|
||||
TranslatableStrings &prefixes,
|
||||
#endif
|
||||
@ -291,7 +291,7 @@ class AUDACITY_DLL_API CommandManager final
|
||||
|
||||
TranslatableString GetLabelFromName(const CommandID &name);
|
||||
TranslatableString GetPrefixedLabelFromName(const CommandID &name);
|
||||
wxString GetCategoryFromName(const CommandID &name);
|
||||
TranslatableString GetCategoryFromName(const CommandID &name);
|
||||
NormalizedKeyString GetKeyFromName(const CommandID &name) const;
|
||||
NormalizedKeyString GetDefaultKeyFromName(const CommandID &name);
|
||||
|
||||
|
@ -318,7 +318,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
void KeyConfigPrefs::RefreshBindings(bool bSort)
|
||||
{
|
||||
TranslatableStrings Labels;
|
||||
wxArrayString Categories;
|
||||
TranslatableStrings Categories;
|
||||
TranslatableStrings Prefixes;
|
||||
|
||||
mNames.clear();
|
||||
|
@ -634,7 +634,7 @@ KeyView::UpdateHScroll()
|
||||
//
|
||||
void
|
||||
KeyView::RefreshBindings(const CommandIDs & names,
|
||||
const wxArrayString & categories,
|
||||
const TranslatableStrings & categories,
|
||||
const TranslatableStrings & prefixes,
|
||||
const TranslatableStrings & labels,
|
||||
const std::vector<NormalizedKeyString> & keys,
|
||||
@ -667,8 +667,8 @@ KeyView::RefreshBindings(const CommandIDs & names,
|
||||
int x, y;
|
||||
|
||||
// Remove any menu code from the category and prefix
|
||||
wxString cat = wxMenuItem::GetLabelText(categories[i]);
|
||||
wxString pfx = wxMenuItem::GetLabelText(prefixes[i].Translation());
|
||||
wxString cat = categories[i].Translation();
|
||||
wxString pfx = prefixes[i].Translation();
|
||||
|
||||
// Append "Menu" this node is for a menu title
|
||||
if (cat != CommandTranslated)
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
wxString GetName() const override; // Gets the control name from the base class
|
||||
|
||||
void RefreshBindings(const CommandIDs & names,
|
||||
const wxArrayString & categories,
|
||||
const TranslatableStrings & categories,
|
||||
const TranslatableStrings & prefixes,
|
||||
const TranslatableStrings & labels,
|
||||
const std::vector<NormalizedKeyString> & keys,
|
||||
|
Loading…
x
Reference in New Issue
Block a user