Use small Astate buttons for plugins with many controls
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Tue, 29 Aug 2017 10:00:20 +0000 (12:00 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Tue, 29 Aug 2017 10:06:33 +0000 (12:06 +0200)
The generic plugin UI uses spelled-out automation state buttons for
controls, which is good for readability and usability, but some plugins
have a very big amount of controls which means we need a lot of columns.

For those plugins, prefer one-letter automation states, to save width.

gtk2_ardour/generic_pluginui.cc

index 01984376b11142b3dd16a2bdad28792d4361d3b0..b1d3b8c49d105d57f4dffef1870dcf3e13894643 100644 (file)
@@ -220,6 +220,7 @@ std::size_t s1pos, s2pos, n = 0;
 
 static const guint32 min_controls_per_column = 17, max_controls_per_column = 24;
 static const float default_similarity_threshold = 0.3;
+static const guint32 max_columns_for_big_autostate = 2;
 
 void
 GenericPluginUI::build ()
@@ -474,6 +475,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
        // starting a new column when necessary.
 
        i = 0;
+       size_t columns = 1;
        for (vector<ControlUI*>::iterator cuip = cui_controls_list.begin(); cuip != cui_controls_list.end(); ++cuip, ++i) {
 
                ControlUI* cui = *cuip;
@@ -493,6 +495,7 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
                                frame->add (*box);
                                hpacker.pack_start(*frame, true, true);
                                x = 0;
+                               ++columns;
                        } else {
                                HSeparator *split = new HSeparator();
                                split->set_size_request(-1, 5);
@@ -503,6 +506,14 @@ GenericPluginUI::automatic_layout (const std::vector<ControlUI*>& control_uis)
                box->pack_start (*cui, false, false);
        }
 
+       if (columns > max_columns_for_big_autostate) {
+               for (vector<ControlUI*>::iterator cuip = cui_controls_list.begin();
+                                                 cuip != cui_controls_list.end();
+                                                 ++cuip) {
+                       set_short_autostate(*cuip, true);
+               }
+       }
+
        if (is_scrollable) {
                prefheight = 30 * i;
        }