mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 14:13:11 +02:00
Completion of fix for bug 229, so that we check against changes in progress rather than the master list.
This commit is contained in:
parent
01c8c239d0
commit
91b1124a39
@ -223,6 +223,8 @@ void KeyConfigPrefs::RepopulateBindingsList()
|
|||||||
// Save the original key value to support canceling
|
// Save the original key value to support canceling
|
||||||
if (save) {
|
if (save) {
|
||||||
mKeys.Add(key);
|
mKeys.Add(key);
|
||||||
|
// mNewKeys is what mKeys will change to
|
||||||
|
mNewKeys.Add(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cat != _("All") && mManager->GetCategoryFromName(name) != cat) {
|
if (cat != _("All") && mManager->GetCategoryFromName(name) != cat) {
|
||||||
@ -363,15 +365,30 @@ void KeyConfigPrefs::OnCaptureChar(wxKeyEvent & e)
|
|||||||
|
|
||||||
// Given a hotkey combination, returns the name (description) of the
|
// Given a hotkey combination, returns the name (description) of the
|
||||||
// corresponding command, or the empty string if none is found.
|
// corresponding command, or the empty string if none is found.
|
||||||
wxString KeyConfigPrefs::NameFromKey( const wxString & Key )
|
wxString KeyConfigPrefs::NameFromKey( const wxString & key )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
i=mKeys.Index( Key );
|
i=mNewKeys.Index( key );
|
||||||
if( i== wxNOT_FOUND )
|
if( i== wxNOT_FOUND )
|
||||||
return wxT("");
|
return wxT("");
|
||||||
return mNames[i];
|
return mNames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets the selected command to have this key
|
||||||
|
// This is not yet a committed change, which will happen on a save.
|
||||||
|
void KeyConfigPrefs::SetKeyForSelected( const wxString & key )
|
||||||
|
{
|
||||||
|
wxString name = mNames[mList->GetItemData(mCommandSelected)];
|
||||||
|
|
||||||
|
mList->SetItem(mCommandSelected, KeyComboColumn, key);
|
||||||
|
mManager->SetKeyFromName(name, key);
|
||||||
|
|
||||||
|
int i=mNames.Index( name );
|
||||||
|
if( i!=wxNOT_FOUND )
|
||||||
|
mNewKeys[i]=key;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
|
void KeyConfigPrefs::OnSet(wxCommandEvent & e)
|
||||||
{
|
{
|
||||||
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount())
|
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount())
|
||||||
@ -391,8 +408,7 @@ void KeyConfigPrefs::OnSet(wxCommandEvent & e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mList->SetItem(mCommandSelected, KeyComboColumn, newKey);
|
SetKeyForSelected( newKey );
|
||||||
mManager->SetKeyFromName(mNames[mList->GetItemData(mCommandSelected)], newKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
|
void KeyConfigPrefs::OnClear(wxCommandEvent& event)
|
||||||
@ -401,9 +417,7 @@ void KeyConfigPrefs::OnClear(wxCommandEvent& event)
|
|||||||
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
|
if (mCommandSelected < 0 || mCommandSelected >= mNames.GetCount()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SetKeyForSelected( wxT("") );
|
||||||
mList->SetItem(mCommandSelected, KeyComboColumn, wxT(""));
|
|
||||||
mManager->SetKeyFromName(mNames[mList->GetItemData(mCommandSelected)], wxT(""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::OnKeyDown(wxListEvent & e)
|
void KeyConfigPrefs::OnKeyDown(wxListEvent & e)
|
||||||
|
@ -35,7 +35,8 @@ class KeyConfigPrefs:public PrefsPanel
|
|||||||
void PopulateOrExchange(ShuttleGui & S);
|
void PopulateOrExchange(ShuttleGui & S);
|
||||||
void CreateList();
|
void CreateList();
|
||||||
void RepopulateBindingsList();
|
void RepopulateBindingsList();
|
||||||
wxString NameFromKey( const wxString & Key );
|
wxString NameFromKey( const wxString & key );
|
||||||
|
void SetKeyForSelected( const wxString & key );
|
||||||
|
|
||||||
void OnDefaults(wxCommandEvent & e);
|
void OnDefaults(wxCommandEvent & e);
|
||||||
void OnLoad(wxCommandEvent & e);
|
void OnLoad(wxCommandEvent & e);
|
||||||
@ -59,6 +60,7 @@ class KeyConfigPrefs:public PrefsPanel
|
|||||||
wxArrayString mCats;
|
wxArrayString mCats;
|
||||||
wxArrayString mNames;
|
wxArrayString mNames;
|
||||||
wxArrayString mKeys;
|
wxArrayString mKeys;
|
||||||
|
wxArrayString mNewKeys; // Used for work in progress.
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user