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.
20 #ifndef __ardour_route_time_axis_h__
21 #define __ardour_route_time_axis_h__
23 #include <gtkmm/table.h>
24 #include <gtkmm/button.h>
25 #include <gtkmm/box.h>
26 #include <gtkmm/menu.h>
27 #include <gtkmm/menuitem.h>
28 #include <gtkmm/radiomenuitem.h>
29 #include <gtkmm/checkmenuitem.h>
30 #include <gtkmm/adjustment.h>
32 #include <gtkmm2ext/selector.h>
33 #include <gtkmm2ext/slider_controller.h>
36 #include <ardour/playlist.h>
37 #include <ardour/types.h>
39 #include "ardour_dialog.h"
42 #include "time_axis_view.h"
44 #include "gain_meter.h"
62 class RegionSelection
;
64 class AutomationTimeAxisView
;
66 class RedirectAutomationLine
;
69 class RouteTimeAxisView
: public RouteUI
, public TimeAxisView
72 RouteTimeAxisView (PublicEditor
&, ARDOUR::Session
&, boost::shared_ptr
<ARDOUR::Route
>, ArdourCanvas::Canvas
& canvas
);
73 virtual ~RouteTimeAxisView ();
75 void show_selection (TimeSelection
&);
77 void set_samples_per_unit (double);
78 void set_height (uint32_t h
);
79 void show_timestretch (nframes_t start
, nframes_t end
);
80 void hide_timestretch ();
81 void selection_click (GdkEventButton
*);
82 void set_selected_points (PointSelection
&);
83 void set_selected_regionviews (RegionSelection
&);
84 void get_selectables (nframes_t start
, nframes_t end
, double top
, double bot
, list
<Selectable
*>&);
85 void get_inverted_selectables (Selection
&, list
<Selectable
*>&);
87 boost::shared_ptr
<ARDOUR::Region
> find_next_region (nframes_t pos
, ARDOUR::RegionPoint
, int32_t dir
);
88 nframes64_t
find_next_region_boundary (nframes64_t pos
, int32_t dir
);
90 /* Editing operations */
91 bool cut_copy_clear (Selection
&, Editing::CutCopyOp
);
92 bool paste (nframes_t
, float times
, Selection
&, size_t nth
);
94 list
<TimeAxisView
*> get_child_list();
96 /* The editor calls these when mapping an operation across multiple tracks */
97 void use_new_playlist (bool prompt
, vector
<boost::shared_ptr
<ARDOUR::Playlist
> > const &);
98 void use_copy_playlist (bool prompt
, vector
<boost::shared_ptr
<ARDOUR::Playlist
> > const &);
99 void clear_playlist ();
101 /* group playlist name resolving */
102 std::string
resolve_new_group_playlist_name(std::string
&, vector
<boost::shared_ptr
<ARDOUR::Playlist
> > const &);
105 void build_playlist_menu (Gtk::Menu
*);
108 StreamView
* view() const { return _view
; }
109 ARDOUR::RouteGroup
* edit_group() const;
110 boost::shared_ptr
<ARDOUR::Playlist
> playlist() const;
116 void io_changed (ARDOUR::IOChange
, void *);
117 void meter_changed (void *);
118 void effective_gain_display () { gm
.effective_gain_display(); }
120 static void setup_slider_pix ();
123 friend class StreamView
;
125 struct RedirectAutomationNode
{
127 Gtk::CheckMenuItem
* menu_item
;
128 AutomationTimeAxisView
* view
;
129 RouteTimeAxisView
& parent
;
131 RedirectAutomationNode (uint32_t w
, Gtk::CheckMenuItem
* mitem
, RouteTimeAxisView
& p
)
132 : what (w
), menu_item (mitem
), view (0), parent (p
) {}
134 ~RedirectAutomationNode ();
137 struct RedirectAutomationInfo
{
138 boost::shared_ptr
<ARDOUR::Redirect
> redirect
;
141 vector
<RedirectAutomationNode
*> lines
;
143 RedirectAutomationInfo (boost::shared_ptr
<ARDOUR::Redirect
> r
)
144 : redirect (r
), valid (true), menu (0) {}
146 ~RedirectAutomationInfo ();
150 void diskstream_changed ();
151 void update_diskstream_display ();
153 gint
edit_click (GdkEventButton
*);
155 void redirects_changed (void *);
157 void add_redirect_to_subplugin_menu (boost::shared_ptr
<ARDOUR::Redirect
>);
158 void remove_ran (RedirectAutomationNode
* ran
);
160 void redirect_menu_item_toggled (RouteTimeAxisView::RedirectAutomationInfo
*,
161 RouteTimeAxisView::RedirectAutomationNode
*);
163 void redirect_automation_track_hidden (RedirectAutomationNode
*,
164 boost::shared_ptr
<ARDOUR::Redirect
>);
166 RedirectAutomationNode
*
167 find_redirect_automation_node (boost::shared_ptr
<ARDOUR::Redirect
> r
, uint32_t);
169 RedirectAutomationLine
*
170 find_redirect_automation_curve (boost::shared_ptr
<ARDOUR::Redirect
> r
, uint32_t);
172 void add_redirect_automation_curve (boost::shared_ptr
<ARDOUR::Redirect
> r
, uint32_t);
173 void add_existing_redirect_automation_curves (boost::shared_ptr
<ARDOUR::Redirect
>);
175 void reset_redirect_automation_curves ();
177 void take_name_changed (void *);
178 void route_name_changed (void *);
179 void name_entry_changed ();
181 void update_rec_display ();
183 virtual void label_view ();
185 void add_edit_group_menu_item (ARDOUR::RouteGroup
*, Gtk::RadioMenuItem::Group
*);
186 void set_edit_group_from_menu (ARDOUR::RouteGroup
*);
188 void reset_samples_per_unit ();
190 void select_track_color();
192 virtual void build_automation_action_menu ();
193 virtual void append_extra_display_menu_items () {}
194 void build_display_menu ();
196 void align_style_changed ();
197 void set_align_style (ARDOUR::AlignStyle
);
199 virtual void set_playlist (boost::shared_ptr
<ARDOUR::Playlist
>);
200 void playlist_click ();
201 void show_playlist_selector ();
202 void playlist_changed ();
203 void playlist_modified ();
205 void rename_current_playlist ();
207 void automation_click ();
208 virtual void show_all_automation ();
209 virtual void show_existing_automation ();
210 virtual void hide_all_automation ();
212 void timestretch (nframes_t start
, nframes_t end
);
214 void visual_click ();
217 void speed_changed ();
221 void color_handler ();
223 void region_view_added (RegionView
*);
224 void add_ghost_to_redirect (RegionView
*, AutomationTimeAxisView
*);
228 ArdourCanvas::Canvas
& parent_canvas
;
231 Gtk::HBox other_button_hbox
;
232 Gtk::Table button_table
;
233 Gtk::Button redirect_button
;
234 Gtk::Button edit_group_button
;
235 Gtk::Button playlist_button
;
236 Gtk::Button size_button
;
237 Gtk::Button automation_button
;
238 Gtk::Button hide_button
;
239 Gtk::Button visual_button
;
241 Gtk::Menu subplugin_menu
;
242 Gtk::Menu
* automation_action_menu
;
243 Gtk::Menu edit_group_menu
;
244 Gtk::RadioMenuItem
* align_existing_item
;
245 Gtk::RadioMenuItem
* align_capture_item
;
246 Gtk::RadioMenuItem
* normal_track_mode_item
;
247 Gtk::RadioMenuItem
* destructive_track_mode_item
;
248 Gtk::Menu
* playlist_menu
;
249 Gtk::Menu
* playlist_action_menu
;
250 Gtk::MenuItem
* playlist_item
;
252 void use_playlist (Gtk::RadioMenuItem
*, boost::weak_ptr
<ARDOUR::Playlist
>);
254 ArdourCanvas::SimpleRect
* timestretch_rect
;
256 void set_track_mode (ARDOUR::TrackMode
);
257 void _set_track_mode (boost::shared_ptr
<ARDOUR::Track
> track
, ARDOUR::TrackMode mode
, Gtk::RadioMenuItem
* reset_item
);
258 void track_mode_changed ();
260 list
<RedirectAutomationInfo
*> redirect_automation
;
261 vector
<RedirectAutomationLine
*> redirect_automation_curves
;
263 sigc::connection modified_connection
;
265 void post_construct ();
269 static Glib::RefPtr
<Gdk::Pixbuf
> slider
;
272 #endif /* __ardour_route_time_axis_h__ */