Plugin Setup dropdown heuristics, limit dropdown entries

The Plugin Pin dialog still shows all options, which can
potentially be a very large dropdown. During initial setup
however, we only need the common "stereo" and "all", options.
This commit is contained in:
Robin Gareus 2023-01-06 00:53:34 +01:00
parent b410ed992b
commit db63f8320e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -135,13 +135,28 @@ PluginSetupDialog::setup_output_presets ()
}
}
bool have_matching_io = false;
const uint32_t n_audio = _cur_outputs.n_audio ();
bool have_matching_io = ppc.find (n_audio) != ppc.end ();
if (have_matching_io) {
_out_presets.AddMenuElem (MenuElem (preset_label (n_audio), sigc::bind (sigc::mem_fun (*this, &PluginSetupDialog::select_output_preset), n_audio)));
}
if (ppc.size() > 6 && *ppc.rbegin () != n_audio) {
uint32_t all = *ppc.rbegin ();
_out_presets.AddMenuElem (MenuElem (string_compose (_("All (%1)"), preset_label (all)), sigc::bind (sigc::mem_fun (*this, &PluginSetupDialog::select_output_preset), all)));
ppc.erase (all);
}
for (PluginOutputConfiguration::const_iterator i = ppc.begin () ; i != ppc.end (); ++i) {
assert (*i > 0);
if (*i == n_audio) {
assert (have_matching_io);
continue;
}
_out_presets.AddMenuElem (MenuElem (preset_label (*i), sigc::bind (sigc::mem_fun (*this, &PluginSetupDialog::select_output_preset), *i)));
if (*i == _cur_outputs.n_audio ()) {
have_matching_io = true;
if (_out_presets.items ().size () > 6) {
break;
}
}