The beginning of the end for ClickBox
authorRobin Gareus <robin@gareus.org>
Sat, 23 Sep 2017 17:40:55 +0000 (19:40 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 23 Sep 2017 17:42:04 +0000 (19:42 +0200)
This fixes various issues with integer controls (some values are not
reachable due to incorrect rounding in AutoSpin) and also pulls
in the various benefits of BarController:
  * mouse-drags
  * numeric entry
  * alternative entry modes (piano-keyboard, tempo-based values)

If this style remains, ClickBox & AutoSpin should be removed from
the codebase.

gtk2_ardour/generic_pluginui.cc

index e1a737444d9a80b4a4b055c97399199fa01cb7ca..e01a36755929d31fd6d7586d05261d3744bbcfa1 100644 (file)
@@ -1014,7 +1014,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
 
                        Adjustment* adj = control_ui->controller->adjustment();
 
-                       if (desc.integer_step && !desc.toggled) {
+                       if (false /* desc.integer_step && !desc.toggled */) {
                                control_ui->clickbox = new ArdourWidgets::ClickBox (adj, "PluginUIClickBox", true);
                                Gtkmm2ext::set_size_request_to_display_given_text (*control_ui->clickbox, "g9999999", 2, 2);
                                if (desc.unit == ParameterDescriptor::MIDI_NOTE) {
@@ -1034,6 +1034,11 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
                        } else {
                                control_ui->controller->set_size_request (200, -1);
                                control_ui->controller->set_name (X_("ProcessorControlSlider"));
+                               if (desc.integer_step) {
+                                       AutomationBarController* abc = dynamic_cast <AutomationBarController*> (control_ui->controller->widget ());
+                                       assert (abc);
+                                       abc->set_digits (0);
+                               }
                        }
 
                        if (!desc.integer_step && !desc.toggled && use_knob) {