diff options
author | David Robillard <d@drobilla.net> | 2007-09-19 23:54:39 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-19 23:54:39 +0000 |
commit | ad558bdafde7e40b5de79b47d8586aec53cf3f7e (patch) | |
tree | a4431ddd696eb66eceb3119a9f7da933f3585ea4 /src/libs/gui | |
parent | 0b8415c61e321d032d62b5b1cbda65bab6f178d7 (diff) | |
download | ingen-ad558bdafde7e40b5de79b47d8586aec53cf3f7e.tar.gz ingen-ad558bdafde7e40b5de79b47d8586aec53cf3f7e.tar.bz2 ingen-ad558bdafde7e40b5de79b47d8586aec53cf3f7e.zip |
Toggling of individual node polyphonic state.
git-svn-id: http://svn.drobilla.net/lad/ingen@733 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/NodeMenu.cpp | 32 | ||||
-rw-r--r-- | src/libs/gui/NodeMenu.hpp | 11 | ||||
-rw-r--r-- | src/libs/gui/NodeModule.cpp | 18 | ||||
-rw-r--r-- | src/libs/gui/NodeModule.hpp | 5 |
4 files changed, 47 insertions, 19 deletions
diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp index 3a09e34f..9f99cfe3 100644 --- a/src/libs/gui/NodeMenu.cpp +++ b/src/libs/gui/NodeMenu.cpp @@ -30,8 +30,9 @@ namespace GUI { NodeMenu::NodeMenu(SharedPtr<NodeModel> node) -: _node(node) -, _controls_menuitem(NULL) + : _enable_signal(false) + , _node(node) + , _controls_menuitem(NULL) { App& app = App::instance(); @@ -77,6 +78,16 @@ NodeMenu::NodeMenu(SharedPtr<NodeModel> node) sigc::bind( sigc::mem_fun(app.window_factory(), &WindowFactory::present_properties), node))); + + Gtk::Menu_Helpers::CheckMenuElem poly_elem = Gtk::Menu_Helpers::CheckMenuElem( + "Polyphonic", sigc::mem_fun(this, &NodeMenu::on_menu_polyphonic)); + items().push_back(poly_elem); + _polyphonic_menuitem = static_cast<Gtk::RadioMenuItem*>(&items().back()); + _polyphonic_menuitem->set_active(node->polyphonic()); + + node->polyphonic_sig.connect(sigc::mem_fun(this, &NodeMenu::polyphonic_changed)); + + _enable_signal = true; //model->new_port_sig.connect(sigc::mem_fun(this, &NodeMenu::add_port)); //model->destroyed_sig.connect(sigc::mem_fun(this, &NodeMenu::destroy)); @@ -176,6 +187,23 @@ NodeMenu::on_menu_destroy() void +NodeMenu::on_menu_polyphonic() +{ + if (_enable_signal) + App::instance().engine()->set_polyphonic(_node->path(), _polyphonic_menuitem->get_active()); +} + + +void +NodeMenu::polyphonic_changed(bool polyphonic) +{ + _enable_signal = false; + _polyphonic_menuitem->set_active(polyphonic); + _enable_signal = true; +} + + +void NodeMenu::on_menu_clone() { cerr << "FIXME: clone broken\n"; diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp index 0290d861..e6f63d73 100644 --- a/src/libs/gui/NodeMenu.hpp +++ b/src/libs/gui/NodeMenu.hpp @@ -51,9 +51,6 @@ public: bool has_control_inputs(); - //virtual void show_menu(GdkEventButton* event) - //{ _menu.popup(event->button, event->time); } - protected: virtual void enable_controls_menuitem(); @@ -62,13 +59,17 @@ protected: //virtual void add_port(SharedPtr<PortModel> pm); void on_menu_destroy(); + void on_menu_polyphonic(); void on_menu_clone(); void on_menu_learn(); void on_menu_disconnect_all(); - //Gtk::Menu _menu; - SharedPtr<NodeModel> _node; + void polyphonic_changed(bool p); + + bool _enable_signal; + SharedPtr<NodeModel> _node; Glib::RefPtr<Gtk::MenuItem> _controls_menuitem; + Gtk::CheckMenuItem* _polyphonic_menuitem; }; diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index ecaafa65..9cba9abd 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -42,15 +42,15 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode { assert(_node); - if (node->polyphonic()) - set_stacked_border(true); - node->new_port_sig.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true)); node->removed_port_sig.connect(sigc::mem_fun(this, &NodeModule::remove_port)); - node->metadata_update_sig.connect(sigc::mem_fun(this, &NodeModule::metadata_update)); - + node->metadata_update_sig.connect(sigc::mem_fun(this, &NodeModule::set_metadata)); + node->polyphonic_sig.connect(sigc::mem_fun(this, &NodeModule::set_stacked_border)); + node->renamed_sig.connect(sigc::mem_fun(this, &NodeModule::rename)); + signal_clicked.connect(sigc::mem_fun(this, &NodeModule::on_click)); - node->renamed_sig.connect(sigc::mem_fun(this, &NodeModule::renamed)); + + set_stacked_border(node->polyphonic()); } @@ -77,7 +77,7 @@ NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> n ret = boost::shared_ptr<NodeModule>(new NodeModule(canvas, node)); for (MetadataMap::const_iterator m = node->metadata().begin(); m != node->metadata().end(); ++m) - ret->metadata_update(m->first, m->second); + ret->set_metadata(m->first, m->second); for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) ret->add_port(*p, false); @@ -89,7 +89,7 @@ NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> n void -NodeModule::renamed() +NodeModule::rename() { set_name(_node->path().name()); } @@ -157,7 +157,7 @@ NodeModule::on_click(GdkEventButton* event) void -NodeModule::metadata_update(const string& key, const Atom& value) +NodeModule::set_metadata(const string& key, const Atom& value) { if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) move_to(value.get_float(), property_y()); diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp index b554a64c..aa77e780 100644 --- a/src/libs/gui/NodeModule.hpp +++ b/src/libs/gui/NodeModule.hpp @@ -74,13 +74,12 @@ protected: virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } - void metadata_update(const string& key, const Atom& value); + void rename(); + void set_metadata(const string& key, const Atom& value); void add_port(SharedPtr<PortModel> port, bool resize=true); void remove_port(SharedPtr<PortModel> port); - void renamed(); - SharedPtr<NodeModel> _node; NodeMenu _menu; }; |