summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-04-06 16:57:35 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-04-06 16:57:35 +0000
commite69aca28426dd17a0f82ea01c7c98e217b4fdcc3 (patch)
tree32854686f9de3cd61f07a5e801886b0f2d5a7012 /gtk2_ardour/utils.cc
parent3a7487d3fa6887c846bc02d2764e376f7f209a03 (diff)
MIDI/Controllables for monitor section, and related fixes
git-svn-id: svn://localhost/ardour2/branches/3.0@6863 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r--gtk2_ardour/utils.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 0bf7c5657f..aa57a3b773 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -47,6 +47,7 @@
#include "i18n.h"
#include "rgb_macros.h"
#include "canvas_impl.h"
+#include "gui_thread.h"
using namespace std;
using namespace Gtk;
@@ -1040,3 +1041,41 @@ escape_underscores (string const & s)
return o;
}
+
+static void
+adjustment_to_controllable (Gtk::Adjustment* adj, boost::weak_ptr<Controllable> wcont)
+{
+ boost::shared_ptr<Controllable> cont = wcont.lock();
+
+ if (cont) {
+ double val = adj->get_value();
+ if (val != cont->get_value()) {
+ cont->set_value (val);
+ }
+ }
+}
+
+static void
+controllable_to_adjustment (Gtk::Adjustment* adj, boost::weak_ptr<Controllable> wcont)
+{
+ boost::shared_ptr<Controllable> cont = wcont.lock();
+
+ if (cont) {
+ float val = cont->get_value();
+
+ if (val != adj->get_value()) {
+ adj->set_value (val);
+ }
+ }
+}
+
+void
+control_link (ScopedConnectionList& scl, boost::shared_ptr<Controllable> c, Gtk::Adjustment& a)
+{
+ boost::weak_ptr<Controllable> wc (c);
+
+ a.signal_value_changed().connect (sigc::bind (sigc::ptr_fun (adjustment_to_controllable), &a, wc));
+ c->Changed.connect (scl, MISSING_INVALIDATOR, boost::bind (controllable_to_adjustment, &a, wc),
+ gui_context());
+}
+