From 971ba0227ab563bf264cf19c967679796209708d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 8 Dec 2011 02:36:32 +0000 Subject: Clean up port event stuff. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3836 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/Port.cpp | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src/gui/Port.cpp') diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 950a1df9..eafc6392 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -150,7 +150,20 @@ Port::value_changed(const Atom& value) bool Port::on_event(GdkEvent* ev) { + PatchWindow* win = NULL; switch (ev->type) { + case GDK_ENTER_NOTIFY: + win = get_patch_window(); + if (win) { + win->object_entered(model().get()); + } + break; + case GDK_LEAVE_NOTIFY: + win = get_patch_window(); + if (win) { + win->object_left(model().get()); + } + break; case GDK_BUTTON_PRESS: if (ev->button.button == 1) _pressed = true; @@ -233,6 +246,17 @@ Port::activity(const Raul::Atom& value) } } +PatchWindow* +Port::get_patch_window() const +{ + SharedPtr patch = PtrCast(model()->parent()); + if (!patch) { + patch = PtrCast(model()->parent()->parent()); + } + + return _app.window_factory()->patch_window(patch); +} + void Port::set_control(float value, bool signal) { @@ -240,13 +264,11 @@ Port::set_control(float value, bool signal) Ingen::Shared::World* const world = _app.world(); _app.engine()->set_property(model()->path(), world->uris()->ingen_value, Atom(value)); - PatchWindow* pw = _app.window_factory()->patch_window( - PtrCast(model()->parent())); - if (!pw) - pw = _app.window_factory()->patch_window( - PtrCast(model()->parent()->parent())); - if (pw) - pw->show_port_status(model().get(), value); + } + + PatchWindow* pw = get_patch_window(); + if (pw) { + pw->show_port_status(model().get(), value); } Ganv::Port::set_control_value(value); -- cgit v1.2.1