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"
45 class MultiChannelDevice;
68 class AudioRegionView;
70 class AutomationGainLine;
71 class AutomationPanLine;
72 class RedirectAutomationLine;
74 class AutomationTimeAxisView;
76 class AudioTimeAxisView : public RouteUI, public TimeAxisView
79 AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, ARDOUR::Route&, ArdourCanvas::Canvas& canvas);
80 virtual ~AudioTimeAxisView ();
82 void show_selection (TimeSelection&);
83 void automation_control_point_changed (ARDOUR::AutomationType);
85 void set_samples_per_unit (double);
86 void set_height (TimeAxisView::TrackHeight);
87 void set_show_waveforms (bool yn);
88 void set_show_waveforms_recording (bool yn);
89 void show_timestretch (jack_nframes_t start, jack_nframes_t end);
90 void hide_timestretch ();
91 void selection_click (GdkEventButton*);
92 void set_selected_regionviews (AudioRegionSelection&);
93 void set_selected_points (PointSelection&);
94 void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
95 void get_inverted_selectables (Selection&, list<Selectable*>&);
96 void show_all_xfades ();
97 void hide_all_xfades ();
98 void hide_dependent_views (TimeAxisViewItem&);
99 void reveal_dependent_views (TimeAxisViewItem&);
101 ARDOUR::Region* find_next_region (jack_nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
105 ARDOUR::RouteGroup* edit_group() const;
107 void build_playlist_menu (Gtk::Menu *);
108 ARDOUR::Playlist* playlist() const;
110 /* overridden from parent to store display state */
111 guint32 show_at (double y, int& nth, Gtk::VBox *parent);
114 /* need accessors/mutators */
118 /* editing operations */
120 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
121 bool paste (jack_nframes_t, float times, Selection&, size_t nth);
123 list<TimeAxisView*>get_child_list();
125 void set_state (const XMLNode&);
126 XMLNode* get_child_xml_node (const string & childname);
129 friend class StreamView;
130 friend class AudioRegionView;
132 ArdourCanvas::Canvas& parent_canvas;
136 AutomationTimeAxisView *gain_track;
137 AutomationTimeAxisView *pan_track;
139 void update_automation_view (ARDOUR::AutomationType);
140 void reset_redirect_automation_curves ();
142 Gtk::HBox other_button_hbox;
144 Gtk::Table button_table;
146 Gtk::Button redirect_button;
147 Gtk::Button edit_group_button;
148 Gtk::Button playlist_button;
149 Gtk::Button size_button;
150 Gtk::Button automation_button;
151 Gtk::Button hide_button;
152 Gtk::Button visual_button;
154 void route_active_changed ();
156 void diskstream_changed (void *src);
157 void update_diskstream_display ();
159 gint edit_click (GdkEventButton *);
161 // variables to get the context menu
162 // automation buttons correctly initialized
163 bool show_gain_automation;
164 bool show_pan_automation;
166 void build_redirect_window ();
167 void redirect_click ();
168 void redirect_add ();
169 void redirect_remove ();
170 void redirect_edit ();
171 void redirect_relist ();
172 void redirect_row_selected (gint row, gint col, GdkEvent *ev);
173 void add_to_redirect_display (ARDOUR::Redirect *);
174 void redirects_changed (void *);
176 sigc::connection modified_connection;
177 sigc::connection state_changed_connection;
179 void take_name_changed (void *);
180 void route_name_changed (void *);
181 void name_entry_changed ();
183 void on_area_realize ();
185 virtual void label_view ();
187 Gtk::Menu edit_group_menu;
188 Gtk::RadioMenuItem::Group edit_group_menu_radio_group;
190 void add_edit_group_menu_item (ARDOUR::RouteGroup *);
191 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
193 void reset_samples_per_unit ();
195 void select_track_color();
197 virtual void build_display_menu ();
199 Gtk::CheckMenuItem* waveform_item;
200 Gtk::RadioMenuItem* traditional_item;
201 Gtk::RadioMenuItem* rectified_item;
203 Gtk::RadioMenuItem* align_existing_item;
204 Gtk::RadioMenuItem* align_capture_item;
206 void align_style_changed ();
207 void set_align_style (ARDOUR::AlignStyle);
209 void toggle_show_waveforms ();
211 void set_waveform_shape (WaveformShape);
212 void toggle_waveforms ();
214 Gtk::Menu *playlist_menu;
215 Gtk::Menu *playlist_action_menu;
216 Gtk::MenuItem *playlist_item;
220 void set_playlist (ARDOUR::AudioPlaylist *);
221 void playlist_click ();
222 void show_playlist_selector ();
224 void playlist_changed ();
225 void playlist_state_changed (ARDOUR::Change);
226 void playlist_modified ();
228 void add_playlist_to_playlist_menu (ARDOUR::Playlist*);
229 void playlist_selected (ARDOUR::AudioPlaylist*);
230 void use_new_playlist ();
231 void use_copy_playlist ();
232 void clear_playlist ();
233 void rename_current_playlist ();
235 /* automation stuff */
237 Gtk::Menu* automation_action_menu;
238 Gtk::CheckMenuItem* gain_automation_item;
239 Gtk::CheckMenuItem* pan_automation_item;
241 void automation_click ();
242 void clear_automation ();
243 void hide_all_automation ();
244 void show_all_automation ();
245 void show_existing_automation ();
247 struct RedirectAutomationNode {
249 Gtk::CheckMenuItem* menu_item;
250 AutomationTimeAxisView* view;
251 AudioTimeAxisView& parent;
253 RedirectAutomationNode (uint32_t w, Gtk::CheckMenuItem* mitem, AudioTimeAxisView& p)
254 : what (w), menu_item (mitem), view (0), parent (p) {}
256 ~RedirectAutomationNode ();
259 struct RedirectAutomationInfo {
260 ARDOUR::Redirect* redirect;
263 vector<RedirectAutomationNode*> lines;
265 RedirectAutomationInfo (ARDOUR::Redirect* r)
266 : redirect (r), valid (true) {}
268 ~RedirectAutomationInfo ();
271 list<RedirectAutomationInfo*> redirect_automation;
272 RedirectAutomationNode* find_redirect_automation_node (ARDOUR::Redirect *redirect, uint32_t what);
274 Gtk::Menu subplugin_menu;
275 void add_redirect_to_subplugin_menu (ARDOUR::Redirect *);
277 void remove_ran (RedirectAutomationNode* ran);
279 void redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo*,
280 AudioTimeAxisView::RedirectAutomationNode*);
281 void redirect_automation_track_hidden (RedirectAutomationNode*, ARDOUR::Redirect*);
283 vector<RedirectAutomationLine*> redirect_automation_curves;
284 RedirectAutomationLine *find_redirect_automation_curve (ARDOUR::Redirect*,uint32_t);
285 void add_redirect_automation_curve (ARDOUR::Redirect*, uint32_t);
286 void add_existing_redirect_automation_curves (ARDOUR::Redirect*);
288 ArdourCanvas::SimpleRect *timestretch_rect;
290 void timestretch (jack_nframes_t start, jack_nframes_t end);
292 void visual_click ();
294 gint when_displayed (GdkEventAny*);
296 void speed_changed ();
298 void add_gain_automation_child ();
299 void add_pan_automation_child ();
300 void add_parameter_automation_child ();
302 void toggle_gain_track ();
303 void toggle_pan_track ();
310 void region_view_added (AudioRegionView*);
311 void add_ghost_to_redirect (AudioRegionView*, AutomationTimeAxisView*);
316 #endif /* __ardour_trackview_h__ */