2 Copyright (C) 2006 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.
18 $Id: audio_time_axis.h 664 2006-07-05 19:47:25Z drobilla $
21 #ifndef __ardour_route_time_axis_h__
22 #define __ardour_route_time_axis_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>
37 #include "ardour_dialog.h"
40 #include "time_axis_view.h"
59 class RegionSelection;
61 class AutomationTimeAxisView;
63 class RedirectAutomationLine;
66 class RouteTimeAxisView : public RouteUI, public TimeAxisView
69 RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
70 virtual ~RouteTimeAxisView ();
72 void show_selection (TimeSelection&);
74 void set_samples_per_unit (double);
75 void set_height (TimeAxisView::TrackHeight);
76 void show_timestretch (nframes_t start, nframes_t end);
77 void hide_timestretch ();
78 void selection_click (GdkEventButton*);
79 void set_selected_points (PointSelection&);
80 void set_selected_regionviews (RegionSelection&);
81 void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
82 void get_inverted_selectables (Selection&, list<Selectable*>&);
84 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
86 /* Editing operations */
87 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
88 bool paste (nframes_t, float times, Selection&, size_t nth);
90 list<TimeAxisView*> get_child_list();
92 /* The editor calls these when mapping an operation across multiple tracks */
93 void use_new_playlist (bool prompt);
94 void use_copy_playlist (bool prompt);
95 void clear_playlist ();
97 void build_playlist_menu (Gtk::Menu *);
100 StreamView* view() const { return _view; }
101 ARDOUR::RouteGroup* edit_group() const;
102 ARDOUR::Playlist* playlist() const;
105 friend class StreamView;
107 struct RedirectAutomationNode {
109 Gtk::CheckMenuItem* menu_item;
110 AutomationTimeAxisView* view;
111 RouteTimeAxisView& parent;
113 RedirectAutomationNode (uint32_t w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
114 : what (w), menu_item (mitem), view (0), parent (p) {}
116 ~RedirectAutomationNode ();
119 struct RedirectAutomationInfo {
120 boost::shared_ptr<ARDOUR::Redirect> redirect;
123 vector<RedirectAutomationNode*> lines;
125 RedirectAutomationInfo (boost::shared_ptr<ARDOUR::Redirect> r)
126 : redirect (r), valid (true), menu (0) {}
128 ~RedirectAutomationInfo ();
132 void diskstream_changed ();
133 void update_diskstream_display ();
135 gint edit_click (GdkEventButton *);
137 void redirects_changed (void *);
139 void add_redirect_to_subplugin_menu (boost::shared_ptr<ARDOUR::Redirect>);
140 void remove_ran (RedirectAutomationNode* ran);
142 void redirect_menu_item_toggled (RouteTimeAxisView::RedirectAutomationInfo*,
143 RouteTimeAxisView::RedirectAutomationNode*);
145 void redirect_automation_track_hidden (RedirectAutomationNode*,
146 boost::shared_ptr<ARDOUR::Redirect>);
148 RedirectAutomationNode*
149 find_redirect_automation_node (boost::shared_ptr<ARDOUR::Redirect> r, uint32_t);
151 RedirectAutomationLine*
152 find_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect> r, uint32_t);
154 void add_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect> r, uint32_t);
155 void add_existing_redirect_automation_curves (boost::shared_ptr<ARDOUR::Redirect>);
157 void reset_redirect_automation_curves ();
159 void take_name_changed (void *);
160 void route_name_changed (void *);
161 void name_entry_changed ();
163 virtual void label_view ();
165 void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
166 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
168 void reset_samples_per_unit ();
170 void select_track_color();
172 virtual void build_automation_action_menu ();
173 virtual void append_extra_display_menu_items () {}
174 void build_display_menu ();
176 void align_style_changed ();
177 void set_align_style (ARDOUR::AlignStyle);
179 virtual void set_playlist (ARDOUR::Playlist *);
180 void playlist_click ();
181 void show_playlist_selector ();
182 void playlist_changed ();
183 void playlist_modified ();
185 void rename_current_playlist ();
187 void automation_click ();
188 virtual void show_all_automation ();
189 virtual void show_existing_automation ();
190 virtual void hide_all_automation ();
192 void timestretch (nframes_t start, nframes_t end);
194 void visual_click ();
197 void speed_changed ();
201 void color_handler (ColorID, uint32_t);
203 void region_view_added (RegionView*);
204 void add_ghost_to_redirect (RegionView*, AutomationTimeAxisView*);
208 ArdourCanvas::Canvas& parent_canvas;
211 Gtk::HBox other_button_hbox;
212 Gtk::Table button_table;
213 Gtk::Button redirect_button;
214 Gtk::Button edit_group_button;
215 Gtk::Button playlist_button;
216 Gtk::Button size_button;
217 Gtk::Button automation_button;
218 Gtk::Button hide_button;
219 Gtk::Button visual_button;
221 Gtk::Menu subplugin_menu;
222 Gtk::Menu* automation_action_menu;
223 Gtk::Menu edit_group_menu;
224 Gtk::RadioMenuItem* align_existing_item;
225 Gtk::RadioMenuItem* align_capture_item;
226 Gtk::RadioMenuItem* normal_track_mode_item;
227 Gtk::RadioMenuItem* destructive_track_mode_item;
228 Gtk::Menu* playlist_menu;
229 Gtk::Menu* playlist_action_menu;
230 Gtk::MenuItem* playlist_item;
232 void use_playlist (ARDOUR::Playlist*);
234 ArdourCanvas::SimpleRect* timestretch_rect;
236 void set_track_mode (ARDOUR::TrackMode);
237 void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item);
238 void track_mode_changed ();
240 list<RedirectAutomationInfo*> redirect_automation;
241 vector<RedirectAutomationLine*> redirect_automation_curves;
243 sigc::connection modified_connection;
246 #endif /* __ardour_route_time_axis_h__ */