mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-25 15:53:52 +02:00
Use type aliases CommandID, CommandIDs...
... for identifiers of menu commands and macros, and for vectors thereof
This commit is contained in:
@@ -77,7 +77,7 @@ BEGIN_EVENT_TABLE(KeyConfigPrefs, PrefsPanel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
KeyConfigPrefs::KeyConfigPrefs(wxWindow * parent, wxWindowID winid,
|
||||
const wxString &name)
|
||||
const CommandID &name)
|
||||
/* i18n-hint: as in computer keyboard (not musical!) */
|
||||
: PrefsPanel(parent, winid, _("Keyboard")),
|
||||
mView(NULL),
|
||||
@@ -501,7 +501,7 @@ void KeyConfigPrefs::OnFilterChar(wxKeyEvent & e)
|
||||
|
||||
// Given a hotkey combination, returns the name (description) of the
|
||||
// corresponding command, or the empty string if none is found.
|
||||
wxString KeyConfigPrefs::NameFromKey(const NormalizedKeyString & key)
|
||||
CommandID KeyConfigPrefs::NameFromKey(const NormalizedKeyString & key)
|
||||
{
|
||||
return mView->GetNameByKey(key);
|
||||
}
|
||||
@@ -510,7 +510,7 @@ wxString KeyConfigPrefs::NameFromKey(const NormalizedKeyString & key)
|
||||
// This is not yet a committed change, which will happen on a save.
|
||||
void KeyConfigPrefs::SetKeyForSelected(const NormalizedKeyString & key)
|
||||
{
|
||||
wxString name = mView->GetName(mCommandSelected);
|
||||
auto name = mView->GetName(mCommandSelected);
|
||||
|
||||
if (!mView->CanSetKey(mCommandSelected))
|
||||
{
|
||||
@@ -534,8 +534,8 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & WXUNUSED(event))
|
||||
}
|
||||
|
||||
NormalizedKeyString key { mKey->GetValue() };
|
||||
wxString oldname = mView->GetNameByKey(key);
|
||||
wxString newname = mView->GetName(mCommandSelected);
|
||||
auto oldname = mView->GetNameByKey(key);
|
||||
auto newname = mView->GetName(mCommandSelected);
|
||||
|
||||
// Just ignore it if they are the same
|
||||
if (oldname == newname) {
|
||||
|
||||
@@ -36,7 +36,7 @@ struct NormalizedKeyString;
|
||||
class KeyConfigPrefs final : public PrefsPanel
|
||||
{
|
||||
public:
|
||||
KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const wxString &name);
|
||||
KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const CommandID &name);
|
||||
bool Commit() override;
|
||||
void Cancel() override;
|
||||
wxString HelpPageName() override;
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
void Populate();
|
||||
void RefreshBindings(bool bSort);
|
||||
void FilterKeys( std::vector<NormalizedKeyString> & arr );
|
||||
wxString NameFromKey(const NormalizedKeyString & key);
|
||||
CommandID NameFromKey(const NormalizedKeyString & key);
|
||||
void SetKeyForSelected(const NormalizedKeyString & key);
|
||||
|
||||
void OnViewBy(wxCommandEvent & e);
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
CommandManager *mManager;
|
||||
int mCommandSelected;
|
||||
|
||||
wxArrayString mNames;
|
||||
CommandIDs mNames;
|
||||
std::vector<NormalizedKeyString> mDefaultKeys; // The full set.
|
||||
std::vector<NormalizedKeyString> mStandardDefaultKeys; // The reduced set.
|
||||
std::vector<NormalizedKeyString> mKeys;
|
||||
@@ -98,11 +98,11 @@ private:
|
||||
class KeyConfigPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
KeyConfigPrefsFactory(const wxString &name = wxString{})
|
||||
KeyConfigPrefsFactory(const CommandID &name = {})
|
||||
: mName{ name } {}
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
|
||||
private:
|
||||
wxString mName;
|
||||
CommandID mName;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user