summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/PatchWindow.hpp5
-rw-r--r--src/gui/Port.cpp36
-rw-r--r--src/gui/Port.hpp3
3 files changed, 35 insertions, 9 deletions
diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp
index b3f7ad55..fcb0e3f7 100644
--- a/src/gui/PatchWindow.hpp
+++ b/src/gui/PatchWindow.hpp
@@ -70,6 +70,9 @@ public:
void show_port_status(const PortModel* model, const Raul::Atom& value);
+ void object_entered(const ObjectModel* model);
+ void object_left(const ObjectModel* model);
+
protected:
void on_show();
void on_hide();
@@ -79,8 +82,6 @@ private:
void patch_port_added(SharedPtr<const PortModel> port);
void patch_port_removed(SharedPtr<const PortModel> port);
void show_status(const ObjectModel* model);
- void object_entered(const ObjectModel* model);
- void object_left(const ObjectModel* model);
void editable_changed(bool editable);
void event_import();
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<const PatchModel> patch = PtrCast<const PatchModel>(model()->parent());
+ if (!patch) {
+ patch = PtrCast<const PatchModel>(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<const PatchModel>(model()->parent()));
- if (!pw)
- pw = _app.window_factory()->patch_window(
- PtrCast<const PatchModel>(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);
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index 3cea7bc5..465fc783 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -34,6 +34,7 @@ using Ingen::Client::PortModel;
namespace GUI {
class App;
+class PatchWindow;
/** A Port on an Module.
*
@@ -71,6 +72,8 @@ private:
const std::string& name,
bool flip = false);
+ PatchWindow* get_patch_window() const;
+
void property_changed(const Raul::URI& key, const Raul::Atom& value);
bool on_event(GdkEvent* ev);