From 4bd53e016b8bb912e48d77e756720516d876d5c2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Sep 2007 19:43:11 +0000 Subject: LV2 UI extension updates. LV2 GUI support in ingen. git-svn-id: http://svn.drobilla.net/lad/ingen@763 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/NodeMenu.cpp | 15 +++++++++++++++ src/libs/gui/NodeMenu.hpp | 2 ++ src/libs/gui/NodeModule.cpp | 30 ++++++++++++++++++++++-------- src/libs/gui/ingen_gui.glade | 16 ++++++++++++++++ 4 files changed, 55 insertions(+), 8 deletions(-) (limited to 'src/libs/gui') diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp index 54966e7e..9c2d978e 100644 --- a/src/libs/gui/NodeMenu.cpp +++ b/src/libs/gui/NodeMenu.cpp @@ -37,10 +37,13 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtrget_widget("node_menu", node_menu); xml->get_widget("node_controls_menuitem", _controls_menuitem); + xml->get_widget("node_gui_menuitem", _gui_menuitem); node_menu->remove(*_controls_menuitem); + node_menu->remove(*_gui_menuitem); items().push_front(Gtk::Menu_Helpers::SeparatorElem()); insert(*_controls_menuitem, 0); + insert(*_gui_menuitem, 0); } @@ -52,11 +55,23 @@ NodeMenu::init(SharedPtr node) _controls_menuitem->signal_activate().connect(sigc::bind( sigc::mem_fun(App::instance().window_factory(), &WindowFactory::present_controls), node)); + + if (node->plugin()->ui()) + _gui_menuitem->signal_activate().connect(sigc::mem_fun(this, &NodeMenu::show_gui)); + //else + // _gui_menuitem->hide(); _enable_signal = true; } +void +NodeMenu::show_gui() +{ + cerr << "SHOW GUI" << endl; +} + + void NodeMenu::on_menu_clone() { diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp index 20bc62e7..50226837 100644 --- a/src/libs/gui/NodeMenu.hpp +++ b/src/libs/gui/NodeMenu.hpp @@ -55,11 +55,13 @@ protected: virtual void enable_controls_menuitem(); virtual void disable_controls_menuitem(); + void show_gui(); void on_menu_clone(); void on_menu_learn(); Gtk::MenuItem* _controls_menuitem; + Gtk::MenuItem* _gui_menuitem; }; diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index e1839f37..25cc4aa1 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -51,9 +51,7 @@ NodeModule::NodeModule(boost::shared_ptr canvas, SharedPtrsignal_metadata.connect(sigc::mem_fun(this, &NodeModule::set_metadata)); node->signal_polyphonic.connect(sigc::mem_fun(this, &NodeModule::set_stacked_border)); node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename)); - - signal_clicked.connect(sigc::mem_fun(this, &NodeModule::on_click)); - + set_stacked_border(node->polyphonic()); } @@ -123,15 +121,31 @@ NodeModule::show_control_window() { #ifdef HAVE_SLV2 if (_node->plugin()->type() == PluginModel::LV2) { - GtkWidget* gui = (GtkWidget*)_node->plugin()->gui(); - if (gui) { - cerr << "GUI!\n"; + // FIXME: check type + + SLV2UIInstance ui = _node->plugin()->ui(); + if (ui) { + cerr << "Showing LV2 GUI" << endl; + // FIXME: leak + GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_node->plugin()->ui()); + Gtk::Window* win = new Gtk::Window(); + Gtk::Widget* widget = Glib::wrap(c_widget); + win->add(*widget); + widget->show_all(); + win->show_all(); + win->present(); + widget->show_all(); + win->show_all(); } else { - cerr << "No gui :(\n"; + cerr << "No LV2 GUI, showing builtin controls" << endl; + App::instance().window_factory()->present_controls(_node); } + } else { + App::instance().window_factory()->present_controls(_node); } -#endif +#else App::instance().window_factory()->present_controls(_node); +#endif } diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index 498faad4..65c2ffdd 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -3168,5 +3168,21 @@ Thank you for contributing. + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Show this node's custom graphical interface + GUI + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-edit + + + + -- cgit v1.2.1