summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/PatchCanvas.cpp36
-rw-r--r--src/gui/PatchCanvas.hpp4
-rw-r--r--src/gui/PatchWindow.cpp31
-rw-r--r--src/gui/PatchWindow.hpp3
4 files changed, 19 insertions, 55 deletions
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 2a406191..644f95f6 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -536,39 +536,23 @@ PatchCanvas::canvas_event(GdkEvent* event)
break;
case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- ret = canvas_key_event(&event->key);
-
- default:
- break;
- }
-
- return (ret ? true : Canvas::canvas_event(event));
-}
-
-
-bool
-PatchCanvas::canvas_key_event(GdkEventKey* event)
-{
- switch (event->type) {
- case GDK_KEY_PRESS:
- switch (event->keyval) {
+ switch (event->key.keyval) {
case GDK_Delete:
destroy_selection();
- return true;
+ ret = true;
+ break;
case GDK_e:
- if (event->state == 0) {
+ if (event->key.state == 0) {
_patch->set_editable(!_patch->get_editable());
- return true;
- } else {
- return false;
+ ret = true;
}
- default:
- return false;
+ default: break;
}
- default:
- return false;
+
+ default: break;
}
+
+ return (ret ? true : Canvas::canvas_event(event));
}
diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp
index 9aa0eacf..a301f680 100644
--- a/src/gui/PatchCanvas.hpp
+++ b/src/gui/PatchCanvas.hpp
@@ -83,7 +83,7 @@ public:
void show_menu(GdkEvent* event);
- bool canvas_key_event(GdkEventKey* event);
+ bool canvas_event(GdkEvent* event);
private:
enum ControlType { NUMBER, BUTTON };
@@ -119,8 +119,6 @@ private:
GraphObject::Properties get_initial_data();
- bool canvas_event(GdkEvent* event);
-
SharedPtr<FlowCanvas::Port> get_port_view(SharedPtr<PortModel> port);
void connect(boost::shared_ptr<FlowCanvas::Connectable> src,
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index a9fe62d2..361e525a 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -472,7 +472,8 @@ PatchWindow::event_save_as()
bool confirm = true;
if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR)) {
- if (Glib::file_test(filename + "/manifest.ttl", Glib::FILE_TEST_EXISTS)) {
+ if (Glib::file_test(Glib::build_filename(filename, "manifest.ttl"),
+ Glib::FILE_TEST_EXISTS)) {
Gtk::MessageDialog confirm_dialog(*this, (boost::format("<b>"
"A bundle named \"%1%\" already exists. Replace it?"
"</b>") % basename).str(),
@@ -615,30 +616,12 @@ PatchWindow::on_hide()
bool
-PatchWindow::on_key_press_event(GdkEventKey* event)
+PatchWindow::on_event(GdkEvent* event)
{
- bool ret = false;
-
- ret = _view->canvas()->canvas_key_event(event);
-
- if (!ret)
- ret = Gtk::Window::on_key_press_event(event);
-
- return ret;
-}
-
-
-bool
-PatchWindow::on_key_release_event(GdkEventKey* event)
-{
- bool ret = false;
-
- ret = _view->canvas()->canvas_key_event(event);
-
- if (!ret)
- ret = Gtk::Window::on_key_release_event(event);
-
- return ret;
+ if (_view->canvas()->canvas_event(event))
+ return true;
+ else
+ return Gtk::Window::on_event(event);
}
diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp
index d4cc87a9..2e03945f 100644
--- a/src/gui/PatchWindow.hpp
+++ b/src/gui/PatchWindow.hpp
@@ -71,8 +71,7 @@ public:
protected:
void on_show();
void on_hide();
- bool on_key_press_event(GdkEventKey* event);
- bool on_key_release_event(GdkEventKey* event);
+ bool on_event(GdkEvent* event);
private:
void patch_port_added(SharedPtr<PortModel> port);