commit 8d94990336f3fd5523986f05bc3a5fe9f076b482 parent 30347b8af893db761882af55723ca7271611d311 Author: dsp56300 <87139854+dsp56300@users.noreply.github.com> Date: Sun, 12 May 2024 01:35:18 +0200 Merge pull request #195 from mkruselj/better-menu-column-breaks Improve column breaks for dropdown menu based parameters Diffstat:
M | source/jucePluginLib/parameterbinding.cpp | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/source/jucePluginLib/parameterbinding.cpp b/source/jucePluginLib/parameterbinding.cpp @@ -133,10 +133,15 @@ namespace pluginLib uint32_t count = 0; - for (const auto& vs : sortedValues) + // we want our long menus to be split into columns of 16 rows each + // but only if we have have more entries than one and a half such column + const uint32_t splitAt = (sortedValues.size() > 24) ? 16 : 0; + + for (const auto &vs : sortedValues) { _combo.addItem(vs.second, vs.first + 1); - if(++count == 16) + + if (++count == splitAt) { _combo.getRootMenu()->addColumnBreak(); count = 0;