ardour
bindable_button.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004 Paul Davis
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; either version 2 of the License, or
6  (at your option) any later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 
17  $Id$
18 */
19 
20 #include <string>
21 #include <iostream>
22 
23 #include "pbd/controllable.h"
24 
25 #include "gtkmm2ext/gtk_ui.h"
27 #include "gtkmm2ext/gui_thread.h"
28 
29 #include "i18n.h"
30 
31 using namespace Gtkmm2ext;
32 using namespace std;
33 using namespace PBD;
34 
35 void
37 {
38  watch_connection.disconnect ();
39  binding_proxy.set_controllable (c);
40 }
41 
42 void
44 {
45  boost::shared_ptr<Controllable> c (binding_proxy.get_controllable ());
46 
47  if (!c) {
48  warning << _("button cannot watch state of non-existing Controllable\n") << endl;
49  return;
50  }
51 
52  c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&BindableToggleButton::controllable_changed, this), gui_context());
53 }
54 
55 void
57 {
58  float val = binding_proxy.get_controllable()->get_value();
59  set_active (fabs (val) >= 0.5f);
60 }
tuple f
Definition: signals.py:35
Definition: Beats.hpp:239
LIBPBD_API Transmitter warning
#define invalidator(x)
Definition: gui_thread.h:40
#define _(Text)
Definition: i18n.h:11
#define gui_context()
Definition: gui_thread.h:36
void set_controllable(boost::shared_ptr< PBD::Controllable > c)
Definition: debug.h:30