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 <libgnomecanvas/libgnomecanvas.h>
26 #include <gtkmm2ext/selector.h>
27 #include <gtkmm2ext/popup_selector.h>
30 #include <ardour/types.h>
31 #include <ardour/region.h>
33 #include "ardour_dialog.h"
36 #include "time_axis_view.h"
39 class MultiChannelDevice;
62 class AudioRegionView;
64 class AutomationGainLine;
65 class AutomationPanLine;
66 class RedirectAutomationLine;
68 class AutomationTimeAxisView;
70 class AudioTimeAxisView : public RouteUI, public TimeAxisView
73 AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, ARDOUR::Route&, Gtk::Widget *canvas);
74 virtual ~AudioTimeAxisView ();
76 void show_selection (TimeSelection&);
77 void automation_control_point_changed (ARDOUR::AutomationType);
79 void set_samples_per_unit (double);
80 void set_height (TimeAxisView::TrackHeight);
81 void set_show_waveforms (bool yn);
82 void set_show_waveforms_recording (bool yn);
83 void show_timestretch (jack_nframes_t start, jack_nframes_t end);
84 void hide_timestretch ();
85 void selection_click (GdkEventButton*);
86 void set_selected_regionviews (AudioRegionSelection&);
87 void set_selected_points (PointSelection&);
88 void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
89 void get_inverted_selectables (Selection&, list<Selectable*>&);
90 void show_all_xfades ();
91 void hide_all_xfades ();
92 void hide_dependent_views (TimeAxisViewItem&);
93 void reveal_dependent_views (TimeAxisViewItem&);
95 ARDOUR::Region* find_next_region (jack_nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
99 ARDOUR::RouteGroup* edit_group() const;
101 void build_playlist_menu (Gtk::Menu *);
102 ARDOUR::Playlist* playlist() const;
104 /* overridden from parent to store display state */
105 guint32 show_at (double y, int& nth, Gtk::VBox *parent);
108 /* need accessors/mutators */
112 /* editing operations */
114 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
115 bool paste (jack_nframes_t, float times, Selection&, size_t nth);
117 list<TimeAxisView*>get_child_list();
119 void set_state (const XMLNode&);
120 XMLNode* get_child_xml_node (std::string childname);
123 friend class StreamView;
124 friend class AudioRegionView;
126 Gtk::Widget* parent_canvas;
130 AutomationTimeAxisView *gain_track;
131 AutomationTimeAxisView *pan_track;
133 void update_automation_view (ARDOUR::AutomationType);
134 void reset_redirect_automation_curves ();
136 Gtk::HBox other_button_hbox;
138 Gtk::Table button_table;
140 Gtk::Button redirect_button;
141 Gtk::Button edit_group_button;
142 Gtk::Button playlist_button;
143 Gtk::Button size_button;
144 Gtk::Button automation_button;
145 Gtk::Button hide_button;
146 Gtk::Button visual_button;
148 void route_active_changed ();
150 void diskstream_changed (void *src);
151 void update_diskstream_display ();
153 gint edit_click (GdkEventButton *);
155 /* Redirect handling */
157 ArdourDialog redirect_window;
158 Gtk::CList redirect_display;
159 Gtk::Button redirect_add_button;
160 Gtk::Button redirect_remove_button;
161 Gtk::Button redirect_up_button;
162 Gtk::Button redirect_down_button;
163 Gtk::Button redirect_edit_button;
164 Gtk::HBox redirect_button_box;
165 Gtk::VBox redirect_vpacker;
166 Gtk::HBox redirect_display_hpacker;
168 int redirect_selected_row;
171 // variables to get the context menu
172 // automation buttons correctly initialized
173 bool show_gain_automation;
174 bool show_pan_automation;
176 void build_redirect_window ();
177 void redirect_click ();
178 void redirect_add ();
179 void redirect_remove ();
180 void redirect_edit ();
181 void redirect_relist ();
182 void redirect_row_selected (gint row, gint col, GdkEvent *ev);
183 void add_to_redirect_display (ARDOUR::Redirect *);
184 void redirects_changed (void *);
186 sigc::connection modified_connection;
187 sigc::connection state_changed_connection;
189 void take_name_changed (void *);
190 void route_name_changed (void *);
191 void name_entry_activated ();
192 void name_entry_changed ();
193 gint name_entry_focus_out_handler (GdkEventFocus*);
194 gint name_entry_key_release_handler (GdkEventKey*);
195 gint name_entry_button_release_handler (GdkEventButton*);
196 gint name_entry_button_press_handler (GdkEventButton*);
197 void on_area_realize ();
199 virtual void label_view ();
201 Gtk::Menu edit_group_menu;
202 Gtk::RadioMenuItem::Group edit_group_menu_radio_group;
204 void add_edit_group_menu_item (ARDOUR::RouteGroup *);
205 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
207 void reset_samples_per_unit ();
209 void select_track_color();
211 virtual void build_display_menu ();
213 Gtk::CheckMenuItem* waveform_item;
214 Gtk::RadioMenuItem* traditional_item;
215 Gtk::RadioMenuItem* rectified_item;
217 Gtk::RadioMenuItem* align_existing_item;
218 Gtk::RadioMenuItem* align_capture_item;
220 void align_style_changed ();
221 void set_align_style (ARDOUR::AlignStyle);
223 void toggle_show_waveforms ();
225 void set_waveform_shape (WaveformShape);
226 void toggle_waveforms ();
228 Gtk::Menu *playlist_menu;
229 Gtk::Menu *playlist_action_menu;
230 Gtk::MenuItem *playlist_item;
234 void set_playlist (ARDOUR::AudioPlaylist *);
235 void playlist_click ();
236 void show_playlist_selector ();
238 void playlist_changed ();
239 void playlist_state_changed (ARDOUR::Change);
240 void playlist_modified ();
242 void add_playlist_to_playlist_menu (ARDOUR::Playlist*);
243 void playlist_selected (ARDOUR::AudioPlaylist*);
244 void use_new_playlist ();
245 void use_copy_playlist ();
246 void clear_playlist ();
247 void rename_current_playlist ();
249 /* automation stuff */
251 Gtk::Menu* automation_action_menu;
252 Gtk::CheckMenuItem* gain_automation_item;
253 Gtk::CheckMenuItem* pan_automation_item;
255 void automation_click ();
256 void clear_automation ();
257 void hide_all_automation ();
258 void show_all_automation ();
259 void show_existing_automation ();
261 struct RedirectAutomationNode {
263 Gtk::CheckMenuItem* menu_item;
264 AutomationTimeAxisView* view;
265 AudioTimeAxisView& parent;
267 RedirectAutomationNode (uint32_t w, Gtk::CheckMenuItem* mitem, AudioTimeAxisView& p)
268 : what (w), menu_item (mitem), view (0), parent (p) {}
270 ~RedirectAutomationNode ();
273 struct RedirectAutomationInfo {
274 ARDOUR::Redirect* redirect;
277 vector<RedirectAutomationNode*> lines;
279 RedirectAutomationInfo (ARDOUR::Redirect* r)
280 : redirect (r), valid (true) {}
282 ~RedirectAutomationInfo ();
285 list<RedirectAutomationInfo*> redirect_automation;
286 RedirectAutomationNode* find_redirect_automation_node (ARDOUR::Redirect *redirect, uint32_t what);
288 Gtk::Menu subplugin_menu;
289 void add_redirect_to_subplugin_menu (ARDOUR::Redirect *);
291 void remove_ran (RedirectAutomationNode* ran);
293 void redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo*,
294 AudioTimeAxisView::RedirectAutomationNode*);
295 void redirect_automation_track_hidden (RedirectAutomationNode*, ARDOUR::Redirect*);
297 vector<RedirectAutomationLine*> redirect_automation_curves;
298 RedirectAutomationLine *find_redirect_automation_curve (ARDOUR::Redirect*,uint32_t);
299 void add_redirect_automation_curve (ARDOUR::Redirect*, uint32_t);
300 void add_existing_redirect_automation_curves (ARDOUR::Redirect*);
302 GnomeCanvasItem *timestretch_rect;
304 void timestretch (jack_nframes_t start, jack_nframes_t end);
306 void visual_click ();
308 gint when_displayed (GdkEventAny*);
310 void speed_changed ();
312 void add_gain_automation_child ();
313 void add_pan_automation_child ();
314 void add_parameter_automation_child ();
316 void toggle_gain_track ();
317 void toggle_pan_track ();
324 void region_view_added (AudioRegionView*);
325 void add_ghost_to_redirect (AudioRegionView*, AutomationTimeAxisView*);
330 #endif /* __ardour_trackview_h__ */