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__
30 #include <glibmm/ustring.h>
32 #include <boost/optional.hpp>
34 #include <libgnomecanvasmm/canvas.h>
35 #include <libgnomecanvasmm/group.h>
36 #include <libgnomecanvasmm/line.h>
37 #include <libgnomecanvasmm/pixbuf.h>
41 #include <gtkmm/layout.h>
42 #include <gtkmm/comboboxtext.h>
44 #include <gtkmm2ext/selector.h>
45 #include <gtkmm2ext/click_box.h>
46 #include <gtkmm2ext/dndtreeview.h>
48 #include "pbd/stateful.h"
49 #include "ardour/session.h"
50 #include "ardour/tempo.h"
51 #include "ardour/stretch.h"
52 #include "ardour/location.h"
53 #include "ardour/audioregion.h"
54 #include "ardour/track.h"
55 #include "ardour/types.h"
57 #include "audio_clock.h"
58 #include "gtk-custom-ruler.h"
59 #include "ardour_dialog.h"
60 #include "public_editor.h"
63 #include "editor_items.h"
64 #include "region_selection.h"
66 #include "editor_summary.h"
73 class AudioDiskstream;
92 class AudioRegionView;
93 class AudioStreamView;
94 class AudioTimeAxisView;
96 class AutomationSelection;
97 class AutomationTimeAxisView;
102 class GlobalPortMatrixWindow;
103 class GroupedButtons;
106 class PlaylistSelector;
107 class PluginSelector;
110 class SoundFileOmega;
116 class TrackSelection;
118 /* <CMT Additions> */
119 class ImageFrameView;
120 class ImageFrameTimeAxisView;
121 class ImageFrameTimeAxis;
122 class MarkerTimeAxis ;
124 class ImageFrameSocketHandler ;
125 class TimeAxisViewItem ;
126 /* </CMT Additions> */
128 struct EditorCursor {
130 ArdourCanvas::Points points;
131 ArdourCanvas::Line canvas_item;
132 nframes64_t current_frame;
135 EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
138 void set_position (nframes64_t);
139 void set_length (double units);
140 void set_y_axis (double position);
142 sigc::signal<void, nframes64_t> PositionChanged;
145 class Editor : public PublicEditor
151 void connect_to_session (ARDOUR::Session *);
152 ARDOUR::Session* current_session() const { return session; }
154 virtual bool have_idled () const { return _have_idled; }
156 nframes64_t leftmost_position() const { return leftmost_frame; }
158 nframes64_t current_page_frames() const {
159 return (nframes64_t) floor (_canvas_width * frames_per_unit);
162 double canvas_height () const {
163 return _canvas_height;
166 void cycle_snap_mode ();
167 void cycle_snap_choice ();
168 void set_snap_to (Editing::SnapType);
169 void set_snap_mode (Editing::SnapMode);
170 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
172 void undo (uint32_t n = 1);
173 void redo (uint32_t n = 1);
175 XMLNode& get_state ();
176 int set_state (const XMLNode& );
178 void set_mouse_mode (Editing::MouseMode, bool force=true);
179 void step_mouse_mode (bool next);
180 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
182 void set_midi_edit_cursor (Editing::MidiEditMode);
183 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
184 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
187 void add_imageframe_time_axis(const std::string & track_name, void*) ;
188 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
189 void connect_to_image_compositor() ;
190 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
193 TimeAxisView* get_named_time_axis(const std::string & name) ;
194 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
195 void add_to_idle_resize (TimeAxisView*, int32_t);
197 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
199 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
200 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
201 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
203 #ifdef USE_RUBBERBAND
204 std::vector<std::string> rb_opt_strings;
207 /* option editor-access */
209 void set_show_waveforms_recording (bool yn);
210 bool show_waveforms_recording() const { return _show_waveforms_recording; }
212 /* things that need to be public to be used in the main menubar */
214 void new_region_from_selection ();
215 void separate_regions_between (const TimeSelection&);
216 void separate_region_from_selection ();
217 void separate_region_from_punch ();
218 void separate_region_from_loop ();
219 void separate_regions_using_location (ARDOUR::Location&);
220 void toggle_playback (bool with_abort);
221 void transition_to_rolling (bool forward);
225 nframes64_t unit_to_frame (double unit) const {
226 return (nframes64_t) rint (unit * frames_per_unit);
229 double frame_to_unit (nframes64_t frame) const {
230 return rint ((double) frame / (double) frames_per_unit);
233 double frame_to_unit (double frame) const {
234 return rint (frame / frames_per_unit);
237 /* NOTE: these functions assume that the "pixel" coordinate is
238 the result of using the world->canvas affine transform on a
239 world coordinate. These coordinates already take into
240 account any scrolling carried out by adjusting the
244 nframes64_t pixel_to_frame (double pixel) const {
246 /* pixel can be less than zero when motion events
247 are processed. since we've already run the world->canvas
248 affine, that means that the location *really* is "off
249 to the right" and thus really is "before the start".
253 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
259 gulong frame_to_pixel (nframes64_t frame) const {
260 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
263 void flush_canvas ();
267 Selection& get_selection() const { return *selection; }
268 Selection& get_cut_buffer() const { return *cut_buffer; }
270 bool extend_selection_to_track (TimeAxisView&);
272 void play_selection ();
273 void select_all_in_track (Selection::Operation op);
274 void select_all (Selection::Operation op);
275 void invert_selection_in_track ();
276 void invert_selection ();
277 void deselect_all ();
281 void set_show_measures (bool yn);
282 bool show_measures () const { return _show_measures; }
284 /* analysis window */
286 void analyze_region_selection();
287 void analyze_range_selection();
291 void export_audio ();
292 void export_selection ();
293 void export_range ();
294 void export_region ();
296 void add_toplevel_controls (Gtk::Container&);
297 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
299 void set_zoom_focus (Editing::ZoomFocus);
300 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
301 double get_current_zoom () const { return frames_per_unit; }
303 void temporal_zoom_step (bool coarser);
305 /* stuff that AudioTimeAxisView and related classes use */
307 PlaylistSelector& playlist_selector() const;
308 void route_name_changed (TimeAxisView *);
309 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
311 void new_playlists (TimeAxisView* v);
312 void copy_playlists (TimeAxisView* v);
313 void clear_playlists (TimeAxisView* v);
315 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
316 void get_onscreen_tracks (TrackViewList&);
318 Width editor_mixer_strip_width;
319 void maybe_add_mixer_strip_width (XMLNode&);
320 void show_editor_mixer (bool yn);
321 void create_editor_mixer ();
322 void show_editor_list (bool yn);
323 void set_selected_mixer_strip (TimeAxisView&);
324 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
325 void show_track_in_display (TimeAxisView& tv);
327 /* nudge is initiated by transport controls owned by ARDOUR_UI */
329 void nudge_forward (bool next, bool force_playhead);
330 void nudge_backward (bool next, bool force_playhead);
332 /* nudge initiated from context menu */
334 void nudge_forward_capture_offset ();
335 void nudge_backward_capture_offset ();
337 /* playhead/screen stuff */
339 void set_follow_playhead (bool yn);
340 void toggle_follow_playhead ();
341 bool follow_playhead() const { return _follow_playhead; }
342 bool dragging_playhead () const { return _dragging_playhead; }
344 void toggle_zero_line_visibility ();
345 void toggle_waveforms_while_recording ();
347 void toggle_measure_visibility ();
348 void toggle_logo_visibility ();
350 double get_physical_screen_width () const { return physical_screen_width; };
351 double physical_screen_width;
352 double physical_screen_height;
356 void toggle_selected_region_fades (int dir);
357 void update_region_fade_visibility ();
358 bool xfade_visibility() const { return _xfade_visibility; }
359 void update_xfade_visibility ();
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_y_origin (double);
385 void reset_zoom (double);
386 void reposition_and_zoom (nframes64_t, double);
388 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
390 bool update_mouse_speed ();
391 bool decelerate_mouse_speed ();
393 void toggle_meter_updating();
395 void show_rhythm_ferret();
396 void show_bundle_manager ();
397 void show_global_port_matrix (ARDOUR::DataType);
399 void goto_visual_state (uint32_t);
400 void save_visual_state (uint32_t);
403 void map_transport_state ();
404 void map_position_change (nframes64_t);
410 /// The session that we are editing, or 0
411 void color_handler ();
412 ARDOUR::Session *session;
415 // to keep track of the playhead position for control_scroll
416 boost::optional<nframes64_t> _control_scroll_target;
418 PlaylistSelector* _playlist_selector;
420 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
424 double frames_per_unit;
425 nframes64_t leftmost_frame;
426 Editing::ZoomFocus zoom_focus;
427 bool zoomed_to_region;
428 std::list<TAVState> track_states;
431 std::list<VisualState*> undo_visual_stack;
432 std::list<VisualState*> redo_visual_stack;
433 VisualState* current_visual_state (bool with_tracks = true);
434 void undo_visual_state ();
435 void redo_visual_state ();
436 void use_visual_state (VisualState&);
438 void swap_visual_state ();
440 std::vector<VisualState*> visual_states;
441 sigc::connection visual_state_op_connection;
442 void start_visual_state_op (uint32_t n);
443 void cancel_visual_state_op (uint32_t n);
444 bool end_visual_state_op (uint32_t n);
446 nframes64_t leftmost_frame;
447 double frames_per_unit;
448 Editing::ZoomFocus zoom_focus;
450 void set_frames_per_unit (double);
453 Editing::MouseMode mouse_mode;
454 Editing::MidiEditMode midi_edit_mode;
456 int post_maximal_editor_width;
457 int post_maximal_pane_position;
458 int pre_maximal_pane_position;
459 int pre_maximal_editor_width;
460 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
462 Gtk::Notebook the_notebook;
463 Gtk::HPaned edit_pane;
465 Gtk::EventBox meter_base;
467 Gtk::EventBox marker_base;
468 Gtk::HBox marker_box;
469 Gtk::VBox scrollers_rulers_markers_box;
471 void location_changed (ARDOUR::Location *);
472 void location_flags_changed (ARDOUR::Location *, void *);
473 void refresh_location_display ();
474 void refresh_location_display_s (ARDOUR::Change);
475 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
476 void add_new_location (ARDOUR::Location *);
477 void location_gone (ARDOUR::Location *);
478 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
479 gint really_remove_marker (ARDOUR::Location* loc);
480 void goto_nth_marker (int nth);
482 uint32_t location_marker_color;
483 uint32_t location_range_color;
484 uint32_t location_loop_color;
485 uint32_t location_punch_color;
486 uint32_t location_cd_marker_color;
488 struct LocationMarkers {
493 LocationMarkers () : start(0), end(0), valid (true) {}
499 void set_name (const std::string&);
500 void set_position (nframes64_t start, nframes64_t end = 0);
501 void set_color_rgba (uint32_t);
504 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
505 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
506 Marker* entered_marker;
508 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
509 LocationMarkerMap location_markers;
511 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
512 void clear_marker_display ();
513 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
514 bool choose_new_marker_name(std::string &name);
515 void update_cd_marker_display ();
516 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
518 TimeAxisView* clicked_axisview;
519 RouteTimeAxisView* clicked_routeview;
520 /** The last RegionView that was clicked on, or 0 if the last click was not
521 * on a RegionView. This is set up by the canvas event handlers in
522 * editor_canvas_events.cc
524 RegionView* clicked_regionview;
525 RegionSelection latest_regionviews;
526 uint32_t clicked_selection;
527 CrossfadeView* clicked_crossfadeview;
528 ControlPoint* clicked_control_point;
530 void sort_track_selection (TrackSelection* sel = 0);
532 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
533 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
534 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
536 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
538 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, std::vector<RegionView*>*) const;
539 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
540 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
541 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
545 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
546 bool button_release_can_deselect;
548 void catch_vanishing_regionview (RegionView *);
550 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
551 void select_all_tracks ();
553 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
555 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
556 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
557 void set_selected_track_as_side_effect (bool force = false);
558 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
560 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
561 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
562 void collect_new_region_view (RegionView *);
563 void collect_and_select_new_region_view (RegionView *);
565 Gtk::Menu track_context_menu;
566 Gtk::Menu track_region_context_menu;
567 Gtk::Menu track_selection_context_menu;
568 Gtk::Menu track_crossfade_context_menu;
570 Gtk::MenuItem* region_edit_menu_split_item;
571 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
572 Gtk::Menu * track_region_edit_playlist_menu;
573 Gtk::Menu * track_edit_playlist_submenu;
574 Gtk::Menu * track_selection_edit_playlist_submenu;
576 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
577 Gtk::Menu* build_track_context_menu (nframes64_t);
578 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
579 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
580 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
581 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
582 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
583 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
584 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
585 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
586 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
588 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
590 void handle_new_route (ARDOUR::RouteList&);
591 void remove_route (TimeAxisView *);
594 Gtk::HBox global_hpacker;
595 Gtk::VBox global_vpacker;
598 Gdk::Cursor* current_canvas_cursor;
599 void set_canvas_cursor ();
600 Gdk::Cursor* which_grabber_cursor ();
602 ArdourCanvas::Canvas* track_canvas;
604 ArdourCanvas::Text* verbose_canvas_cursor;
605 bool verbose_cursor_visible;
607 void parameter_changed (std::string);
609 bool track_canvas_motion (GdkEvent*);
611 void set_verbose_canvas_cursor (const std::string &, double x, double y);
612 void set_verbose_canvas_cursor_text (const std::string &);
613 void show_verbose_canvas_cursor();
614 void hide_verbose_canvas_cursor();
616 bool verbose_cursor_on; // so far unused
618 Gtk::EventBox time_canvas_event_box;
619 Gtk::EventBox track_canvas_event_box;
620 Gtk::EventBox time_button_event_box;
621 Gtk::EventBox ruler_label_event_box;
623 ArdourCanvas::Group *minsec_group;
624 ArdourCanvas::Pixbuf *logo_item;
625 ArdourCanvas::Group *bbt_group;
626 ArdourCanvas::Group *smpte_group;
627 ArdourCanvas::Group *frame_group;
628 ArdourCanvas::Group *tempo_group;
629 ArdourCanvas::Group *meter_group;
630 ArdourCanvas::Group *marker_group;
631 ArdourCanvas::Group *range_marker_group;
632 ArdourCanvas::Group *transport_marker_group;
633 ArdourCanvas::Group* cd_marker_group;
635 ArdourCanvas::Group* timebar_group;
637 /* These bars never need to be scrolled */
638 ArdourCanvas::Group* meter_bar_group;
639 ArdourCanvas::Group* tempo_bar_group;
640 ArdourCanvas::Group* marker_bar_group;
641 ArdourCanvas::Group* range_marker_bar_group;
642 ArdourCanvas::Group* transport_marker_bar_group;
643 ArdourCanvas::Group* cd_marker_bar_group;
645 /** The group containing all items that require horizontal scrolling. */
646 ArdourCanvas::Group* _background_group;
648 The _master_group is the group containing all items
649 that require horizontal scrolling..
650 It is primarily used to separate canvas items
651 that require horizontal scrolling from those that do not.
653 ArdourCanvas::Group* _master_group;
655 /* The group containing all trackviews. Only scrolled vertically. */
656 ArdourCanvas::Group* _trackview_group;
658 /* The group used for region motion. Sits on top of _trackview_group */
659 ArdourCanvas::Group* _region_motion_group;
662 ruler_metric_smpte = 0,
663 ruler_metric_bbt = 1,
664 ruler_metric_frames = 2,
665 ruler_metric_minsec = 3,
667 ruler_time_tempo = 4,
668 ruler_time_meter = 5,
669 ruler_time_marker = 6,
670 ruler_time_range_marker = 7,
671 ruler_time_transport_marker = 8,
672 ruler_time_cd_marker = 9,
675 static GtkCustomMetric ruler_metrics[4];
676 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
677 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
678 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
679 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
680 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
681 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
682 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
683 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
686 bool no_ruler_shown_update;
688 gint ruler_button_press (GdkEventButton*);
689 gint ruler_button_release (GdkEventButton*);
690 gint ruler_mouse_motion (GdkEventMotion*);
691 bool ruler_scroll (GdkEventScroll* event);
693 Gtk::Widget * ruler_grabbed_widget;
695 void initialize_rulers ();
696 void update_just_smpte ();
697 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
698 void update_fixed_rulers ();
699 void update_tempo_based_rulers ();
700 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
701 void update_ruler_visibility ();
702 void set_ruler_visible (RulerType, bool);
703 void toggle_ruler_visibility (RulerType rt);
704 void ruler_toggled (int);
705 gint ruler_label_button_release (GdkEventButton*);
706 void store_ruler_visibility ();
707 void restore_ruler_visibility ();
709 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
710 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
711 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
712 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
714 enum MinsecRulerScale {
721 MinsecRulerScale minsec_ruler_scale;
723 nframes_t minsec_mark_interval;
724 gint minsec_mark_modulo;
726 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
728 enum SMPTERulerScale {
736 SMPTERulerScale smpte_ruler_scale;
738 nframes_t smpte_mark_interval;
739 gint smpte_mark_modulo;
741 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
751 bbt_show_ticks_detail,
752 bbt_show_ticks_super_detail
755 BBTRulerScale bbt_ruler_scale;
759 uint32_t bbt_bar_helper_on;
760 uint32_t bbt_accent_modulo;
761 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
763 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
764 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
765 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
766 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
768 Gtk::Widget *_ruler_separator;
769 GtkWidget *_smpte_ruler;
770 GtkWidget *_bbt_ruler;
771 GtkWidget *_frames_ruler;
772 GtkWidget *_minsec_ruler;
773 Gtk::Widget *smpte_ruler;
774 Gtk::Widget *bbt_ruler;
775 Gtk::Widget *frames_ruler;
776 Gtk::Widget *minsec_ruler;
777 static Editor *ruler_editor;
779 static const double timebar_height;
780 guint32 visible_timebars;
781 gdouble canvas_timebars_vsize;
782 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
783 Gtk::Menu *editor_ruler_menu;
785 ArdourCanvas::SimpleRect* tempo_bar;
786 ArdourCanvas::SimpleRect* meter_bar;
787 ArdourCanvas::SimpleRect* marker_bar;
788 ArdourCanvas::SimpleRect* range_marker_bar;
789 ArdourCanvas::SimpleRect* transport_marker_bar;
790 ArdourCanvas::SimpleRect* cd_marker_bar;
792 Gtk::Label minsec_label;
793 Gtk::Label bbt_label;
794 Gtk::Label smpte_label;
795 Gtk::Label frame_label;
796 Gtk::Label tempo_label;
797 Gtk::Label meter_label;
798 Gtk::Label mark_label;
799 Gtk::Label range_mark_label;
800 Gtk::Label transport_mark_label;
801 Gtk::Label cd_mark_label;
803 Gtk::VBox time_button_vbox;
804 Gtk::HBox time_button_hbox;
806 friend class EditorCursor;
808 EditorCursor* playhead_cursor;
809 ArdourCanvas::Group* cursor_group;
811 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
813 void cursor_to_region_boundary (bool with_selection, int32_t dir);
814 void cursor_to_next_region_boundary (bool with_selection);
815 void cursor_to_previous_region_boundary (bool with_selection);
816 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
817 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
818 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
819 void cursor_to_selection_start (EditorCursor *);
820 void cursor_to_selection_end (EditorCursor *);
822 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
823 void selected_marker_to_next_region_boundary (bool with_selection);
824 void selected_marker_to_previous_region_boundary (bool with_selection);
825 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
826 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
827 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
828 void selected_marker_to_selection_start ();
829 void selected_marker_to_selection_end ();
831 void select_all_selectables_using_cursor (EditorCursor *, bool);
832 void select_all_selectables_using_edit (bool);
833 void select_all_selectables_between (bool within);
834 void select_range_between ();
836 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
837 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
839 std::vector<nframes64_t> region_boundary_cache;
840 void build_region_boundary_cache ();
843 Gtk::HBox bottom_hbox;
845 Gtk::Table edit_packer;
846 Gtk::VScrollbar edit_vscrollbar;
848 Gtk::Adjustment vertical_adjustment;
849 Gtk::Adjustment horizontal_adjustment;
851 Gtk::Layout controls_layout;
852 bool control_layout_scroll (GdkEventScroll* ev);
853 void controls_layout_size_request (Gtk::Requisition*);
854 sigc::connection controls_layout_size_request_connection;
856 Gtk::HScrollbar edit_hscrollbar;
857 bool _dragging_hscrollbar;
859 void reset_hscrollbar_stepping ();
861 bool hscrollbar_button_press (GdkEventButton*);
862 bool hscrollbar_button_release (GdkEventButton*);
863 void hscrollbar_allocate (Gtk::Allocation &alloc);
865 double _canvas_width;
866 double _canvas_height;
867 double full_canvas_height;
869 bool track_canvas_map_handler (GdkEventAny*);
871 gint edit_controls_button_release (GdkEventButton*);
872 Gtk::Menu *edit_controls_left_menu;
873 Gtk::Menu *edit_controls_right_menu;
875 Gtk::VBox ruler_label_vbox;
876 Gtk::VBox track_canvas_vbox;
877 Gtk::VBox time_canvas_vbox;
878 Gtk::VBox edit_controls_vbox;
879 Gtk::HBox edit_controls_hbox;
881 void control_scroll (float);
882 void access_action (std::string,std::string);
883 bool deferred_control_scroll (nframes64_t);
884 sigc::connection control_scroll_connection;
886 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
888 ArdourCanvas::Group* get_background_group () const { return _background_group; }
889 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
890 double last_trackview_group_vertical_offset;
891 void tie_vertical_scrolling ();
892 void scroll_canvas_horizontally ();
893 void scroll_canvas_vertically ();
895 struct VisualChange {
903 nframes64_t time_origin;
904 double frames_per_unit;
909 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
911 pending = Type (pending | t);
916 VisualChange pending_visual_change;
918 static int _idle_visual_changer (void *arg);
919 int idle_visual_changer ();
921 void queue_visual_change (nframes64_t);
922 void queue_visual_change (double);
923 void queue_visual_change_y (double);
924 void ensure_visual_change_idle_handler ();
926 void end_location_changed (ARDOUR::Location*);
928 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
929 RegionListDisplayModelColumns() {
946 Gtk::TreeModelColumn<Glib::ustring> name;
947 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
948 Gtk::TreeModelColumn<Gdk::Color> color_;
949 Gtk::TreeModelColumn<Glib::ustring> start;
950 Gtk::TreeModelColumn<Glib::ustring> end;
951 Gtk::TreeModelColumn<Glib::ustring> length;
952 Gtk::TreeModelColumn<Glib::ustring> sync;
953 Gtk::TreeModelColumn<Glib::ustring> fadein;
954 Gtk::TreeModelColumn<Glib::ustring> fadeout;
955 Gtk::TreeModelColumn<bool> locked;
956 Gtk::TreeModelColumn<bool> glued;
957 Gtk::TreeModelColumn<bool> muted;
958 Gtk::TreeModelColumn<bool> opaque;
959 Gtk::TreeModelColumn<Glib::ustring> used;
960 Gtk::TreeModelColumn<Glib::ustring> path;
963 RegionListDisplayModelColumns region_list_columns;
964 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
966 Glib::RefPtr<Gtk::TreeStore> region_list_model;
967 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
968 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
970 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
971 void region_list_selection_changed ();
972 sigc::connection region_list_change_connection;
973 void set_selected_in_region_list(RegionSelection&);
974 bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
975 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
976 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
977 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
979 Gtk::Menu *region_list_menu;
980 Gtk::ScrolledWindow region_list_scroller;
981 Gtk::Frame region_list_frame;
983 bool region_list_display_key_press (GdkEventKey *);
984 bool region_list_display_key_release (GdkEventKey *);
985 bool region_list_display_button_press (GdkEventButton *);
986 bool region_list_display_button_release (GdkEventButton *);
987 void region_list_clear ();
988 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
989 void build_region_list_menu ();
990 void show_region_list_display_context_menu (int button, int time);
992 bool show_automatic_regions_in_region_list;
993 Editing::RegionListSortType region_list_sort_type;
995 void reset_region_list_sort_direction (bool);
996 void reset_region_list_sort_type (Editing::RegionListSortType);
998 void toggle_full_region_list ();
999 void toggle_show_auto_regions ();
1001 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1005 Gtk::ScrolledWindow snapshot_display_scroller;
1006 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1007 SnapshotDisplayModelColumns() {
1011 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1012 Gtk::TreeModelColumn<Glib::ustring> real_name;
1015 SnapshotDisplayModelColumns snapshot_display_columns;
1016 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1017 Gtk::TreeView snapshot_display;
1018 Gtk::Menu snapshot_context_menu;
1020 bool snapshot_display_button_press (GdkEventButton*);
1021 void snapshot_display_selection_changed ();
1022 void redisplay_snapshots();
1023 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1025 /* named selections */
1027 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1028 NamedSelectionDisplayModelColumns() {
1032 Gtk::TreeModelColumn<Glib::ustring> text;
1033 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1036 NamedSelectionDisplayModelColumns named_selection_columns;
1037 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1039 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1040 Gtk::ScrolledWindow named_selection_scroller;
1042 void create_named_selection ();
1043 void paste_named_selection (float times);
1044 void remove_selected_named_selections ();
1045 void remove_snapshot (Glib::ustring);
1046 void rename_snapshot (Glib::ustring);
1048 void handle_new_named_selection ();
1049 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1050 void redisplay_named_selections ();
1052 bool named_selection_display_button_release (GdkEventButton *ev);
1053 bool named_selection_display_key_release (GdkEventKey *ev);
1054 void named_selection_display_selection_changed ();
1057 TrackViewList track_views;
1058 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1060 static Gdk::Cursor* cross_hair_cursor;
1061 static Gdk::Cursor* trimmer_cursor;
1062 static Gdk::Cursor* selector_cursor;
1063 static Gdk::Cursor* grabber_cursor;
1064 static Gdk::Cursor* grabber_edit_point_cursor;
1065 static Gdk::Cursor* zoom_cursor;
1066 static Gdk::Cursor* time_fx_cursor;
1067 static Gdk::Cursor* fader_cursor;
1068 static Gdk::Cursor* speaker_cursor;
1069 static Gdk::Cursor* midi_pencil_cursor;
1070 static Gdk::Cursor* midi_select_cursor;
1071 static Gdk::Cursor* midi_resize_cursor;
1072 static Gdk::Cursor* midi_erase_cursor;
1073 static Gdk::Cursor* wait_cursor;
1074 static Gdk::Cursor* timebar_cursor;
1075 static Gdk::Cursor* transparent_cursor;
1077 static void build_cursors ();
1079 sigc::connection scroll_connection;
1080 nframes64_t last_update_frame;
1081 void center_screen (nframes64_t);
1082 void center_screen_internal (nframes64_t, float);
1084 void update_current_screen ();
1086 void session_going_away ();
1088 nframes64_t cut_buffer_start;
1089 nframes64_t cut_buffer_length;
1091 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1092 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1093 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1094 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1095 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1096 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1098 /* KEYMAP HANDLING */
1100 void register_actions ();
1102 int ensure_cursor (nframes64_t* pos);
1104 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1105 void handle_new_regions (std::vector<boost::weak_ptr<ARDOUR::Region> >& );
1106 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1107 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1108 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1109 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1110 void redisplay_regions ();
1111 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1112 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1113 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1114 void update_all_region_rows ();
1115 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1116 bool no_region_list_redisplay;
1117 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1119 std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1121 void cut_copy (Editing::CutCopyOp);
1122 bool can_cut_copy () const;
1123 void cut_copy_points (Editing::CutCopyOp);
1124 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1125 void cut_copy_ranges (Editing::CutCopyOp);
1127 void mouse_paste ();
1128 void paste_internal (nframes64_t position, float times);
1130 /* EDITING OPERATIONS */
1132 void reset_point_selection ();
1133 void toggle_region_mute ();
1134 void toggle_region_lock ();
1135 void toggle_region_opaque ();
1136 void toggle_record_enable ();
1137 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1138 void raise_region ();
1139 void raise_region_to_top ();
1140 void lower_region ();
1141 void lower_region_to_bottom ();
1142 void split_region ();
1143 void split_region_at (nframes64_t);
1144 void split_regions_at (nframes64_t, RegionSelection&);
1145 void split_region_at_transients ();
1146 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1147 void crop_region_to_selection ();
1148 void crop_region_to (nframes64_t start, nframes64_t end);
1149 void set_sync_point (nframes64_t, const RegionSelection&);
1150 void set_region_sync_from_edit_point ();
1151 void remove_region_sync();
1152 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1153 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1154 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1155 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1156 void remove_selected_regions ();
1157 void remove_clicked_region ();
1158 void edit_region ();
1159 void rename_region ();
1160 void duplicate_some_regions (RegionSelection&, float times);
1161 void duplicate_selection (float times);
1162 void region_fill_selection ();
1164 void region_fill_track ();
1165 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1166 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1167 void split_multichannel_region();
1168 void reverse_region ();
1169 void strip_region_silence ();
1170 void normalize_region ();
1171 void denormalize_region ();
1172 void adjust_region_scale_amplitude (bool up);
1173 void quantize_region ();
1175 void do_insert_time ();
1176 void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool);
1178 void tab_to_transient (bool forward);
1180 void use_region_as_bar ();
1181 void use_range_as_bar ();
1183 void define_one_bar (nframes64_t start, nframes64_t end);
1185 void audition_region_from_region_list ();
1186 void hide_region_from_region_list ();
1187 void remove_region_from_region_list ();
1189 void align (ARDOUR::RegionPoint);
1190 void align_relative (ARDOUR::RegionPoint);
1193 void reset_focus ();
1199 void paste (float times);
1201 int get_prefix (float&, bool&);
1203 void keyboard_paste ();
1204 void keyboard_insert_region_list_selection ();
1206 void region_from_selection ();
1207 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1209 void play_from_start ();
1210 void play_from_edit_point ();
1211 void play_from_edit_point_and_return ();
1212 void play_selected_region ();
1213 void play_edit_range ();
1214 void loop_selected_region ();
1215 void play_location (ARDOUR::Location&);
1216 void loop_location (ARDOUR::Location&);
1218 void temporal_zoom_selection ();
1219 void temporal_zoom_region (bool both_axes);
1220 void toggle_zoom_region (bool both_axes);
1221 bool zoomed_to_region;
1222 void temporal_zoom_session ();
1223 void temporal_zoom (gdouble scale);
1224 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const std::string & op);
1225 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1227 void amplitude_zoom (gdouble scale);
1228 void amplitude_zoom_step (bool in);
1230 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1231 void insert_region_list_selection (float times);
1233 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1235 /* import & embed */
1237 void add_external_audio_action (Editing::ImportMode);
1238 void external_audio_dialog ();
1239 void session_import_dialog ();
1241 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1242 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1244 SoundFileOmega* sfbrowser;
1246 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1248 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1249 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1251 void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1252 void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1254 int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1255 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1256 int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1257 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1259 int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1260 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1261 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1262 boost::shared_ptr<ARDOUR::Track>& existing_track);
1264 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1265 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1267 /* generic interthread progress window */
1269 ArdourDialog* interthread_progress_window;
1270 Gtk::Label interthread_progress_label;
1271 Gtk::VBox interthread_progress_vbox;
1272 Gtk::ProgressBar interthread_progress_bar;
1273 Gtk::Button interthread_cancel_button;
1274 Gtk::Label interthread_cancel_label;
1275 sigc::connection interthread_progress_connection;
1276 void interthread_cancel_clicked ();
1277 void build_interthread_progress_window ();
1278 ARDOUR::InterThreadInfo* current_interthread_info;
1280 AnalysisWindow* analysis_window;
1282 /* import specific info */
1284 struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
1285 Editing::ImportMode mode;
1289 boost::shared_ptr<ARDOUR::Track> track;
1293 EditorImportStatus import_status;
1294 gint import_progress_timeout (void *);
1295 static void *_import_thread (void *);
1296 void* import_thread ();
1297 void finish_import ();
1299 /* to support this ... */
1301 void import_audio (bool as_tracks);
1302 void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
1304 void move_to_start ();
1305 void move_to_end ();
1307 void center_playhead ();
1308 void center_edit_point ();
1309 void edit_cursor_backward ();
1310 void edit_cursor_forward ();
1311 void playhead_forward_to_grid ();
1312 void playhead_backward_to_grid ();
1313 void playhead_backward ();
1314 void playhead_forward ();
1315 void scroll_playhead (bool forward);
1316 void scroll_backward (float pages=0.8f);
1317 void scroll_forward (float pages=0.8f);
1318 void scroll_tracks_down ();
1319 void scroll_tracks_up ();
1320 void delete_sample_forward ();
1321 void delete_sample_backward ();
1322 void delete_screen ();
1323 void search_backwards ();
1324 void search_forwards ();
1326 void clear_markers ();
1327 void clear_ranges ();
1328 void clear_locations ();
1329 void unhide_markers ();
1330 void unhide_ranges ();
1331 void jump_forward_to_mark ();
1332 void jump_backward_to_mark ();
1333 void cursor_align (bool playhead_to_edit);
1335 void remove_last_capture ();
1336 void select_all_selectables_using_time_selection ();
1337 void select_all_selectables_using_loop();
1338 void select_all_selectables_using_punch();
1339 void set_selection_from_range (ARDOUR::Location&);
1340 void set_selection_from_punch ();
1341 void set_selection_from_loop ();
1342 void set_selection_from_region ();
1344 void add_location_mark (nframes64_t where);
1345 void add_location_from_audio_region ();
1346 void add_locations_from_audio_region ();
1347 void add_location_from_selection ();
1348 void set_loop_from_selection (bool play);
1349 void set_punch_from_selection ();
1350 void set_punch_from_region ();
1352 void set_loop_from_edit_range (bool play);
1353 void set_loop_from_region (bool play);
1354 void set_punch_from_edit_range ();
1356 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1357 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1359 void add_location_from_playhead_cursor ();
1360 bool select_new_marker;
1362 void reverse_selection ();
1363 void edit_envelope ();
1365 void start_scrolling ();
1366 void stop_scrolling ();
1368 double last_scrub_x;
1369 int scrubbing_direction;
1370 int scrub_reversals;
1371 int scrub_reverse_distance;
1374 void keyboard_selection_begin ();
1375 void keyboard_selection_finish (bool add);
1376 bool have_pending_keyboard_selection;
1377 nframes64_t pending_keyboard_selection_start;
1379 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1380 void extend_selection_to_end_of_region (bool next);
1381 void extend_selection_to_start_of_region (bool previous);
1383 Editing::SnapType snap_type;
1384 Editing::SnapMode snap_mode;
1386 /// Snap threshold in pixels
1387 double snap_threshold;
1389 void handle_gui_changes (const std::string &, void *);
1390 bool ignore_gui_changes;
1392 void hide_all_tracks (bool with_select);
1398 Gtk::Menu fade_context_menu;
1399 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1401 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1402 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1404 void set_fade_length (bool in);
1405 void toggle_fade_active (bool in);
1406 void set_fade_in_active (bool);
1407 void set_fade_out_active (bool);
1409 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1410 RegionSelection pre_drag_region_selection;
1412 bool _dragging_playhead;
1413 bool _dragging_edit_point;
1415 void marker_drag_motion_callback (GdkEvent*);
1416 void marker_drag_finished_callback (GdkEvent*);
1418 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1420 void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1421 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1422 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1423 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1424 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1426 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1428 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1429 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1431 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1432 void brush (nframes64_t);
1434 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1435 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1436 double clamp_verbose_cursor_x (double);
1437 double clamp_verbose_cursor_y (double);
1439 /* Canvas event handlers */
1441 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1442 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1443 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1444 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1445 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1446 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1447 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1448 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1449 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1450 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1453 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1455 ArdourCanvas::Item *last_item_entered;
1456 int last_item_entered_n;
1459 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1460 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1461 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1462 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1463 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1464 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1465 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1466 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1467 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1469 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1470 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1471 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1472 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1473 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1474 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1476 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1477 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1478 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1479 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1480 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1481 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1482 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1483 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1485 /* non-public event handlers */
1487 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1488 bool track_canvas_scroll (GdkEventScroll* event);
1490 bool track_canvas_scroll_event (GdkEventScroll* event);
1491 bool track_canvas_button_press_event (GdkEventButton* event);
1492 bool track_canvas_button_release_event (GdkEventButton* event);
1493 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1495 Gtk::Allocation canvas_allocation;
1496 void track_canvas_allocate (Gtk::Allocation alloc);
1497 bool track_canvas_size_allocated ();
1498 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1500 void set_playhead_cursor ();
1502 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1503 void kbd_mute_unmute_region ();
1506 void kbd_do_brush (GdkEvent*);
1507 void kbd_do_audition (GdkEvent*);
1509 void handle_new_duration ();
1510 void initialize_canvas ();
1512 /* display control */
1514 bool _show_measures;
1515 /// true if the editor should follow the playhead, otherwise false
1516 bool _follow_playhead;
1517 /// true if waveforms should be shown while recording audio tracks, otherwise false
1518 bool _show_waveforms_recording;
1520 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1522 TempoLines* tempo_lines;
1524 ArdourCanvas::Group* time_line_group;
1526 void hide_measures ();
1527 void draw_measures ();
1528 bool redraw_measures ();
1530 void new_tempo_section ();
1532 void mouse_add_new_tempo_event (nframes64_t where);
1533 void mouse_add_new_meter_event (nframes64_t where);
1535 void remove_tempo_marker (ArdourCanvas::Item*);
1536 void remove_meter_marker (ArdourCanvas::Item*);
1537 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1538 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1540 void edit_tempo_section (ARDOUR::TempoSection*);
1541 void edit_meter_section (ARDOUR::MeterSection*);
1542 void edit_tempo_marker (ArdourCanvas::Item*);
1543 void edit_meter_marker (ArdourCanvas::Item*);
1544 void edit_control_point (ArdourCanvas::Item*);
1546 void marker_menu_edit ();
1547 void marker_menu_remove ();
1548 void marker_menu_rename ();
1549 void marker_menu_lock (bool yn);
1550 void marker_menu_hide ();
1551 void marker_menu_loop_range ();
1552 void marker_menu_select_all_selectables_using_range ();
1553 void marker_menu_select_using_range ();
1554 void marker_menu_separate_regions_using_location ();
1555 void marker_menu_play_from ();
1556 void marker_menu_play_range ();
1557 void marker_menu_set_playhead ();
1558 void marker_menu_set_from_playhead ();
1559 void marker_menu_set_from_selection ();
1560 void marker_menu_range_to_next ();
1561 void new_transport_marker_menu_set_loop ();
1562 void new_transport_marker_menu_set_punch ();
1563 void update_loop_range_view (bool visibility=false);
1564 void update_punch_range_view (bool visibility=false);
1565 void new_transport_marker_menu_popdown ();
1566 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1567 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1568 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1569 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1570 void build_range_marker_menu (bool loop_or_punch);
1571 void build_marker_menu (bool start_or_end);
1572 void build_tm_marker_menu ();
1573 void build_new_transport_marker_menu ();
1575 Gtk::Menu* tm_marker_menu;
1576 Gtk::Menu* marker_menu;
1577 Gtk::Menu* start_end_marker_menu;
1578 Gtk::Menu* range_marker_menu;
1579 Gtk::Menu* transport_marker_menu;
1580 Gtk::Menu* new_transport_marker_menu;
1581 Gtk::Menu* cd_marker_menu;
1582 ArdourCanvas::Item* marker_menu_item;
1584 typedef std::list<Marker*> Marks;
1587 void remove_metric_marks ();
1588 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1590 void compute_current_bbt_points (nframes_t left, nframes_t right);
1591 void tempo_map_changed (ARDOUR::Change);
1592 void redisplay_tempo (bool immediate_redraw);
1594 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1596 double snap_length_beats (nframes64_t start);
1598 uint32_t bbt_beat_subdivision;
1602 Gtk::ToggleButton editor_mixer_button;
1603 Gtk::ToggleButton editor_list_button;
1604 void editor_mixer_button_toggled ();
1605 void editor_list_button_toggled ();
1607 AudioClock edit_point_clock;
1608 AudioClock zoom_range_clock;
1609 Gtk::Button zoom_in_button;
1610 Gtk::Button zoom_out_button;
1611 Gtk::Button zoom_out_full_button;
1612 Gtk::Button zoom_onetoone_button;
1614 Gtk::VBox toolbar_clock_vbox;
1615 Gtk::VBox toolbar_selection_clock_vbox;
1616 Gtk::Table toolbar_selection_clock_table;
1617 Gtk::Label toolbar_selection_cursor_label;
1619 Gtk::HBox mouse_mode_button_box;
1620 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1621 Gtk::ToggleButton mouse_select_button;
1622 Gtk::ToggleButton mouse_move_button;
1623 Gtk::ToggleButton mouse_gain_button;
1624 Gtk::ToggleButton mouse_zoom_button;
1625 Gtk::ToggleButton mouse_timefx_button;
1626 Gtk::ToggleButton mouse_audition_button;
1627 Gtk::ToggleButton mouse_note_button;
1628 GroupedButtons *mouse_mode_button_set;
1629 void mouse_mode_toggled (Editing::MouseMode m);
1630 bool ignore_mouse_mode_toggle;
1632 gint mouse_select_button_release (GdkEventButton*);
1634 Gtk::VBox automation_box;
1635 Gtk::Button automation_mode_button;
1636 Gtk::ToggleButton global_automation_button;
1638 Gtk::ComboBoxText edit_mode_selector;
1639 Gtk::VBox edit_mode_box;
1641 void set_edit_mode (ARDOUR::EditMode);
1642 void cycle_edit_mode ();
1643 void edit_mode_selection_done ();
1645 Gtk::ComboBoxText snap_type_selector;
1646 Gtk::ComboBoxText snap_mode_selector;
1649 std::vector<std::string> snap_type_strings;
1650 std::vector<std::string> snap_mode_strings;
1652 void snap_type_selection_done ();
1653 void snap_mode_selection_done ();
1654 void snap_mode_chosen (Editing::SnapMode);
1655 void snap_type_chosen (Editing::SnapType);
1657 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1658 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1660 Gtk::ComboBoxText zoom_focus_selector;
1661 Gtk::VBox zoom_focus_box;
1663 std::vector<std::string> zoom_focus_strings;
1665 void zoom_focus_selection_done ();
1666 void zoom_focus_chosen (Editing::ZoomFocus);
1668 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1671 Gtk::VBox zoom_vbox;
1673 void zoom_adjustment_changed();
1675 void edit_point_clock_changed();
1677 void setup_toolbar ();
1679 Gtkmm2ext::TearOff* tools_tearoff;
1680 Gtk::HBox toolbar_hbox;
1681 Gtk::EventBox toolbar_base;
1682 Gtk::Frame toolbar_frame;
1686 Gtk::HBox midi_tool_button_box;
1687 Gtk::ToggleButton midi_tool_pencil_button;
1688 Gtk::ToggleButton midi_tool_select_button;
1689 Gtk::ToggleButton midi_tool_resize_button;
1690 Gtk::ToggleButton midi_tool_erase_button;
1691 Gtk::Button midi_panic_button;
1692 Gtk::ToggleButton midi_sound_notes;
1693 GroupedButtons *midi_tool_button_set;
1694 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1695 void midi_panic_button_pressed ();
1696 bool sound_notes () const { return midi_sound_notes.get_active(); }
1698 bool ignore_midi_edit_mode_toggle;
1700 Gtkmm2ext::TearOff* midi_tools_tearoff;
1701 Gtk::HBox midi_toolbar_hbox;
1702 Gtk::EventBox midi_toolbar_base;
1703 Gtk::Frame midi_toolbar_frame;
1705 void setup_midi_toolbar ();
1707 /* selection process */
1709 Selection* selection;
1710 Selection* cut_buffer;
1712 void time_selection_changed ();
1713 void track_selection_changed ();
1714 void region_selection_changed ();
1715 sigc::connection editor_regions_selection_changed_connection;
1716 void sensitize_the_right_region_actions (bool have_selected_regions);
1717 void point_selection_changed ();
1718 void marker_selection_changed ();
1720 void cancel_selection ();
1722 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1723 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1724 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1726 bool audio_region_selection_covers (nframes64_t where);
1728 /* transport range select process */
1730 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1731 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1732 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1735 ArdourCanvas::SimpleRect *bogus_background_rect;
1737 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1738 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1739 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1740 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1741 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1742 ArdourCanvas::SimpleLine *transport_punchin_line;
1743 ArdourCanvas::SimpleLine *transport_punchout_line;
1744 ArdourCanvas::SimpleRect *transport_preroll_rect;
1745 ArdourCanvas::SimpleRect *transport_postroll_rect;
1747 ARDOUR::Location* transport_loop_location();
1748 ARDOUR::Location* transport_punch_location();
1750 ARDOUR::Location *temp_location;
1752 /* object rubberband select process */
1754 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1756 ArdourCanvas::SimpleRect *rubberband_rect;
1758 /* mouse zoom process */
1760 ArdourCanvas::SimpleRect *zoom_rect;
1761 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1763 /* diskstream/route display management */
1765 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1766 RouteDisplayModelColumns() {
1769 add (temporary_visible);
1773 Gtk::TreeModelColumn<Glib::ustring> text;
1774 Gtk::TreeModelColumn<bool> visible;
1775 Gtk::TreeModelColumn<bool> temporary_visible;
1776 Gtk::TreeModelColumn<TimeAxisView*> tv;
1777 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1780 RouteDisplayModelColumns route_display_columns;
1781 Glib::RefPtr<Gtk::ListStore> route_display_model;
1782 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1784 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1785 Gtk::ScrolledWindow route_list_scroller;
1786 Gtk::Menu* route_list_menu;
1788 void update_route_visibility ();
1790 void sync_order_keys (const char*);
1791 bool route_redisplay_does_not_sync_order_keys;
1792 bool route_redisplay_does_not_reset_order_keys;
1794 bool route_list_display_button_press (GdkEventButton*);
1795 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1798 const Gtk::SelectionData& data,
1802 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1804 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1805 void route_list_delete (const Gtk::TreeModel::Path&);
1806 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1808 void initial_route_list_display ();
1809 void redisplay_route_list();
1810 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1811 bool ignore_route_list_reorder;
1812 bool no_route_list_redisplay;
1813 bool sync_track_view_list_and_route_list ();
1815 void build_route_list_menu ();
1816 void show_route_list_menu ();
1818 void show_all_routes ();
1819 void hide_all_routes ();
1820 void show_all_audiotracks ();
1821 void hide_all_audiotracks ();
1822 void show_all_audiobus ();
1823 void hide_all_audiobus ();
1825 void set_all_tracks_visibility (bool yn);
1826 void set_all_audio_visibility (int type, bool yn);
1828 /* edit group management */
1830 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1831 GroupListModelColumns () {
1837 Gtk::TreeModelColumn<bool> is_active;
1838 Gtk::TreeModelColumn<bool> is_visible;
1839 Gtk::TreeModelColumn<std::string> text;
1840 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1843 GroupListModelColumns group_columns;
1844 Glib::RefPtr<Gtk::ListStore> group_model;
1845 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1847 Gtk::TreeView edit_group_display;
1848 Gtk::ScrolledWindow edit_group_display_scroller;
1849 Gtk::Menu* edit_group_list_menu;
1851 void build_edit_group_list_menu ();
1852 void activate_all_edit_groups ();
1853 void disable_all_edit_groups ();
1855 bool in_edit_group_row_change;
1856 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1857 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1858 void new_edit_group ();
1859 void edit_group_list_button_clicked ();
1860 gint edit_group_list_button_press_event (GdkEventButton* ev);
1861 void add_edit_group (ARDOUR::RouteGroup* group);
1862 void remove_selected_edit_group ();
1863 void edit_groups_changed ();
1864 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1866 Gtk::VBox list_vpacker;
1870 bool autoscroll_active;
1871 int autoscroll_timeout_tag;
1874 int last_autoscroll_x;
1875 int last_autoscroll_y;
1876 uint32_t autoscroll_cnt;
1877 nframes64_t autoscroll_x_distance;
1878 double autoscroll_y_distance;
1880 static gint _autoscroll_canvas (void *);
1881 bool autoscroll_canvas ();
1882 void start_canvas_autoscroll (int x, int y);
1883 void stop_canvas_autoscroll ();
1884 void maybe_autoscroll (GdkEventMotion*, bool);
1885 bool allow_vertical_scroll;
1888 void point_trim (GdkEvent*);
1889 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1890 void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
1891 void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
1893 void thaw_region_after_trim (RegionView& rv);
1895 void trim_region_front();
1896 void trim_region_back();
1897 void trim_region (bool front);
1899 void trim_region_to_edit_point ();
1900 void trim_region_from_edit_point ();
1901 void trim_region_to_loop ();
1902 void trim_region_to_punch ();
1903 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1905 void trim_to_region(bool forward);
1906 void trim_region_to_previous_region_end();
1907 void trim_region_to_next_region_start();
1909 bool show_gain_after_trim;
1913 int convert_drop_to_paths (
1914 std::vector<Glib::ustring>& paths,
1915 const Glib::RefPtr<Gdk::DragContext>& context,
1918 const Gtk::SelectionData& data,
1922 void track_canvas_drag_data_received (
1923 const Glib::RefPtr<Gdk::DragContext>& context,
1926 const Gtk::SelectionData& data,
1930 void region_list_display_drag_data_received (
1931 const Glib::RefPtr<Gdk::DragContext>& context,
1934 const Gtk::SelectionData& data,
1939 const Glib::RefPtr<Gdk::DragContext>& context,
1942 const Gtk::SelectionData& data,
1947 const Glib::RefPtr<Gdk::DragContext>& context,
1950 const Gtk::SelectionData& data,
1955 const Glib::RefPtr<Gdk::DragContext>& context,
1958 const Gtk::SelectionData& data,
1964 int write_region_selection(RegionSelection&);
1965 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1966 void bounce_region_selection ();
1967 void bounce_range_selection (bool replace, bool enable_processing);
1968 void external_edit_region ();
1970 int write_audio_selection (TimeSelection&);
1971 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1973 void write_selection ();
1975 XMLNode *before; /* used in *_reversible_command */
1977 void begin_reversible_command (std::string cmd_name);
1978 void commit_reversible_command ();
1980 void update_title ();
1981 void update_title_s (const std::string & snapshot_name);
1984 Selection* selection;
1985 double frames_per_unit;
1987 State (PublicEditor const * e);
1991 void store_state (State&) const;
1992 void restore_state (State *);
1994 void instant_save ();
1996 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1998 /* freeze operations */
2000 ARDOUR::InterThreadInfo freeze_status;
2001 gint freeze_progress_timeout (void *);
2002 static void* _freeze_thread (void*);
2003 void* freeze_thread ();
2005 void freeze_route ();
2006 void unfreeze_route ();
2008 /* edit-group solo + mute */
2010 void set_edit_group_solo (ARDOUR::Route&, bool);
2011 void set_edit_group_mute (ARDOUR::Route&, bool);
2015 void duplicate_dialog (bool with_dialog);
2017 nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
2019 /* returns false if mouse pointer is not in track or marker canvas
2021 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2023 /* "whats mine is yours" */
2025 TimeFXDialog* current_timefx;
2027 static void* timefx_thread (void *arg);
2028 void do_timefx (TimeFXDialog&);
2030 int time_stretch (RegionSelection&, float fraction);
2031 int pitch_shift (RegionSelection&, float cents);
2032 void pitch_shift_regions ();
2033 int time_fx (RegionSelection&, float val, bool pitching);
2035 /* editor-mixer strip */
2037 MixerStrip *current_mixer_strip;
2038 bool show_editor_mixer_when_tracks_arrive;
2039 Gtk::VBox current_mixer_strip_vbox;
2040 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2041 void cms_deleted ();
2042 void current_mixer_strip_hidden ();
2043 void current_mixer_strip_removed ();
2045 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2046 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2048 void ensure_all_elements_drawn ();
2050 /* nudging tracks */
2052 void nudge_track (bool use_edit_point, bool forwards);
2056 bool _xfade_visibility;
2059 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
2060 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
2062 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2063 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2065 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2066 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2067 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2069 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2070 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2071 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2072 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2074 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2075 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2076 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2077 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2079 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2080 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2081 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2082 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2083 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2084 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2086 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2087 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2088 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2089 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2090 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2091 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2093 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2094 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2096 ImageFrameSocketHandler* image_socket_listener ;
2099 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2100 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2101 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2102 void xfade_edit_left_region ();
2103 void xfade_edit_right_region ();
2105 static const int32_t default_width = 995;
2106 static const int32_t default_height = 765;
2110 Gtk::Button nudge_forward_button;
2111 Gtk::Button nudge_backward_button;
2112 Gtk::HBox nudge_hbox;
2113 Gtk::VBox nudge_vbox;
2114 AudioClock nudge_clock;
2116 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2118 bool nudge_forward_release (GdkEventButton*);
2119 bool nudge_backward_release (GdkEventButton*);
2123 void apply_filter (ARDOUR::Filter&, std::string cmd);
2125 /* handling cleanup */
2127 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2129 std::vector<sigc::connection> session_connections;
2131 /* tracking step changes of track height */
2133 TimeAxisView* current_stepping_trackview;
2134 ARDOUR::microseconds_t last_track_height_step_timestamp;
2135 gint track_height_step_timeout();
2136 sigc::connection step_timeout;
2138 TimeAxisView* entered_track;
2139 RegionView* entered_regionview;
2142 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2143 bool clear_entered_track;
2144 bool left_track_canvas (GdkEventCrossing*);
2145 bool entered_track_canvas (GdkEventCrossing*);
2146 void set_entered_track (TimeAxisView*);
2147 void set_entered_regionview (RegionView*);
2148 void ensure_track_visible (TimeAxisView*);
2149 gint left_automation_track ();
2151 bool _new_regionviews_show_envelope;
2153 void reset_canvas_action_sensitivity (bool);
2154 void toggle_gain_envelope_visibility ();
2155 void toggle_gain_envelope_active ();
2156 void reset_region_gain_envelopes ();
2158 bool on_key_press_event (GdkEventKey*);
2159 bool on_key_release_event (GdkEventKey*);
2161 void session_state_saved (std::string);
2163 Glib::RefPtr<Gtk::Action> undo_action;
2164 Glib::RefPtr<Gtk::Action> redo_action;
2166 void history_changed ();
2168 Gtk::HBox status_bar_hpacker;
2170 Editing::EditPoint _edit_point;
2172 Gtk::ComboBoxText edit_point_selector;
2174 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2175 void cycle_edit_point (bool with_marker);
2176 void set_edit_point ();
2177 void edit_point_selection_done ();
2178 void edit_point_chosen (Editing::EditPoint);
2179 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2180 std::vector<std::string> edit_point_strings;
2182 void selected_marker_moved (ARDOUR::Location*);
2183 sigc::connection edit_point_clock_connection_a;
2184 sigc::connection edit_point_clock_connection_b;
2186 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2188 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2189 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2191 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2193 sigc::connection fast_screen_update_connection;
2194 gint start_updating ();
2195 gint stop_updating ();
2196 void fast_update_strips ();
2197 bool meters_running;
2199 void select_next_route ();
2200 void select_prev_route ();
2202 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2204 RhythmFerret* rhythm_ferret;
2205 BundleManager* _bundle_manager;
2206 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2209 void set_track_height (uint32_t h);
2211 void remove_tracks ();
2212 void toggle_tracks_active ();
2217 friend gboolean _idle_resize (gpointer);
2218 std::map<TimeAxisView*, int32_t> pending_resizes;
2220 void visible_order_range (int*, int*) const;
2223 bool _pending_locate_request;
2225 EditorSummary* _summary;
2226 void region_view_added (RegionView *);
2228 void update_canvas_now ();
2229 void streamview_height_changed ();
2230 int32_t add_single_to_idle_resize (TimeAxisView*, int32_t);
2233 friend class RegionDrag;
2234 friend class RegionMoveDrag;
2235 friend class RegionSpliceDrag;
2236 friend class TrimDrag;
2237 friend class MeterMarkerDrag;
2238 friend class TempoMarkerDrag;
2239 friend class CursorDrag;
2240 friend class FadeInDrag;
2241 friend class FadeOutDrag;
2242 friend class MarkerDrag;
2243 friend class RegionGainDrag;
2244 friend class ControlPointDrag;
2245 friend class LineDrag;
2246 friend class RubberbandSelectDrag;
2247 friend class TimeFXDrag;
2248 friend class ScrubDrag;
2249 friend class SelectionDrag;
2250 friend class RangeMarkerBarDrag;
2251 friend class MouseZoomDrag;
2252 friend class RegionCreateDrag;
2253 friend class RegionMotionDrag;
2254 friend class RegionInsertDrag;
2256 friend class EditorSummary;
2259 #endif /* __ardour_editor_h__ */