2 Copyright (C) 2000-2007 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_gtk_automation_time_axis_h__
21 #define __ardour_gtk_automation_time_axis_h__
27 #include <boost/shared_ptr.hpp>
29 #include "ardour/types.h"
30 #include "ardour/automatable.h"
31 #include "ardour/automation_list.h"
34 #include "time_axis_view.h"
35 #include "simplerect.h"
36 #include "automation_controller.h"
41 class AutomationControl;
46 class RegionSelection;
51 class AutomationStreamView;
52 class AutomationController;
55 class AutomationTimeAxisView : public TimeAxisView {
57 AutomationTimeAxisView (ARDOUR::Session*,
58 boost::shared_ptr<ARDOUR::Route>,
59 boost::shared_ptr<ARDOUR::Automatable>,
60 boost::shared_ptr<ARDOUR::AutomationControl>,
65 ArdourCanvas::Canvas& canvas,
66 const std::string & name, /* translatable */
67 const std::string & plug_name = "");
69 ~AutomationTimeAxisView();
71 virtual void set_height (uint32_t);
72 void set_samples_per_unit (double);
73 std::string name() const { return _name; }
75 void add_automation_event (GdkEvent *, framepos_t, double);
79 /** @return Our AutomationLine, if this view has one, or 0 if it uses AutomationRegionViews */
80 boost::shared_ptr<AutomationLine> line() { return _line; }
82 /** @return All AutomationLines associated with this view */
83 std::list<boost::shared_ptr<AutomationLine> > lines () const;
85 void set_selected_points (PointSelection&);
86 void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
87 void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
89 void show_timestretch (framepos_t /*start*/, framepos_t /*end*/) {}
90 void hide_timestretch () {}
92 /* editing operations */
94 void cut_copy_clear (Selection&, Editing::CutCopyOp);
95 void cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp);
96 bool paste (ARDOUR::framepos_t, float times, Selection&, size_t nth);
97 void reset_objects (PointSelection&);
99 int set_state (const XMLNode&, int version);
101 std::string state_id() const;
102 static bool parse_state_id (std::string const &, PBD::ID &, bool &, Evoral::Parameter &);
104 boost::shared_ptr<ARDOUR::AutomationControl> control() { return _control; }
105 boost::shared_ptr<AutomationController> controller() { return _controller; }
106 Evoral::Parameter parameter () const {
110 ArdourCanvas::Item* base_item () const {
114 bool has_automation () const;
116 boost::shared_ptr<ARDOUR::Route> parent_route () {
120 bool show_regions () const {
121 return _show_regions;
124 static void what_has_visible_automation (const boost::shared_ptr<ARDOUR::Automatable>& automatable, std::set<Evoral::Parameter>& visible);
128 boost::shared_ptr<ARDOUR::Route> _route;
129 /** control; 0 if we are editing region-based automation */
130 boost::shared_ptr<ARDOUR::AutomationControl> _control;
131 /** control owner; may be _route, or 0 if we are editing region-based automation */
132 boost::shared_ptr<ARDOUR::Automatable> _automatable;
133 /** controller owner; 0 if we are editing region-based automation */
134 boost::shared_ptr<AutomationController> _controller;
135 Evoral::Parameter _parameter;
137 ArdourCanvas::SimpleRect* _base_rect;
138 boost::shared_ptr<AutomationLine> _line;
140 /** AutomationStreamView if we are editing region-based automation (for MIDI), otherwise 0 */
141 AutomationStreamView* _view;
146 bool first_call_to_set_height;
148 Gtk::Button hide_button;
149 Gtk::Button auto_button;
150 Gtk::Menu* automation_menu;
151 Gtk::Label* plugname;
152 bool plugname_packed;
154 Gtk::CheckMenuItem* auto_off_item;
155 Gtk::CheckMenuItem* auto_play_item;
156 Gtk::CheckMenuItem* auto_touch_item;
157 Gtk::CheckMenuItem* auto_write_item;
159 Gtk::CheckMenuItem* mode_discrete_item;
160 Gtk::CheckMenuItem* mode_line_item;
164 void add_line (boost::shared_ptr<AutomationLine>);
166 void clear_clicked ();
167 void hide_clicked ();
168 void auto_clicked ();
170 void build_display_menu ();
172 void cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
173 void cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp);
174 bool paste_one (AutomationLine&, ARDOUR::framepos_t, float times, Selection&, size_t nth);
175 void reset_objects_one (AutomationLine&, PointSelection&);
176 void route_going_away ();
178 void set_automation_state (ARDOUR::AutoState);
179 bool ignore_state_request;
181 void automation_state_changed ();
183 void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
184 void interpolation_changed (ARDOUR::AutomationList::InterpolationStyle);
186 PBD::ScopedConnectionList _list_connections;
187 PBD::ScopedConnectionList _route_connections;
192 //void set_colors ();
193 void color_handler ();
195 static Pango::FontDescription name_font;
196 static bool have_name_font;
199 int set_state_2X (const XMLNode &, int);
202 #endif /* __ardour_gtk_automation_time_axis_h__ */