summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-01 05:27:41 +0000
committerDavid Robillard <d@drobilla.net>2007-10-01 05:27:41 +0000
commita47220df59c076eaa717710dc2ffc6614bee268c (patch)
treebea9dd981dd6a8ca90bb27c77bb976997be31f2d /src/libs/gui
parent344cdcbd4f2bc7a9203b4e98da2ac349581e521a (diff)
downloadingen-a47220df59c076eaa717710dc2ffc6614bee268c.tar.gz
ingen-a47220df59c076eaa717710dc2ffc6614bee268c.tar.bz2
ingen-a47220df59c076eaa717710dc2ffc6614bee268c.zip
Blink MIDI ports on message transmission.
git-svn-id: http://svn.drobilla.net/lad/ingen@794 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/App.cpp42
-rw-r--r--src/libs/gui/App.hpp9
-rw-r--r--src/libs/gui/NodeModule.cpp2
-rw-r--r--src/libs/gui/Port.cpp9
-rw-r--r--src/libs/gui/Port.hpp1
5 files changed, 59 insertions, 4 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index feeae181..dc3db30d 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -47,11 +47,12 @@
#ifdef HAVE_SLV2
#include <slv2/slv2.h>
#endif
-using std::cerr; using std::cout; using std::endl;
-using std::string;
-namespace Ingen { namespace Client { class PluginModel; } }
+
+using namespace std;
using namespace Ingen::Client;
+namespace Ingen { namespace Client { class PluginModel; } }
+
namespace Ingen {
namespace GUI {
@@ -145,6 +146,9 @@ App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> cli
_loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(engine));
_patch_tree_window->init(*_store);
+
+ Glib::signal_timeout().connect(sigc::mem_fun(this, &App::animate_callback),
+ 100, G_PRIORITY_DEFAULT_IDLE);
}
@@ -172,6 +176,38 @@ App::error_message(const string& str)
}
+void
+App::port_activity(Port* port)
+{
+ std::pair<ActivityPorts::iterator, bool> inserted = _activity_ports.insert(make_pair(port, false));
+ if (inserted.second)
+ inserted.first->second = false;
+
+ port->set_highlighted(true, false, true, false);
+}
+
+
+bool
+App::animate_callback()
+{
+ for (ActivityPorts::iterator i = _activity_ports.begin(); i != _activity_ports.end() ; ) {
+ ActivityPorts::iterator next = i;
+ ++next;
+
+ if ((*i).second) { // saw it last time, unhighlight and pop
+ (*i).first->set_highlighted(false, false, true, false);
+ _activity_ports.erase(i);
+ } else {
+ (*i).second = true;
+ }
+
+ i = next;
+ }
+
+ return true;
+}
+
+
/*
bool
App::idle_callback()
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index 298fc44e..7629cd0e 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -61,6 +61,7 @@ class ConnectWindow;
class Configuration;
class ThreadedLoader;
class WindowFactory;
+class Port;
/** Singleton master class most everything is contained within.
@@ -84,6 +85,8 @@ public:
void quit();
+ void port_activity(Port* port);
+
ConnectWindow* connect_window() const { return _connect_window; }
Gtk::AboutDialog* about_dialog() const { return _about_dialog; }
MessagesWindow* messages_dialog() const { return _messages_window; }
@@ -108,6 +111,8 @@ public:
protected:
App(Ingen::Shared::World* world);
+ bool animate_callback();
+
static App* _instance;
SharedPtr<EngineInterface> _engine;
@@ -125,6 +130,10 @@ protected:
Ingen::Shared::World* _world;
+ /// <Port, whether it has been seen in gtk callback yet>
+ typedef std::map<Port*, bool> ActivityPorts;
+ ActivityPorts _activity_ports;
+
/** Used to avoid feedback loops with (eg) process checkbutton
* FIXME: Maybe this should be globally implemented at the Controller level,
* disable all command sending while handling events to avoid feedback
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 39df7151..4ac973f9 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -187,7 +187,7 @@ NodeModule::embed_gui(bool embed)
_gui = NULL;
}
- slv2_ui_instance_free(_slv2_ui);
+ //slv2_ui_instance_free(_slv2_ui); // FIXME: leak
_slv2_ui = NULL;
_ports_y_offset = 0;
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index a75d9cee..228e4598 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -61,6 +61,8 @@ Port::Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm
pm->signal_metadata.connect(sigc::mem_fun(this, &Port::metadata_update));
_port_model->signal_control.connect(sigc::mem_fun(this, &Port::control_changed));
}
+
+ _port_model->signal_activity.connect(sigc::mem_fun(this, &Port::activity));
control_changed(_port_model->value());
}
@@ -90,6 +92,13 @@ Port::control_changed(float value)
FlowCanvas::Port::set_control(value);
}
+
+void
+Port::activity()
+{
+ App::instance().port_activity(this);
+}
+
void
Port::set_control(float value, bool signal)
diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp
index 5e7b6bbe..e381c59b 100644
--- a/src/libs/gui/Port.hpp
+++ b/src/libs/gui/Port.hpp
@@ -48,6 +48,7 @@ public:
virtual void set_control(float value, bool signal);
void control_changed(float value);
+ void activity();
private: