From 00cc6439dc4241bb1c8ba99632b6627b0f1617d7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 3 Oct 2007 05:30:41 +0000 Subject: Fix embed gui/popup gui/show controls items in node menu. git-svn-id: http://svn.drobilla.net/lad/ingen@804 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/NodeModule.cpp | 29 +++++++++++++++++++++-------- src/libs/gui/NodeModule.hpp | 8 ++++---- 2 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src/libs') diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index 0ab3cfa8..d7d5ccfc 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -72,6 +72,7 @@ NodeModule::create_menu() xml->get_widget_derived("object_menu", _menu); _menu->init(_node); _menu->signal_embed_gui.connect(sigc::mem_fun(this, &NodeModule::embed_gui)); + _menu->signal_popup_gui.connect(sigc::hide_return(sigc::mem_fun(this, &NodeModule::popup_gui))); set_menu(_menu); } @@ -243,8 +244,8 @@ NodeModule::remove_port(SharedPtr port) } -void -NodeModule::show_control_window() +bool +NodeModule::popup_gui() { #ifdef HAVE_SLV2 if (_node->plugin()->type() == PluginModel::LV2) { @@ -261,16 +262,28 @@ NodeModule::show_control_window() win->add(*widget); widget->show_all(); win->present(); + return true; } else { - cerr << "No LV2 GUI, showing builtin controls" << endl; - App::instance().window_factory()->present_controls(_node); + cerr << "No LV2 GUI" << endl; } - } else { - App::instance().window_factory()->present_controls(_node); } -#else - App::instance().window_factory()->present_controls(_node); #endif + return false; +} + + +void +NodeModule::show_control_window() +{ + App::instance().window_factory()->present_controls(_node); +} + + +void +NodeModule::on_double_click(GdkEventButton* ev) +{ + if ( ! popup_gui() ) + show_control_window(); } diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp index 00e5835d..7dd0fdee 100644 --- a/src/libs/gui/NodeModule.hpp +++ b/src/libs/gui/NodeModule.hpp @@ -61,15 +61,15 @@ public: virtual void store_location(); - void show_control_window(); - SharedPtr node() const { return _node; } protected: NodeModule(boost::shared_ptr canvas, SharedPtr node); - virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } - virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } + void on_double_click(GdkEventButton* ev); + + void show_control_window(); + bool popup_gui(); void rename(); void set_metadata(const std::string& key, const Atom& value); -- cgit v1.2.1