summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/PatchageModule.cpp19
-rw-r--r--src/PatchageModule.hpp3
2 files changed, 15 insertions, 7 deletions
diff --git a/src/PatchageModule.cpp b/src/PatchageModule.cpp
index e19418b..3c6dd76 100644
--- a/src/PatchageModule.cpp
+++ b/src/PatchageModule.cpp
@@ -24,6 +24,7 @@ PatchageModule::PatchageModule(
Patchage* app, const std::string& name, ModuleType type, double x, double y)
: Module(*app->canvas().get(), name, x, y)
, _app(app)
+ , _menu(NULL)
, _type(type)
{
}
@@ -58,22 +59,28 @@ PatchageModule::update_menu()
}
}
-void
-PatchageModule::create_menu()
+bool
+PatchageModule::show_menu(GdkEventButton* ev)
{
_menu = new Gtk::Menu();
Gtk::Menu::MenuList& items = _menu->items();
if (_type == InputOutput) {
items.push_back(
- Gtk::Menu_Helpers::MenuElem("_Split", sigc::mem_fun(this, &PatchageModule::split)));
+ Gtk::Menu_Helpers::MenuElem(
+ "_Split", sigc::mem_fun(this, &PatchageModule::split)));
update_menu();
} else {
items.push_back(
- Gtk::Menu_Helpers::MenuElem("_Join", sigc::mem_fun(this, &PatchageModule::join)));
+ Gtk::Menu_Helpers::MenuElem(
+ "_Join", sigc::mem_fun(this, &PatchageModule::join)));
}
items.push_back(
- Gtk::Menu_Helpers::MenuElem("_Disconnect All",
- sigc::mem_fun(this, &PatchageModule::menu_disconnect_all)));
+ Gtk::Menu_Helpers::MenuElem(
+ "_Disconnect All",
+ sigc::mem_fun(this, &PatchageModule::menu_disconnect_all)));
+
+ _menu->popup(ev->button, ev->time);
+ return true;
}
void
diff --git a/src/PatchageModule.hpp b/src/PatchageModule.hpp
index d9ba9dd..952a2eb 100644
--- a/src/PatchageModule.hpp
+++ b/src/PatchageModule.hpp
@@ -36,7 +36,7 @@ public:
void split();
void join();
- void create_menu();
+ bool show_menu(GdkEventButton* ev);
void update_menu();
void load_location();
@@ -51,6 +51,7 @@ protected:
void remove_port(FlowCanvas::Port* port);
Patchage* _app;
+ Gtk::Menu* _menu;
ModuleType _type;
};