From 2fc2d031a11b0a7ea6de48f7c20313c4b842a51d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 9 Jun 2008 01:53:00 +0000 Subject: Add quick context menu for Internal 'plugins'. git-svn-id: http://svn.drobilla.net/lad/ingen@1235 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/PatchCanvas.cpp | 31 +++++++++++++++++++++++++++++-- src/libs/gui/PatchCanvas.hpp | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index 4960d5d4..b26c5737 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -112,6 +112,8 @@ PatchCanvas::PatchCanvas(SharedPtr patch, int width, int height) _menu_add_button_control->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), BUTTON));*/ + build_internal_menu(); + #ifdef HAVE_SLV2 build_plugin_menu(); #endif @@ -131,6 +133,31 @@ PatchCanvas::PatchCanvas(SharedPtr patch, int width, int height) } +void +PatchCanvas::build_internal_menu() +{ + _menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem("Internal", + *(manage(new Gtk::Image(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU))))); + + Gtk::MenuItem* internal_menu_item = &(_menu->items().back()); + Gtk::Menu* internal_menu = Gtk::manage(new Gtk::Menu()); + internal_menu_item->set_submenu(*internal_menu); + + const Store::Plugins& plugins = App::instance().store()->plugins(); + + // Add LV2 plugins + for (Store::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { + SharedPtr p = i->second; + if (p->type() == Plugin::Internal) { + internal_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(p->name(), + sigc::bind(sigc::mem_fun(this, &PatchCanvas::load_plugin), p))); + } + } + + _menu->reorder_child(*internal_menu_item, 2); +} + + #ifdef HAVE_SLV2 size_t PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, @@ -162,7 +189,7 @@ PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, const Store::Plugins& plugins = App::instance().store()->plugins(); - // Add plugins + // Add LV2 plugins for (Store::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { SLV2Plugin p = i->second->slv2_plugin(); @@ -196,7 +223,7 @@ PatchCanvas::build_plugin_menu() Gtk::MenuItem* plugin_menu_item = &(_menu->items().back()); Gtk::Menu* plugin_menu = Gtk::manage(new Gtk::Menu()); plugin_menu_item->set_submenu(*plugin_menu); - _menu->reorder_child(*plugin_menu_item, 2); + _menu->reorder_child(*plugin_menu_item, 3); SLV2PluginClass lv2_plugin = slv2_world_get_plugin_class(PluginModel::slv2_world()); SLV2PluginClasses classes = slv2_world_get_plugin_classes(PluginModel::slv2_world()); diff --git a/src/libs/gui/PatchCanvas.hpp b/src/libs/gui/PatchCanvas.hpp index 98a1635d..dfebab7e 100644 --- a/src/libs/gui/PatchCanvas.hpp +++ b/src/libs/gui/PatchCanvas.hpp @@ -94,6 +94,7 @@ private: void menu_load_patch(); void load_plugin(SharedPtr plugin); + void build_internal_menu(); #ifdef HAVE_SLV2 void build_plugin_menu(); size_t build_plugin_class_menu(Gtk::Menu* menu, -- cgit v1.2.1