add "remove from favorites" context menu
authorRobin Gareus <robin@gareus.org>
Sun, 27 Dec 2015 17:17:45 +0000 (18:17 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 27 Dec 2015 17:17:45 +0000 (18:17 +0100)
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h

index 822363c1a8db2ad2a9802dbe2085e6c9b8859969..7bbfb843c6dd83dec7e6778fd83c39e2ea9c1a6e 100644 (file)
@@ -2343,18 +2343,19 @@ Mixer_UI::popup_note_context_menu (GdkEventButton *ev)
 
        if (_selection.routes.empty()) {
                items.push_back (MenuElem (_("No Track/Bus is selected.")));
 
        if (_selection.routes.empty()) {
                items.push_back (MenuElem (_("No Track/Bus is selected.")));
-               m->popup (ev->button, ev->time);
-               return;
-       }
+       } else {
 
 
-       items.push_back (MenuElem (_("Add at the top"),
-                               sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddTop)));
-       items.push_back (MenuElem (_("Add Pre-Fader"),
-                               sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPreFader)));
-       items.push_back (MenuElem (_("Add Post-Fader"),
-                               sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPostFader)));
-       items.push_back (MenuElem (_("Add at the end"),
-                               sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddBottom)));
+               items.push_back (MenuElem (_("Add at the top"),
+                                       sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddTop)));
+               items.push_back (MenuElem (_("Add Pre-Fader"),
+                                       sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPreFader)));
+               items.push_back (MenuElem (_("Add Post-Fader"),
+                                       sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddPostFader)));
+               items.push_back (MenuElem (_("Add at the end"),
+                                       sigc::bind (sigc::mem_fun (*this, &Mixer_UI::add_selected_processor), AddBottom)));
+       }
+       items.push_back (SeparatorElem());
+       items.push_back (MenuElem (_("Remove from favorites"), sigc::mem_fun (*this, &Mixer_UI::remove_selected_from_favorites)));
        m->popup (ev->button, ev->time);
 }
 
        m->popup (ev->button, ev->time);
 }
 
@@ -2382,6 +2383,26 @@ Mixer_UI::add_selected_processor (ProcessorPosition pos)
        add_favorite_processor (ppp, pos);
 }
 
        add_favorite_processor (ppp, pos);
 }
 
+void
+Mixer_UI::remove_selected_from_favorites ()
+{
+       Glib::RefPtr<Gtk::TreeView::Selection> selection = favorite_plugins_display.get_selection();
+       if (!selection) {
+               return;
+       }
+       Gtk::TreeModel::iterator iter = selection->get_selected();
+       if (!iter) {
+               return;
+       }
+       ARDOUR::PluginPresetPtr ppp = (*iter)[favorite_plugins_columns.plugin];
+       PluginManager::PluginStatusType status = PluginManager::Normal;
+       PluginManager& manager (PluginManager::instance());
+
+       manager.set_status (ppp->_pip->type, ppp->_pip->unique_id, status);
+       manager.save_statuses ();
+       sync_treeview_from_favorite_order ();
+}
+
 void
 Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* column)
 {
 void
 Mixer_UI::plugin_row_activated (const TreeModel::Path& path, TreeViewColumn* column)
 {
index 5399307be69e86b8a646e199116a5c9ddb00680a..492ecd3a14f8607bdc3eafa71fb34ab7afd98ba2 100644 (file)
@@ -211,6 +211,7 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
 
        void add_selected_processor (ProcessorPosition);
        void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
 
        void add_selected_processor (ProcessorPosition);
        void add_favorite_processor (ARDOUR::PluginPresetPtr, ProcessorPosition);
+       void remove_selected_from_favorites ();
 
        void initial_track_display ();
        void show_track_list_menu ();
 
        void initial_track_display ();
        void show_track_list_menu ();