summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-06-10 17:41:26 +0000
committerDavid Robillard <d@drobilla.net>2008-06-10 17:41:26 +0000
commit6ed65a4a3b14d204a24ab63fa907f8e9adce01dc (patch)
tree52ec9bafe242c976b70f8422f1a33f9e78d9ab16 /src/libs/gui
parent43dc73756cf97b4e4bc2ebdec59f3cb15f99750b (diff)
downloadingen-6ed65a4a3b14d204a24ab63fa907f8e9adce01dc.tar.gz
ingen-6ed65a4a3b14d204a24ab63fa907f8e9adce01dc.tar.bz2
ingen-6ed65a4a3b14d204a24ab63fa907f8e9adce01dc.zip
Fix 'disconnect' operation for all objects (inc. patch ports).
Fixes ticket #147. git-svn-id: http://svn.drobilla.net/lad/ingen@1265 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/NodeMenu.cpp7
-rw-r--r--src/libs/gui/NodeMenu.hpp1
-rw-r--r--src/libs/gui/ObjectMenu.cpp7
-rw-r--r--src/libs/gui/ObjectMenu.hpp8
-rw-r--r--src/libs/gui/PatchPortModule.cpp2
-rw-r--r--src/libs/gui/Port.cpp3
-rw-r--r--src/libs/gui/Port.hpp1
-rw-r--r--src/libs/gui/PortMenu.cpp17
-rw-r--r--src/libs/gui/PortMenu.hpp7
9 files changed, 38 insertions, 15 deletions
diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp
index cbb4c0df..6051ec7c 100644
--- a/src/libs/gui/NodeMenu.cpp
+++ b/src/libs/gui/NodeMenu.cpp
@@ -125,6 +125,13 @@ NodeMenu::on_menu_learn()
App::instance().engine()->midi_learn(_object->path());
}
+
+void
+NodeMenu::on_menu_disconnect()
+{
+ App::instance().engine()->disconnect_all(_object->parent()->path(), _object->path());
+}
+
bool
NodeMenu::has_control_inputs()
diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp
index 05457b8f..2a10e473 100644
--- a/src/libs/gui/NodeMenu.hpp
+++ b/src/libs/gui/NodeMenu.hpp
@@ -55,6 +55,7 @@ protected:
virtual void enable_controls_menuitem();
virtual void disable_controls_menuitem();
+ void on_menu_disconnect();
void on_menu_clone();
void on_menu_learn();
void on_menu_embed_gui();
diff --git a/src/libs/gui/ObjectMenu.cpp b/src/libs/gui/ObjectMenu.cpp
index 73d01389..3a208d51 100644
--- a/src/libs/gui/ObjectMenu.cpp
+++ b/src/libs/gui/ObjectMenu.cpp
@@ -92,13 +92,6 @@ ObjectMenu::polyphonic_changed(bool polyphonic)
void
-ObjectMenu::on_menu_disconnect()
-{
- App::instance().engine()->disconnect_all(_object->path());
-}
-
-
-void
ObjectMenu::on_menu_destroy()
{
App::instance().engine()->destroy(_object->path());
diff --git a/src/libs/gui/ObjectMenu.hpp b/src/libs/gui/ObjectMenu.hpp
index ab9eb30e..712322e3 100644
--- a/src/libs/gui/ObjectMenu.hpp
+++ b/src/libs/gui/ObjectMenu.hpp
@@ -46,10 +46,10 @@ public:
protected:
- void on_menu_polyphonic();
- void on_menu_disconnect();
- void on_menu_destroy();
- void on_menu_properties();
+ virtual void on_menu_disconnect() = 0;
+ void on_menu_polyphonic();
+ void on_menu_destroy();
+ void on_menu_properties();
void polyphonic_changed(bool polyphonic);
diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp
index de0ed445..a6192210 100644
--- a/src/libs/gui/PatchPortModule.cpp
+++ b/src/libs/gui/PatchPortModule.cpp
@@ -90,7 +90,7 @@ PatchPortModule::create_menu()
{
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
xml->get_widget_derived("object_menu", _menu);
- _menu->init(_port);
+ _menu->init(_port, true);
set_menu(_menu);
}
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index df0b779c..36a010bb 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -42,6 +42,7 @@ Port::Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm
flip ? (!pm->is_input()) : pm->is_input(),
App::instance().configuration()->get_port_color(pm.get()))
, _port_model(pm)
+ , _flipped(flip)
{
assert(module);
assert(_port_model);
@@ -78,7 +79,7 @@ Port::create_menu()
PortMenu* menu = NULL;
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
xml->get_widget_derived("object_menu", menu);
- menu->init(_port_model);
+ menu->init(_port_model, _flipped);
set_menu(menu);
}
diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp
index e14110e7..ae9b0c48 100644
--- a/src/libs/gui/Port.hpp
+++ b/src/libs/gui/Port.hpp
@@ -57,6 +57,7 @@ private:
void renamed();
SharedPtr<PortModel> _port_model;
+ bool _flipped;
};
diff --git a/src/libs/gui/PortMenu.cpp b/src/libs/gui/PortMenu.cpp
index 8bb002c9..45b216b6 100644
--- a/src/libs/gui/PortMenu.cpp
+++ b/src/libs/gui/PortMenu.cpp
@@ -30,14 +30,16 @@ namespace GUI {
PortMenu::PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
: ObjectMenu(cobject, xml)
+ , _patch_port(NULL)
{
}
void
-PortMenu::init(SharedPtr<PortModel> port)
+PortMenu::init(SharedPtr<PortModel> port, bool patch_port)
{
ObjectMenu::init(port);
+ _patch_port = patch_port;
if ( ! PtrCast<PatchModel>(port->parent()) ) {
_polyphonic_menuitem->set_sensitive(false);
@@ -48,6 +50,19 @@ PortMenu::init(SharedPtr<PortModel> port)
_enable_signal = true;
}
+
+void
+PortMenu::on_menu_disconnect()
+{
+ if (_patch_port) {
+ App::instance().engine()->disconnect_all(
+ _object->parent()->path(), _object->path());
+ } else {
+ App::instance().engine()->disconnect_all(
+ _object->parent()->path().parent(), _object->path());
+ }
+}
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/libs/gui/PortMenu.hpp b/src/libs/gui/PortMenu.hpp
index 06e8ac7d..520c5809 100644
--- a/src/libs/gui/PortMenu.hpp
+++ b/src/libs/gui/PortMenu.hpp
@@ -40,7 +40,12 @@ class PortMenu : public ObjectMenu
public:
PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml);
- void init(SharedPtr<PortModel> port);
+ void init(SharedPtr<PortModel> port, bool patch_port = false);
+
+private:
+ void on_menu_disconnect();
+
+ bool _patch_port;
};