diff options
author | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2016-07-28 20:26:58 +0200 |
---|---|---|
committer | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2016-07-28 23:20:03 +0200 |
commit | 0e7b9c6a9892a9f80dced00baa52745961f31014 (patch) | |
tree | 87c4632748444523214b4881be10d3870524edd3 /gtk2_ardour/generic_pluginui.cc | |
parent | 63bbcf968a11a3d6e89a6983d7bb810f487d63c1 (diff) |
GenericUI: move up filepath property handling
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).
Diffstat (limited to 'gtk2_ardour/generic_pluginui.cc')
-rw-r--r-- | gtk2_ardour/generic_pluginui.cc | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 68bb429dbf..dc19aca19e 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -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 */ |