summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/plugin_ui.cc8
-rw-r--r--gtk2_ardour/plugin_ui.h18
-rw-r--r--gtk2_ardour/vst_pluginui.cc46
-rw-r--r--libs/ardour/ardour/vst_plugin.h1
-rw-r--r--libs/ardour/vst_plugin.cc15
5 files changed, 26 insertions, 62 deletions
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index 165108ae19..dc26e49d82 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -687,7 +687,9 @@ PlugUIBase::update_presets ()
void
PlugUIBase::update_sensitivity ()
{
- bool const have_preset = !preset_combo.get_model()->children().empty();
- save_button.set_sensitive (have_preset);
- delete_button.set_sensitive (have_preset);
+ bool const have_user_preset =
+ !preset_combo.get_model()->children().empty() && preset_combo.get_active_row_number() >= plugin->first_user_preset_index();
+
+ save_button.set_sensitive (have_user_preset);
+ delete_button.set_sensitive (have_user_preset);
}
diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h
index e1d9cfafce..9fe2ab4921 100644
--- a/gtk2_ardour/plugin_ui.h
+++ b/gtk2_ardour/plugin_ui.h
@@ -121,7 +121,7 @@ class PlugUIBase : public virtual sigc::trackable
Gtk::Image* focus_in_image;
bool no_load_preset;
- void setting_selected();
+ virtual void setting_selected ();
void add_plugin_setting ();
void save_plugin_setting ();
void delete_plugin_setting ();
@@ -311,24 +311,10 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
Gtk::Socket socket;
Gtk::HBox preset_box;
Gtk::VBox vpacker;
- Gtk::ComboBox vst_preset_combo;
- Glib::RefPtr<Gtk::ListStore> preset_model;
-
- struct PresetModelColumns : public Gtk::TreeModel::ColumnRecord {
- PresetModelColumns() {
- add (name);
- add (number);
- }
- Gtk::TreeModelColumn<std::string> name;
- Gtk::TreeModelColumn<int> number;
- };
-
- PresetModelColumns preset_columns;
bool configure_handler (GdkEventConfigure*, Gtk::Socket*);
void save_plugin_setting ();
- void preset_chosen ();
- void update_presets ();
+ void setting_selected ();
};
#endif // VST_SUPPORT
diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc
index 134ae6f2c1..8de5ebe63b 100644
--- a/gtk2_ardour/vst_pluginui.cc
+++ b/gtk2_ardour/vst_pluginui.cc
@@ -35,13 +35,6 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
: PlugUIBase (pi),
vst (vp)
{
- preset_model = ListStore::create (preset_columns);
-
- CellRenderer* renderer = manage (new CellRendererText());
- vst_preset_combo.pack_start (*renderer, true);
- vst_preset_combo.add_attribute (*renderer, "text", 0);
- vst_preset_combo.set_model (preset_model);
-
update_presets ();
fst_run_editor (vst->fst());
@@ -49,12 +42,10 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
preset_box.set_spacing (6);
preset_box.set_border_width (6);
preset_box.pack_end (bypass_button, false, false, 10);
- preset_box.pack_end (edit_button, false, false);
+ preset_box.pack_end (delete_button, false, false);
preset_box.pack_end (save_button, false, false);
preset_box.pack_end (add_button, false, false);
- preset_box.pack_end (vst_preset_combo, false, false);
-
- vst_preset_combo.signal_changed().connect (sigc::mem_fun (*this, &VSTPluginUI::preset_chosen));
+ preset_box.pack_end (preset_combo, false, false);
bypass_button.set_active (!insert->active());
@@ -70,9 +61,9 @@ VSTPluginUI::~VSTPluginUI ()
}
void
-VSTPluginUI::preset_chosen ()
+VSTPluginUI::setting_selected ()
{
- int const r = vst_preset_combo.get_active_row_number ();
+ int const r = preset_combo.get_active_row_number ();
if (r < vst->first_user_preset_index()) {
/* This is a plugin-provided preset.
@@ -81,11 +72,11 @@ VSTPluginUI::preset_chosen ()
vst->fst()->want_program = r;
} else {
/* This is a user preset. This method knows about the direct dispatch restriction, too */
- TreeModel::iterator i = vst_preset_combo.get_active ();
- plugin->load_preset ((*i)[preset_columns.name]);
+ plugin->load_preset (preset_combo.get_active_text());
}
socket.grab_focus ();
+ update_sensitivity ();
}
int
@@ -157,31 +148,6 @@ VSTPluginUI::configure_handler (GdkEventConfigure* ev, Gtk::Socket *socket)
return false;
}
-void
-VSTPluginUI::update_presets ()
-{
- std::vector<Plugin::PresetRecord> presets = plugin->get_presets ();
-
- preset_model->clear ();
-
- int j = 0;
- for (std::vector<Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
- TreeModel::Row row = *(preset_model->append ());
- row[preset_columns.name] = i->label;
- row[preset_columns.number] = j++;
- }
-
- if (presets.size() > 0) {
- vst->fst()->plugin->dispatcher (vst->fst()->plugin, effSetProgram, 0, 0, NULL, 0);
- }
-
- if (vst->fst()->current_program != -1) {
- vst_preset_combo.set_active (vst->fst()->current_program);
- } else {
- vst_preset_combo.set_active (0);
- }
-}
-
typedef int (*error_handler_t)( Display *, XErrorEvent *);
static Display *the_gtk_display;
static error_handler_t wine_error_handler;
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index b6e2a02756..e9a2c4abdf 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -97,6 +97,7 @@ private:
gchar* get_chunk (bool);
int set_chunk (gchar const *, bool);
XMLTree * presets_tree () const;
+ std::string presets_file () const;
FSTHandle* handle;
FST* _fst;
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index e77fc483ed..625e4482b3 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -425,8 +425,9 @@ VSTPlugin::do_save_preset (string name)
sys::path f = ARDOUR::user_config_directory ();
f /= "presets";
- f /= "vst";
+ f /= presets_file ();
+ cout << "Write presets to " << f.to_string () << "\n";
t->write (f.to_string ());
delete t;
return uri;
@@ -449,8 +450,9 @@ VSTPlugin::do_remove_preset (string name)
sys::path f = ARDOUR::user_config_directory ();
f /= "presets";
- f /= "vst";
+ f /= presets_file ();
+ cout << "Write presets to " << f.to_string () << "\n";
t->write (f.to_string ());
delete t;
}
@@ -711,7 +713,7 @@ VSTPlugin::presets_tree () const
create_directory (p);
}
- p /= "vst";
+ p /= presets_file ();
if (!exists (p)) {
t->set_root (new XMLNode (X_("VSTPresets")));
@@ -734,7 +736,14 @@ VSTPlugin::first_user_preset_index () const
return _plugin->numPrograms;
}
+string
+VSTPlugin::presets_file () const
+{
+ return string_compose ("vst-%1", unique_id ());
+}
+
VSTPluginInfo::VSTPluginInfo()
{
type = ARDOUR::VST;
}
+