2 Copyright (C) 2000-2003 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_editor_h__
21 #define __ardour_editor_h__
29 #include <glibmm/ustring.h>
31 #include <boost/optional.hpp>
33 #include <libgnomecanvasmm/canvas.h>
34 #include <libgnomecanvasmm/group.h>
35 #include <libgnomecanvasmm/line.h>
36 #include <libgnomecanvasmm/pixbuf.h>
40 #include <gtkmm/layout.h>
41 #include <gtkmm/comboboxtext.h>
43 #include <gtkmm2ext/selector.h>
44 #include <gtkmm2ext/click_box.h>
45 #include <gtkmm2ext/dndtreeview.h>
47 #include <pbd/stateful.h>
48 #include <ardour/session.h>
49 #include <ardour/tempo.h>
50 #include <ardour/stretch.h>
51 #include <ardour/location.h>
52 #include <ardour/audioregion.h>
53 #include <ardour/track.h>
55 #include "audio_clock.h"
56 #include "gtk-custom-ruler.h"
57 #include "ardour_dialog.h"
58 #include "public_editor.h"
61 #include "editor_items.h"
62 #include "region_selection.h"
71 class AudioDiskstream;
90 class AudioTimeAxisView;
91 class AutomationTimeAxisView;
92 class AudioRegionView;
95 class PlaylistSelector;
102 class TrackSelection;
103 class AutomationSelection;
106 class AudioStreamView;
108 class SoundFileOmega;
110 class AnalysisWindow;
112 /* <CMT Additions> */
113 class ImageFrameView;
114 class ImageFrameTimeAxisView;
115 class ImageFrameTimeAxis;
116 class MarkerTimeAxis ;
118 class ImageFrameSocketHandler ;
119 class TimeAxisViewItem ;
120 /* </CMT Additions> */
123 class Editor : public PublicEditor
129 void connect_to_session (ARDOUR::Session *);
130 ARDOUR::Session* current_session() const { return session; }
132 virtual bool have_idled() const { return _have_idled; }
134 nframes64_t leftmost_position() const { return leftmost_frame; }
135 nframes64_t current_page_frames() const {
136 return (nframes64_t) floor (canvas_width * frames_per_unit);
139 void cycle_snap_mode ();
140 void cycle_snap_choice ();
141 void set_snap_to (Editing::SnapType);
142 void set_snap_mode (Editing::SnapMode);
143 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
145 void undo (uint32_t n = 1);
146 void redo (uint32_t n = 1);
148 XMLNode& get_state ();
149 int set_state (const XMLNode& );
151 void set_mouse_mode (Editing::MouseMode, bool force=true);
152 void step_mouse_mode (bool next);
153 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
155 void set_midi_edit_cursor (Editing::MidiEditMode);
156 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
157 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
160 void add_imageframe_time_axis(const std::string & track_name, void*) ;
161 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
162 void connect_to_image_compositor() ;
163 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
166 TimeAxisView* get_named_time_axis(const std::string & name) ;
167 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
168 void add_to_idle_resize (TimeAxisView*, uint32_t);
170 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
172 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
173 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
174 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
176 #ifdef USE_RUBBERBAND
177 std::vector<std::string> rb_opt_strings;
180 /* option editor-access */
182 void set_show_waveforms (bool yn);
183 bool show_waveforms() const { return _show_waveforms; }
185 void set_waveform_scale (Editing::WaveformScale);
187 void set_show_waveforms_recording (bool yn);
188 bool show_waveforms_recording() const { return _show_waveforms_recording; }
190 /* things that need to be public to be used in the main menubar */
192 void new_region_from_selection ();
193 void separate_regions_between (const TimeSelection&);
194 void separate_region_from_selection ();
195 void separate_region_from_punch ();
196 void separate_region_from_loop ();
197 void separate_regions_using_location (ARDOUR::Location&);
198 void toggle_playback (bool with_abort);
199 void transition_to_rolling (bool forward);
203 nframes64_t unit_to_frame (double unit) const {
204 return (nframes64_t) rint (unit * frames_per_unit);
207 double frame_to_unit (nframes64_t frame) const {
208 return rint ((double) frame / (double) frames_per_unit);
211 double frame_to_unit (double frame) const {
212 return rint (frame / frames_per_unit);
215 /* NOTE: these functions assume that the "pixel" coordinate is
216 the result of using the world->canvas affine transform on a
217 world coordinate. These coordinates already take into
218 account any scrolling carried out by adjusting the
222 nframes64_t pixel_to_frame (double pixel) const {
224 /* pixel can be less than zero when motion events
225 are processed. since we've already run the world->canvas
226 affine, that means that the location *really* is "off
227 to the right" and thus really is "before the start".
231 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
237 gulong frame_to_pixel (nframes64_t frame) const {
238 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
241 void flush_canvas ();
245 Selection& get_selection() const { return *selection; }
246 Selection& get_cut_buffer() const { return *cut_buffer; }
248 bool extend_selection_to_track (TimeAxisView&);
250 void play_selection ();
251 void select_all_in_track (Selection::Operation op);
252 void select_all (Selection::Operation op);
253 void invert_selection_in_track ();
254 void invert_selection ();
255 void deselect_all ();
259 void set_show_measures (bool yn);
260 bool show_measures () const { return _show_measures; }
262 /* analysis window */
263 void analyze_region_selection();
264 void analyze_range_selection();
268 void export_audio ();
269 void export_selection ();
270 void export_range ();
271 void export_region ();
273 void add_toplevel_controls (Gtk::Container&);
274 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
276 void set_zoom_focus (Editing::ZoomFocus);
277 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
278 double get_current_zoom () const { return frames_per_unit; }
280 void temporal_zoom_step (bool coarser);
282 /* stuff that AudioTimeAxisView and related classes use */
284 PlaylistSelector& playlist_selector() const;
285 void route_name_changed (TimeAxisView *);
286 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
288 void new_playlists (TimeAxisView* v);
289 void copy_playlists (TimeAxisView* v);
290 void clear_playlists (TimeAxisView* v);
292 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
294 Width editor_mixer_strip_width;
295 void maybe_add_mixer_strip_width (XMLNode&);
296 void show_editor_mixer (bool yn);
297 void create_editor_mixer ();
298 void show_editor_list (bool yn);
299 void set_selected_mixer_strip (TimeAxisView&);
300 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
301 void show_track_in_display (TimeAxisView& tv);
303 /* nudge is initiated by transport controls owned by ARDOUR_UI */
305 void nudge_forward (bool next, bool force_playhead);
306 void nudge_backward (bool next, bool force_playhead);
308 /* nudge initiated from context menu */
310 void nudge_forward_capture_offset ();
311 void nudge_backward_capture_offset ();
313 /* playhead/screen stuff */
315 void set_follow_playhead (bool yn);
316 void toggle_follow_playhead ();
317 bool follow_playhead() const { return _follow_playhead; }
318 bool dragging_playhead () const { return _dragging_playhead; }
320 void toggle_waveform_visibility ();
321 void toggle_zero_line_visibility ();
322 void toggle_waveforms_while_recording ();
323 void toggle_measure_visibility ();
324 void toggle_logo_visibility ();
326 double get_physical_screen_width () const { return physical_screen_width; };
327 double physical_screen_width;
328 double physical_screen_height;
330 /* SMPTE timecode & video sync */
332 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
333 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
334 void subframes_per_frame_chosen (uint32_t);
336 void update_smpte_mode();
337 void update_video_pullup();
338 void update_subframes_per_frame ();
342 void toggle_region_fades ();
343 void toggle_region_fades_visible ();
344 void toggle_selected_region_fades (int dir);
345 void update_region_fade_visibility ();
346 void toggle_auto_xfade ();
347 void toggle_xfades_active ();
348 void toggle_xfade_visibility ();
349 bool xfade_visibility() const { return _xfade_visibility; }
350 void update_xfade_visibility ();
351 void update_crossfade_model ();
352 void set_crossfade_model (ARDOUR::CrossfadeModel);
355 void set_layer_model (ARDOUR::LayerModel);
356 void update_layering_model ();
358 void toggle_link_region_and_track_selection ();
359 void toggle_automation_follows_regions ();
361 /* redirect shared ops menu. caller must free returned menu */
363 Gtk::Menu* redirect_menu ();
365 /* floating windows/transient */
367 void ensure_float (Gtk::Window&);
371 void scroll_tracks_down_line ();
372 void scroll_tracks_up_line ();
374 void move_selected_tracks (bool up);
376 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
377 void prepare_for_cleanup ();
378 void finish_cleanup ();
380 void maximise_editing_space();
381 void restore_editing_space();
383 void reset_x_origin (nframes64_t);
384 void reset_zoom (double);
385 void reposition_and_zoom (nframes64_t, double);
387 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
389 bool update_mouse_speed ();
390 bool decelerate_mouse_speed ();
392 void toggle_meter_updating();
394 void show_rhythm_ferret();
396 void goto_visual_state (uint32_t);
397 void save_visual_state (uint32_t);
399 void queue_draw_resize_line (int at);
400 void start_resize_line_ops ();
401 void end_resize_line_ops ();
404 void map_transport_state ();
405 void map_position_change (nframes64_t);
408 bool on_expose_event (GdkEventExpose*);
412 /// The session that we are editing, or 0
413 void color_handler ();
414 ARDOUR::Session *session;
417 // to keep track of the playhead position for control_scroll
418 boost::optional<nframes64_t> _control_scroll_target;
420 PlaylistSelector* _playlist_selector;
422 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
426 double frames_per_unit;
427 nframes64_t leftmost_frame;
428 Editing::ZoomFocus zoom_focus;
429 bool zoomed_to_region;
430 std::list<TAVState> track_states;
433 std::list<VisualState*> undo_visual_stack;
434 std::list<VisualState*> redo_visual_stack;
435 VisualState* current_visual_state (bool with_tracks = true);
436 void undo_visual_state ();
437 void redo_visual_state ();
438 void use_visual_state (VisualState&);
440 void swap_visual_state ();
442 std::vector<VisualState*> visual_states;
443 sigc::connection visual_state_op_connection;
444 void start_visual_state_op (uint32_t n);
445 void cancel_visual_state_op (uint32_t n);
446 bool end_visual_state_op (uint32_t n);
448 nframes64_t leftmost_frame;
449 double frames_per_unit;
450 Editing::ZoomFocus zoom_focus;
452 void set_frames_per_unit (double);
455 Editing::MouseMode mouse_mode;
456 Editing::MidiEditMode midi_edit_mode;
458 int post_maximal_editor_width;
459 int post_maximal_pane_position;
460 int pre_maximal_pane_position;
461 int pre_maximal_editor_width;
462 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
464 Gtk::Notebook the_notebook;
465 Gtk::HPaned edit_pane;
467 Gtk::EventBox meter_base;
469 Gtk::EventBox marker_base;
470 Gtk::HBox marker_box;
471 Gtk::VBox scrollers_rulers_markers_box;
473 void location_changed (ARDOUR::Location *);
474 void location_flags_changed (ARDOUR::Location *, void *);
475 void refresh_location_display ();
476 void refresh_location_display_s (ARDOUR::Change);
477 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
478 void add_new_location (ARDOUR::Location *);
479 void location_gone (ARDOUR::Location *);
480 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
481 gint really_remove_marker (ARDOUR::Location* loc);
482 void goto_nth_marker (int nth);
484 uint32_t location_marker_color;
485 uint32_t location_range_color;
486 uint32_t location_loop_color;
487 uint32_t location_punch_color;
488 uint32_t location_cd_marker_color;
490 struct LocationMarkers {
495 LocationMarkers () : start(0), end(0), valid (true) {}
501 void set_name (const string&);
502 void set_position (nframes64_t start, nframes64_t end = 0);
503 void set_color_rgba (uint32_t);
506 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
507 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
508 Marker* entered_marker;
510 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
511 LocationMarkerMap location_markers;
513 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
514 void clear_marker_display ();
515 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
516 bool choose_new_marker_name(string &name);
517 void update_cd_marker_display ();
518 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
520 TimeAxisView* clicked_axisview;
521 RouteTimeAxisView* clicked_routeview;
522 /** The last RegionView that was clicked on, or 0 if the last click was not
523 * on a RegionView. This is set up by the canvas event handlers in
524 * editor_canvas_events.cc
526 RegionView* clicked_regionview;
527 RegionSelection latest_regionviews;
528 uint32_t clicked_selection;
529 CrossfadeView* clicked_crossfadeview;
530 ControlPoint* clicked_control_point;
532 void sort_track_selection (TrackSelection* sel = 0);
534 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
535 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
536 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
538 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
540 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
541 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
542 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
543 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
547 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
548 bool button_release_can_deselect;
550 void catch_vanishing_regionview (RegionView *);
552 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
553 void select_all_tracks ();
555 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
557 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
558 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
559 void set_selected_track_as_side_effect (bool force = false);
560 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
562 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
563 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
564 void collect_new_region_view (RegionView *);
565 void collect_and_select_new_region_view (RegionView *);
567 Gtk::Menu track_context_menu;
568 Gtk::Menu track_region_context_menu;
569 Gtk::Menu track_selection_context_menu;
570 Gtk::Menu track_crossfade_context_menu;
572 Gtk::MenuItem* region_edit_menu_split_item;
573 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
574 Gtk::Menu * track_region_edit_playlist_menu;
575 Gtk::Menu * track_edit_playlist_submenu;
576 Gtk::Menu * track_selection_edit_playlist_submenu;
578 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
579 Gtk::Menu* build_track_context_menu (nframes64_t);
580 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
581 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
582 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
583 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
584 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
585 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
586 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
587 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
588 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
590 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
592 void handle_new_route (ARDOUR::Session::RouteList&);
593 void remove_route (TimeAxisView *);
596 Gtk::HBox global_hpacker;
597 Gtk::VBox global_vpacker;
600 bool need_resize_line;
602 int old_resize_line_y;
604 Gdk::Cursor* current_canvas_cursor;
605 void set_canvas_cursor ();
606 Gdk::Cursor* which_grabber_cursor ();
608 ArdourCanvas::Canvas* track_canvas;
610 ArdourCanvas::Text* first_action_message;
611 ArdourCanvas::Text* verbose_canvas_cursor;
612 bool verbose_cursor_visible;
614 void parameter_changed (const char *);
616 bool track_canvas_motion (GdkEvent*);
618 void set_verbose_canvas_cursor (const string &, double x, double y);
619 void set_verbose_canvas_cursor_text (const string &);
620 void show_verbose_canvas_cursor();
621 void hide_verbose_canvas_cursor();
623 bool verbose_cursor_on; // so far unused
625 Gtk::EventBox time_canvas_event_box;
626 Gtk::EventBox track_canvas_event_box;
627 Gtk::EventBox time_button_event_box;
628 Gtk::EventBox ruler_label_event_box;
630 ArdourCanvas::Group *minsec_group;
631 ArdourCanvas::Pixbuf *logo_item;
632 ArdourCanvas::Group *bbt_group;
633 ArdourCanvas::Group *smpte_group;
634 ArdourCanvas::Group *frame_group;
635 ArdourCanvas::Group *tempo_group;
636 ArdourCanvas::Group *meter_group;
637 ArdourCanvas::Group *marker_group;
638 ArdourCanvas::Group *range_marker_group;
639 ArdourCanvas::Group *transport_marker_group;
640 ArdourCanvas::Group* cd_marker_group;
642 ArdourCanvas::Group* timebar_group;
644 /* These bars never need to be scrolled */
645 ArdourCanvas::Group* meter_bar_group;
646 ArdourCanvas::Group* tempo_bar_group;
647 ArdourCanvas::Group* marker_bar_group;
648 ArdourCanvas::Group* range_marker_bar_group;
649 ArdourCanvas::Group* transport_marker_bar_group;
650 ArdourCanvas::Group* cd_marker_bar_group;
652 /** The group containing all items that require horizontal scrolling. */
653 ArdourCanvas::Group* _background_group;
655 The _master_group is the group containing all items
656 that require horizontal scrolling..
657 It is primarily used to separate canvas items
658 that require horizontal scrolling from those that do not.
660 ArdourCanvas::Group* _master_group;
662 /* The group containing all trackviews. Only scrolled vertically. */
663 ArdourCanvas::Group* _trackview_group;
665 /* The group used for region motion. Sits on top of _trackview_group */
666 ArdourCanvas::Group* _region_motion_group;
669 ruler_metric_smpte = 0,
670 ruler_metric_bbt = 1,
671 ruler_metric_frames = 2,
672 ruler_metric_minsec = 3,
674 ruler_time_tempo = 4,
675 ruler_time_meter = 5,
676 ruler_time_marker = 6,
677 ruler_time_range_marker = 7,
678 ruler_time_transport_marker = 8,
679 ruler_time_cd_marker = 9,
682 static GtkCustomMetric ruler_metrics[4];
683 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
686 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
687 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
688 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
689 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
690 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
691 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
692 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
693 bool no_ruler_shown_update;
695 gint ruler_button_press (GdkEventButton*);
696 gint ruler_button_release (GdkEventButton*);
697 gint ruler_mouse_motion (GdkEventMotion*);
698 bool ruler_scroll (GdkEventScroll* event);
700 gint ruler_pressed_button;
701 Gtk::Widget * ruler_grabbed_widget;
703 void initialize_rulers ();
704 void update_just_smpte ();
705 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
706 void update_fixed_rulers ();
707 void update_tempo_based_rulers ();
708 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
709 void update_ruler_visibility ();
710 void set_ruler_visible (RulerType, bool);
711 void toggle_ruler_visibility (RulerType rt);
712 void ruler_toggled (int);
713 gint ruler_label_button_release (GdkEventButton*);
714 void store_ruler_visibility ();
715 void restore_ruler_visibility ();
717 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
718 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
719 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
720 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
722 enum MinsecRulerScale {
729 MinsecRulerScale minsec_ruler_scale;
731 nframes_t minsec_mark_interval;
732 gint minsec_mark_modulo;
734 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
736 enum SMPTERulerScale {
744 SMPTERulerScale smpte_ruler_scale;
746 nframes_t smpte_mark_interval;
747 gint smpte_mark_modulo;
749 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
759 bbt_show_ticks_detail,
760 bbt_show_ticks_super_detail
763 BBTRulerScale bbt_ruler_scale;
767 uint32_t bbt_bar_helper_on;
768 uint32_t bbt_accent_modulo;
769 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
771 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
772 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
773 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
774 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
776 Gtk::Widget *_ruler_separator;
777 GtkWidget *_smpte_ruler;
778 GtkWidget *_bbt_ruler;
779 GtkWidget *_frames_ruler;
780 GtkWidget *_minsec_ruler;
781 Gtk::Widget *smpte_ruler;
782 Gtk::Widget *bbt_ruler;
783 Gtk::Widget *frames_ruler;
784 Gtk::Widget *minsec_ruler;
785 static Editor *ruler_editor;
787 static const double timebar_height;
788 guint32 visible_timebars;
789 gdouble canvas_timebars_vsize;
790 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
791 Gtk::Menu *editor_ruler_menu;
793 ArdourCanvas::SimpleRect* tempo_bar;
794 ArdourCanvas::SimpleRect* meter_bar;
795 ArdourCanvas::SimpleRect* marker_bar;
796 ArdourCanvas::SimpleRect* range_marker_bar;
797 ArdourCanvas::SimpleRect* transport_marker_bar;
798 ArdourCanvas::SimpleRect* cd_marker_bar;
800 Gtk::Label minsec_label;
801 Gtk::Label bbt_label;
802 Gtk::Label smpte_label;
803 Gtk::Label frame_label;
804 Gtk::Label tempo_label;
805 Gtk::Label meter_label;
806 Gtk::Label mark_label;
807 Gtk::Label range_mark_label;
808 Gtk::Label transport_mark_label;
809 Gtk::Label cd_mark_label;
812 Gtk::VBox time_button_vbox;
813 Gtk::HBox time_button_hbox;
817 ArdourCanvas::Points points;
818 ArdourCanvas::Line canvas_item;
819 nframes64_t current_frame;
822 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
825 void set_position (nframes64_t);
826 void set_length (double units);
827 void set_y_axis (double position);
830 friend struct Cursor; /* it needs access to several private
834 Cursor* playhead_cursor;
835 ArdourCanvas::Group* cursor_group;
837 void cursor_to_region_boundary (Cursor*, int32_t dir);
838 void cursor_to_next_region_boundary (Cursor*);
839 void cursor_to_previous_region_boundary (Cursor*);
840 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
841 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
842 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
843 void cursor_to_selection_start (Cursor *);
844 void cursor_to_selection_end (Cursor *);
846 void selected_marker_to_region_boundary (int32_t dir);
847 void selected_marker_to_next_region_boundary ();
848 void selected_marker_to_previous_region_boundary ();
849 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
850 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
851 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
852 void selected_marker_to_selection_start ();
853 void selected_marker_to_selection_end ();
855 void select_all_selectables_using_cursor (Cursor *, bool);
856 void select_all_selectables_using_edit (bool);
857 void select_all_selectables_between (bool within);
858 void select_range_between ();
860 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
861 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
863 vector<nframes64_t> region_boundary_cache;
864 void build_region_boundary_cache ();
867 Gtk::HBox bottom_hbox;
869 Gtk::Table edit_packer;
870 Gtk::VScrollbar edit_vscrollbar;
872 Gtk::Adjustment vertical_adjustment;
873 Gtk::Adjustment horizontal_adjustment;
875 Gtk::Layout controls_layout;
876 bool control_layout_scroll (GdkEventScroll* ev);
877 void controls_layout_size_request (Gtk::Requisition*);
878 sigc::connection controls_layout_size_request_connection;
880 Gtk::HScrollbar edit_hscrollbar;
881 bool _dragging_hscrollbar;
883 void reset_hscrollbar_stepping ();
885 bool hscrollbar_button_press (GdkEventButton*);
886 bool hscrollbar_button_release (GdkEventButton*);
887 void hscrollbar_allocate (Gtk::Allocation &alloc);
890 double canvas_height;
891 double full_canvas_height;
893 bool track_canvas_map_handler (GdkEventAny*);
895 gint edit_controls_button_release (GdkEventButton*);
896 Gtk::Menu *edit_controls_left_menu;
897 Gtk::Menu *edit_controls_right_menu;
899 Gtk::VBox ruler_label_vbox;
900 Gtk::VBox track_canvas_vbox;
901 Gtk::VBox time_canvas_vbox;
902 Gtk::VBox edit_controls_vbox;
903 Gtk::HBox edit_controls_hbox;
905 void control_scroll (float);
906 void access_action (std::string,std::string);
907 bool deferred_control_scroll (nframes64_t);
908 sigc::connection control_scroll_connection;
910 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
912 ArdourCanvas::Group* get_background_group () const { return _background_group; }
913 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
914 double last_trackview_group_vertical_offset;
915 void tie_vertical_scrolling ();
916 void scroll_canvas_horizontally ();
917 void scroll_canvas_vertically ();
918 void canvas_horizontally_scrolled ();
919 void canvas_scroll_to (nframes64_t);
921 struct VisualChange {
928 nframes64_t time_origin;
929 double frames_per_unit;
933 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
937 VisualChange pending_visual_change;
939 static int _idle_visual_changer (void *arg);
940 int idle_visual_changer ();
942 void queue_visual_change (nframes64_t);
943 void queue_visual_change (double);
945 void end_location_changed (ARDOUR::Location*);
947 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
948 RegionListDisplayModelColumns() {
965 Gtk::TreeModelColumn<Glib::ustring> name;
966 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
967 Gtk::TreeModelColumn<Gdk::Color> color_;
968 Gtk::TreeModelColumn<Glib::ustring> start;
969 Gtk::TreeModelColumn<Glib::ustring> end;
970 Gtk::TreeModelColumn<Glib::ustring> length;
971 Gtk::TreeModelColumn<Glib::ustring> sync;
972 Gtk::TreeModelColumn<Glib::ustring> fadein;
973 Gtk::TreeModelColumn<Glib::ustring> fadeout;
974 Gtk::TreeModelColumn<bool> locked;
975 Gtk::TreeModelColumn<bool> glued;
976 Gtk::TreeModelColumn<bool> muted;
977 Gtk::TreeModelColumn<bool> opaque;
978 Gtk::TreeModelColumn<Glib::ustring> used;
979 Gtk::TreeModelColumn<Glib::ustring> path;
982 RegionListDisplayModelColumns region_list_columns;
983 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
985 Glib::RefPtr<Gtk::TreeStore> region_list_model;
986 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
987 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
989 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
990 void region_list_selection_changed ();
991 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
992 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
993 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
995 Gtk::Menu *region_list_menu;
996 Gtk::ScrolledWindow region_list_scroller;
997 Gtk::Frame region_list_frame;
999 bool region_list_display_key_press (GdkEventKey *);
1000 bool region_list_display_key_release (GdkEventKey *);
1001 bool region_list_display_button_press (GdkEventButton *);
1002 bool region_list_display_button_release (GdkEventButton *);
1003 void region_list_clear ();
1004 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
1005 void build_region_list_menu ();
1006 void show_region_list_display_context_menu (int button, int time);
1008 bool show_automatic_regions_in_region_list;
1009 Editing::RegionListSortType region_list_sort_type;
1011 void reset_region_list_sort_direction (bool);
1012 void reset_region_list_sort_type (Editing::RegionListSortType);
1014 void toggle_full_region_list ();
1015 void toggle_show_auto_regions ();
1017 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1021 Gtk::ScrolledWindow snapshot_display_scroller;
1022 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1023 SnapshotDisplayModelColumns() {
1027 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1028 Gtk::TreeModelColumn<Glib::ustring> real_name;
1031 SnapshotDisplayModelColumns snapshot_display_columns;
1032 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1033 Gtk::TreeView snapshot_display;
1034 Gtk::Menu snapshot_context_menu;
1036 bool snapshot_display_button_press (GdkEventButton*);
1037 void snapshot_display_selection_changed ();
1038 void redisplay_snapshots();
1039 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1041 /* named selections */
1043 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1044 NamedSelectionDisplayModelColumns() {
1048 Gtk::TreeModelColumn<Glib::ustring> text;
1049 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1052 NamedSelectionDisplayModelColumns named_selection_columns;
1053 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1055 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1056 Gtk::ScrolledWindow named_selection_scroller;
1058 void create_named_selection ();
1059 void paste_named_selection (float times);
1060 void remove_selected_named_selections ();
1061 void remove_snapshot (Glib::ustring);
1062 void rename_snapshot (Glib::ustring);
1064 void handle_new_named_selection ();
1065 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1066 void redisplay_named_selections ();
1068 bool named_selection_display_button_release (GdkEventButton *ev);
1069 bool named_selection_display_key_release (GdkEventKey *ev);
1070 void named_selection_display_selection_changed ();
1073 TrackViewList track_views;
1074 TimeAxisView *trackview_by_y_position (double ypos);
1076 static Gdk::Cursor* cross_hair_cursor;
1077 static Gdk::Cursor* trimmer_cursor;
1078 static Gdk::Cursor* selector_cursor;
1079 static Gdk::Cursor* grabber_cursor;
1080 static Gdk::Cursor* grabber_edit_point_cursor;
1081 static Gdk::Cursor* zoom_cursor;
1082 static Gdk::Cursor* time_fx_cursor;
1083 static Gdk::Cursor* fader_cursor;
1084 static Gdk::Cursor* speaker_cursor;
1085 static Gdk::Cursor* midi_pencil_cursor;
1086 static Gdk::Cursor* midi_select_cursor;
1087 static Gdk::Cursor* midi_resize_cursor;
1088 static Gdk::Cursor* midi_erase_cursor;
1089 static Gdk::Cursor* wait_cursor;
1090 static Gdk::Cursor* timebar_cursor;
1091 static Gdk::Cursor* transparent_cursor;
1093 static void build_cursors ();
1095 sigc::connection scroll_connection;
1096 nframes64_t last_update_frame;
1097 void center_screen (nframes64_t);
1098 void center_screen_internal (nframes64_t, float);
1100 void update_current_screen ();
1102 void session_going_away ();
1104 nframes64_t cut_buffer_start;
1105 nframes64_t cut_buffer_length;
1107 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1108 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1109 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1110 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1111 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1112 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1114 /* KEYMAP HANDLING */
1116 void register_actions ();
1118 int ensure_cursor (nframes64_t* pos);
1120 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1121 void handle_new_regions (vector<boost::weak_ptr<ARDOUR::Region> >& );
1122 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1123 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1124 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1125 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1126 void redisplay_regions ();
1127 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1128 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1129 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1130 void update_all_region_rows ();
1131 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1132 bool no_region_list_redisplay;
1133 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1135 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1137 void cut_copy (Editing::CutCopyOp);
1138 bool can_cut_copy () const;
1139 void cut_copy_points (Editing::CutCopyOp);
1140 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1141 void cut_copy_ranges (Editing::CutCopyOp);
1143 void mouse_paste ();
1144 void paste_internal (nframes64_t position, float times);
1146 /* EDITING OPERATIONS */
1148 void reset_point_selection ();
1149 void toggle_region_mute ();
1150 void toggle_region_lock ();
1151 void toggle_region_opaque ();
1152 void toggle_record_enable ();
1153 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1154 void raise_region ();
1155 void raise_region_to_top ();
1156 void lower_region ();
1157 void lower_region_to_bottom ();
1158 void split_region ();
1159 void split_region_at (nframes64_t);
1160 void split_regions_at (nframes64_t, RegionSelection&);
1161 void split_region_at_transients ();
1162 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1163 void crop_region_to_selection ();
1164 void crop_region_to (nframes64_t start, nframes64_t end);
1165 void set_sync_point (nframes64_t, const RegionSelection&);
1166 void set_region_sync_from_edit_point ();
1167 void remove_region_sync();
1168 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1169 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1170 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1171 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1172 void remove_selected_regions ();
1173 void remove_clicked_region ();
1174 void edit_region ();
1175 void rename_region ();
1176 void duplicate_some_regions (RegionSelection&, float times);
1177 void duplicate_selection (float times);
1178 void region_fill_selection ();
1180 void region_fill_track ();
1181 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1182 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1183 void split_multichannel_region();
1184 void reverse_region ();
1185 void normalize_region ();
1186 void denormalize_region ();
1187 void adjust_region_scale_amplitude (bool up);
1188 void quantize_region ();
1190 void do_insert_time ();
1191 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1193 void tab_to_transient (bool forward);
1195 void use_region_as_bar ();
1196 void use_range_as_bar ();
1198 void define_one_bar (nframes64_t start, nframes64_t end);
1200 void audition_region_from_region_list ();
1201 void hide_region_from_region_list ();
1202 void remove_region_from_region_list ();
1204 void align (ARDOUR::RegionPoint);
1205 void align_relative (ARDOUR::RegionPoint);
1208 void reset_focus ();
1214 void paste (float times);
1216 int get_prefix (float&, bool&);
1218 void keyboard_paste ();
1219 void keyboard_insert_region_list_selection ();
1221 void region_from_selection ();
1222 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1224 void play_from_start ();
1225 void play_from_edit_point ();
1226 void play_from_edit_point_and_return ();
1227 void play_selected_region ();
1228 void play_edit_range ();
1229 void loop_selected_region ();
1230 void play_location (ARDOUR::Location&);
1231 void loop_location (ARDOUR::Location&);
1233 void temporal_zoom_selection ();
1234 void temporal_zoom_region (bool both_axes);
1235 void toggle_zoom_region (bool both_axes);
1236 bool zoomed_to_region;
1237 void temporal_zoom_session ();
1238 void temporal_zoom (gdouble scale);
1239 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1240 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1242 void amplitude_zoom (gdouble scale);
1243 void amplitude_zoom_step (bool in);
1245 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1246 void insert_region_list_selection (float times);
1248 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1250 /* import & embed */
1252 void add_external_audio_action (Editing::ImportMode);
1253 void external_audio_dialog ();
1254 void session_import_dialog ();
1256 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1257 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1259 SoundFileOmega* sfbrowser;
1261 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1263 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1264 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1266 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1267 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1269 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1270 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1271 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1272 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1274 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1275 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1276 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1277 boost::shared_ptr<ARDOUR::Track>& existing_track);
1279 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1280 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1282 /* generic interthread progress window */
1284 ArdourDialog* interthread_progress_window;
1285 Gtk::Label interthread_progress_label;
1286 Gtk::VBox interthread_progress_vbox;
1287 Gtk::ProgressBar interthread_progress_bar;
1288 Gtk::Button interthread_cancel_button;
1289 Gtk::Label interthread_cancel_label;
1290 sigc::connection interthread_progress_connection;
1291 void interthread_cancel_clicked ();
1292 void build_interthread_progress_window ();
1293 ARDOUR::InterThreadInfo* current_interthread_info;
1295 AnalysisWindow* analysis_window;
1297 /* import specific info */
1299 struct EditorImportStatus : public ARDOUR::Session::import_status {
1300 Editing::ImportMode mode;
1304 boost::shared_ptr<ARDOUR::Track> track;
1308 EditorImportStatus import_status;
1309 gint import_progress_timeout (void *);
1310 static void *_import_thread (void *);
1311 void* import_thread ();
1312 void finish_import ();
1314 /* to support this ... */
1316 void import_audio (bool as_tracks);
1317 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1319 void move_to_start ();
1320 void move_to_end ();
1322 void center_playhead ();
1323 void center_edit_point ();
1324 void edit_cursor_backward ();
1325 void edit_cursor_forward ();
1326 void playhead_forward_to_grid ();
1327 void playhead_backward_to_grid ();
1328 void playhead_backward ();
1329 void playhead_forward ();
1330 void scroll_playhead (bool forward);
1331 void scroll_backward (float pages=0.8f);
1332 void scroll_forward (float pages=0.8f);
1333 void scroll_tracks_down ();
1334 void scroll_tracks_up ();
1335 void delete_sample_forward ();
1336 void delete_sample_backward ();
1337 void delete_screen ();
1338 void search_backwards ();
1339 void search_forwards ();
1341 void clear_markers ();
1342 void clear_ranges ();
1343 void clear_locations ();
1344 void unhide_markers ();
1345 void unhide_ranges ();
1346 void jump_forward_to_mark ();
1347 void jump_backward_to_mark ();
1348 void cursor_align (bool playhead_to_edit);
1350 void remove_last_capture ();
1351 void select_all_selectables_using_time_selection ();
1352 void select_all_selectables_using_loop();
1353 void select_all_selectables_using_punch();
1354 void set_selection_from_range (ARDOUR::Location&);
1355 void set_selection_from_punch ();
1356 void set_selection_from_loop ();
1357 void set_selection_from_region ();
1359 void add_location_mark (nframes64_t where);
1360 void add_location_from_audio_region ();
1361 void add_locations_from_audio_region ();
1362 void add_location_from_selection ();
1363 void set_loop_from_selection (bool play);
1364 void set_punch_from_selection ();
1365 void set_punch_from_region ();
1367 void set_loop_from_edit_range (bool play);
1368 void set_loop_from_region (bool play);
1369 void set_punch_from_edit_range ();
1371 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1372 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1374 void add_location_from_playhead_cursor ();
1375 bool select_new_marker;
1377 void reverse_selection ();
1378 void edit_envelope ();
1380 void start_scrolling ();
1381 void stop_scrolling ();
1384 double last_scrub_x;
1385 int scrubbing_direction;
1386 int scrub_reversals;
1387 int scrub_reverse_distance;
1390 void keyboard_selection_begin ();
1391 void keyboard_selection_finish (bool add);
1392 bool have_pending_keyboard_selection;
1393 nframes64_t pending_keyboard_selection_start;
1395 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1396 void extend_selection_to_end_of_region (bool next);
1397 void extend_selection_to_start_of_region (bool previous);
1399 Editing::SnapType snap_type;
1400 Editing::SnapMode snap_mode;
1402 /// Snap threshold in pixels
1403 double snap_threshold;
1405 void handle_gui_changes (const string &, void *);
1406 bool ignore_gui_changes;
1408 void hide_all_tracks (bool with_select);
1411 LineDragInfo current_line_drag_info;
1413 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1414 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1415 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1417 void finalize_drag ();
1419 Gtk::Menu fade_context_menu;
1420 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1422 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1424 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1425 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1426 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1427 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1428 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1429 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1431 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1432 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1434 void set_fade_length (bool in);
1435 void toggle_fade_active (bool in);
1436 void set_fade_in_active (bool);
1437 void set_fade_out_active (bool);
1439 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1440 RegionSelection pre_drag_region_selection;
1441 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1442 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1443 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1444 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1445 bool check_region_drag_possible (RouteTimeAxisView**);
1446 void possibly_copy_regions_during_grab (GdkEvent*);
1447 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1448 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1450 bool _dragging_playhead;
1451 bool _dragging_edit_point;
1453 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1454 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1455 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1456 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1457 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1458 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1459 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1460 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1461 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1463 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1464 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1465 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1466 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1468 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1470 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1471 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1472 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1473 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1474 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1475 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1476 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1477 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1478 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1479 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1480 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1481 void start_line_grab (AutomationLine *, GdkEvent*);
1482 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1483 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1484 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1485 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1487 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1489 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1490 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1492 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1493 void brush (nframes64_t);
1495 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1496 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1497 double clamp_verbose_cursor_x (double);
1498 double clamp_verbose_cursor_y (double);
1500 /* Canvas event handlers */
1502 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1503 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1504 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1505 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1506 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1507 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1508 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1509 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1510 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1511 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1514 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1516 ArdourCanvas::Item *last_item_entered;
1517 int last_item_entered_n;
1520 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1521 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1522 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1523 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1524 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1525 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1526 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1527 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1528 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1530 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1531 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1532 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1533 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1534 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1535 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1537 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1538 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1539 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1540 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1541 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1542 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1543 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1544 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1546 /* non-public event handlers */
1548 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1549 bool track_canvas_scroll (GdkEventScroll* event);
1551 bool track_canvas_scroll_event (GdkEventScroll* event);
1552 bool track_canvas_button_press_event (GdkEventButton* event);
1553 bool track_canvas_button_release_event (GdkEventButton* event);
1554 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1556 Gtk::Allocation canvas_allocation;
1557 void track_canvas_allocate (Gtk::Allocation alloc);
1558 bool track_canvas_size_allocated ();
1560 void set_playhead_cursor ();
1562 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1563 void kbd_mute_unmute_region ();
1566 void kbd_do_brush (GdkEvent*);
1567 void kbd_do_audition (GdkEvent*);
1569 void handle_new_duration ();
1570 void initialize_canvas ();
1572 /* display control */
1574 bool _show_measures;
1575 /// true to show waveforms, otherwise false
1576 bool _show_waveforms;
1577 /// true if the editor should follow the playhead, otherwise false
1578 bool _follow_playhead;
1579 /// true if waveforms should be shown while recording audio tracks, otherwise false
1580 bool _show_waveforms_recording;
1582 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1584 TempoLines* tempo_lines;
1586 ArdourCanvas::Group* time_line_group;
1588 void hide_measures ();
1589 void draw_measures ();
1590 bool redraw_measures ();
1592 void new_tempo_section ();
1594 void mouse_add_new_tempo_event (nframes64_t where);
1595 void mouse_add_new_meter_event (nframes64_t where);
1597 void remove_tempo_marker (ArdourCanvas::Item*);
1598 void remove_meter_marker (ArdourCanvas::Item*);
1599 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1600 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1602 void edit_tempo_section (ARDOUR::TempoSection*);
1603 void edit_meter_section (ARDOUR::MeterSection*);
1604 void edit_tempo_marker (ArdourCanvas::Item*);
1605 void edit_meter_marker (ArdourCanvas::Item*);
1606 void edit_control_point (ArdourCanvas::Item*);
1608 void marker_menu_edit ();
1609 void marker_menu_remove ();
1610 void marker_menu_rename ();
1611 void marker_menu_lock (bool yn);
1612 void marker_menu_hide ();
1613 void marker_menu_loop_range ();
1614 void marker_menu_select_all_selectables_using_range ();
1615 void marker_menu_select_using_range ();
1616 void marker_menu_separate_regions_using_location ();
1617 void marker_menu_play_from ();
1618 void marker_menu_play_range ();
1619 void marker_menu_set_playhead ();
1620 void marker_menu_set_from_playhead ();
1621 void marker_menu_set_from_selection ();
1622 void marker_menu_range_to_next ();
1623 void new_transport_marker_menu_set_loop ();
1624 void new_transport_marker_menu_set_punch ();
1625 void update_loop_range_view (bool visibility=false);
1626 void update_punch_range_view (bool visibility=false);
1627 void new_transport_marker_menu_popdown ();
1628 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1629 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1630 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1631 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1632 void build_range_marker_menu (bool loop_or_punch);
1633 void build_marker_menu (bool start_or_end);
1634 void build_tm_marker_menu ();
1635 void build_new_transport_marker_menu ();
1637 Gtk::Menu* tm_marker_menu;
1638 Gtk::Menu* marker_menu;
1639 Gtk::Menu* start_end_marker_menu;
1640 Gtk::Menu* range_marker_menu;
1641 Gtk::Menu* transport_marker_menu;
1642 Gtk::Menu* new_transport_marker_menu;
1643 Gtk::Menu* cd_marker_menu;
1644 ArdourCanvas::Item* marker_menu_item;
1646 typedef list<Marker*> Marks;
1649 void remove_metric_marks ();
1650 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1652 void compute_current_bbt_points (nframes_t left, nframes_t right);
1653 void tempo_map_changed (ARDOUR::Change);
1654 void redisplay_tempo (bool immediate_redraw);
1656 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1658 double snap_length_beats (nframes64_t start);
1660 uint32_t bbt_beat_subdivision;
1664 Gtk::ToggleButton editor_mixer_button;
1665 Gtk::ToggleButton editor_list_button;
1666 void editor_mixer_button_toggled ();
1667 void editor_list_button_toggled ();
1669 AudioClock edit_point_clock;
1670 AudioClock zoom_range_clock;
1671 Gtk::Button zoom_in_button;
1672 Gtk::Button zoom_out_button;
1673 Gtk::Button zoom_out_full_button;
1674 Gtk::Button zoom_onetoone_button;
1676 Gtk::VBox toolbar_clock_vbox;
1677 Gtk::VBox toolbar_selection_clock_vbox;
1678 Gtk::Table toolbar_selection_clock_table;
1679 Gtk::Label toolbar_selection_cursor_label;
1681 Gtk::HBox mouse_mode_button_box;
1682 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1683 Gtk::ToggleButton mouse_select_button;
1684 Gtk::ToggleButton mouse_move_button;
1685 Gtk::ToggleButton mouse_gain_button;
1686 Gtk::ToggleButton mouse_zoom_button;
1687 Gtk::ToggleButton mouse_timefx_button;
1688 Gtk::ToggleButton mouse_audition_button;
1689 Gtk::ToggleButton mouse_note_button;
1690 GroupedButtons *mouse_mode_button_set;
1691 void mouse_mode_toggled (Editing::MouseMode m);
1692 bool ignore_mouse_mode_toggle;
1694 gint mouse_select_button_release (GdkEventButton*);
1696 Gtk::VBox automation_box;
1697 Gtk::Button automation_mode_button;
1698 Gtk::ToggleButton global_automation_button;
1700 Gtk::ComboBoxText edit_mode_selector;
1701 Gtk::VBox edit_mode_box;
1703 void set_edit_mode (ARDOUR::EditMode);
1704 void cycle_edit_mode ();
1705 void edit_mode_selection_done ();
1707 Gtk::ComboBoxText snap_type_selector;
1708 Gtk::ComboBoxText snap_mode_selector;
1711 std::vector<std::string> snap_type_strings;
1712 std::vector<std::string> snap_mode_strings;
1714 void snap_type_selection_done ();
1715 void snap_mode_selection_done ();
1716 void snap_mode_chosen (Editing::SnapMode);
1717 void snap_type_chosen (Editing::SnapType);
1719 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1720 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1722 Gtk::ComboBoxText zoom_focus_selector;
1723 Gtk::VBox zoom_focus_box;
1725 std::vector<std::string> zoom_focus_strings;
1727 void zoom_focus_selection_done ();
1728 void zoom_focus_chosen (Editing::ZoomFocus);
1730 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1734 void zoom_adjustment_changed();
1736 void edit_point_clock_changed();
1738 void setup_toolbar ();
1740 Gtkmm2ext::TearOff* tools_tearoff;
1741 Gtk::HBox toolbar_hbox;
1742 Gtk::EventBox toolbar_base;
1743 Gtk::Frame toolbar_frame;
1747 Gtk::HBox midi_tool_button_box;
1748 Gtk::ToggleButton midi_tool_pencil_button;
1749 Gtk::ToggleButton midi_tool_select_button;
1750 Gtk::ToggleButton midi_tool_resize_button;
1751 Gtk::ToggleButton midi_tool_erase_button;
1752 Gtk::ToggleButton midi_panic_button;
1753 GroupedButtons *midi_tool_button_set;
1754 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1755 bool ignore_midi_edit_mode_toggle;
1757 Gtkmm2ext::TearOff* midi_tools_tearoff;
1758 Gtk::HBox midi_toolbar_hbox;
1759 Gtk::EventBox midi_toolbar_base;
1760 Gtk::Frame midi_toolbar_frame;
1762 void midi_panic_toggle ();
1763 void setup_midi_toolbar ();
1765 /* selection process */
1767 Selection* selection;
1768 Selection* cut_buffer;
1770 void time_selection_changed ();
1771 void track_selection_changed ();
1772 void region_selection_changed ();
1773 void sensitize_the_right_region_actions (bool have_selected_regions);
1774 void point_selection_changed ();
1775 void marker_selection_changed ();
1784 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1785 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1786 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1787 void cancel_selection ();
1789 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1790 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1791 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1793 bool audio_region_selection_covers (nframes64_t where);
1795 /* transport range select process */
1796 enum RangeMarkerOp {
1798 CreateTransportMarker,
1802 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1803 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1804 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1806 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1807 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1808 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1809 ArdourCanvas::Line* marker_drag_line;
1810 ArdourCanvas::Points marker_drag_line_points;
1811 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1813 void update_marker_drag_item (ARDOUR::Location *);
1815 ArdourCanvas::SimpleRect *bogus_background_rect;
1817 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1818 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1819 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1820 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1821 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1822 ArdourCanvas::SimpleLine *transport_punchin_line;
1823 ArdourCanvas::SimpleLine *transport_punchout_line;
1824 ArdourCanvas::SimpleRect *transport_preroll_rect;
1825 ArdourCanvas::SimpleRect *transport_postroll_rect;
1827 ARDOUR::Location* transport_loop_location();
1828 ARDOUR::Location* transport_punch_location();
1830 ARDOUR::Location *temp_location;
1832 /* object rubberband select process */
1834 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1835 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1836 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1838 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1840 ArdourCanvas::SimpleRect *rubberband_rect;
1842 /* mouse zoom process */
1844 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1845 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1846 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1848 ArdourCanvas::SimpleRect *zoom_rect;
1849 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1851 /* diskstream/route display management */
1853 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1854 RouteDisplayModelColumns() {
1857 add (temporary_visible);
1861 Gtk::TreeModelColumn<Glib::ustring> text;
1862 Gtk::TreeModelColumn<bool> visible;
1863 Gtk::TreeModelColumn<bool> temporary_visible;
1864 Gtk::TreeModelColumn<TimeAxisView*> tv;
1865 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1868 RouteDisplayModelColumns route_display_columns;
1869 Glib::RefPtr<Gtk::ListStore> route_display_model;
1870 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1872 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1873 Gtk::ScrolledWindow route_list_scroller;
1874 Gtk::Menu* route_list_menu;
1876 void update_route_visibility ();
1878 void sync_order_keys (const char*);
1879 bool route_redisplay_does_not_sync_order_keys;
1880 bool route_redisplay_does_not_reset_order_keys;
1882 bool route_list_display_button_press (GdkEventButton*);
1883 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1886 const Gtk::SelectionData& data,
1890 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1892 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1893 void route_list_delete (const Gtk::TreeModel::Path&);
1894 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1896 void initial_route_list_display ();
1897 void redisplay_route_list();
1898 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1899 bool ignore_route_list_reorder;
1900 bool no_route_list_redisplay;
1902 void build_route_list_menu ();
1903 void show_route_list_menu ();
1905 void show_all_routes ();
1906 void hide_all_routes ();
1907 void show_all_audiotracks ();
1908 void hide_all_audiotracks ();
1909 void show_all_audiobus ();
1910 void hide_all_audiobus ();
1912 void set_all_tracks_visibility (bool yn);
1913 void set_all_audio_visibility (int type, bool yn);
1915 /* edit group management */
1917 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1918 GroupListModelColumns () {
1924 Gtk::TreeModelColumn<bool> is_active;
1925 Gtk::TreeModelColumn<bool> is_visible;
1926 Gtk::TreeModelColumn<std::string> text;
1927 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1930 GroupListModelColumns group_columns;
1931 Glib::RefPtr<Gtk::ListStore> group_model;
1932 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1934 Gtk::TreeView edit_group_display;
1935 Gtk::ScrolledWindow edit_group_display_scroller;
1936 Gtk::Menu* edit_group_list_menu;
1938 void build_edit_group_list_menu ();
1939 void activate_all_edit_groups ();
1940 void disable_all_edit_groups ();
1942 bool in_edit_group_row_change;
1943 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1944 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1945 void new_edit_group ();
1946 void edit_group_list_button_clicked ();
1947 gint edit_group_list_button_press_event (GdkEventButton* ev);
1948 void add_edit_group (ARDOUR::RouteGroup* group);
1949 void remove_selected_edit_group ();
1950 void edit_groups_changed ();
1951 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1953 Gtk::VBox list_vpacker;
1957 bool autoscroll_active;
1958 int autoscroll_timeout_tag;
1961 int last_autoscroll_x;
1962 int last_autoscroll_y;
1963 uint32_t autoscroll_cnt;
1964 nframes64_t autoscroll_x_distance;
1965 double autoscroll_y_distance;
1967 static gint _autoscroll_canvas (void *);
1968 bool autoscroll_canvas ();
1969 void start_canvas_autoscroll (int x, int y);
1970 void stop_canvas_autoscroll ();
1971 void maybe_autoscroll (GdkEventMotion*);
1972 void maybe_autoscroll_horizontally (GdkEventMotion*);
1973 bool allow_vertical_scroll;
1982 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1983 void point_trim (GdkEvent*);
1984 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1985 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1986 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1987 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1989 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1990 void thaw_region_after_trim (RegionView& rv);
1992 void trim_region_front();
1993 void trim_region_back();
1994 void trim_region (bool front);
1996 void trim_region_to_edit_point ();
1997 void trim_region_from_edit_point ();
1998 void trim_region_to_loop ();
1999 void trim_region_to_punch ();
2000 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
2002 bool show_gain_after_trim;
2006 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
2007 const Glib::RefPtr<Gdk::DragContext>& context,
2010 const Gtk::SelectionData& data,
2014 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
2017 const Gtk::SelectionData& data,
2021 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
2024 const Gtk::SelectionData& data,
2028 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
2031 const Gtk::SelectionData& data,
2035 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
2038 const Gtk::SelectionData& data,
2042 void drop_routes (const Glib::RefPtr<Gdk::DragContext>& context,
2045 const Gtk::SelectionData& data,
2051 int write_region_selection(RegionSelection&);
2052 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
2053 void bounce_region_selection ();
2054 void bounce_range_selection (bool replace);
2055 void external_edit_region ();
2057 int write_audio_selection (TimeSelection&);
2058 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
2060 void write_selection ();
2064 UndoAction get_memento() const;
2066 XMLNode *before; /* used in *_reversible_command */
2068 void begin_reversible_command (string cmd_name);
2069 void commit_reversible_command ();
2071 void update_title ();
2072 void update_title_s (const string & snapshot_name);
2075 Selection* selection;
2076 double frames_per_unit;
2078 State (PublicEditor const * e);
2082 void store_state (State&) const;
2083 void restore_state (State *);
2085 void instant_save ();
2087 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
2089 /* freeze operations */
2091 ARDOUR::InterThreadInfo freeze_status;
2092 gint freeze_progress_timeout (void *);
2093 static void* _freeze_thread (void*);
2094 void* freeze_thread ();
2096 void freeze_route ();
2097 void unfreeze_route ();
2099 /* edit-group solo + mute */
2101 void set_edit_group_solo (ARDOUR::Route&, bool);
2102 void set_edit_group_mute (ARDOUR::Route&, bool);
2106 void duplicate_dialog (bool with_dialog);
2108 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
2110 /* returns false if mouse pointer is not in track or marker canvas
2112 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2114 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
2115 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
2116 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
2118 struct TimeFXDialog : public ArdourDialog {
2119 ARDOUR::TimeFXRequest request;
2122 Gtk::Adjustment pitch_octave_adjustment;
2123 Gtk::Adjustment pitch_semitone_adjustment;
2124 Gtk::Adjustment pitch_cent_adjustment;
2125 Gtk::SpinButton pitch_octave_spinner;
2126 Gtk::SpinButton pitch_semitone_spinner;
2127 Gtk::SpinButton pitch_cent_spinner;
2128 RegionSelection regions;
2129 Gtk::ProgressBar progress_bar;
2132 Gtk::ToggleButton quick_button;
2133 Gtk::ToggleButton antialias_button;
2134 Gtk::HBox upper_button_box;
2137 Gtk::ComboBoxText stretch_opts_selector;
2138 Gtk::Label stretch_opts_label;
2139 Gtk::ToggleButton precise_button;
2140 Gtk::ToggleButton preserve_formants_button;
2143 Gtk::Button* cancel_button;
2144 Gtk::Button* action_button;
2148 TimeFXDialog (Editor& e, bool for_pitch);
2150 gint update_progress ();
2151 sigc::connection first_cancel;
2152 sigc::connection first_delete;
2153 void cancel_in_progress ();
2154 gint delete_in_progress (GdkEventAny*);
2157 /* "whats mine is yours" */
2159 friend class TimeFXDialog;
2161 TimeFXDialog* current_timefx;
2163 static void* timefx_thread (void *arg);
2164 void do_timefx (TimeFXDialog&);
2166 int time_stretch (RegionSelection&, float fraction);
2167 int pitch_shift (RegionSelection&, float cents);
2168 void pitch_shift_regions ();
2169 int time_fx (RegionSelection&, float val, bool pitching);
2171 /* editor-mixer strip */
2173 MixerStrip *current_mixer_strip;
2174 bool show_editor_mixer_when_tracks_arrive;
2175 Gtk::VBox current_mixer_strip_vbox;
2176 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2177 void cms_deleted ();
2178 void current_mixer_strip_hidden ();
2179 void current_mixer_strip_removed ();
2181 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2182 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2184 void ensure_all_elements_drawn ();
2186 /* nudging tracks */
2188 void nudge_track (bool use_edit_point, bool forwards);
2192 bool _xfade_visibility;
2195 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2196 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2198 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2199 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2201 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2202 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2203 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2205 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2206 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2207 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2208 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2210 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2211 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2212 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2213 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2215 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2216 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2217 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2218 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2219 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2220 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2222 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2223 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2224 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2225 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2226 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2227 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2229 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2230 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2232 ImageFrameSocketHandler* image_socket_listener ;
2235 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2236 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2237 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2238 void xfade_edit_left_region ();
2239 void xfade_edit_right_region ();
2241 static const int32_t default_width = 995;
2242 static const int32_t default_height = 765;
2246 Gtk::Button nudge_forward_button;
2247 Gtk::Button nudge_backward_button;
2248 Gtk::HBox nudge_hbox;
2249 Gtk::VBox nudge_vbox;
2250 AudioClock nudge_clock;
2252 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2254 bool nudge_forward_release (GdkEventButton*);
2255 bool nudge_backward_release (GdkEventButton*);
2259 void apply_filter (ARDOUR::Filter&, string cmd);
2261 /* handling cleanup */
2263 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2265 vector<sigc::connection> session_connections;
2267 /* tracking step changes of track height */
2269 TimeAxisView* current_stepping_trackview;
2270 ARDOUR::microseconds_t last_track_height_step_timestamp;
2271 gint track_height_step_timeout();
2272 sigc::connection step_timeout;
2274 TimeAxisView* entered_track;
2275 RegionView* entered_regionview;
2278 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2279 bool clear_entered_track;
2280 bool left_track_canvas (GdkEventCrossing*);
2281 bool entered_track_canvas (GdkEventCrossing*);
2282 void set_entered_track (TimeAxisView*);
2283 void set_entered_regionview (RegionView*);
2284 void ensure_track_visible (TimeAxisView*);
2285 gint left_automation_track ();
2287 bool _new_regionviews_show_envelope;
2289 void reset_canvas_action_sensitivity (bool);
2290 void toggle_gain_envelope_visibility ();
2291 void toggle_gain_envelope_active ();
2292 void reset_region_gain_envelopes ();
2294 bool on_key_press_event (GdkEventKey*);
2295 bool on_key_release_event (GdkEventKey*);
2297 void session_state_saved (string);
2299 Glib::RefPtr<Gtk::Action> undo_action;
2300 Glib::RefPtr<Gtk::Action> redo_action;
2302 void history_changed ();
2304 Gtk::HBox status_bar_hpacker;
2306 Editing::EditPoint _edit_point;
2308 Gtk::ComboBoxText edit_point_selector;
2310 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2311 void cycle_edit_point (bool with_marker);
2312 void set_edit_point ();
2313 void edit_point_selection_done ();
2314 void edit_point_chosen (Editing::EditPoint);
2315 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2316 std::vector<std::string> edit_point_strings;
2318 void selected_marker_moved (ARDOUR::Location*);
2319 sigc::connection edit_point_clock_connection_a;
2320 sigc::connection edit_point_clock_connection_b;
2322 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2324 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2325 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2327 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2329 sigc::connection fast_screen_update_connection;
2330 gint start_updating ();
2331 gint stop_updating ();
2332 void fast_update_strips ();
2333 bool meters_running;
2335 void select_next_route ();
2336 void select_prev_route ();
2338 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2340 RhythmFerret* rhythm_ferret;
2343 void set_track_height (uint32_t h);
2344 void set_track_height_largest ();
2345 void set_track_height_large ();
2346 void set_track_height_larger ();
2347 void set_track_height_normal ();
2348 void set_track_height_smaller ();
2349 void set_track_height_small ();
2351 void remove_tracks ();
2352 void toggle_tracks_active ();
2353 void waveform_scale_chosen (Editing::WaveformScale);
2357 int32_t resize_idle_target;
2359 friend gboolean _idle_resize (gpointer);
2360 std::vector<TimeAxisView*> pending_resizes;
2363 #endif /* __ardour_editor_h__ */