various fixes to MidiRegionView selection handling, key handling, drawing of ghost...
[ardour2.git] / gtk2_ardour / automation_controller.h
blobbb1c0d443c0de0cef48b4a5811425855c34c8b04
1 /*
2 Copyright (C) 2007 Paul Davis
3 Author: David Robillard
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.
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.
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.
21 #ifndef __ardour_gtk_automation_controller_h__
22 #define __ardour_gtk_automation_controller_h__
24 #include <boost/shared_ptr.hpp>
25 #include <gtkmm.h>
27 #include "gtkmm2ext/barcontroller.h"
28 #include "pbd/signals.h"
30 namespace ARDOUR {
31 class Session;
32 class AutomationList;
33 class AutomationControl;
34 class Automatable;
37 /** A BarController which displays the value and allows control of an AutomationControl */
38 class AutomationController : public Gtkmm2ext::BarController {
39 public:
40 static boost::shared_ptr<AutomationController> create(
41 boost::shared_ptr<ARDOUR::Automatable> parent,
42 const Evoral::Parameter& param,
43 boost::shared_ptr<ARDOUR::AutomationControl> ac);
45 ~AutomationController();
47 boost::shared_ptr<ARDOUR::AutomationControl> controllable() { return _controllable; }
49 Gtk::Adjustment* adjustment() { return _adjustment; }
51 void display_effective_value();
52 void value_adjusted();
54 void stop_updating ();
56 private:
57 AutomationController (boost::shared_ptr<ARDOUR::Automatable> printer, boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj);
58 std::string get_label (double&);
60 void start_touch();
61 void end_touch();
63 void value_changed();
64 void automation_state_changed();
66 bool _ignore_change;
67 boost::shared_ptr<ARDOUR::Automatable> _printer;
68 boost::shared_ptr<ARDOUR::AutomationControl> _controllable;
69 Gtk::Adjustment* _adjustment;
70 sigc::connection _screen_update_connection;
71 PBD::ScopedConnection _changed_connection;
75 #endif /* __ardour_gtk_automation_controller_h__ */