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"
60 class AutomationTimeAxisView;
62 class RedirectAutomationLine;
65 class RouteTimeAxisView : public RouteUI, public TimeAxisView
68 RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
69 virtual ~RouteTimeAxisView ();
71 void show_selection (TimeSelection&);
73 void set_samples_per_unit (double);
74 void set_height (TimeAxisView::TrackHeight);
75 void show_timestretch (jack_nframes_t start, jack_nframes_t end);
76 void hide_timestretch ();
77 void selection_click (GdkEventButton*);
78 void set_selected_points (PointSelection&);
79 void set_selected_regionviews (RegionSelection&);
80 void get_selectables (jack_nframes_t start, jack_nframes_t end, double top, double bot, list<Selectable *>&);
81 void get_inverted_selectables (Selection&, list<Selectable*>&);
83 ARDOUR::Region* find_next_region (jack_nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
85 /* Editing operations */
86 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
87 bool paste (jack_nframes_t, float times, Selection&, size_t nth);
89 list<TimeAxisView*> get_child_list();
91 /* The editor calls these when mapping an operation across multiple tracks */
92 void use_new_playlist (bool prompt);
93 void use_copy_playlist (bool prompt);
94 void clear_playlist ();
96 void build_playlist_menu (Gtk::Menu *);
99 StreamView* view() const { return _view; }
100 ARDOUR::RouteGroup* edit_group() const;
101 ARDOUR::Playlist* playlist() const;
104 friend class StreamView;
106 struct RedirectAutomationNode {
108 Gtk::CheckMenuItem* menu_item;
109 AutomationTimeAxisView* view;
110 RouteTimeAxisView& parent;
112 RedirectAutomationNode (uint32_t w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
113 : what (w), menu_item (mitem), view (0), parent (p) {}
115 ~RedirectAutomationNode ();
118 struct RedirectAutomationInfo {
119 boost::shared_ptr<ARDOUR::Redirect> redirect;
122 vector<RedirectAutomationNode*> lines;
124 RedirectAutomationInfo (boost::shared_ptr<ARDOUR::Redirect> r)
125 : redirect (r), valid (true), menu (0) {}
127 ~RedirectAutomationInfo ();
131 void diskstream_changed (void *src);
132 void update_diskstream_display ();
134 gint edit_click (GdkEventButton *);
136 void build_redirect_window ();
137 void redirect_click ();
138 void redirect_add ();
139 void redirect_remove ();
140 void redirect_edit ();
141 void redirect_relist ();
142 void redirect_row_selected (gint row, gint col, GdkEvent *ev);
143 void add_to_redirect_display (ARDOUR::Redirect *);
144 void redirects_changed (void *);
146 void add_redirect_to_subplugin_menu (boost::shared_ptr<ARDOUR::Redirect>);
147 void remove_ran (RedirectAutomationNode* ran);
149 void redirect_menu_item_toggled (RouteTimeAxisView::RedirectAutomationInfo*,
150 RouteTimeAxisView::RedirectAutomationNode*);
152 void redirect_automation_track_hidden (RedirectAutomationNode*,
153 boost::shared_ptr<ARDOUR::Redirect>);
155 RedirectAutomationNode*
156 find_redirect_automation_node (boost::shared_ptr<ARDOUR::Redirect> r, uint32_t);
158 RedirectAutomationLine*
159 find_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect> r, uint32_t);
161 void add_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect> r, uint32_t);
162 void add_existing_redirect_automation_curves (boost::shared_ptr<ARDOUR::Redirect>);
164 void reset_redirect_automation_curves ();
166 void update_automation_view (ARDOUR::AutomationType);
168 void take_name_changed (void *);
169 void route_name_changed (void *);
170 void name_entry_changed ();
172 void on_area_realize ();
174 virtual void label_view ();
176 void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
177 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
179 void reset_samples_per_unit ();
181 void select_track_color();
183 virtual void build_automation_action_menu ();
184 virtual void append_extra_display_menu_items () {}
185 void build_display_menu ();
187 void align_style_changed ();
188 void set_align_style (ARDOUR::AlignStyle);
190 virtual void set_playlist (ARDOUR::Playlist *);
191 void playlist_click ();
192 void show_playlist_selector ();
193 void playlist_changed ();
194 void playlist_state_changed (ARDOUR::Change);
195 void playlist_modified ();
197 void add_playlist_to_playlist_menu (ARDOUR::Playlist*);
198 void rename_current_playlist ();
200 void automation_click ();
201 virtual void show_all_automation ();
202 virtual void show_existing_automation ();
203 virtual void hide_all_automation ();
205 void timestretch (jack_nframes_t start, jack_nframes_t end);
207 void visual_click ();
209 gint when_displayed (GdkEventAny*);
211 void speed_changed ();
215 void color_handler (ColorID, uint32_t);
216 bool select_me (GdkEventButton*);
218 void region_view_added (RegionView*);
219 void add_ghost_to_redirect (RegionView*, AutomationTimeAxisView*);
223 ArdourCanvas::Canvas& parent_canvas;
226 Gtk::HBox other_button_hbox;
227 Gtk::Table button_table;
228 Gtk::Button redirect_button;
229 Gtk::Button edit_group_button;
230 Gtk::Button playlist_button;
231 Gtk::Button size_button;
232 Gtk::Button automation_button;
233 Gtk::Button hide_button;
234 Gtk::Button visual_button;
236 Gtk::Menu subplugin_menu;
237 Gtk::Menu* automation_action_menu;
238 Gtk::Menu edit_group_menu;
239 Gtk::RadioMenuItem* align_existing_item;
240 Gtk::RadioMenuItem* align_capture_item;
241 Gtk::Menu* playlist_menu;
242 Gtk::Menu* playlist_action_menu;
243 Gtk::MenuItem* playlist_item;
245 ArdourCanvas::SimpleRect* timestretch_rect;
247 list<RedirectAutomationInfo*> redirect_automation;
248 vector<RedirectAutomationLine*> redirect_automation_curves;
250 sigc::connection modified_connection;
251 sigc::connection state_changed_connection;
254 #endif /* __ardour_route_time_axis_h__ */