diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 7ceb4ef3f..c1bc2888b 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -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; iAppend(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; iAppend(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; i0 ) + 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(); } /// diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 9cf472bbc..cb2474780 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -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; }