summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-07-04 19:15:50 +0000
committerDavid Robillard <d@drobilla.net>2011-07-04 19:15:50 +0000
commitc71019812594dbdf4a5078a46a54d490be9e0292 (patch)
treec7fccdb631573d87235008b7307f8d360f9287c7 /src
parent8b8e32c3fa8989d0997eeef340a2a39bbfdc2382 (diff)
downloadpatchage-c71019812594dbdf4a5078a46a54d490be9e0292.tar.gz
patchage-c71019812594dbdf4a5078a46a54d490be9e0292.tar.bz2
patchage-c71019812594dbdf4a5078a46a54d490be9e0292.zip
Simplify FlowCanvas menu API, and fix crashing Ingen menus (ticket #721).
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3411 a436a847-0d15-0410-975c-d299462d15a1
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;
};