From f4d6256067e9581e67162dc9516b5ad11c8c0d93 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Sep 2007 04:00:03 +0000 Subject: Working LV2 GUI embedding, except for size issues... git-svn-id: http://svn.drobilla.net/lad/ingen@767 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/NodeMenu.cpp | 20 +- src/libs/gui/NodeMenu.hpp | 10 +- src/libs/gui/NodeModule.cpp | 55 ++- src/libs/gui/NodeModule.hpp | 8 +- src/libs/gui/ingen_gui.glade | 975 ++++++++++++++++++++++--------------------- 5 files changed, 572 insertions(+), 496 deletions(-) (limited to 'src/libs') diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp index 6e4cb1d2..93c76cc6 100644 --- a/src/libs/gui/NodeMenu.cpp +++ b/src/libs/gui/NodeMenu.cpp @@ -37,13 +37,16 @@ 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); + xml->get_widget("node_popup_gui_menuitem", _popup_gui_menuitem); + xml->get_widget("node_embed_gui_menuitem", _embed_gui_menuitem); node_menu->remove(*_controls_menuitem); - node_menu->remove(*_gui_menuitem); + node_menu->remove(*_popup_gui_menuitem); + node_menu->remove(*_embed_gui_menuitem); items().push_front(Gtk::Menu_Helpers::SeparatorElem()); insert(*_controls_menuitem, 0); - insert(*_gui_menuitem, 0); + insert(*_popup_gui_menuitem, 0); + insert(*_embed_gui_menuitem, 0); } @@ -56,8 +59,11 @@ NodeMenu::init(SharedPtr node) sigc::mem_fun(App::instance().window_factory(), &WindowFactory::present_controls), node)); - if (node->plugin()->ui(App::instance().engine().get(), node.get())) - _gui_menuitem->signal_activate().connect(sigc::mem_fun(this, &NodeMenu::show_gui)); + //if (node->plugin()->ui(App::instance().engine().get(), node.get())) + _popup_gui_menuitem->signal_activate().connect(sigc::mem_fun(signal_popup_gui, + &sigc::signal::emit)); + _embed_gui_menuitem->signal_toggled().connect(sigc::mem_fun(this, + &NodeMenu::on_menu_embed_gui)); //else // _gui_menuitem->hide(); @@ -66,9 +72,9 @@ NodeMenu::init(SharedPtr node) void -NodeMenu::show_gui() +NodeMenu::on_menu_embed_gui() { - cerr << "SHOW GUI" << endl; + signal_embed_gui.emit(_embed_gui_menuitem->get_active()); } diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp index 50226837..f0d30f4c 100644 --- a/src/libs/gui/NodeMenu.hpp +++ b/src/libs/gui/NodeMenu.hpp @@ -51,17 +51,21 @@ public: bool has_control_inputs(); + sigc::signal signal_popup_gui; + sigc::signal signal_embed_gui; + protected: virtual void enable_controls_menuitem(); virtual void disable_controls_menuitem(); - void show_gui(); void on_menu_clone(); void on_menu_learn(); + void on_menu_embed_gui(); - Gtk::MenuItem* _controls_menuitem; - Gtk::MenuItem* _gui_menuitem; + Gtk::MenuItem* _controls_menuitem; + Gtk::MenuItem* _popup_gui_menuitem; + Gtk::CheckMenuItem* _embed_gui_menuitem; }; diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index d271dd2f..4d7770ba 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -38,6 +38,8 @@ namespace GUI { NodeModule::NodeModule(boost::shared_ptr canvas, SharedPtr node) : FlowCanvas::Module(canvas, node->path().name()) , _node(node) + , _gui(NULL) + , _gui_item(NULL) { assert(_node); @@ -51,6 +53,8 @@ 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)); + + _menu->signal_embed_gui.connect(sigc::mem_fun(this, &NodeModule::embed_gui)); set_stacked_border(node->polyphonic()); } @@ -90,6 +94,54 @@ NodeModule::create(boost::shared_ptr canvas, SharedPtr n } +void +NodeModule::embed_gui(bool embed) +{ + if (embed) { + if (!_gui_item) { + cerr << "Embedding LV2 GUI" << endl; + // FIXME: leaks? + SLV2UIInstance ui = _node->plugin()->ui(App::instance().engine().get(), _node.get()); + if (ui) { + cerr << "Found UI" << endl; + GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(ui); + _gui = Glib::wrap(c_widget); + assert(_gui); + const double y = 4 + _canvas_title.property_text_height(); + _gui_item = new Gnome::Canvas::Widget(/**_canvas.lock()->root()*/*this, 2.0, y, *_gui); + } + } + + if (_gui_item) { + assert(_gui); + cerr << "Created canvas item" << endl; + _gui->show(); + _gui->show_all(); + _gui_item->show(); + Gtk::Requisition r = _gui->size_request(); + cerr << "Size request: " << r.width << "x" << r.height << endl; + _width = max(_width, (double)r.width); + _height = max(_height, (double)r.height); + _gui_item->property_width() = _width; + _gui_item->property_height() = _height; + _gui_item->raise_to_top(); + _ports_y_offset = _height + 2; + set_width(_width); + } else { + cerr << "*** Failed to create canvas item" << endl; + } + + } else { + if (_gui_item) + _gui_item->hide(); + + _ports_y_offset = 0; + } + + resize(); +} + + void NodeModule::rename() { @@ -128,8 +180,9 @@ NodeModule::show_control_window() cerr << "Showing LV2 GUI" << endl; // FIXME: leak GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(ui); - Gtk::Window* win = new Gtk::Window(); Gtk::Widget* widget = Glib::wrap(c_widget); + + Gtk::Window* win = new Gtk::Window(); win->add(*widget); widget->show_all(); win->show_all(); diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp index e34b289f..d414ca9a 100644 --- a/src/libs/gui/NodeModule.hpp +++ b/src/libs/gui/NodeModule.hpp @@ -76,9 +76,13 @@ protected: void add_port(SharedPtr port, bool resize=true); void remove_port(SharedPtr port); + + void embed_gui(bool embed); - SharedPtr _node; - NodeMenu* _menu; + SharedPtr _node; + NodeMenu* _menu; + Gtk::Widget* _gui; + Gnome::Canvas::Widget* _gui_item; }; diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index 65c2ffdd..cad82a9d 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -460,53 +460,62 @@ 3 12 - + True - 1 - Node Name: - True + True + Clear filter text (show all plugins) + gtk-clear + True + 0 - 2 - 3 + 2 + 3 GTK_FILL - + True + Name contains: - 1 - 2 - 1 - 2 GTK_FILL + - + True + True + True + Search string to filter plugin list + * - 1 - 2 - GTK_FILL - GTK_FILL + 1 + 2 + 6 - + True + False + True + Add selected plugin to patch + gtk-add + True + 0 2 3 - 1 - 2 + 2 + 3 GTK_FILL - GTK_FILL + @@ -549,60 +558,51 @@ - + True - False - True - Add selected plugin to patch - gtk-add - True - 0 2 3 - 2 - 3 + 1 + 2 GTK_FILL - + GTK_FILL - + True - True - True - Search string to filter plugin list - * - 1 - 2 - 6 + 1 + 2 + GTK_FILL + GTK_FILL - + True - Name contains: + 1 + 2 + 1 + 2 GTK_FILL - - + True - True - Clear filter text (show all plugins) - gtk-clear - True - 0 + 1 + Node Name: + True - 2 - 3 + 2 + 3 GTK_FILL @@ -633,61 +633,61 @@ 2 2 - + True - 0 - Name: + True + True + * + True - GTK_FILL - GTK_EXPAND - 5 + 1 + 2 + + 4 - + True - 0 - Polyphony: + True + 1 0 100 1 10 10 + 1 + 1 + 2 1 2 GTK_FILL - GTK_EXPAND - 5 + + 4 - + True - True - 1 0 100 1 10 10 - 1 + 0 + Polyphony: - 1 - 2 1 2 GTK_FILL - - 4 + GTK_EXPAND + 5 - + True - True - True - * - True + 0 + Name: - 1 - 2 - - 4 + GTK_FILL + GTK_EXPAND + 5 @@ -789,63 +789,71 @@ 12 4 - + True - 0 - <b>Name: </b> - True + + + True + True + Specify the name for the new patch + Specify: + True + 0 + True + load_subpatch_name_from_file_radio + + + False + False + + + + + True + False + True + Specify the name for the new patch + * + True + + + False + 1 + + - GTK_FILL - + 3 + 4 + GTK_FILL - + True 0 - <b>Polyphony: </b> - True - - - 1 - 2 - GTK_FILL - - - - - - True - True - Use the name stored in the patch file - Load from file - True - 0 - True - True - 1 - 2 + 2 + 3 GTK_FILL - + True True - Use the polyphony value stored in the patch file - Load from file + Set polyphony to the same value as the parent (containing) patch + Same as parent (?) True 0 - True True + load_subpatch_poly_from_file_radio - 1 - 2 + 2 + 3 1 2 GTK_FILL @@ -896,19 +904,19 @@ - + True True - Set polyphony to the same value as the parent (containing) patch - Same as parent (?) + Use the polyphony value stored in the patch file + Load from file True 0 + True True - load_subpatch_poly_from_file_radio - 2 - 3 + 1 + 2 1 2 GTK_FILL @@ -916,55 +924,47 @@ - + + True + True + Use the name stored in the patch file + Load from file + True + 0 + True + True + + + 1 + 2 + GTK_FILL + + + + + True 0 + <b>Polyphony: </b> + True - 2 - 3 + 1 + 2 GTK_FILL - + True - - - True - True - Specify the name for the new patch - Specify: - True - 0 - True - load_subpatch_name_from_file_radio - - - False - False - - - - - True - False - True - Specify the name for the new patch - * - True - - - False - 1 - - + 0 + <b>Name: </b> + True - 3 - 4 - GTK_FILL + GTK_FILL + @@ -1025,54 +1025,6 @@ 4 12 4 - - - True - 0 - <b>Polyphony: </b> - True - - - GTK_FILL - - - - - - True - True - Use the same polyphony as the current patch - Keep current - True - 0 - True - True - - - 1 - 2 - GTK_FILL - - - - - - True - True - Use the polyphony value stored in the patch file - Load from file - True - 0 - True - load_patch_poly_from_current_radio - - - 2 - 3 - GTK_FILL - - - True @@ -1113,6 +1065,54 @@ GTK_FILL + + + True + True + Use the polyphony value stored in the patch file + Load from file + True + 0 + True + load_patch_poly_from_current_radio + + + 2 + 3 + GTK_FILL + + + + + + True + True + Use the same polyphony as the current patch + Keep current + True + 0 + True + True + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + <b>Polyphony: </b> + True + + + GTK_FILL + + + False @@ -1156,67 +1156,42 @@ - - window1 - - - True - 4 - 2 - - - - - - - - - - - - - - - True - - - True - 0 - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - - - True - GTK_SHADOW_NONE - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - - - - - - + + window1 + + + True + 4 + 2 + + + + + + + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - True - Apply changed controls to all voices - All Voices - True - 0 - True + 0 + 4 + 4 + <b>Name</b> + True + True False @@ -1224,54 +1199,67 @@ - + True - 5 - - - True - True - Apply changed controls to one voice only - Specific Voice: - True - 0 - True - control_panel_all_voices_radio - - - False - False - - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + 1 + 0 + 0 + 2 + 2 + 2 - + True - False True - Voice control changes are applied to - 1 1 100 1 10 10 - 1 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 12 + 0 -9.9999999999999999e+45 1.0000000000000001e+63 1 10 10 + 4 True - - 1 - - False - False 1 False - 5 + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 -1e+113 1e+137 0 0 0 + 63 + False + + + False 1 + + 3 + 4 + + + + + True + + + 1 + 2 + GTK_FILL + @@ -1536,32 +1524,47 @@ Hold <Ctrl> to play controls in either mode. - - True - - - 1 - 2 - GTK_FILL - - - - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 - + True - 0 - 4 - 4 - <b>Name</b> - True - True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + + + True + GTK_SHADOW_NONE + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + + + + + + True + True + + + True + True + Apply changed controls to all voices + All Voices + True + 0 + True False @@ -1569,57 +1572,54 @@ Hold <Ctrl> to play controls in either mode. - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 1 - 0 - 0 - 2 - 2 - 2 + 5 - + True True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 12 - 0 -9.9999999999999999e+45 1.0000000000000001e+63 1 10 10 - 4 + Apply changed controls to one voice only + Specific Voice: + True + 0 + True + control_panel_all_voices_radio + + + False + False + + + + + True + False + True + Voice control changes are applied to + 1 1 100 1 10 10 + 1 True + + 1 + + False + False 1 False - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 -1e+113 1e+137 0 0 0 - 63 - False - - - False + 5 1 - - 3 - 4 - @@ -1709,51 +1709,51 @@ Hold <Ctrl> to play controls in either mode. 2 2 - + True - <b>Patch Search Path: </b> - True + 0 + 1 + 2 GTK_FILL - + True - True - * + <i>Example: /foo/bar:/home/john/patches:/usr/share/om/patches</i> + True 1 2 + 1 + 2 + GTK_FILL - + True - <i>Example: /foo/bar:/home/john/patches:/usr/share/om/patches</i> - True + True + * 1 - 2 - 1 - 2 - GTK_FILL + 2 - + True - 0 + <b>Patch Search Path: </b> + True - 1 - 2 GTK_FILL @@ -2129,7 +2129,7 @@ Hold <Ctrl> to play controls in either mode. 10 6 - + True 0 - @@ -2137,28 +2137,34 @@ Hold <Ctrl> to play controls in either mode. 1 2 + 2 + 3 GTK_FILL - + True 0 - Type: + Name: + 2 + 3 GTK_FILL - + True 0 - URI: + - + 1 + 2 1 2 GTK_FILL @@ -2166,14 +2172,12 @@ Hold <Ctrl> to play controls in either mode. - + True 0 - - + URI: - 1 - 2 1 2 GTK_FILL @@ -2181,20 +2185,18 @@ Hold <Ctrl> to play controls in either mode. - + True 0 - Name: + Type: - 2 - 3 GTK_FILL - + True 0 - @@ -2202,8 +2204,6 @@ Hold <Ctrl> to play controls in either mode. 1 2 - 2 - 3 GTK_FILL @@ -2358,64 +2358,33 @@ Contributors: 2 8 - - True - - - True - False - True - 16180 1 65535 1 10 10 - 1 - True - - - False - False - - - - - 1 - 2 - 1 - 2 - GTK_FILL - 8 - - - - + True - - - True - True - * - True - 28 - osc.udp://localhost:16180 - - + 0 1 2 + 2 + 3 GTK_FILL - GTK_FILL - 8 + - + True + False True - Connect to running server at: + Use internal engine True 0 True + connect_server_radiobutton + 2 + 3 GTK_FILL @@ -2438,35 +2407,66 @@ Contributors: - + True - False True - Use internal engine + Connect to running server at: True 0 True - connect_server_radiobutton - 2 - 3 GTK_FILL - + True - 0 + + + True + True + * + True + 28 + osc.udp://localhost:16180 + + 1 2 - 2 - 3 GTK_FILL - + GTK_FILL + 8 + + + + + True + + + True + False + True + 16180 1 65535 1 10 10 + 1 + True + + + False + False + + + + + 1 + 2 + 1 + 2 + GTK_FILL + 8 @@ -2807,19 +2807,26 @@ Contributors: 2 8 - + True - True - Enter a short name suitable for use as an identifier or filename. - -The first character must be one of _, a-z or A-Z and subsequenct characters can be from _, a-z, A-Z or 0-9. - - * - True + 0 + Short Name: - 1 - 2 + 1 + 2 + GTK_FILL + + + + + + True + 0 + Symbol: + + + GTK_FILL @@ -2840,26 +2847,19 @@ The first character must be one of _, a-z or A-Z and subsequenct characters can - - True - 0 - Symbol: - - - GTK_FILL - - - - - + True - 0 - Short Name: + True + Enter a short name suitable for use as an identifier or filename. + +The first character must be one of _, a-z or A-Z and subsequenct characters can be from _, a-z, A-Z or 0-9. + + * + True - 1 - 2 - GTK_FILL + 1 + 2 @@ -3005,17 +3005,26 @@ Thank you for contributing. 2 4 - + True - True - 0 -100000000 100000000 1 10 10 - 1 - 5 - True + 0 + Maximum Value: - 1 - 2 + 1 + 2 + GTK_FILL + + + + + + True + 0 + Minimum Value: + + + GTK_FILL @@ -3037,26 +3046,17 @@ Thank you for contributing. - - True - 0 - Minimum Value: - - - GTK_FILL - - - - - + True - 0 - Maximum Value: + True + 0 -100000000 100000000 1 10 10 + 1 + 5 + True - 1 - 2 - GTK_FILL + 1 + 2 @@ -3169,11 +3169,11 @@ 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 + Show this node's custom graphical interface in a separate window + GUI... True @@ -3184,5 +3184,14 @@ Thank you for contributing. + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Embed the custom GUI for this plugin in the patch canvas + Embed GUI + True + + -- cgit v1.2.1