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__
25 #include <gtkmm2ext/selector.h>
28 #include <ardour/types.h>
29 #include <ardour/region.h>
31 #include "ardour_dialog.h"
34 #include "time_axis_view.h"
38 class MultiChannelDevice;
61 class AudioRegionView;
63 class AutomationGainLine;
64 class AutomationPanLine;
65 class RedirectAutomationLine;
67 class AutomationTimeAxisView;
69 class AudioTimeAxisView : public RouteUI, public TimeAxisView
72 AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, ARDOUR::Route&, ArdourCanvas::Canvas& canvas);
73 virtual ~AudioTimeAxisView ();
75 void show_selection (TimeSelection&);
76 void automation_control_point_changed (ARDOUR::AutomationType);
78 void set_samples_per_unit (double);
79 void set_height (TimeAxisView::TrackHeight);
80 void set_show_waveforms (bool yn);
81 void set_show_waveforms_recording (bool yn);
82 void show_timestretch (jack_nframes_t start, jack_nframes_t end);
83 void hide_timestretch ();
84 void selection_click (GdkEventButton*);
85 void set_selected_regionviews (AudioRegionSelection&);
86 void set_selected_points (PointSelection&);
87 void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
88 void get_inverted_selectables (Selection&, list<Selectable*>&);
89 void show_all_xfades ();
90 void hide_all_xfades ();
91 void hide_dependent_views (TimeAxisViewItem&);
92 void reveal_dependent_views (TimeAxisViewItem&);
94 ARDOUR::Region* find_next_region (jack_nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
98 ARDOUR::RouteGroup* edit_group() const;
100 void build_playlist_menu (Gtk::Menu *);
101 ARDOUR::Playlist* playlist() const;
103 /* overridden from parent to store display state */
104 guint32 show_at (double y, int& nth, Gtk::VBox *parent);
107 /* need accessors/mutators */
111 /* editing operations */
113 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
114 bool paste (jack_nframes_t, float times, Selection&, size_t nth);
116 list<TimeAxisView*>get_child_list();
118 void set_state (const XMLNode&);
119 XMLNode* get_child_xml_node (std::string childname);
122 friend class StreamView;
123 friend class AudioRegionView;
125 ArdourCanvas::Canvas& parent_canvas;
129 AutomationTimeAxisView *gain_track;
130 AutomationTimeAxisView *pan_track;
132 void update_automation_view (ARDOUR::AutomationType);
133 void reset_redirect_automation_curves ();
135 Gtk::HBox other_button_hbox;
137 Gtk::Table button_table;
139 Gtk::Button redirect_button;
140 Gtk::Button edit_group_button;
141 Gtk::Button playlist_button;
142 Gtk::Button size_button;
143 Gtk::Button automation_button;
144 Gtk::Button hide_button;
145 Gtk::Button visual_button;
147 void route_active_changed ();
149 void diskstream_changed (void *src);
150 void update_diskstream_display ();
152 gint edit_click (GdkEventButton *);
154 // variables to get the context menu
155 // automation buttons correctly initialized
156 bool show_gain_automation;
157 bool show_pan_automation;
159 void build_redirect_window ();
160 void redirect_click ();
161 void redirect_add ();
162 void redirect_remove ();
163 void redirect_edit ();
164 void redirect_relist ();
165 void redirect_row_selected (gint row, gint col, GdkEvent *ev);
166 void add_to_redirect_display (ARDOUR::Redirect *);
167 void redirects_changed (void *);
169 sigc::connection modified_connection;
170 sigc::connection state_changed_connection;
172 void take_name_changed (void *);
173 void route_name_changed (void *);
174 void name_entry_activated ();
175 void name_entry_changed ();
176 gint name_entry_key_release_handler (GdkEventKey*);
177 gint name_entry_button_release_handler (GdkEventButton*);
178 gint name_entry_button_press_handler (GdkEventButton*);
179 void on_area_realize ();
181 virtual void label_view ();
183 Gtk::Menu edit_group_menu;
184 Gtk::RadioMenuItem::Group edit_group_menu_radio_group;
186 void add_edit_group_menu_item (ARDOUR::RouteGroup *);
187 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
189 void reset_samples_per_unit ();
191 void select_track_color();
193 virtual void build_display_menu ();
195 Gtk::CheckMenuItem* waveform_item;
196 Gtk::RadioMenuItem* traditional_item;
197 Gtk::RadioMenuItem* rectified_item;
199 Gtk::RadioMenuItem* align_existing_item;
200 Gtk::RadioMenuItem* align_capture_item;
202 void align_style_changed ();
203 void set_align_style (ARDOUR::AlignStyle);
205 void toggle_show_waveforms ();
207 void set_waveform_shape (WaveformShape);
208 void toggle_waveforms ();
210 Gtk::Menu *playlist_menu;
211 Gtk::Menu *playlist_action_menu;
212 Gtk::MenuItem *playlist_item;
216 void set_playlist (ARDOUR::AudioPlaylist *);
217 void playlist_click ();
218 void show_playlist_selector ();
220 void playlist_changed ();
221 void playlist_state_changed (ARDOUR::Change);
222 void playlist_modified ();
224 void add_playlist_to_playlist_menu (ARDOUR::Playlist*);
225 void playlist_selected (ARDOUR::AudioPlaylist*);
226 void use_new_playlist ();
227 void use_copy_playlist ();
228 void clear_playlist ();
229 void rename_current_playlist ();
231 /* automation stuff */
233 Gtk::Menu* automation_action_menu;
234 Gtk::CheckMenuItem* gain_automation_item;
235 Gtk::CheckMenuItem* pan_automation_item;
237 void automation_click ();
238 void clear_automation ();
239 void hide_all_automation ();
240 void show_all_automation ();
241 void show_existing_automation ();
243 struct RedirectAutomationNode {
245 Gtk::CheckMenuItem* menu_item;
246 AutomationTimeAxisView* view;
247 AudioTimeAxisView& parent;
249 RedirectAutomationNode (uint32_t w, Gtk::CheckMenuItem* mitem, AudioTimeAxisView& p)
250 : what (w), menu_item (mitem), view (0), parent (p) {}
252 ~RedirectAutomationNode ();
255 struct RedirectAutomationInfo {
256 ARDOUR::Redirect* redirect;
259 vector<RedirectAutomationNode*> lines;
261 RedirectAutomationInfo (ARDOUR::Redirect* r)
262 : redirect (r), valid (true) {}
264 ~RedirectAutomationInfo ();
267 list<RedirectAutomationInfo*> redirect_automation;
268 RedirectAutomationNode* find_redirect_automation_node (ARDOUR::Redirect *redirect, uint32_t what);
270 Gtk::Menu subplugin_menu;
271 void add_redirect_to_subplugin_menu (ARDOUR::Redirect *);
273 void remove_ran (RedirectAutomationNode* ran);
275 void redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo*,
276 AudioTimeAxisView::RedirectAutomationNode*);
277 void redirect_automation_track_hidden (RedirectAutomationNode*, ARDOUR::Redirect*);
279 vector<RedirectAutomationLine*> redirect_automation_curves;
280 RedirectAutomationLine *find_redirect_automation_curve (ARDOUR::Redirect*,uint32_t);
281 void add_redirect_automation_curve (ARDOUR::Redirect*, uint32_t);
282 void add_existing_redirect_automation_curves (ARDOUR::Redirect*);
284 ArdourCanvas::SimpleRect *timestretch_rect;
286 void timestretch (jack_nframes_t start, jack_nframes_t end);
288 void visual_click ();
290 gint when_displayed (GdkEventAny*);
292 void speed_changed ();
294 void add_gain_automation_child ();
295 void add_pan_automation_child ();
296 void add_parameter_automation_child ();
298 void toggle_gain_track ();
299 void toggle_pan_track ();
306 void region_view_added (AudioRegionView*);
307 void add_ghost_to_redirect (AudioRegionView*, AutomationTimeAxisView*);
312 #endif /* __ardour_trackview_h__ */