summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
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;
};