1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Further speed up to showing preferences.

We now don't sort the list until a view is selected.  Also we create it with nodes open, rather than creating with nodes closed and then separately opening them.  Instead of 3 sorts at initialisation only one happens now.  AX info is only updated after a sort, so this may be 3x faster for screen reader users too.
This commit is contained in:
James Crook
2017-05-25 15:45:47 +01:00
parent 181c137129
commit 597ddbfa52
4 changed files with 49 additions and 32 deletions

View File

@@ -142,7 +142,9 @@ void KeyConfigPrefs::Populate()
mManager = project->GetCommandManager();
RefreshBindings();
// For speed, don't sort here. We're just creating.
// Instead sort when we do SetView later in this function.
RefreshBindings(false);
if (mViewByTree->GetValue()) {
mViewType = ViewByTree;
@@ -294,7 +296,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
Layout();
}
void KeyConfigPrefs::RefreshBindings()
void KeyConfigPrefs::RefreshBindings(bool bSort)
{
wxArrayString Labels;
wxArrayString Categories;
@@ -316,8 +318,10 @@ void KeyConfigPrefs::RefreshBindings()
Categories,
Prefixes,
Labels,
mKeys);
mView->ExpandAll();
mKeys,
bSort);
//Not needed as new nodes are already shown expanded.
//mView->ExpandAll();
mNewKeys = mKeys;
}
@@ -351,7 +355,7 @@ void KeyConfigPrefs::OnImport(wxCommandEvent & WXUNUSED(event))
wxOK | wxCENTRE, this);
}
RefreshBindings();
RefreshBindings(true);
}
void KeyConfigPrefs::OnExport(wxCommandEvent & WXUNUSED(event))
@@ -391,7 +395,7 @@ void KeyConfigPrefs::OnDefaults(wxCommandEvent & WXUNUSED(event))
mManager->SetKeyFromIndex(i, mNewKeys[i]);
}
RefreshBindings();
RefreshBindings(true);
}
void KeyConfigPrefs::OnHotkeyKeyDown(wxKeyEvent & e)

View File

@@ -46,7 +46,7 @@ public:
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void RefreshBindings();
void RefreshBindings(bool bSort);
wxString NameFromKey(const wxString & key);
void SetKeyForSelected(const wxString & key);