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__
28 #include <boost/shared_ptr.hpp>
30 #include <ardour/types.h>
31 #include <ardour/automatable.h>
34 #include "time_axis_view.h"
35 #include "simplerect.h"
36 #include "automation_controller.h"
49 class RegionSelection;
57 class AutomationTimeAxisView : public TimeAxisView {
59 AutomationTimeAxisView (ARDOUR::Session&,
60 boost::shared_ptr<ARDOUR::Route>,
61 boost::shared_ptr<ARDOUR::Automatable>,
62 boost::shared_ptr<ARDOUR::AutomationControl>,
65 ArdourCanvas::Canvas& canvas,
66 const string & name, /* translatable */
67 const string & state_name, /* not translatable */
68 const string & plug_name = "");
70 ~AutomationTimeAxisView();
72 void set_height (TimeAxisView::TrackHeight);
73 void set_samples_per_unit (double);
74 std::string name() const { return _name; }
76 void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double);
79 boost::shared_ptr<AutomationLine> line() { return _line; }
81 void set_selected_points (PointSelection&);
82 void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
83 void get_inverted_selectables (Selection&, list<Selectable*>& results);
85 void show_timestretch (nframes_t start, nframes_t end) {}
86 void hide_timestretch () {}
88 /* editing operations */
90 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
91 bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp);
92 bool paste (nframes_t, float times, Selection&, size_t nth);
93 void reset_objects (PointSelection&);
95 void add_ghost (GhostRegion*);
96 void remove_ghost (GhostRegion*);
98 void show_all_control_points ();
99 void hide_all_but_selected_control_points ();
100 void set_state (const XMLNode&);
101 XMLNode* get_state_node ();
103 guint32 show_at (double y, int& nth, Gtk::VBox *parent);
107 boost::shared_ptr<ARDOUR::Route> _route; ///< Parent route
108 boost::shared_ptr<ARDOUR::AutomationControl> _control; ///< Control
109 boost::shared_ptr<ARDOUR::Automatable> _automatable; ///< Control owner, maybe = _route
111 boost::shared_ptr<AutomationController> _controller;
113 ArdourCanvas::SimpleRect* _base_rect;
114 boost::shared_ptr<AutomationLine> _line;
123 bool first_call_to_set_height;
125 Gtk::Button hide_button;
126 Gtk::Button height_button;
127 Gtk::Button clear_button;
128 Gtk::Button auto_button;
129 Gtk::Menu* automation_menu;
130 Gtk::Label* plugname;
131 bool plugname_packed;
133 Gtk::CheckMenuItem* auto_off_item;
134 Gtk::CheckMenuItem* auto_play_item;
135 Gtk::CheckMenuItem* auto_touch_item;
136 Gtk::CheckMenuItem* auto_write_item;
138 void add_line (boost::shared_ptr<AutomationLine>);
140 void clear_clicked ();
141 void height_clicked ();
142 void hide_clicked ();
143 void auto_clicked ();
145 void build_display_menu ();
147 list<GhostRegion*> ghosts;
149 bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
150 bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp);
151 bool paste_one (AutomationLine&, nframes_t, float times, Selection&, size_t nth);
152 void reset_objects_one (AutomationLine&, PointSelection&);
154 void set_automation_state (ARDOUR::AutoState);
155 bool ignore_state_request;
157 void automation_state_changed ();
158 sigc::connection automation_connection;
160 void ensure_xml_node ();
161 void update_extra_xml_shown (bool editor_shown);
167 void color_handler ();
169 static Pango::FontDescription* name_font;
170 static bool have_name_font;
173 #endif /* __ardour_gtk_automation_time_axis_h__ */