1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-02 17:23:18 +02:00

Merge branch 'master' into HEAD

This commit is contained in:
Paul Licameli 2017-05-26 14:50:17 -04:00
commit c8f65d821d
5 changed files with 57 additions and 41 deletions

View File

@ -770,8 +770,8 @@ _("Selection too long for Nyquist code.\nMaximum allowed selection is %ld sample
if (mDebug && !mRedirectOutput) {
NyquistOutputDialog dlog(mUIParent, -1,
_("Nyquist"),
_("Nyquist Output: "),
mName,
_("Debug Output: "),
mDebugOutput.c_str());
dlog.CentreOnParent();
dlog.ShowModal();
@ -1175,8 +1175,7 @@ bool NyquistEffect::ProcessOne()
if (rval == nyx_string) {
wxMessageBox(NyquistToWxString(nyx_get_string()),
wxT("Nyquist"),
wxOK | wxCENTRE, mUIParent);
mName, wxOK | wxCENTRE, mUIParent);
// True if not process type.
// If not returning audio from process effect,
@ -2382,7 +2381,7 @@ NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id,
const wxString & title,
const wxString & prompt,
const wxString &message)
: wxDialogWrapper(parent, id, title)
: wxDialogWrapper{ parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER }
{
SetName(GetTitle());
@ -2399,10 +2398,10 @@ NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id,
// TODO: use ShowInfoDialog() instead.
// Beware this dialog MUST work with screen readers.
item = safenew wxTextCtrl(this, -1, message,
wxDefaultPosition, wxSize(400, 200),
wxTE_MULTILINE | wxTE_READONLY);
mainSizer->Add(item, 0, wxALIGN_LEFT | wxALL, 10);
item = new wxTextCtrl(this, -1, message,
wxDefaultPosition, wxSize(480, 250),
wxTE_MULTILINE | wxTE_READONLY);
mainSizer->Add(item, 1, wxEXPAND | wxALL, 10);
{
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);

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);

View File

@ -531,7 +531,9 @@ KeyView::RefreshBindings(const wxArrayString & names,
const wxArrayString & categories,
const wxArrayString & prefixes,
const wxArrayString & labels,
const wxArrayString & keys)
const wxArrayString & keys,
bool bSort
)
{
bool firsttime = mNodes.GetCount() == 0;
@ -604,6 +606,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
node.iscat = true;
node.isparent = true;
node.depth = depth++;
node.isopen = true;
// Add it to the tree
mNodes.Add(node);
@ -643,6 +646,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
node.ispfx = true;
node.isparent = true;
node.depth = depth++;
node.isopen = true;
// Add it to the tree
mNodes.Add(node);
@ -724,10 +728,10 @@ KeyView::RefreshBindings(const wxArrayString & names,
UpdateHScroll();
// Refresh the view lines
RefreshLines();
RefreshLines(bSort);
// Set the selected node if this was the first time through
if (firsttime)
// Set the selected node if we've just reprepared the list and nothing was selected.
if ((GetSelection()==wxNOT_FOUND) && bSort )
{
SelectNode(LineToIndex(0));
}
@ -737,7 +741,7 @@ KeyView::RefreshBindings(const wxArrayString & names,
// Refresh the list of lines within the current view
//
void
KeyView::RefreshLines()
KeyView::RefreshLines(bool bSort)
{
int cnt = (int) mNodes.GetCount();
int linecnt = 0;
@ -918,27 +922,34 @@ KeyView::RefreshLines()
mLines.Add(&node);
}
}
//To see how many lines are being sorted (and how often).
//wxLogDebug("Sorting %i lines", mLines.GetCount());
// Speed up the comparison function used in sorting
// by only translating this string once.
CommandTranslated = _("Command");
// Sort list based on type
switch (mViewType)
// Sorting is costly. If bSort is false, we do not have to sort.
// bSort false means we know that the list will be updated again before
// the user needs to see it.
if( bSort )
{
case ViewByTree:
mLines.Sort(CmpKeyNodeByTree);
break;
//To see how many lines are being sorted (and how often).
//wxLogDebug("Sorting %i lines for type %i", mLines.GetCount(), mViewType);
case ViewByName:
mLines.Sort(CmpKeyNodeByName);
break;
// Speed up the comparison function used in sorting
// by only translating this string once.
CommandTranslated = _("Command");
case ViewByKey:
mLines.Sort(CmpKeyNodeByKey);
break;
// Sort list based on type
switch (mViewType)
{
case ViewByTree:
mLines.Sort(CmpKeyNodeByTree);
break;
case ViewByName:
mLines.Sort(CmpKeyNodeByName);
break;
case ViewByKey:
mLines.Sort(CmpKeyNodeByKey);
break;
}
}
// Now, reassign the line numbers
@ -973,7 +984,8 @@ KeyView::RefreshLines()
#if wxUSE_ACCESSIBILITY
// Let accessibility know that the list has changed
mAx->ListUpdated();
if( bSort )
mAx->ListUpdated();
#endif
}

View File

@ -82,7 +82,8 @@ public:
const wxArrayString & categories,
const wxArrayString & prefixes,
const wxArrayString & labels,
const wxArrayString & keys);
const wxArrayString & keys,
bool bSort);
int GetSelected() const;
@ -109,7 +110,7 @@ public:
private:
void RecalcExtents();
void UpdateHScroll();
void RefreshLines();
void RefreshLines(bool bSort = true);
void SelectNode(int index);