diff options
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/NodeMenu.cpp | 15 | ||||
-rw-r--r-- | src/libs/gui/NodeMenu.hpp | 2 | ||||
-rw-r--r-- | src/libs/gui/NodeModule.cpp | 30 | ||||
-rw-r--r-- | src/libs/gui/ingen_gui.glade | 16 |
4 files changed, 55 insertions, 8 deletions
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::RefPtr<Gnome::Glade::Xml Gtk::Menu* node_menu = NULL; xml->get_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,12 +55,24 @@ NodeMenu::init(SharedPtr<NodeModel> 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() { cerr << "[NodeMenu] FIXME: clone broken\n"; 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<PatchCanvas> canvas, SharedPtr<NodeMode node->signal_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.</property> </child> </widget> </child> + <child> + <widget class="GtkImageMenuItem" id="node_gui_menuitem"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip" translatable="yes">Show this node's custom graphical interface</property> + <property name="label" translatable="yes">GUI</property> + <property name="use_underline">True</property> + <child internal-child="image"> + <widget class="GtkImage" id="menu-item-image22"> + <property name="visible">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="stock">gtk-edit</property> + </widget> + </child> + </widget> + </child> </widget> </glade-interface> |