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>,
64 ArdourCanvas::Canvas& canvas,
65 const std::string & name, /* translatable */
66 const std::string & plug_name = "");
68 ~AutomationTimeAxisView();
70 virtual void set_height (uint32_t);
71 void set_samples_per_unit (double);
72 std::string name() const { return _name; }
74 void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double);
77 boost::shared_ptr<AutomationLine> line() { return _line; }
79 void set_selected_points (PointSelection&);
80 void get_selectables (nframes_t start, nframes_t end, double top, double bot, std::list<Selectable *>&);
81 void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
83 void show_timestretch (nframes_t start, nframes_t end) {}
84 void hide_timestretch () {}
86 /* editing operations */
88 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
89 bool cut_copy_clear_objects (PointSelection&, Editing::CutCopyOp);
90 bool paste (nframes_t, float times, Selection&, size_t nth);
91 void reset_objects (PointSelection&);
93 int set_state (const XMLNode&);
95 guint32 show_at (double y, int& nth, Gtk::VBox *parent);
98 static const std::string state_node_name;
99 XMLNode* get_state_node();
101 boost::shared_ptr<ARDOUR::AutomationControl> control() { return _control; }
102 boost::shared_ptr<AutomationController> controller() { return _controller; }
105 boost::shared_ptr<ARDOUR::Route> _route; ///< Parent route
106 boost::shared_ptr<ARDOUR::AutomationControl> _control; ///< Control
107 boost::shared_ptr<ARDOUR::Automatable> _automatable; ///< Control owner, maybe = _route
109 boost::shared_ptr<AutomationController> _controller;
111 ArdourCanvas::SimpleRect* _base_rect;
112 boost::shared_ptr<AutomationLine> _line;
113 AutomationStreamView* _view;
118 bool first_call_to_set_height;
120 Gtk::Button hide_button;
121 Gtk::Button auto_button;
122 Gtk::Menu* automation_menu;
123 Gtk::Label* plugname;
124 bool plugname_packed;
126 Gtk::CheckMenuItem* auto_off_item;
127 Gtk::CheckMenuItem* auto_play_item;
128 Gtk::CheckMenuItem* auto_touch_item;
129 Gtk::CheckMenuItem* auto_write_item;
131 Gtk::CheckMenuItem* mode_discrete_item;
132 Gtk::CheckMenuItem* mode_line_item;
134 void add_line (boost::shared_ptr<AutomationLine>);
136 void clear_clicked ();
137 void hide_clicked ();
138 void auto_clicked ();
140 void build_display_menu ();
142 bool cut_copy_clear_one (AutomationLine&, Selection&, Editing::CutCopyOp);
143 bool cut_copy_clear_objects_one (AutomationLine&, PointSelection&, Editing::CutCopyOp);
144 bool paste_one (AutomationLine&, nframes_t, float times, Selection&, size_t nth);
145 void reset_objects_one (AutomationLine&, PointSelection&);
147 void set_automation_state (ARDOUR::AutoState);
148 bool ignore_state_request;
150 void automation_state_changed ();
152 void set_interpolation (ARDOUR::AutomationList::InterpolationStyle);
153 void interpolation_changed ();
155 sigc::connection automation_connection;
157 void update_extra_xml_shown (bool editor_shown);
162 //void set_colors ();
163 void color_handler ();
165 static Pango::FontDescription* name_font;
166 static bool have_name_font;
169 #endif /* __ardour_gtk_automation_time_axis_h__ */