Another not-quite-there-but-better commit.
[ardour.git] / gtk2_ardour / automation_controller.h
1 /*
2     Copyright (C) 2007 Paul Davis 
3     Author: Dave Robillard
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_gtk_automation_controller_h__
22 #define __ardour_gtk_automation_controller_h__
23
24 #include <boost/shared_ptr.hpp>
25 #include <gtkmm.h>
26 #include <gtkmm2ext/barcontroller.h>
27
28 namespace ARDOUR {
29         class Session;
30         class AutomationList;
31         class AutomationControl;
32 }
33
34
35 class AutomationController : public Gtkmm2ext::BarController {
36 public:
37         static boost::shared_ptr<AutomationController> create(
38                         ARDOUR::Session& s,
39                         boost::shared_ptr<ARDOUR::AutomationList> al,
40                         boost::shared_ptr<ARDOUR::AutomationControl> ac);
41
42         ~AutomationController();
43         
44         boost::shared_ptr<ARDOUR::AutomationControl> controllable() { return _controllable; }
45
46         Gtk::Adjustment* adjustment() { return _adjustment; }
47         
48         void update_label(char* label, int label_len);
49         void display_effective_value();
50         void value_adjusted();
51
52 private:
53         AutomationController(boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj);
54         void start_touch();
55         void end_touch();
56
57         void value_changed();
58         void automation_state_changed();
59
60         bool                                         _ignore_change;
61         boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
62         Gtk::Adjustment*                             _adjustment;
63         sigc::connection                             _screen_update_connection;
64 };
65
66
67 #endif /* __ardour_gtk_automation_controller_h__ */