2 Copyright (C) 2000 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.
21 #ifndef __ardour_trackview_h__
22 #define __ardour_trackview_h__
24 #include <gtkmm/table.h>
25 #include <gtkmm/button.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/menu.h>
28 #include <gtkmm/menuitem.h>
29 #include <gtkmm/radiomenuitem.h>
30 #include <gtkmm/checkmenuitem.h>
32 #include <gtkmm2ext/selector.h>
35 #include <ardour/types.h>
36 #include <ardour/region.h>
38 #include "ardour_dialog.h"
41 #include "time_axis_view.h"
46 class MultiChannelDevice;
51 class AudioDiskstream;
69 class AudioRegionView;
71 class AutomationGainLine;
72 class AutomationPanLine;
73 class RedirectAutomationLine;
75 class AutomationTimeAxisView;
77 class AudioTimeAxisView : public RouteUI, public TimeAxisView
80 AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
81 virtual ~AudioTimeAxisView ();
83 void show_selection (TimeSelection&);
84 void automation_control_point_changed (ARDOUR::AutomationType);
86 void set_samples_per_unit (double);
87 void set_height (TimeAxisView::TrackHeight);
88 void set_show_waveforms (bool yn);
89 void set_show_waveforms_recording (bool yn);
90 void show_timestretch (jack_nframes_t start, jack_nframes_t end);
91 void hide_timestretch ();
92 void selection_click (GdkEventButton*);
93 void set_selected_regionviews (AudioRegionSelection&);
94 void set_selected_points (PointSelection&);
95 void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
96 void get_inverted_selectables (Selection&, list<Selectable*>&);
97 void show_all_xfades ();
98 void hide_all_xfades ();
99 void hide_dependent_views (TimeAxisViewItem&);
100 void reveal_dependent_views (TimeAxisViewItem&);
102 ARDOUR::Region* find_next_region (jack_nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
106 ARDOUR::RouteGroup* edit_group() const;
108 void build_playlist_menu (Gtk::Menu *);
109 ARDOUR::Playlist* playlist() const;
111 /* overridden from parent to store display state */
112 guint32 show_at (double y, int& nth, Gtk::VBox *parent);
115 /* need accessors/mutators */
119 /* editing operations */
121 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
122 bool paste (jack_nframes_t, float times, Selection&, size_t nth);
124 list<TimeAxisView*>get_child_list();
126 void set_state (const XMLNode&);
127 XMLNode* get_child_xml_node (const string & childname);
129 /* the editor calls these when mapping an operation across multiple tracks */
131 void use_new_playlist (bool prompt);
132 void use_copy_playlist (bool prompt);
133 void clear_playlist ();
136 friend class StreamView;
137 friend class AudioRegionView;
139 ArdourCanvas::Canvas& parent_canvas;
143 AutomationTimeAxisView *gain_track;
144 AutomationTimeAxisView *pan_track;
146 void update_automation_view (ARDOUR::AutomationType);
147 void reset_redirect_automation_curves ();
149 Gtk::HBox other_button_hbox;
151 Gtk::Table button_table;
153 Gtk::Button redirect_button;
154 Gtk::Button edit_group_button;
155 Gtk::Button playlist_button;
156 Gtk::Button size_button;
157 Gtk::Button automation_button;
158 Gtk::Button hide_button;
159 Gtk::Button visual_button;
161 void route_active_changed ();
163 void diskstream_changed (void *src);
164 void update_diskstream_display ();
166 gint edit_click (GdkEventButton *);
168 // variables to get the context menu
169 // automation buttons correctly initialized
170 bool show_gain_automation;
171 bool show_pan_automation;
173 void build_redirect_window ();
174 void redirect_click ();
175 void redirect_add ();
176 void redirect_remove ();
177 void redirect_edit ();
178 void redirect_relist ();
179 void redirect_row_selected (gint row, gint col, GdkEvent *ev);
180 void add_to_redirect_display (boost::shared_ptr<ARDOUR::Redirect>);
181 void redirects_changed (void *);
183 sigc::connection modified_connection;
184 sigc::connection state_changed_connection;
186 void take_name_changed (void *);
187 void route_name_changed (void *);
188 void name_entry_changed ();
190 void on_area_realize ();
192 virtual void label_view ();
194 Gtk::Menu edit_group_menu;
196 void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
197 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
199 void reset_samples_per_unit ();
201 void select_track_color();
203 virtual void build_display_menu ();
205 Gtk::CheckMenuItem* waveform_item;
206 Gtk::RadioMenuItem* traditional_item;
207 Gtk::RadioMenuItem* rectified_item;
209 Gtk::RadioMenuItem* align_existing_item;
210 Gtk::RadioMenuItem* align_capture_item;
212 void align_style_changed ();
213 void set_align_style (ARDOUR::AlignStyle);
215 void toggle_show_waveforms ();
217 void set_waveform_shape (WaveformShape);
218 void toggle_waveforms ();
220 Gtk::Menu *playlist_menu;
221 Gtk::Menu *playlist_action_menu;
222 Gtk::MenuItem *playlist_item;
226 void set_playlist (ARDOUR::AudioPlaylist *);
227 void playlist_click ();
228 void show_playlist_selector ();
230 void playlist_changed ();
231 void playlist_state_changed (ARDOUR::Change);
232 void playlist_modified ();
234 void add_playlist_to_playlist_menu (ARDOUR::Playlist*);
235 void rename_current_playlist ();
237 /* automation stuff */
239 Gtk::Menu* automation_action_menu;
240 Gtk::CheckMenuItem* gain_automation_item;
241 Gtk::CheckMenuItem* pan_automation_item;
243 void automation_click ();
244 void clear_automation ();
245 void hide_all_automation ();
246 void show_all_automation ();
247 void show_existing_automation ();
249 struct RedirectAutomationNode {
251 Gtk::CheckMenuItem* menu_item;
252 AutomationTimeAxisView* view;
253 AudioTimeAxisView& parent;
255 RedirectAutomationNode (uint32_t w, Gtk::CheckMenuItem* mitem, AudioTimeAxisView& p)
256 : what (w), menu_item (mitem), view (0), parent (p) {}
258 ~RedirectAutomationNode ();
261 struct RedirectAutomationInfo {
262 boost::shared_ptr<ARDOUR::Redirect> redirect;
265 vector<RedirectAutomationNode*> lines;
267 RedirectAutomationInfo (boost::shared_ptr<ARDOUR::Redirect> r)
268 : redirect (r), valid (true) {}
270 ~RedirectAutomationInfo ();
273 list<RedirectAutomationInfo*> redirect_automation;
274 RedirectAutomationNode* find_redirect_automation_node (boost::shared_ptr<ARDOUR::Redirect> redirect, uint32_t what);
276 Gtk::Menu subplugin_menu;
277 void add_redirect_to_subplugin_menu (boost::shared_ptr<ARDOUR::Redirect>);
279 void remove_ran (RedirectAutomationNode* ran);
281 void redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo*,
282 AudioTimeAxisView::RedirectAutomationNode*);
283 void redirect_automation_track_hidden (RedirectAutomationNode*, boost::shared_ptr<ARDOUR::Redirect>);
285 vector<RedirectAutomationLine*> redirect_automation_curves;
286 RedirectAutomationLine *find_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect>,uint32_t);
287 void add_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect>, uint32_t);
288 void add_existing_redirect_automation_curves (boost::shared_ptr<ARDOUR::Redirect>);
290 ArdourCanvas::SimpleRect *timestretch_rect;
292 void timestretch (jack_nframes_t start, jack_nframes_t end);
294 void visual_click ();
296 gint when_displayed (GdkEventAny*);
298 void speed_changed ();
300 void add_gain_automation_child ();
301 void add_pan_automation_child ();
302 void add_parameter_automation_child ();
304 void toggle_gain_track ();
305 void toggle_pan_track ();
312 void region_view_added (AudioRegionView*);
313 void add_ghost_to_redirect (AudioRegionView*, AutomationTimeAxisView*);
317 void color_handler (ColorID, uint32_t);
318 bool select_me (GdkEventButton*);
321 #endif /* __ardour_trackview_h__ */