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;
117 class EditorGroupTabs;
119 /* <CMT Additions> */
120 class ImageFrameView;
121 class ImageFrameTimeAxisView;
122 class ImageFrameTimeAxis;
123 class MarkerTimeAxis ;
125 class ImageFrameSocketHandler ;
126 class TimeAxisViewItem ;
127 /* </CMT Additions> */
129 struct EditorCursor {
131 ArdourCanvas::Points points;
132 ArdourCanvas::Line canvas_item;
133 nframes64_t current_frame;
136 EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
139 void set_position (nframes64_t);
140 void set_length (double units);
141 void set_y_axis (double position);
143 sigc::signal<void, nframes64_t> PositionChanged;
146 class Editor : public PublicEditor
152 void connect_to_session (ARDOUR::Session *);
153 ARDOUR::Session* current_session() const { return session; }
155 virtual bool have_idled () const { return _have_idled; }
157 nframes64_t leftmost_position() const { return leftmost_frame; }
159 nframes64_t current_page_frames() const {
160 return (nframes64_t) floor (_canvas_width * frames_per_unit);
163 double canvas_height () const {
164 return _canvas_height;
167 void cycle_snap_mode ();
168 void cycle_snap_choice ();
169 void set_snap_to (Editing::SnapType);
170 void set_snap_mode (Editing::SnapMode);
171 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
173 void undo (uint32_t n = 1);
174 void redo (uint32_t n = 1);
176 XMLNode& get_state ();
177 int set_state (const XMLNode& );
179 void set_mouse_mode (Editing::MouseMode, bool force=true);
180 void step_mouse_mode (bool next);
181 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
183 void set_midi_edit_cursor (Editing::MidiEditMode);
184 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
185 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
188 void add_imageframe_time_axis(const std::string & track_name, void*) ;
189 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
190 void connect_to_image_compositor() ;
191 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
194 TimeAxisView* get_named_time_axis(const std::string & name) ;
195 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
196 void add_to_idle_resize (TimeAxisView*, int32_t);
198 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
200 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
201 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
202 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
204 #ifdef USE_RUBBERBAND
205 std::vector<std::string> rb_opt_strings;
208 /* option editor-access */
210 void set_show_waveforms_recording (bool yn);
211 bool show_waveforms_recording() const { return _show_waveforms_recording; }
213 /* things that need to be public to be used in the main menubar */
215 void new_region_from_selection ();
216 void separate_regions_between (const TimeSelection&);
217 void separate_region_from_selection ();
218 void separate_region_from_punch ();
219 void separate_region_from_loop ();
220 void separate_regions_using_location (ARDOUR::Location&);
221 void toggle_playback (bool with_abort);
222 void transition_to_rolling (bool forward);
226 nframes64_t unit_to_frame (double unit) const {
227 return (nframes64_t) rint (unit * frames_per_unit);
230 double frame_to_unit (nframes64_t frame) const {
231 return rint ((double) frame / (double) frames_per_unit);
234 double frame_to_unit (double frame) const {
235 return rint (frame / frames_per_unit);
238 /* NOTE: these functions assume that the "pixel" coordinate is
239 the result of using the world->canvas affine transform on a
240 world coordinate. These coordinates already take into
241 account any scrolling carried out by adjusting the
245 nframes64_t pixel_to_frame (double pixel) const {
247 /* pixel can be less than zero when motion events
248 are processed. since we've already run the world->canvas
249 affine, that means that the location *really* is "off
250 to the right" and thus really is "before the start".
254 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
260 gulong frame_to_pixel (nframes64_t frame) const {
261 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
264 void flush_canvas ();
268 Selection& get_selection() const { return *selection; }
269 Selection& get_cut_buffer() const { return *cut_buffer; }
271 bool extend_selection_to_track (TimeAxisView&);
273 void play_selection ();
274 void select_all_in_track (Selection::Operation op);
275 void select_all (Selection::Operation op);
276 void invert_selection_in_track ();
277 void invert_selection ();
278 void deselect_all ();
282 void set_show_measures (bool yn);
283 bool show_measures () const { return _show_measures; }
285 /* analysis window */
287 void analyze_region_selection();
288 void analyze_range_selection();
292 void export_audio ();
293 void export_selection ();
294 void export_range ();
295 void export_region ();
297 void add_toplevel_controls (Gtk::Container&);
298 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
300 void set_zoom_focus (Editing::ZoomFocus);
301 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
302 double get_current_zoom () const { return frames_per_unit; }
304 void temporal_zoom_step (bool coarser);
306 /* stuff that AudioTimeAxisView and related classes use */
308 PlaylistSelector& playlist_selector() const;
309 void route_name_changed (TimeAxisView *);
310 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
312 void new_playlists (TimeAxisView* v);
313 void copy_playlists (TimeAxisView* v);
314 void clear_playlists (TimeAxisView* v);
316 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
317 void get_onscreen_tracks (TrackViewList&);
319 Width editor_mixer_strip_width;
320 void maybe_add_mixer_strip_width (XMLNode&);
321 void show_editor_mixer (bool yn);
322 void create_editor_mixer ();
323 void show_editor_list (bool yn);
324 void set_selected_mixer_strip (TimeAxisView&);
325 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
326 void show_track_in_display (TimeAxisView& tv);
328 /* nudge is initiated by transport controls owned by ARDOUR_UI */
330 void nudge_forward (bool next, bool force_playhead);
331 void nudge_backward (bool next, bool force_playhead);
333 /* nudge initiated from context menu */
335 void nudge_forward_capture_offset ();
336 void nudge_backward_capture_offset ();
338 /* playhead/screen stuff */
340 void set_follow_playhead (bool yn);
341 void toggle_follow_playhead ();
342 bool follow_playhead() const { return _follow_playhead; }
343 bool dragging_playhead () const { return _dragging_playhead; }
345 void toggle_zero_line_visibility ();
346 void toggle_waveforms_while_recording ();
348 void set_group_tabs ();
349 void toggle_measure_visibility ();
350 void toggle_logo_visibility ();
352 double get_physical_screen_width () const { return physical_screen_width; };
353 double physical_screen_width;
354 double physical_screen_height;
358 void toggle_selected_region_fades (int dir);
359 void update_region_fade_visibility ();
360 bool xfade_visibility() const { return _xfade_visibility; }
361 void update_xfade_visibility ();
363 /* redirect shared ops menu. caller must free returned menu */
365 Gtk::Menu* redirect_menu ();
367 /* floating windows/transient */
369 void ensure_float (Gtk::Window&);
373 void scroll_tracks_down_line ();
374 void scroll_tracks_up_line ();
376 void move_selected_tracks (bool up);
378 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
379 void prepare_for_cleanup ();
380 void finish_cleanup ();
382 void maximise_editing_space();
383 void restore_editing_space();
385 void reset_x_origin (nframes64_t);
386 void reset_y_origin (double);
387 void reset_zoom (double);
388 void reposition_and_zoom (nframes64_t, double);
390 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
392 bool update_mouse_speed ();
393 bool decelerate_mouse_speed ();
395 void toggle_meter_updating();
397 void show_rhythm_ferret();
398 void show_bundle_manager ();
399 void show_global_port_matrix (ARDOUR::DataType);
401 void goto_visual_state (uint32_t);
402 void save_visual_state (uint32_t);
404 void update_rec_display ();
407 void map_transport_state ();
408 void map_position_change (nframes64_t);
414 /// The session that we are editing, or 0
415 void color_handler ();
416 ARDOUR::Session *session;
419 // to keep track of the playhead position for control_scroll
420 boost::optional<nframes64_t> _control_scroll_target;
422 PlaylistSelector* _playlist_selector;
424 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
428 double frames_per_unit;
429 nframes64_t leftmost_frame;
430 Editing::ZoomFocus zoom_focus;
431 bool zoomed_to_region;
432 std::list<TAVState> track_states;
435 std::list<VisualState*> undo_visual_stack;
436 std::list<VisualState*> redo_visual_stack;
437 VisualState* current_visual_state (bool with_tracks = true);
438 void undo_visual_state ();
439 void redo_visual_state ();
440 void use_visual_state (VisualState&);
442 void swap_visual_state ();
444 std::vector<VisualState*> visual_states;
445 sigc::connection visual_state_op_connection;
446 void start_visual_state_op (uint32_t n);
447 void cancel_visual_state_op (uint32_t n);
448 bool end_visual_state_op (uint32_t n);
450 nframes64_t leftmost_frame;
451 double frames_per_unit;
452 Editing::ZoomFocus zoom_focus;
454 void set_frames_per_unit (double);
457 Editing::MouseMode mouse_mode;
458 Editing::MidiEditMode midi_edit_mode;
460 int post_maximal_editor_width;
461 int post_maximal_pane_position;
462 int pre_maximal_pane_position;
463 int pre_maximal_editor_width;
464 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
466 Gtk::Notebook the_notebook;
467 Gtk::HPaned edit_pane;
469 Gtk::EventBox meter_base;
471 Gtk::EventBox marker_base;
472 Gtk::HBox marker_box;
473 Gtk::VBox scrollers_rulers_markers_box;
475 void location_changed (ARDOUR::Location *);
476 void location_flags_changed (ARDOUR::Location *, void *);
477 void refresh_location_display ();
478 void refresh_location_display_s (ARDOUR::Change);
479 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
480 void add_new_location (ARDOUR::Location *);
481 void location_gone (ARDOUR::Location *);
482 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
483 gint really_remove_marker (ARDOUR::Location* loc);
484 void goto_nth_marker (int nth);
486 uint32_t location_marker_color;
487 uint32_t location_range_color;
488 uint32_t location_loop_color;
489 uint32_t location_punch_color;
490 uint32_t location_cd_marker_color;
492 struct LocationMarkers {
497 LocationMarkers () : start(0), end(0), valid (true) {}
503 void set_name (const std::string&);
504 void set_position (nframes64_t start, nframes64_t end = 0);
505 void set_color_rgba (uint32_t);
508 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
509 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
510 Marker* entered_marker;
512 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
513 LocationMarkerMap location_markers;
515 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
516 void clear_marker_display ();
517 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
518 bool choose_new_marker_name(std::string &name);
519 void update_cd_marker_display ();
520 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
522 TimeAxisView* clicked_axisview;
523 RouteTimeAxisView* clicked_routeview;
524 /** The last RegionView that was clicked on, or 0 if the last click was not
525 * on a RegionView. This is set up by the canvas event handlers in
526 * editor_canvas_events.cc
528 RegionView* clicked_regionview;
529 RegionSelection latest_regionviews;
530 uint32_t clicked_selection;
531 CrossfadeView* clicked_crossfadeview;
532 ControlPoint* clicked_control_point;
534 void sort_track_selection (TrackSelection* sel = 0);
536 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
537 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
538 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
540 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
542 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, std::vector<RegionView*>*) const;
543 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
544 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
545 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
549 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
550 bool button_release_can_deselect;
552 void catch_vanishing_regionview (RegionView *);
554 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
555 void select_all_tracks ();
557 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
559 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
560 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
561 void set_selected_track_as_side_effect (bool force = false);
562 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
564 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
565 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
566 void collect_new_region_view (RegionView *);
567 void collect_and_select_new_region_view (RegionView *);
569 Gtk::Menu track_context_menu;
570 Gtk::Menu track_region_context_menu;
571 Gtk::Menu track_selection_context_menu;
572 Gtk::Menu track_crossfade_context_menu;
574 Gtk::MenuItem* region_edit_menu_split_item;
575 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
576 Gtk::Menu * track_region_edit_playlist_menu;
577 Gtk::Menu * track_edit_playlist_submenu;
578 Gtk::Menu * track_selection_edit_playlist_submenu;
580 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
581 Gtk::Menu* build_track_context_menu (nframes64_t);
582 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
583 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
584 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
585 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
586 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
587 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
588 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
589 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
590 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
592 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
594 void handle_new_route (ARDOUR::RouteList&);
595 void remove_route (TimeAxisView *);
598 Gtk::HBox global_hpacker;
599 Gtk::VBox global_vpacker;
602 Gdk::Cursor* current_canvas_cursor;
603 void set_canvas_cursor ();
604 Gdk::Cursor* which_grabber_cursor ();
606 ArdourCanvas::Canvas* track_canvas;
608 ArdourCanvas::Text* verbose_canvas_cursor;
609 bool verbose_cursor_visible;
611 void parameter_changed (std::string);
613 bool track_canvas_motion (GdkEvent*);
615 void set_verbose_canvas_cursor (const std::string &, double x, double y);
616 void set_verbose_canvas_cursor_text (const std::string &);
617 void show_verbose_canvas_cursor();
618 void hide_verbose_canvas_cursor();
620 bool verbose_cursor_on; // so far unused
622 Gtk::EventBox time_canvas_event_box;
623 Gtk::EventBox track_canvas_event_box;
624 Gtk::EventBox time_button_event_box;
625 Gtk::EventBox ruler_label_event_box;
627 ArdourCanvas::Group *minsec_group;
628 ArdourCanvas::Pixbuf *logo_item;
629 ArdourCanvas::Group *bbt_group;
630 ArdourCanvas::Group *smpte_group;
631 ArdourCanvas::Group *frame_group;
632 ArdourCanvas::Group *tempo_group;
633 ArdourCanvas::Group *meter_group;
634 ArdourCanvas::Group *marker_group;
635 ArdourCanvas::Group *range_marker_group;
636 ArdourCanvas::Group *transport_marker_group;
637 ArdourCanvas::Group* cd_marker_group;
639 ArdourCanvas::Group* timebar_group;
641 /* These bars never need to be scrolled */
642 ArdourCanvas::Group* meter_bar_group;
643 ArdourCanvas::Group* tempo_bar_group;
644 ArdourCanvas::Group* marker_bar_group;
645 ArdourCanvas::Group* range_marker_bar_group;
646 ArdourCanvas::Group* transport_marker_bar_group;
647 ArdourCanvas::Group* cd_marker_bar_group;
649 /** The group containing all items that require horizontal scrolling. */
650 ArdourCanvas::Group* _background_group;
652 The _master_group is the group containing all items
653 that require horizontal scrolling..
654 It is primarily used to separate canvas items
655 that require horizontal scrolling from those that do not.
657 ArdourCanvas::Group* _master_group;
659 /* The group containing all trackviews. Only scrolled vertically. */
660 ArdourCanvas::Group* _trackview_group;
662 /* The group used for region motion. Sits on top of _trackview_group */
663 ArdourCanvas::Group* _region_motion_group;
666 ruler_metric_smpte = 0,
667 ruler_metric_bbt = 1,
668 ruler_metric_frames = 2,
669 ruler_metric_minsec = 3,
671 ruler_time_tempo = 4,
672 ruler_time_meter = 5,
673 ruler_time_marker = 6,
674 ruler_time_range_marker = 7,
675 ruler_time_transport_marker = 8,
676 ruler_time_cd_marker = 9,
679 static GtkCustomMetric ruler_metrics[4];
680 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
681 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
682 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
683 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
686 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
687 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
688 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
689 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
690 bool no_ruler_shown_update;
692 gint ruler_button_press (GdkEventButton*);
693 gint ruler_button_release (GdkEventButton*);
694 gint ruler_mouse_motion (GdkEventMotion*);
695 bool ruler_scroll (GdkEventScroll* event);
697 Gtk::Widget * ruler_grabbed_widget;
699 void initialize_rulers ();
700 void update_just_smpte ();
701 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
702 void update_fixed_rulers ();
703 void update_tempo_based_rulers ();
704 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
705 void update_ruler_visibility ();
706 void set_ruler_visible (RulerType, bool);
707 void toggle_ruler_visibility (RulerType rt);
708 void ruler_toggled (int);
709 gint ruler_label_button_release (GdkEventButton*);
710 void store_ruler_visibility ();
711 void restore_ruler_visibility ();
713 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
714 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
715 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
716 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
718 enum MinsecRulerScale {
725 MinsecRulerScale minsec_ruler_scale;
727 nframes_t minsec_mark_interval;
728 gint minsec_mark_modulo;
730 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
732 enum SMPTERulerScale {
740 SMPTERulerScale smpte_ruler_scale;
742 nframes_t smpte_mark_interval;
743 gint smpte_mark_modulo;
745 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
755 bbt_show_ticks_detail,
756 bbt_show_ticks_super_detail
759 BBTRulerScale bbt_ruler_scale;
763 uint32_t bbt_bar_helper_on;
764 uint32_t bbt_accent_modulo;
765 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
767 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
768 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
769 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
770 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
772 Gtk::Widget *_ruler_separator;
773 GtkWidget *_smpte_ruler;
774 GtkWidget *_bbt_ruler;
775 GtkWidget *_frames_ruler;
776 GtkWidget *_minsec_ruler;
777 Gtk::Widget *smpte_ruler;
778 Gtk::Widget *bbt_ruler;
779 Gtk::Widget *frames_ruler;
780 Gtk::Widget *minsec_ruler;
781 static Editor *ruler_editor;
783 static const double timebar_height;
784 guint32 visible_timebars;
785 gdouble canvas_timebars_vsize;
786 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
787 Gtk::Menu *editor_ruler_menu;
789 ArdourCanvas::SimpleRect* tempo_bar;
790 ArdourCanvas::SimpleRect* meter_bar;
791 ArdourCanvas::SimpleRect* marker_bar;
792 ArdourCanvas::SimpleRect* range_marker_bar;
793 ArdourCanvas::SimpleRect* transport_marker_bar;
794 ArdourCanvas::SimpleRect* cd_marker_bar;
796 Gtk::Label minsec_label;
797 Gtk::Label bbt_label;
798 Gtk::Label smpte_label;
799 Gtk::Label frame_label;
800 Gtk::Label tempo_label;
801 Gtk::Label meter_label;
802 Gtk::Label mark_label;
803 Gtk::Label range_mark_label;
804 Gtk::Label transport_mark_label;
805 Gtk::Label cd_mark_label;
807 Gtk::VBox time_button_vbox;
808 Gtk::HBox time_button_hbox;
810 friend class EditorCursor;
812 EditorCursor* playhead_cursor;
813 ArdourCanvas::Group* cursor_group;
815 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
817 void cursor_to_region_boundary (bool with_selection, int32_t dir);
818 void cursor_to_next_region_boundary (bool with_selection);
819 void cursor_to_previous_region_boundary (bool with_selection);
820 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
821 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
822 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
823 void cursor_to_selection_start (EditorCursor *);
824 void cursor_to_selection_end (EditorCursor *);
826 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
827 void selected_marker_to_next_region_boundary (bool with_selection);
828 void selected_marker_to_previous_region_boundary (bool with_selection);
829 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
830 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
831 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
832 void selected_marker_to_selection_start ();
833 void selected_marker_to_selection_end ();
835 void select_all_selectables_using_cursor (EditorCursor *, bool);
836 void select_all_selectables_using_edit (bool);
837 void select_all_selectables_between (bool within);
838 void select_range_between ();
840 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
841 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
843 std::vector<nframes64_t> region_boundary_cache;
844 void build_region_boundary_cache ();
847 Gtk::HBox bottom_hbox;
849 Gtk::Table edit_packer;
850 Gtk::VScrollbar edit_vscrollbar;
852 Gtk::Adjustment vertical_adjustment;
853 Gtk::Adjustment horizontal_adjustment;
855 Gtk::Layout controls_layout;
856 bool control_layout_scroll (GdkEventScroll* ev);
857 void controls_layout_size_request (Gtk::Requisition*);
858 sigc::connection controls_layout_size_request_connection;
860 Gtk::HScrollbar edit_hscrollbar;
861 bool _dragging_hscrollbar;
863 void reset_hscrollbar_stepping ();
865 bool hscrollbar_button_press (GdkEventButton*);
866 bool hscrollbar_button_release (GdkEventButton*);
867 void hscrollbar_allocate (Gtk::Allocation &alloc);
869 double _canvas_width;
870 double _canvas_height;
871 double full_canvas_height;
873 bool track_canvas_map_handler (GdkEventAny*);
875 gint edit_controls_button_release (GdkEventButton*);
876 Gtk::Menu *edit_controls_left_menu;
877 Gtk::Menu *edit_controls_right_menu;
879 Gtk::VBox ruler_label_vbox;
880 Gtk::VBox track_canvas_vbox;
881 Gtk::VBox time_canvas_vbox;
882 Gtk::VBox edit_controls_vbox;
883 Gtk::HBox edit_controls_hbox;
885 void control_scroll (float);
886 void access_action (std::string,std::string);
887 bool deferred_control_scroll (nframes64_t);
888 sigc::connection control_scroll_connection;
890 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
892 ArdourCanvas::Group* get_background_group () const { return _background_group; }
893 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
894 double last_trackview_group_vertical_offset;
895 void tie_vertical_scrolling ();
896 void scroll_canvas_horizontally ();
897 void scroll_canvas_vertically ();
899 struct VisualChange {
907 nframes64_t time_origin;
908 double frames_per_unit;
913 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
915 pending = Type (pending | t);
920 VisualChange pending_visual_change;
922 static int _idle_visual_changer (void *arg);
923 int idle_visual_changer ();
925 void queue_visual_change (nframes64_t);
926 void queue_visual_change (double);
927 void queue_visual_change_y (double);
928 void ensure_visual_change_idle_handler ();
930 void end_location_changed (ARDOUR::Location*);
932 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
933 RegionListDisplayModelColumns() {
950 Gtk::TreeModelColumn<Glib::ustring> name;
951 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
952 Gtk::TreeModelColumn<Gdk::Color> color_;
953 Gtk::TreeModelColumn<Glib::ustring> start;
954 Gtk::TreeModelColumn<Glib::ustring> end;
955 Gtk::TreeModelColumn<Glib::ustring> length;
956 Gtk::TreeModelColumn<Glib::ustring> sync;
957 Gtk::TreeModelColumn<Glib::ustring> fadein;
958 Gtk::TreeModelColumn<Glib::ustring> fadeout;
959 Gtk::TreeModelColumn<bool> locked;
960 Gtk::TreeModelColumn<bool> glued;
961 Gtk::TreeModelColumn<bool> muted;
962 Gtk::TreeModelColumn<bool> opaque;
963 Gtk::TreeModelColumn<Glib::ustring> used;
964 Gtk::TreeModelColumn<Glib::ustring> path;
967 RegionListDisplayModelColumns region_list_columns;
968 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
970 Glib::RefPtr<Gtk::TreeStore> region_list_model;
971 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
972 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
974 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
975 void region_list_selection_changed ();
976 sigc::connection region_list_change_connection;
977 void set_selected_in_region_list(RegionSelection&);
978 bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
979 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
980 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
981 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
983 Gtk::Menu *region_list_menu;
984 Gtk::ScrolledWindow region_list_scroller;
985 Gtk::Frame region_list_frame;
987 bool region_list_display_key_press (GdkEventKey *);
988 bool region_list_display_key_release (GdkEventKey *);
989 bool region_list_display_button_press (GdkEventButton *);
990 bool region_list_display_button_release (GdkEventButton *);
991 void region_list_clear ();
992 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
993 void build_region_list_menu ();
994 void show_region_list_display_context_menu (int button, int time);
996 bool show_automatic_regions_in_region_list;
997 Editing::RegionListSortType region_list_sort_type;
999 void reset_region_list_sort_direction (bool);
1000 void reset_region_list_sort_type (Editing::RegionListSortType);
1002 void toggle_full_region_list ();
1003 void toggle_show_auto_regions ();
1005 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1009 Gtk::ScrolledWindow snapshot_display_scroller;
1010 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1011 SnapshotDisplayModelColumns() {
1015 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1016 Gtk::TreeModelColumn<Glib::ustring> real_name;
1019 SnapshotDisplayModelColumns snapshot_display_columns;
1020 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1021 Gtk::TreeView snapshot_display;
1022 Gtk::Menu snapshot_context_menu;
1024 bool snapshot_display_button_press (GdkEventButton*);
1025 void snapshot_display_selection_changed ();
1026 void redisplay_snapshots();
1027 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1029 /* named selections */
1031 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1032 NamedSelectionDisplayModelColumns() {
1036 Gtk::TreeModelColumn<Glib::ustring> text;
1037 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1040 NamedSelectionDisplayModelColumns named_selection_columns;
1041 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1043 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1044 Gtk::ScrolledWindow named_selection_scroller;
1046 void create_named_selection ();
1047 void paste_named_selection (float times);
1048 void remove_selected_named_selections ();
1049 void remove_snapshot (Glib::ustring);
1050 void rename_snapshot (Glib::ustring);
1052 void handle_new_named_selection ();
1053 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1054 void redisplay_named_selections ();
1056 bool named_selection_display_button_release (GdkEventButton *ev);
1057 bool named_selection_display_key_release (GdkEventKey *ev);
1058 void named_selection_display_selection_changed ();
1061 TrackViewList track_views;
1062 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1063 TrackSelection axis_views_from_routes (std::list<ARDOUR::Route *>) const;
1065 static Gdk::Cursor* cross_hair_cursor;
1066 static Gdk::Cursor* trimmer_cursor;
1067 static Gdk::Cursor* selector_cursor;
1068 static Gdk::Cursor* grabber_cursor;
1069 static Gdk::Cursor* grabber_edit_point_cursor;
1070 static Gdk::Cursor* zoom_cursor;
1071 static Gdk::Cursor* time_fx_cursor;
1072 static Gdk::Cursor* fader_cursor;
1073 static Gdk::Cursor* speaker_cursor;
1074 static Gdk::Cursor* midi_pencil_cursor;
1075 static Gdk::Cursor* midi_select_cursor;
1076 static Gdk::Cursor* midi_resize_cursor;
1077 static Gdk::Cursor* midi_erase_cursor;
1078 static Gdk::Cursor* wait_cursor;
1079 static Gdk::Cursor* timebar_cursor;
1080 static Gdk::Cursor* transparent_cursor;
1082 static void build_cursors ();
1084 sigc::connection scroll_connection;
1085 nframes64_t last_update_frame;
1086 void center_screen (nframes64_t);
1087 void center_screen_internal (nframes64_t, float);
1089 void update_current_screen ();
1091 void session_going_away ();
1093 nframes64_t cut_buffer_start;
1094 nframes64_t cut_buffer_length;
1096 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1097 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1098 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1099 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1100 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1101 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1103 /* KEYMAP HANDLING */
1105 void register_actions ();
1107 int ensure_cursor (nframes64_t* pos);
1109 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1110 void handle_new_regions (std::vector<boost::weak_ptr<ARDOUR::Region> >& );
1111 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1112 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1113 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1114 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1115 void redisplay_regions ();
1116 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1117 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1118 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1119 void update_all_region_rows ();
1120 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1121 bool no_region_list_redisplay;
1122 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1124 std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1126 void cut_copy (Editing::CutCopyOp);
1127 bool can_cut_copy () const;
1128 void cut_copy_points (Editing::CutCopyOp);
1129 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1130 void cut_copy_ranges (Editing::CutCopyOp);
1132 void mouse_paste ();
1133 void paste_internal (nframes64_t position, float times);
1135 /* EDITING OPERATIONS */
1137 void reset_point_selection ();
1138 void toggle_region_mute ();
1139 void toggle_region_lock ();
1140 void toggle_region_opaque ();
1141 void toggle_record_enable ();
1142 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1143 void raise_region ();
1144 void raise_region_to_top ();
1145 void lower_region ();
1146 void lower_region_to_bottom ();
1147 void split_region ();
1148 void split_region_at (nframes64_t);
1149 void split_regions_at (nframes64_t, RegionSelection&);
1150 void split_region_at_transients ();
1151 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1152 void crop_region_to_selection ();
1153 void crop_region_to (nframes64_t start, nframes64_t end);
1154 void set_sync_point (nframes64_t, const RegionSelection&);
1155 void set_region_sync_from_edit_point ();
1156 void remove_region_sync();
1157 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1158 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1159 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1160 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1161 void remove_selected_regions ();
1162 void remove_clicked_region ();
1163 void edit_region ();
1164 void rename_region ();
1165 void duplicate_some_regions (RegionSelection&, float times);
1166 void duplicate_selection (float times);
1167 void region_fill_selection ();
1169 void region_fill_track ();
1170 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1171 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1172 void split_multichannel_region();
1173 void reverse_region ();
1174 void strip_region_silence ();
1175 void normalize_region ();
1176 double _last_normalization_value;
1177 void denormalize_region ();
1178 void adjust_region_scale_amplitude (bool up);
1179 void quantize_region ();
1181 void do_insert_time ();
1182 void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool);
1184 void tab_to_transient (bool forward);
1186 void use_region_as_bar ();
1187 void use_range_as_bar ();
1189 void define_one_bar (nframes64_t start, nframes64_t end);
1191 void audition_region_from_region_list ();
1192 void hide_region_from_region_list ();
1193 void remove_region_from_region_list ();
1195 void align (ARDOUR::RegionPoint);
1196 void align_relative (ARDOUR::RegionPoint);
1199 void reset_focus ();
1205 void paste (float times);
1207 int get_prefix (float&, bool&);
1209 void keyboard_paste ();
1210 void keyboard_insert_region_list_selection ();
1212 void region_from_selection ();
1213 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1215 void play_from_start ();
1216 void play_from_edit_point ();
1217 void play_from_edit_point_and_return ();
1218 void play_selected_region ();
1219 void play_edit_range ();
1220 void loop_selected_region ();
1221 void play_location (ARDOUR::Location&);
1222 void loop_location (ARDOUR::Location&);
1224 void temporal_zoom_selection ();
1225 void temporal_zoom_region (bool both_axes);
1226 void toggle_zoom_region (bool both_axes);
1227 bool zoomed_to_region;
1228 void temporal_zoom_session ();
1229 void temporal_zoom (gdouble scale);
1230 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const std::string & op);
1231 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1233 void amplitude_zoom (gdouble scale);
1234 void amplitude_zoom_step (bool in);
1236 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1237 void insert_region_list_selection (float times);
1239 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1241 /* import & embed */
1243 void add_external_audio_action (Editing::ImportMode);
1244 void external_audio_dialog ();
1245 void session_import_dialog ();
1247 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1248 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1250 SoundFileOmega* sfbrowser;
1252 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1254 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1255 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1257 void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1258 void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1260 int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1261 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1262 int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1263 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1265 int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1266 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1267 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1268 boost::shared_ptr<ARDOUR::Track>& existing_track);
1270 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1271 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1273 /* generic interthread progress window */
1275 ArdourDialog* interthread_progress_window;
1276 Gtk::Label interthread_progress_label;
1277 Gtk::VBox interthread_progress_vbox;
1278 Gtk::ProgressBar interthread_progress_bar;
1279 Gtk::Button interthread_cancel_button;
1280 Gtk::Label interthread_cancel_label;
1281 sigc::connection interthread_progress_connection;
1282 void interthread_cancel_clicked ();
1283 void build_interthread_progress_window ();
1284 ARDOUR::InterThreadInfo* current_interthread_info;
1286 AnalysisWindow* analysis_window;
1288 /* import specific info */
1290 struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
1291 Editing::ImportMode mode;
1295 boost::shared_ptr<ARDOUR::Track> track;
1299 EditorImportStatus import_status;
1300 gint import_progress_timeout (void *);
1301 static void *_import_thread (void *);
1302 void* import_thread ();
1303 void finish_import ();
1305 /* to support this ... */
1307 void import_audio (bool as_tracks);
1308 void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
1310 void move_to_start ();
1311 void move_to_end ();
1313 void center_playhead ();
1314 void center_edit_point ();
1315 void edit_cursor_backward ();
1316 void edit_cursor_forward ();
1317 void playhead_forward_to_grid ();
1318 void playhead_backward_to_grid ();
1319 void playhead_backward ();
1320 void playhead_forward ();
1321 void scroll_playhead (bool forward);
1322 void scroll_backward (float pages=0.8f);
1323 void scroll_forward (float pages=0.8f);
1324 void scroll_tracks_down ();
1325 void scroll_tracks_up ();
1326 void delete_sample_forward ();
1327 void delete_sample_backward ();
1328 void delete_screen ();
1329 void search_backwards ();
1330 void search_forwards ();
1332 void clear_markers ();
1333 void clear_ranges ();
1334 void clear_locations ();
1335 void unhide_markers ();
1336 void unhide_ranges ();
1337 void jump_forward_to_mark ();
1338 void jump_backward_to_mark ();
1339 void cursor_align (bool playhead_to_edit);
1341 void remove_last_capture ();
1342 void select_all_selectables_using_time_selection ();
1343 void select_all_selectables_using_loop();
1344 void select_all_selectables_using_punch();
1345 void set_selection_from_range (ARDOUR::Location&);
1346 void set_selection_from_punch ();
1347 void set_selection_from_loop ();
1348 void set_selection_from_region ();
1350 void add_location_mark (nframes64_t where);
1351 void add_location_from_audio_region ();
1352 void add_locations_from_audio_region ();
1353 void add_location_from_selection ();
1354 void set_loop_from_selection (bool play);
1355 void set_punch_from_selection ();
1356 void set_punch_from_region ();
1358 void set_loop_from_edit_range (bool play);
1359 void set_loop_from_region (bool play);
1360 void set_punch_from_edit_range ();
1362 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1363 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1365 void add_location_from_playhead_cursor ();
1366 bool select_new_marker;
1368 void reverse_selection ();
1369 void edit_envelope ();
1371 void start_scrolling ();
1372 void stop_scrolling ();
1374 double last_scrub_x;
1375 int scrubbing_direction;
1376 int scrub_reversals;
1377 int scrub_reverse_distance;
1380 void keyboard_selection_begin ();
1381 void keyboard_selection_finish (bool add);
1382 bool have_pending_keyboard_selection;
1383 nframes64_t pending_keyboard_selection_start;
1385 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1386 void extend_selection_to_end_of_region (bool next);
1387 void extend_selection_to_start_of_region (bool previous);
1389 Editing::SnapType snap_type;
1390 Editing::SnapMode snap_mode;
1392 /// Snap threshold in pixels
1393 double snap_threshold;
1395 void handle_gui_changes (const std::string &, void *);
1396 bool ignore_gui_changes;
1398 void hide_all_tracks (bool with_select);
1404 Gtk::Menu fade_context_menu;
1405 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1407 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1408 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1410 void set_fade_length (bool in);
1411 void toggle_fade_active (bool in);
1412 void set_fade_in_active (bool);
1413 void set_fade_out_active (bool);
1415 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1416 RegionSelection pre_drag_region_selection;
1418 bool _dragging_playhead;
1419 bool _dragging_edit_point;
1421 void marker_drag_motion_callback (GdkEvent*);
1422 void marker_drag_finished_callback (GdkEvent*);
1424 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1426 void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1427 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1428 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1429 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1430 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1432 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1434 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1435 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1437 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1438 void brush (nframes64_t);
1440 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1441 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1442 double clamp_verbose_cursor_x (double);
1443 double clamp_verbose_cursor_y (double);
1445 /* Canvas event handlers */
1447 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1448 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1449 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1450 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1451 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1452 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1453 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1454 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1455 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1456 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1459 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1461 ArdourCanvas::Item *last_item_entered;
1462 int last_item_entered_n;
1465 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1466 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1467 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1468 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1469 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1470 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1471 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1472 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1473 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1475 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1476 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1477 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1478 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1479 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1480 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1482 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1483 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1484 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1485 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1486 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1487 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1488 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1489 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1491 /* non-public event handlers */
1493 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1494 bool track_canvas_scroll (GdkEventScroll* event);
1496 bool track_canvas_scroll_event (GdkEventScroll* event);
1497 bool track_canvas_button_press_event (GdkEventButton* event);
1498 bool track_canvas_button_release_event (GdkEventButton* event);
1499 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1501 Gtk::Allocation canvas_allocation;
1502 void track_canvas_allocate (Gtk::Allocation alloc);
1503 bool track_canvas_size_allocated ();
1504 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1506 void set_playhead_cursor ();
1508 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1509 void kbd_mute_unmute_region ();
1512 void kbd_do_brush (GdkEvent*);
1513 void kbd_do_audition (GdkEvent*);
1515 void handle_new_duration ();
1516 void initialize_canvas ();
1518 /* display control */
1520 bool _show_measures;
1521 /// true if the editor should follow the playhead, otherwise false
1522 bool _follow_playhead;
1523 /// true if waveforms should be shown while recording audio tracks, otherwise false
1524 bool _show_waveforms_recording;
1526 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1528 TempoLines* tempo_lines;
1530 ArdourCanvas::Group* time_line_group;
1532 void hide_measures ();
1533 void draw_measures ();
1534 bool redraw_measures ();
1536 void new_tempo_section ();
1538 void mouse_add_new_tempo_event (nframes64_t where);
1539 void mouse_add_new_meter_event (nframes64_t where);
1541 void remove_tempo_marker (ArdourCanvas::Item*);
1542 void remove_meter_marker (ArdourCanvas::Item*);
1543 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1544 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1546 void edit_tempo_section (ARDOUR::TempoSection*);
1547 void edit_meter_section (ARDOUR::MeterSection*);
1548 void edit_tempo_marker (ArdourCanvas::Item*);
1549 void edit_meter_marker (ArdourCanvas::Item*);
1550 void edit_control_point (ArdourCanvas::Item*);
1552 void marker_menu_edit ();
1553 void marker_menu_remove ();
1554 void marker_menu_rename ();
1555 void marker_menu_lock (bool yn);
1556 void marker_menu_hide ();
1557 void marker_menu_loop_range ();
1558 void marker_menu_select_all_selectables_using_range ();
1559 void marker_menu_select_using_range ();
1560 void marker_menu_separate_regions_using_location ();
1561 void marker_menu_play_from ();
1562 void marker_menu_play_range ();
1563 void marker_menu_set_playhead ();
1564 void marker_menu_set_from_playhead ();
1565 void marker_menu_set_from_selection ();
1566 void marker_menu_range_to_next ();
1567 void new_transport_marker_menu_set_loop ();
1568 void new_transport_marker_menu_set_punch ();
1569 void update_loop_range_view (bool visibility=false);
1570 void update_punch_range_view (bool visibility=false);
1571 void new_transport_marker_menu_popdown ();
1572 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1573 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1574 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1575 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1576 void build_range_marker_menu (bool loop_or_punch);
1577 void build_marker_menu (bool start_or_end);
1578 void build_tm_marker_menu ();
1579 void build_new_transport_marker_menu ();
1581 Gtk::Menu* tm_marker_menu;
1582 Gtk::Menu* marker_menu;
1583 Gtk::Menu* start_end_marker_menu;
1584 Gtk::Menu* range_marker_menu;
1585 Gtk::Menu* transport_marker_menu;
1586 Gtk::Menu* new_transport_marker_menu;
1587 Gtk::Menu* cd_marker_menu;
1588 ArdourCanvas::Item* marker_menu_item;
1590 typedef std::list<Marker*> Marks;
1593 void remove_metric_marks ();
1594 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1596 void compute_current_bbt_points (nframes_t left, nframes_t right);
1597 void tempo_map_changed (ARDOUR::Change);
1598 void redisplay_tempo (bool immediate_redraw);
1600 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1602 double snap_length_beats (nframes64_t start);
1604 uint32_t bbt_beat_subdivision;
1608 Gtk::ToggleButton editor_mixer_button;
1609 Gtk::ToggleButton editor_list_button;
1610 void editor_mixer_button_toggled ();
1611 void editor_list_button_toggled ();
1613 AudioClock edit_point_clock;
1614 AudioClock zoom_range_clock;
1615 Gtk::Button zoom_in_button;
1616 Gtk::Button zoom_out_button;
1617 Gtk::Button zoom_out_full_button;
1618 Gtk::Button zoom_onetoone_button;
1620 Gtk::VBox toolbar_clock_vbox;
1621 Gtk::VBox toolbar_selection_clock_vbox;
1622 Gtk::Table toolbar_selection_clock_table;
1623 Gtk::Label toolbar_selection_cursor_label;
1625 Gtk::HBox mouse_mode_button_box;
1626 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1627 Gtk::ToggleButton mouse_select_button;
1628 Gtk::ToggleButton mouse_move_button;
1629 Gtk::ToggleButton mouse_gain_button;
1630 Gtk::ToggleButton mouse_zoom_button;
1631 Gtk::ToggleButton mouse_timefx_button;
1632 Gtk::ToggleButton mouse_audition_button;
1633 Gtk::ToggleButton mouse_note_button;
1634 GroupedButtons *mouse_mode_button_set;
1635 void mouse_mode_toggled (Editing::MouseMode m);
1636 bool ignore_mouse_mode_toggle;
1638 gint mouse_select_button_release (GdkEventButton*);
1640 Gtk::VBox automation_box;
1641 Gtk::Button automation_mode_button;
1642 Gtk::ToggleButton global_automation_button;
1644 Gtk::ComboBoxText edit_mode_selector;
1645 Gtk::VBox edit_mode_box;
1647 void set_edit_mode (ARDOUR::EditMode);
1648 void cycle_edit_mode ();
1649 void edit_mode_selection_done ();
1651 Gtk::ComboBoxText snap_type_selector;
1652 Gtk::ComboBoxText snap_mode_selector;
1655 std::vector<std::string> snap_type_strings;
1656 std::vector<std::string> snap_mode_strings;
1658 void snap_type_selection_done ();
1659 void snap_mode_selection_done ();
1660 void snap_mode_chosen (Editing::SnapMode);
1661 void snap_type_chosen (Editing::SnapType);
1663 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1664 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1666 Gtk::ComboBoxText zoom_focus_selector;
1667 Gtk::VBox zoom_focus_box;
1669 std::vector<std::string> zoom_focus_strings;
1671 void zoom_focus_selection_done ();
1672 void zoom_focus_chosen (Editing::ZoomFocus);
1674 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1677 Gtk::VBox zoom_vbox;
1679 void zoom_adjustment_changed();
1681 void edit_point_clock_changed();
1683 void setup_toolbar ();
1685 Gtkmm2ext::TearOff* tools_tearoff;
1686 Gtk::HBox toolbar_hbox;
1687 Gtk::EventBox toolbar_base;
1688 Gtk::Frame toolbar_frame;
1692 Gtk::HBox midi_tool_button_box;
1693 Gtk::ToggleButton midi_tool_pencil_button;
1694 Gtk::ToggleButton midi_tool_select_button;
1695 Gtk::ToggleButton midi_tool_resize_button;
1696 Gtk::ToggleButton midi_tool_erase_button;
1697 Gtk::Button midi_panic_button;
1698 Gtk::ToggleButton midi_sound_notes;
1699 GroupedButtons *midi_tool_button_set;
1700 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1701 void midi_panic_button_pressed ();
1702 bool sound_notes () const { return midi_sound_notes.get_active(); }
1704 bool ignore_midi_edit_mode_toggle;
1706 Gtkmm2ext::TearOff* midi_tools_tearoff;
1707 Gtk::HBox midi_toolbar_hbox;
1708 Gtk::EventBox midi_toolbar_base;
1709 Gtk::Frame midi_toolbar_frame;
1711 void setup_midi_toolbar ();
1713 /* selection process */
1715 Selection* selection;
1716 Selection* cut_buffer;
1718 void time_selection_changed ();
1719 void track_selection_changed ();
1720 void region_selection_changed ();
1721 sigc::connection editor_regions_selection_changed_connection;
1722 void sensitize_the_right_region_actions (bool have_selected_regions);
1723 void point_selection_changed ();
1724 void marker_selection_changed ();
1726 void cancel_selection ();
1728 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1729 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1730 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1732 bool audio_region_selection_covers (nframes64_t where);
1734 /* transport range select process */
1736 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1737 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1738 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1741 ArdourCanvas::SimpleRect *bogus_background_rect;
1743 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1744 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1745 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1746 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1747 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1748 ArdourCanvas::SimpleLine *transport_punchin_line;
1749 ArdourCanvas::SimpleLine *transport_punchout_line;
1750 ArdourCanvas::SimpleRect *transport_preroll_rect;
1751 ArdourCanvas::SimpleRect *transport_postroll_rect;
1753 ARDOUR::Location* transport_loop_location();
1754 ARDOUR::Location* transport_punch_location();
1756 ARDOUR::Location *temp_location;
1758 /* object rubberband select process */
1760 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1762 ArdourCanvas::SimpleRect *rubberband_rect;
1764 /* mouse zoom process */
1766 ArdourCanvas::SimpleRect *zoom_rect;
1767 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1769 /* diskstream/route display management */
1770 Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
1771 Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
1773 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1774 RouteDisplayModelColumns() {
1778 add (temporary_visible);
1783 Gtk::TreeModelColumn<Glib::ustring> text;
1784 Gtk::TreeModelColumn<bool> visible;
1785 Gtk::TreeModelColumn<bool> rec_enabled;
1786 Gtk::TreeModelColumn<bool> temporary_visible;
1787 Gtk::TreeModelColumn<bool> is_track;
1788 Gtk::TreeModelColumn<TimeAxisView*> tv;
1789 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1792 void on_tv_rec_enable_toggled(const Glib::ustring& path_string);
1794 RouteDisplayModelColumns route_display_columns;
1795 Glib::RefPtr<Gtk::ListStore> route_display_model;
1796 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1798 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1799 Gtk::ScrolledWindow route_list_scroller;
1800 Gtk::Menu* route_list_menu;
1802 void update_route_visibility ();
1804 void sync_order_keys (const char*);
1805 bool route_redisplay_does_not_sync_order_keys;
1806 bool route_redisplay_does_not_reset_order_keys;
1808 bool route_list_display_button_press (GdkEventButton*);
1809 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1812 const Gtk::SelectionData& data,
1816 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1818 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1819 void route_list_delete (const Gtk::TreeModel::Path&);
1820 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1822 void initial_route_list_display ();
1823 void redisplay_route_list();
1824 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1825 bool ignore_route_list_reorder;
1826 bool no_route_list_redisplay;
1827 bool sync_track_view_list_and_route_list ();
1829 void build_route_list_menu ();
1830 void show_route_list_menu ();
1832 void show_all_routes ();
1833 void hide_all_routes ();
1834 void show_all_audiotracks ();
1835 void hide_all_audiotracks ();
1836 void show_all_audiobus ();
1837 void hide_all_audiobus ();
1839 void set_all_tracks_visibility (bool yn);
1840 void set_all_audio_visibility (int type, bool yn);
1842 /* edit group management */
1844 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1845 GroupListModelColumns () {
1850 Gtk::TreeModelColumn<bool> is_visible;
1851 Gtk::TreeModelColumn<std::string> text;
1852 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1855 GroupListModelColumns group_columns;
1856 Glib::RefPtr<Gtk::ListStore> group_model;
1857 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1859 Gtk::TreeView route_group_display;
1860 Gtk::ScrolledWindow route_group_display_scroller;
1861 Gtk::Menu* route_group_list_menu;
1863 void build_route_group_list_menu (ARDOUR::RouteGroup *);
1864 void activate_all_route_groups ();
1865 void disable_all_route_groups ();
1867 bool in_route_group_row_change;
1868 void route_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1869 void route_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1870 void new_route_group ();
1871 void new_route_group_from_selection ();
1872 void new_route_group_from_rec_enabled ();
1873 void new_route_group_from_soloed ();
1874 void edit_route_group (ARDOUR::RouteGroup *);
1875 void fit_route_group (ARDOUR::RouteGroup *);
1876 void route_group_list_button_clicked ();
1877 gint route_group_list_button_press_event (GdkEventButton* ev);
1878 void add_route_group (ARDOUR::RouteGroup* group);
1879 void remove_selected_route_group ();
1880 void route_groups_changed ();
1881 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1883 Gtk::VBox list_vpacker;
1887 bool autoscroll_active;
1888 int autoscroll_timeout_tag;
1891 int last_autoscroll_x;
1892 int last_autoscroll_y;
1893 uint32_t autoscroll_cnt;
1894 nframes64_t autoscroll_x_distance;
1895 double autoscroll_y_distance;
1897 static gint _autoscroll_canvas (void *);
1898 bool autoscroll_canvas ();
1899 void start_canvas_autoscroll (int x, int y);
1900 void stop_canvas_autoscroll ();
1901 void maybe_autoscroll (GdkEventMotion*, bool);
1902 bool allow_vertical_scroll;
1905 void point_trim (GdkEvent*);
1906 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1907 void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
1908 void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
1910 void thaw_region_after_trim (RegionView& rv);
1912 void trim_region_front();
1913 void trim_region_back();
1914 void trim_region (bool front);
1916 void trim_region_to_edit_point ();
1917 void trim_region_from_edit_point ();
1918 void trim_region_to_loop ();
1919 void trim_region_to_punch ();
1920 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1922 void trim_to_region(bool forward);
1923 void trim_region_to_previous_region_end();
1924 void trim_region_to_next_region_start();
1926 bool show_gain_after_trim;
1930 int convert_drop_to_paths (
1931 std::vector<Glib::ustring>& paths,
1932 const Glib::RefPtr<Gdk::DragContext>& context,
1935 const Gtk::SelectionData& data,
1939 void track_canvas_drag_data_received (
1940 const Glib::RefPtr<Gdk::DragContext>& context,
1943 const Gtk::SelectionData& data,
1947 void region_list_display_drag_data_received (
1948 const Glib::RefPtr<Gdk::DragContext>& context,
1951 const Gtk::SelectionData& data,
1956 const Glib::RefPtr<Gdk::DragContext>& context,
1959 const Gtk::SelectionData& data,
1964 const Glib::RefPtr<Gdk::DragContext>& context,
1967 const Gtk::SelectionData& data,
1972 const Glib::RefPtr<Gdk::DragContext>& context,
1975 const Gtk::SelectionData& data,
1981 int write_region_selection(RegionSelection&);
1982 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1983 void bounce_region_selection ();
1984 void bounce_range_selection (bool replace, bool enable_processing);
1985 void external_edit_region ();
1987 int write_audio_selection (TimeSelection&);
1988 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1990 void write_selection ();
1992 XMLNode *before; /* used in *_reversible_command */
1994 void begin_reversible_command (std::string cmd_name);
1995 void commit_reversible_command ();
1997 void update_title ();
1998 void update_title_s (const std::string & snapshot_name);
2001 Selection* selection;
2002 double frames_per_unit;
2004 State (PublicEditor const * e);
2008 void store_state (State&) const;
2009 void restore_state (State *);
2011 void instant_save ();
2013 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
2015 /* freeze operations */
2017 ARDOUR::InterThreadInfo freeze_status;
2018 gint freeze_progress_timeout (void *);
2019 static void* _freeze_thread (void*);
2020 void* freeze_thread ();
2022 void freeze_route ();
2023 void unfreeze_route ();
2025 /* route-group solo + mute */
2027 void set_route_group_solo (ARDOUR::Route&, bool);
2028 void set_route_group_mute (ARDOUR::Route&, bool);
2032 void duplicate_dialog (bool with_dialog);
2034 nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
2036 /* returns false if mouse pointer is not in track or marker canvas
2038 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2040 /* "whats mine is yours" */
2042 TimeFXDialog* current_timefx;
2044 static void* timefx_thread (void *arg);
2045 void do_timefx (TimeFXDialog&);
2047 int time_stretch (RegionSelection&, float fraction);
2048 int pitch_shift (RegionSelection&, float cents);
2049 void pitch_shift_regions ();
2050 int time_fx (RegionSelection&, float val, bool pitching);
2052 /* editor-mixer strip */
2054 MixerStrip *current_mixer_strip;
2055 bool show_editor_mixer_when_tracks_arrive;
2056 Gtk::VBox current_mixer_strip_vbox;
2057 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2058 void cms_deleted ();
2059 void current_mixer_strip_hidden ();
2060 void current_mixer_strip_removed ();
2062 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2063 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2065 void ensure_all_elements_drawn ();
2067 /* nudging tracks */
2069 void nudge_track (bool use_edit_point, bool forwards);
2073 bool _xfade_visibility;
2076 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
2077 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
2079 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2080 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2082 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2083 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2084 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2086 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2087 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2088 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2089 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2091 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2092 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2093 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2094 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2096 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2097 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2098 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2099 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2100 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2101 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2103 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2104 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2105 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2106 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2107 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2108 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2110 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2111 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2113 ImageFrameSocketHandler* image_socket_listener ;
2116 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2117 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2118 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2119 void xfade_edit_left_region ();
2120 void xfade_edit_right_region ();
2122 static const int32_t default_width = 995;
2123 static const int32_t default_height = 765;
2127 Gtk::Button nudge_forward_button;
2128 Gtk::Button nudge_backward_button;
2129 Gtk::HBox nudge_hbox;
2130 Gtk::VBox nudge_vbox;
2131 AudioClock nudge_clock;
2133 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2135 bool nudge_forward_release (GdkEventButton*);
2136 bool nudge_backward_release (GdkEventButton*);
2140 void apply_filter (ARDOUR::Filter&, std::string cmd);
2142 /* handling cleanup */
2144 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2146 std::vector<sigc::connection> session_connections;
2148 /* tracking step changes of track height */
2150 TimeAxisView* current_stepping_trackview;
2151 ARDOUR::microseconds_t last_track_height_step_timestamp;
2152 gint track_height_step_timeout();
2153 sigc::connection step_timeout;
2155 TimeAxisView* entered_track;
2156 RegionView* entered_regionview;
2159 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2160 bool clear_entered_track;
2161 bool left_track_canvas (GdkEventCrossing*);
2162 bool entered_track_canvas (GdkEventCrossing*);
2163 void set_entered_track (TimeAxisView*);
2164 void set_entered_regionview (RegionView*);
2165 void ensure_track_visible (TimeAxisView*);
2166 gint left_automation_track ();
2168 bool _new_regionviews_show_envelope;
2170 void reset_canvas_action_sensitivity (bool);
2171 void toggle_gain_envelope_visibility ();
2172 void toggle_gain_envelope_active ();
2173 void reset_region_gain_envelopes ();
2175 bool on_key_press_event (GdkEventKey*);
2176 bool on_key_release_event (GdkEventKey*);
2178 void session_state_saved (std::string);
2180 Glib::RefPtr<Gtk::Action> undo_action;
2181 Glib::RefPtr<Gtk::Action> redo_action;
2183 void history_changed ();
2185 Gtk::HBox status_bar_hpacker;
2187 Editing::EditPoint _edit_point;
2189 Gtk::ComboBoxText edit_point_selector;
2191 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2192 void cycle_edit_point (bool with_marker);
2193 void set_edit_point ();
2194 void edit_point_selection_done ();
2195 void edit_point_chosen (Editing::EditPoint);
2196 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2197 std::vector<std::string> edit_point_strings;
2199 void selected_marker_moved (ARDOUR::Location*);
2200 sigc::connection edit_point_clock_connection_a;
2201 sigc::connection edit_point_clock_connection_b;
2203 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2205 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2206 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2208 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2210 sigc::connection fast_screen_update_connection;
2211 gint start_updating ();
2212 gint stop_updating ();
2213 void fast_update_strips ();
2214 bool meters_running;
2216 void select_next_route ();
2217 void select_prev_route ();
2219 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2221 RhythmFerret* rhythm_ferret;
2222 BundleManager* _bundle_manager;
2223 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2225 void fit_tracks (TrackSelection &);
2226 void fit_selected_tracks ();
2227 void set_track_height (uint32_t h);
2229 void remove_tracks ();
2230 void toggle_tracks_active ();
2235 friend gboolean _idle_resize (gpointer);
2236 int32_t _pending_resize_amount;
2237 TimeAxisView* _pending_resize_view;
2239 void visible_order_range (int*, int*) const;
2242 bool _pending_locate_request;
2244 EditorSummary* _summary;
2245 void region_view_added (RegionView *);
2247 void update_canvas_now ();
2248 void streamview_height_changed ();
2250 EditorGroupTabs* _group_tabs;
2252 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
2255 friend class RegionDrag;
2256 friend class RegionMoveDrag;
2257 friend class RegionSpliceDrag;
2258 friend class TrimDrag;
2259 friend class MeterMarkerDrag;
2260 friend class TempoMarkerDrag;
2261 friend class CursorDrag;
2262 friend class FadeInDrag;
2263 friend class FadeOutDrag;
2264 friend class MarkerDrag;
2265 friend class RegionGainDrag;
2266 friend class ControlPointDrag;
2267 friend class LineDrag;
2268 friend class RubberbandSelectDrag;
2269 friend class TimeFXDrag;
2270 friend class ScrubDrag;
2271 friend class SelectionDrag;
2272 friend class RangeMarkerBarDrag;
2273 friend class MouseZoomDrag;
2274 friend class RegionCreateDrag;
2275 friend class RegionMotionDrag;
2276 friend class RegionInsertDrag;
2278 friend class EditorSummary;
2279 friend class EditorGroupTabs;
2282 #endif /* __ardour_editor_h__ */