commit 752db74b8c5b2fd0674df4f6c8d4759a03a728b5 parent 30347b8af893db761882af55723ca7271611d311 Author: Mario Kruselj <mario.kruselj@gmail.com> Date: Sat, 11 May 2024 22:59:21 +0200 Improve column breaks for dropdown menu based parameters Previously column breaks happened after every 16th menu entry verbatim, no chance of parole. With this change a column break will only happen if we have more than one and a half columns of entries total (16 + 8) 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;