1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 16:49:41 +02:00

Simplified Audacity (using ! prefix) now works for effects and analyse items too.

This commit is contained in:
james.k.crook@gmail.com 2013-09-22 11:48:29 +00:00
parent 7ddd4ed2ab
commit db56cbd363
2 changed files with 45 additions and 31 deletions

View File

@ -537,43 +537,55 @@ void CommandManager::AddItemList(wxString name, wxArrayString labels,
if( mHidingLevel > 0 )
return;
if (CurrentMenu()->GetMenuItemCount() + labels.GetCount() < MAX_MENU_LEN)
plugins = false;
if (!plugins) {
for(i=0; i<labels.GetCount(); i++) {
int ID = NewIdentifier(name, labels[i], CurrentMenu(), callback,
true, i, labels.GetCount());
CurrentMenu()->Append(ID, labels[i]);
}
mbSeparatorAllowed = true;
return;
}
unsigned int effLen = labels.GetCount();
unsigned int nVisibleEffects=0;
wxString label;
unsigned int effLen = labels.GetCount();
int listnum = 1;
int tmpmax = MAX_SUBMENU_LEN < effLen? MAX_SUBMENU_LEN: effLen;
//The first submenu starts at 1.
BeginSubMenu(wxString::Format(_("Plugins 1 to %i"), tmpmax));
int tmpmax;
// Count the visible effects.
for(i=0; i<effLen; i++) {
int ID = NewIdentifier(name, labels[i], CurrentMenu(), callback,
true, i, effLen);
CurrentMenu()->Append(ID, labels[i]);
if(((i+1) % MAX_SUBMENU_LEN) == 0 && i != (effLen - 1)) {
EndSubMenu();
listnum++;
//This label the plugins by number in the submenu title (1 to 15, 15 to 30, etc.)
tmpmax = i + MAX_SUBMENU_LEN < effLen? 1 + i + MAX_SUBMENU_LEN: effLen;
BeginSubMenu(wxString::Format(_("Plugins %i to %i"),i+2,tmpmax));
// ItemShouldBeHidden removes the ! so do it to a temporary.
label = labels[i];
if (!ItemShouldBeHidden(label)) {
nVisibleEffects++;
}
}
EndSubMenu();
if (CurrentMenu()->GetMenuItemCount() + nVisibleEffects < MAX_MENU_LEN)
plugins = false;
// j counts the visible menu items, i counts the actual menu items.
// These numbers are the same unless we are using a simplified interface
// by hiding effects with a ! before them when translated.
int j=0;
for(i=0; i<effLen; i++) {
if (!ItemShouldBeHidden(labels[i])) {
// ---- Start of code for Plugin sub-menus. Only relevant on wxGTK.
// If plugins, and at start of a sublist....
if( plugins && ((j % MAX_SUBMENU_LEN) == 0 )) {
// End previous sub-menu, if there was one.
if( j>0 )
EndSubMenu();
// Start new sub-menu
// tmpmax is number of last plugin for this sub-menu
tmpmax = wxMax(j + MAX_SUBMENU_LEN, (int)nVisibleEffects);
// Submenu titles are 1 to 15, 15 to 30, etc.
BeginSubMenu(wxString::Format(_("Plugins %i to %i"),j+1,tmpmax));
}
// ---- End of code for Plugin sub-menus.
j++;
int ID = NewIdentifier(name, labels[i], CurrentMenu(), callback,
true, i, effLen);
CurrentMenu()->Append(ID, labels[i]);
mbSeparatorAllowed = true;
}
}
if( plugins && (nVisibleEffects>0 ))
EndSubMenu();
}
///

View File

@ -53,6 +53,8 @@ wxString Effect::StripAmpersand(const wxString& str)
{
wxString strippedStr = str;
strippedStr.Replace(wxT("&"), wxT(""));
// ! is used for hiding effects, and should not affect sort order.
strippedStr.Replace(wxT("!"), wxT(""));
return strippedStr;
}