patch from colinf that adds an 'empty' preset to the preset drop-down list, so that...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 19 Jun 2012 16:02:24 +0000 (16:02 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 19 Jun 2012 16:02:24 +0000 (16:02 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@12787 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/plugin_ui.cc
libs/ardour/ardour/plugin.h
libs/ardour/plugin.cc

index 455cea1364343bcdcb61c7cab46c443b778edd86..169928843ab4e1602bba6cbca11195053b495235 100644 (file)
@@ -593,6 +593,9 @@ PlugUIBase::preset_selected ()
                        warning << string_compose(_("Plugin preset %1 not found"),
                                                  _preset_combo.get_active_text()) << endmsg;
                }
+       } else {
+               // blank selected = no preset
+               plugin->clear_preset();
        }
 }
 
@@ -745,6 +748,8 @@ PlugUIBase::update_preset_list ()
                preset_labels.push_back (i->label);
        }
 
+       preset_labels.push_back("");
+
        set_popdown_strings (_preset_combo, preset_labels);
 
        --_no_load_preset;
@@ -768,6 +773,7 @@ PlugUIBase::update_preset ()
 void
 PlugUIBase::update_preset_modified ()
 {
+
        if (plugin->last_preset().uri.empty()) {
                _preset_modified.set_text ("");
                return;
index 15e5f4a9c52b1946cbe13d9489fc392b9bfd2282..bf91de903b68258fd16b7adb8afe08f218b01ed8 100644 (file)
@@ -183,6 +183,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent
        void remove_preset (std::string);
 
        virtual bool load_preset (PresetRecord);
+       void clear_preset ();
 
        const PresetRecord * preset_by_label (const std::string &);
        const PresetRecord * preset_by_uri (const std::string &);
index 4afc39b4ecdb63abedd873169115262b92bf8307..8cdbf98b899258502dc616042f7b51993ff9d328 100644 (file)
@@ -327,6 +327,16 @@ Plugin::load_preset (PresetRecord r)
        return true;
 }
 
+void
+Plugin::clear_preset ()
+{
+       _last_preset.uri = "";
+       _last_preset.label = "";
+       _parameter_changed_since_last_preset = false;
+
+       PresetLoaded (); /* EMIT SIGNAL */
+}
+
 /** @param val `plugin' value */
 void
 Plugin::set_parameter (uint32_t which, float val)