GenericUI: move up filepath property handling
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Thu, 28 Jul 2016 18:26:58 +0000 (20:26 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Thu, 28 Jul 2016 21:20:03 +0000 (23:20 +0200)
Since it is the only case that's completely different from others in
that it only handles properties, and uses a different signal path for
updates, don't put it in the middle, but as the first case to check for.

Code move only, no behavior change (since it should be exclusive to all
other cases anyway).

gtk2_ardour/generic_pluginui.cc

index 68bb429dbfb858246fb6c9466dc73e24889531ef..dc19aca19ed90e5018cb525751e5c294415f7f32 100644 (file)
@@ -663,6 +663,38 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
 
        if (is_input) {
 
+               if (desc.datatype == Variant::PATH) {
+
+                       /* Build a file selector button */
+
+                       // Create/add controller
+                       control_ui->file_button = manage(new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_OPEN));
+                       control_ui->file_button->set_title(desc.label);
+
+                       if (use_knob) {
+                               control_ui->knobtable = manage (new Table());
+                               control_ui->pack_start(*control_ui->knobtable, true, false);
+                               control_ui->knobtable->attach (control_ui->label, 0, 1, 0, 1);
+                               control_ui->knobtable->attach (*control_ui->file_button, 0, 1, 1, 2);
+                       } else {
+                               control_ui->pack_start (control_ui->label, false, true);
+                               control_ui->pack_start (*control_ui->file_button, true, true);
+                       }
+
+                       // Monitor changes from the user.
+                       control_ui->file_button->signal_file_set().connect(
+                               sigc::bind(sigc::mem_fun(*this, &GenericPluginUI::set_path_property),
+                                          desc, control_ui->file_button));
+
+                       /* Add the filebutton control to a map so that we can update it when
+                        * the corresponding property changes. This doesn't go through the usual
+                        * AutomationControls, because they don't support non-numeric values. */
+                       _filepath_controls.insert(std::make_pair(desc.key, control_ui->file_button));
+
+                       return control_ui;
+               }
+
+
                /* See if there any named values for our input value */
                control_ui->scale_points = desc.scale_points;
 
@@ -709,36 +741,6 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
                        return control_ui;
                }
 
-               if (desc.datatype == Variant::PATH) {
-
-                       /* Build a file selector button */
-
-                       // Create/add controller
-                       control_ui->file_button = manage(new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_OPEN));
-                       control_ui->file_button->set_title(desc.label);
-
-                       if (use_knob) {
-                               control_ui->knobtable = manage (new Table());
-                               control_ui->pack_start(*control_ui->knobtable, true, false);
-                               control_ui->knobtable->attach (control_ui->label, 0, 1, 0, 1);
-                               control_ui->knobtable->attach (*control_ui->file_button, 0, 1, 1, 2);
-                       } else {
-                               control_ui->pack_start (control_ui->label, false, true);
-                               control_ui->pack_start (*control_ui->file_button, true, true);
-                       }
-
-                       // Monitor changes from the user.
-                       control_ui->file_button->signal_file_set().connect(
-                               sigc::bind(sigc::mem_fun(*this, &GenericPluginUI::set_path_property),
-                                          desc, control_ui->file_button));
-
-                       /* Add the filebutton control to a map so that we can update it when
-                        * the corresponding property changes. This doesn't go through the usual
-                        * AutomationControls, because they don't support non-numeric values. */
-                       _filepath_controls.insert(std::make_pair(desc.key, control_ui->file_button));
-
-                       return control_ui;
-               }
 
                /* create the controller */