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);
143 class Editor : public PublicEditor
149 void connect_to_session (ARDOUR::Session *);
150 ARDOUR::Session* current_session() const { return session; }
152 virtual bool have_idled () const { return _have_idled; }
154 nframes64_t leftmost_position() const { return leftmost_frame; }
156 nframes64_t current_page_frames() const {
157 return (nframes64_t) floor (_canvas_width * frames_per_unit);
160 double canvas_height () const {
161 return _canvas_height;
164 void cycle_snap_mode ();
165 void cycle_snap_choice ();
166 void set_snap_to (Editing::SnapType);
167 void set_snap_mode (Editing::SnapMode);
168 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
170 void undo (uint32_t n = 1);
171 void redo (uint32_t n = 1);
173 XMLNode& get_state ();
174 int set_state (const XMLNode& );
176 void set_mouse_mode (Editing::MouseMode, bool force=true);
177 void step_mouse_mode (bool next);
178 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
180 void set_midi_edit_cursor (Editing::MidiEditMode);
181 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
182 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
185 void add_imageframe_time_axis(const std::string & track_name, void*) ;
186 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
187 void connect_to_image_compositor() ;
188 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
191 TimeAxisView* get_named_time_axis(const std::string & name) ;
192 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
193 void add_to_idle_resize (TimeAxisView*, uint32_t);
195 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
197 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
198 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
199 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
201 #ifdef USE_RUBBERBAND
202 std::vector<std::string> rb_opt_strings;
205 /* option editor-access */
207 void set_show_waveforms_recording (bool yn);
208 bool show_waveforms_recording() const { return _show_waveforms_recording; }
210 /* things that need to be public to be used in the main menubar */
212 void new_region_from_selection ();
213 void separate_regions_between (const TimeSelection&);
214 void separate_region_from_selection ();
215 void separate_region_from_punch ();
216 void separate_region_from_loop ();
217 void separate_regions_using_location (ARDOUR::Location&);
218 void toggle_playback (bool with_abort);
219 void transition_to_rolling (bool forward);
223 nframes64_t unit_to_frame (double unit) const {
224 return (nframes64_t) rint (unit * frames_per_unit);
227 double frame_to_unit (nframes64_t frame) const {
228 return rint ((double) frame / (double) frames_per_unit);
231 double frame_to_unit (double frame) const {
232 return rint (frame / frames_per_unit);
235 /* NOTE: these functions assume that the "pixel" coordinate is
236 the result of using the world->canvas affine transform on a
237 world coordinate. These coordinates already take into
238 account any scrolling carried out by adjusting the
242 nframes64_t pixel_to_frame (double pixel) const {
244 /* pixel can be less than zero when motion events
245 are processed. since we've already run the world->canvas
246 affine, that means that the location *really* is "off
247 to the right" and thus really is "before the start".
251 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
257 gulong frame_to_pixel (nframes64_t frame) const {
258 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
261 void flush_canvas ();
265 Selection& get_selection() const { return *selection; }
266 Selection& get_cut_buffer() const { return *cut_buffer; }
268 bool extend_selection_to_track (TimeAxisView&);
270 void play_selection ();
271 void select_all_in_track (Selection::Operation op);
272 void select_all (Selection::Operation op);
273 void invert_selection_in_track ();
274 void invert_selection ();
275 void deselect_all ();
279 void set_show_measures (bool yn);
280 bool show_measures () const { return _show_measures; }
282 /* analysis window */
284 void analyze_region_selection();
285 void analyze_range_selection();
289 void export_audio ();
290 void export_selection ();
291 void export_range ();
292 void export_region ();
294 void add_toplevel_controls (Gtk::Container&);
295 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
297 void set_zoom_focus (Editing::ZoomFocus);
298 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
299 double get_current_zoom () const { return frames_per_unit; }
301 void temporal_zoom_step (bool coarser);
303 /* stuff that AudioTimeAxisView and related classes use */
305 PlaylistSelector& playlist_selector() const;
306 void route_name_changed (TimeAxisView *);
307 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
309 void new_playlists (TimeAxisView* v);
310 void copy_playlists (TimeAxisView* v);
311 void clear_playlists (TimeAxisView* v);
313 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
314 void get_onscreen_tracks (TrackViewList&);
316 Width editor_mixer_strip_width;
317 void maybe_add_mixer_strip_width (XMLNode&);
318 void show_editor_mixer (bool yn);
319 void create_editor_mixer ();
320 void show_editor_list (bool yn);
321 void set_selected_mixer_strip (TimeAxisView&);
322 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
323 void show_track_in_display (TimeAxisView& tv);
325 /* nudge is initiated by transport controls owned by ARDOUR_UI */
327 void nudge_forward (bool next, bool force_playhead);
328 void nudge_backward (bool next, bool force_playhead);
330 /* nudge initiated from context menu */
332 void nudge_forward_capture_offset ();
333 void nudge_backward_capture_offset ();
335 /* playhead/screen stuff */
337 void set_follow_playhead (bool yn);
338 void toggle_follow_playhead ();
339 bool follow_playhead() const { return _follow_playhead; }
340 bool dragging_playhead () const { return _dragging_playhead; }
342 void toggle_zero_line_visibility ();
343 void toggle_waveforms_while_recording ();
344 void toggle_measure_visibility ();
345 void toggle_logo_visibility ();
347 double get_physical_screen_width () const { return physical_screen_width; };
348 double physical_screen_width;
349 double physical_screen_height;
353 void toggle_selected_region_fades (int dir);
354 void update_region_fade_visibility ();
355 bool xfade_visibility() const { return _xfade_visibility; }
356 void update_xfade_visibility ();
358 /* redirect shared ops menu. caller must free returned menu */
360 Gtk::Menu* redirect_menu ();
362 /* floating windows/transient */
364 void ensure_float (Gtk::Window&);
368 void scroll_tracks_down_line ();
369 void scroll_tracks_up_line ();
371 void move_selected_tracks (bool up);
373 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
374 void prepare_for_cleanup ();
375 void finish_cleanup ();
377 void maximise_editing_space();
378 void restore_editing_space();
380 void reset_x_origin (nframes64_t);
381 void reset_y_origin (double);
382 void reset_zoom (double);
383 void reposition_and_zoom (nframes64_t, double);
385 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
387 bool update_mouse_speed ();
388 bool decelerate_mouse_speed ();
390 void toggle_meter_updating();
392 void show_rhythm_ferret();
393 void show_bundle_manager ();
394 void show_global_port_matrix (ARDOUR::DataType);
396 void goto_visual_state (uint32_t);
397 void save_visual_state (uint32_t);
399 void queue_draw_resize_line (int at);
400 void start_resize_line_ops ();
401 void end_resize_line_ops ();
404 void map_transport_state ();
405 void map_position_change (nframes64_t);
408 bool on_expose_event (GdkEventExpose*);
412 /// The session that we are editing, or 0
413 void color_handler ();
414 ARDOUR::Session *session;
417 // to keep track of the playhead position for control_scroll
418 boost::optional<nframes64_t> _control_scroll_target;
420 PlaylistSelector* _playlist_selector;
422 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
426 double frames_per_unit;
427 nframes64_t leftmost_frame;
428 Editing::ZoomFocus zoom_focus;
429 bool zoomed_to_region;
430 std::list<TAVState> track_states;
433 std::list<VisualState*> undo_visual_stack;
434 std::list<VisualState*> redo_visual_stack;
435 VisualState* current_visual_state (bool with_tracks = true);
436 void undo_visual_state ();
437 void redo_visual_state ();
438 void use_visual_state (VisualState&);
440 void swap_visual_state ();
442 std::vector<VisualState*> visual_states;
443 sigc::connection visual_state_op_connection;
444 void start_visual_state_op (uint32_t n);
445 void cancel_visual_state_op (uint32_t n);
446 bool end_visual_state_op (uint32_t n);
448 nframes64_t leftmost_frame;
449 double frames_per_unit;
450 Editing::ZoomFocus zoom_focus;
452 void set_frames_per_unit (double);
455 Editing::MouseMode mouse_mode;
456 Editing::MidiEditMode midi_edit_mode;
458 int post_maximal_editor_width;
459 int post_maximal_pane_position;
460 int pre_maximal_pane_position;
461 int pre_maximal_editor_width;
462 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
464 Gtk::Notebook the_notebook;
465 Gtk::HPaned edit_pane;
467 Gtk::EventBox meter_base;
469 Gtk::EventBox marker_base;
470 Gtk::HBox marker_box;
471 Gtk::VBox scrollers_rulers_markers_box;
473 void location_changed (ARDOUR::Location *);
474 void location_flags_changed (ARDOUR::Location *, void *);
475 void refresh_location_display ();
476 void refresh_location_display_s (ARDOUR::Change);
477 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
478 void add_new_location (ARDOUR::Location *);
479 void location_gone (ARDOUR::Location *);
480 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
481 gint really_remove_marker (ARDOUR::Location* loc);
482 void goto_nth_marker (int nth);
484 uint32_t location_marker_color;
485 uint32_t location_range_color;
486 uint32_t location_loop_color;
487 uint32_t location_punch_color;
488 uint32_t location_cd_marker_color;
490 struct LocationMarkers {
495 LocationMarkers () : start(0), end(0), valid (true) {}
501 void set_name (const std::string&);
502 void set_position (nframes64_t start, nframes64_t end = 0);
503 void set_color_rgba (uint32_t);
506 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
507 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
508 Marker* entered_marker;
510 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
511 LocationMarkerMap location_markers;
513 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
514 void clear_marker_display ();
515 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
516 bool choose_new_marker_name(std::string &name);
517 void update_cd_marker_display ();
518 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
520 TimeAxisView* clicked_axisview;
521 RouteTimeAxisView* clicked_routeview;
522 /** The last RegionView that was clicked on, or 0 if the last click was not
523 * on a RegionView. This is set up by the canvas event handlers in
524 * editor_canvas_events.cc
526 RegionView* clicked_regionview;
527 RegionSelection latest_regionviews;
528 uint32_t clicked_selection;
529 CrossfadeView* clicked_crossfadeview;
530 ControlPoint* clicked_control_point;
532 void sort_track_selection (TrackSelection* sel = 0);
534 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
535 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
536 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
538 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
540 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, std::vector<RegionView*>*) const;
541 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
542 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
543 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
547 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
548 bool button_release_can_deselect;
550 void catch_vanishing_regionview (RegionView *);
552 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
553 void select_all_tracks ();
555 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
557 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
558 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
559 void set_selected_track_as_side_effect (bool force = false);
560 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
562 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
563 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
564 void collect_new_region_view (RegionView *);
565 void collect_and_select_new_region_view (RegionView *);
567 Gtk::Menu track_context_menu;
568 Gtk::Menu track_region_context_menu;
569 Gtk::Menu track_selection_context_menu;
570 Gtk::Menu track_crossfade_context_menu;
572 Gtk::MenuItem* region_edit_menu_split_item;
573 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
574 Gtk::Menu * track_region_edit_playlist_menu;
575 Gtk::Menu * track_edit_playlist_submenu;
576 Gtk::Menu * track_selection_edit_playlist_submenu;
578 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
579 Gtk::Menu* build_track_context_menu (nframes64_t);
580 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
581 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
582 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
583 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
584 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
585 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
586 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
587 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
588 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
590 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
592 void handle_new_route (ARDOUR::RouteList&);
593 void remove_route (TimeAxisView *);
596 Gtk::HBox global_hpacker;
597 Gtk::VBox global_vpacker;
600 bool need_resize_line;
602 int old_resize_line_y;
604 Gdk::Cursor* current_canvas_cursor;
605 void set_canvas_cursor ();
606 Gdk::Cursor* which_grabber_cursor ();
608 ArdourCanvas::Canvas* track_canvas;
610 ArdourCanvas::Text* verbose_canvas_cursor;
611 bool verbose_cursor_visible;
613 void parameter_changed (std::string);
615 bool track_canvas_motion (GdkEvent*);
617 void set_verbose_canvas_cursor (const std::string &, double x, double y);
618 void set_verbose_canvas_cursor_text (const std::string &);
619 void show_verbose_canvas_cursor();
620 void hide_verbose_canvas_cursor();
622 bool verbose_cursor_on; // so far unused
624 Gtk::EventBox time_canvas_event_box;
625 Gtk::EventBox track_canvas_event_box;
626 Gtk::EventBox time_button_event_box;
627 Gtk::EventBox ruler_label_event_box;
629 ArdourCanvas::Group *minsec_group;
630 ArdourCanvas::Pixbuf *logo_item;
631 ArdourCanvas::Group *bbt_group;
632 ArdourCanvas::Group *smpte_group;
633 ArdourCanvas::Group *frame_group;
634 ArdourCanvas::Group *tempo_group;
635 ArdourCanvas::Group *meter_group;
636 ArdourCanvas::Group *marker_group;
637 ArdourCanvas::Group *range_marker_group;
638 ArdourCanvas::Group *transport_marker_group;
639 ArdourCanvas::Group* cd_marker_group;
641 ArdourCanvas::Group* timebar_group;
643 /* These bars never need to be scrolled */
644 ArdourCanvas::Group* meter_bar_group;
645 ArdourCanvas::Group* tempo_bar_group;
646 ArdourCanvas::Group* marker_bar_group;
647 ArdourCanvas::Group* range_marker_bar_group;
648 ArdourCanvas::Group* transport_marker_bar_group;
649 ArdourCanvas::Group* cd_marker_bar_group;
651 /** The group containing all items that require horizontal scrolling. */
652 ArdourCanvas::Group* _background_group;
654 The _master_group is the group containing all items
655 that require horizontal scrolling..
656 It is primarily used to separate canvas items
657 that require horizontal scrolling from those that do not.
659 ArdourCanvas::Group* _master_group;
661 /* The group containing all trackviews. Only scrolled vertically. */
662 ArdourCanvas::Group* _trackview_group;
664 /* The group used for region motion. Sits on top of _trackview_group */
665 ArdourCanvas::Group* _region_motion_group;
668 ruler_metric_smpte = 0,
669 ruler_metric_bbt = 1,
670 ruler_metric_frames = 2,
671 ruler_metric_minsec = 3,
673 ruler_time_tempo = 4,
674 ruler_time_meter = 5,
675 ruler_time_marker = 6,
676 ruler_time_range_marker = 7,
677 ruler_time_transport_marker = 8,
678 ruler_time_cd_marker = 9,
681 static GtkCustomMetric ruler_metrics[4];
682 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
683 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
686 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
687 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
688 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
689 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
690 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
691 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
692 bool no_ruler_shown_update;
694 gint ruler_button_press (GdkEventButton*);
695 gint ruler_button_release (GdkEventButton*);
696 gint ruler_mouse_motion (GdkEventMotion*);
697 bool ruler_scroll (GdkEventScroll* event);
699 Gtk::Widget * ruler_grabbed_widget;
701 void initialize_rulers ();
702 void update_just_smpte ();
703 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
704 void update_fixed_rulers ();
705 void update_tempo_based_rulers ();
706 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
707 void update_ruler_visibility ();
708 void set_ruler_visible (RulerType, bool);
709 void toggle_ruler_visibility (RulerType rt);
710 void ruler_toggled (int);
711 gint ruler_label_button_release (GdkEventButton*);
712 void store_ruler_visibility ();
713 void restore_ruler_visibility ();
715 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
716 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
717 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
718 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
720 enum MinsecRulerScale {
727 MinsecRulerScale minsec_ruler_scale;
729 nframes_t minsec_mark_interval;
730 gint minsec_mark_modulo;
732 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
734 enum SMPTERulerScale {
742 SMPTERulerScale smpte_ruler_scale;
744 nframes_t smpte_mark_interval;
745 gint smpte_mark_modulo;
747 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
757 bbt_show_ticks_detail,
758 bbt_show_ticks_super_detail
761 BBTRulerScale bbt_ruler_scale;
765 uint32_t bbt_bar_helper_on;
766 uint32_t bbt_accent_modulo;
767 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
769 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
770 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
771 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
772 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
774 Gtk::Widget *_ruler_separator;
775 GtkWidget *_smpte_ruler;
776 GtkWidget *_bbt_ruler;
777 GtkWidget *_frames_ruler;
778 GtkWidget *_minsec_ruler;
779 Gtk::Widget *smpte_ruler;
780 Gtk::Widget *bbt_ruler;
781 Gtk::Widget *frames_ruler;
782 Gtk::Widget *minsec_ruler;
783 static Editor *ruler_editor;
785 static const double timebar_height;
786 guint32 visible_timebars;
787 gdouble canvas_timebars_vsize;
788 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
789 Gtk::Menu *editor_ruler_menu;
791 ArdourCanvas::SimpleRect* tempo_bar;
792 ArdourCanvas::SimpleRect* meter_bar;
793 ArdourCanvas::SimpleRect* marker_bar;
794 ArdourCanvas::SimpleRect* range_marker_bar;
795 ArdourCanvas::SimpleRect* transport_marker_bar;
796 ArdourCanvas::SimpleRect* cd_marker_bar;
798 Gtk::Label minsec_label;
799 Gtk::Label bbt_label;
800 Gtk::Label smpte_label;
801 Gtk::Label frame_label;
802 Gtk::Label tempo_label;
803 Gtk::Label meter_label;
804 Gtk::Label mark_label;
805 Gtk::Label range_mark_label;
806 Gtk::Label transport_mark_label;
807 Gtk::Label cd_mark_label;
809 Gtk::VBox time_button_vbox;
810 Gtk::HBox time_button_hbox;
812 friend class EditorCursor;
814 EditorCursor* playhead_cursor;
815 ArdourCanvas::Group* cursor_group;
817 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
819 void cursor_to_region_boundary (bool with_selection, int32_t dir);
820 void cursor_to_next_region_boundary (bool with_selection);
821 void cursor_to_previous_region_boundary (bool with_selection);
822 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
823 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
824 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
825 void cursor_to_selection_start (EditorCursor *);
826 void cursor_to_selection_end (EditorCursor *);
828 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
829 void selected_marker_to_next_region_boundary (bool with_selection);
830 void selected_marker_to_previous_region_boundary (bool with_selection);
831 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
832 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
833 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
834 void selected_marker_to_selection_start ();
835 void selected_marker_to_selection_end ();
837 void select_all_selectables_using_cursor (EditorCursor *, bool);
838 void select_all_selectables_using_edit (bool);
839 void select_all_selectables_between (bool within);
840 void select_range_between ();
842 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
843 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
845 std::vector<nframes64_t> region_boundary_cache;
846 void build_region_boundary_cache ();
849 Gtk::HBox bottom_hbox;
851 Gtk::Table edit_packer;
852 Gtk::VScrollbar edit_vscrollbar;
854 Gtk::Adjustment vertical_adjustment;
855 Gtk::Adjustment horizontal_adjustment;
857 Gtk::Layout controls_layout;
858 bool control_layout_scroll (GdkEventScroll* ev);
859 void controls_layout_size_request (Gtk::Requisition*);
860 sigc::connection controls_layout_size_request_connection;
862 Gtk::HScrollbar edit_hscrollbar;
863 bool _dragging_hscrollbar;
865 void reset_hscrollbar_stepping ();
867 bool hscrollbar_button_press (GdkEventButton*);
868 bool hscrollbar_button_release (GdkEventButton*);
869 void hscrollbar_allocate (Gtk::Allocation &alloc);
871 double _canvas_width;
872 double _canvas_height;
873 double full_canvas_height;
875 bool track_canvas_map_handler (GdkEventAny*);
877 gint edit_controls_button_release (GdkEventButton*);
878 Gtk::Menu *edit_controls_left_menu;
879 Gtk::Menu *edit_controls_right_menu;
881 Gtk::VBox ruler_label_vbox;
882 Gtk::VBox track_canvas_vbox;
883 Gtk::VBox time_canvas_vbox;
884 Gtk::VBox edit_controls_vbox;
885 Gtk::HBox edit_controls_hbox;
887 void control_scroll (float);
888 void access_action (std::string,std::string);
889 bool deferred_control_scroll (nframes64_t);
890 sigc::connection control_scroll_connection;
892 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
894 ArdourCanvas::Group* get_background_group () const { return _background_group; }
895 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
896 double last_trackview_group_vertical_offset;
897 void tie_vertical_scrolling ();
898 void scroll_canvas_horizontally ();
899 void scroll_canvas_vertically ();
901 struct VisualChange {
909 nframes64_t time_origin;
910 double frames_per_unit;
915 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
919 VisualChange pending_visual_change;
921 static int _idle_visual_changer (void *arg);
922 int idle_visual_changer ();
924 void queue_visual_change (nframes64_t);
925 void queue_visual_change (double);
926 void queue_visual_change_y (double);
928 void end_location_changed (ARDOUR::Location*);
930 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
931 RegionListDisplayModelColumns() {
948 Gtk::TreeModelColumn<Glib::ustring> name;
949 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
950 Gtk::TreeModelColumn<Gdk::Color> color_;
951 Gtk::TreeModelColumn<Glib::ustring> start;
952 Gtk::TreeModelColumn<Glib::ustring> end;
953 Gtk::TreeModelColumn<Glib::ustring> length;
954 Gtk::TreeModelColumn<Glib::ustring> sync;
955 Gtk::TreeModelColumn<Glib::ustring> fadein;
956 Gtk::TreeModelColumn<Glib::ustring> fadeout;
957 Gtk::TreeModelColumn<bool> locked;
958 Gtk::TreeModelColumn<bool> glued;
959 Gtk::TreeModelColumn<bool> muted;
960 Gtk::TreeModelColumn<bool> opaque;
961 Gtk::TreeModelColumn<Glib::ustring> used;
962 Gtk::TreeModelColumn<Glib::ustring> path;
965 RegionListDisplayModelColumns region_list_columns;
966 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
968 Glib::RefPtr<Gtk::TreeStore> region_list_model;
969 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
970 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
972 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
973 void region_list_selection_changed ();
974 sigc::connection region_list_change_connection;
975 void set_selected_in_region_list(RegionSelection&);
976 bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
977 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
978 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
979 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
981 Gtk::Menu *region_list_menu;
982 Gtk::ScrolledWindow region_list_scroller;
983 Gtk::Frame region_list_frame;
985 bool region_list_display_key_press (GdkEventKey *);
986 bool region_list_display_key_release (GdkEventKey *);
987 bool region_list_display_button_press (GdkEventButton *);
988 bool region_list_display_button_release (GdkEventButton *);
989 void region_list_clear ();
990 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
991 void build_region_list_menu ();
992 void show_region_list_display_context_menu (int button, int time);
994 bool show_automatic_regions_in_region_list;
995 Editing::RegionListSortType region_list_sort_type;
997 void reset_region_list_sort_direction (bool);
998 void reset_region_list_sort_type (Editing::RegionListSortType);
1000 void toggle_full_region_list ();
1001 void toggle_show_auto_regions ();
1003 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1007 Gtk::ScrolledWindow snapshot_display_scroller;
1008 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1009 SnapshotDisplayModelColumns() {
1013 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1014 Gtk::TreeModelColumn<Glib::ustring> real_name;
1017 SnapshotDisplayModelColumns snapshot_display_columns;
1018 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1019 Gtk::TreeView snapshot_display;
1020 Gtk::Menu snapshot_context_menu;
1022 bool snapshot_display_button_press (GdkEventButton*);
1023 void snapshot_display_selection_changed ();
1024 void redisplay_snapshots();
1025 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1027 /* named selections */
1029 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1030 NamedSelectionDisplayModelColumns() {
1034 Gtk::TreeModelColumn<Glib::ustring> text;
1035 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1038 NamedSelectionDisplayModelColumns named_selection_columns;
1039 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1041 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1042 Gtk::ScrolledWindow named_selection_scroller;
1044 void create_named_selection ();
1045 void paste_named_selection (float times);
1046 void remove_selected_named_selections ();
1047 void remove_snapshot (Glib::ustring);
1048 void rename_snapshot (Glib::ustring);
1050 void handle_new_named_selection ();
1051 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1052 void redisplay_named_selections ();
1054 bool named_selection_display_button_release (GdkEventButton *ev);
1055 bool named_selection_display_key_release (GdkEventKey *ev);
1056 void named_selection_display_selection_changed ();
1059 TrackViewList track_views;
1060 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1062 static Gdk::Cursor* cross_hair_cursor;
1063 static Gdk::Cursor* trimmer_cursor;
1064 static Gdk::Cursor* selector_cursor;
1065 static Gdk::Cursor* grabber_cursor;
1066 static Gdk::Cursor* grabber_edit_point_cursor;
1067 static Gdk::Cursor* zoom_cursor;
1068 static Gdk::Cursor* time_fx_cursor;
1069 static Gdk::Cursor* fader_cursor;
1070 static Gdk::Cursor* speaker_cursor;
1071 static Gdk::Cursor* midi_pencil_cursor;
1072 static Gdk::Cursor* midi_select_cursor;
1073 static Gdk::Cursor* midi_resize_cursor;
1074 static Gdk::Cursor* midi_erase_cursor;
1075 static Gdk::Cursor* wait_cursor;
1076 static Gdk::Cursor* timebar_cursor;
1077 static Gdk::Cursor* transparent_cursor;
1079 static void build_cursors ();
1081 sigc::connection scroll_connection;
1082 nframes64_t last_update_frame;
1083 void center_screen (nframes64_t);
1084 void center_screen_internal (nframes64_t, float);
1086 void update_current_screen ();
1088 void session_going_away ();
1090 nframes64_t cut_buffer_start;
1091 nframes64_t cut_buffer_length;
1093 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1094 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1095 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1096 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1097 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1098 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1100 /* KEYMAP HANDLING */
1102 void register_actions ();
1104 int ensure_cursor (nframes64_t* pos);
1106 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1107 void handle_new_regions (std::vector<boost::weak_ptr<ARDOUR::Region> >& );
1108 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1109 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1110 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1111 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1112 void redisplay_regions ();
1113 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1114 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1115 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1116 void update_all_region_rows ();
1117 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1118 bool no_region_list_redisplay;
1119 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1121 std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1123 void cut_copy (Editing::CutCopyOp);
1124 bool can_cut_copy () const;
1125 void cut_copy_points (Editing::CutCopyOp);
1126 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1127 void cut_copy_ranges (Editing::CutCopyOp);
1129 void mouse_paste ();
1130 void paste_internal (nframes64_t position, float times);
1132 /* EDITING OPERATIONS */
1134 void reset_point_selection ();
1135 void toggle_region_mute ();
1136 void toggle_region_lock ();
1137 void toggle_region_opaque ();
1138 void toggle_record_enable ();
1139 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1140 void raise_region ();
1141 void raise_region_to_top ();
1142 void lower_region ();
1143 void lower_region_to_bottom ();
1144 void split_region ();
1145 void split_region_at (nframes64_t);
1146 void split_regions_at (nframes64_t, RegionSelection&);
1147 void split_region_at_transients ();
1148 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1149 void crop_region_to_selection ();
1150 void crop_region_to (nframes64_t start, nframes64_t end);
1151 void set_sync_point (nframes64_t, const RegionSelection&);
1152 void set_region_sync_from_edit_point ();
1153 void remove_region_sync();
1154 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1155 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1156 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1157 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1158 void remove_selected_regions ();
1159 void remove_clicked_region ();
1160 void edit_region ();
1161 void rename_region ();
1162 void duplicate_some_regions (RegionSelection&, float times);
1163 void duplicate_selection (float times);
1164 void region_fill_selection ();
1166 void region_fill_track ();
1167 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1168 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1169 void split_multichannel_region();
1170 void reverse_region ();
1171 void strip_region_silence ();
1172 void normalize_region ();
1173 void denormalize_region ();
1174 void adjust_region_scale_amplitude (bool up);
1175 void quantize_region ();
1177 void do_insert_time ();
1178 void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool);
1180 void tab_to_transient (bool forward);
1182 void use_region_as_bar ();
1183 void use_range_as_bar ();
1185 void define_one_bar (nframes64_t start, nframes64_t end);
1187 void audition_region_from_region_list ();
1188 void hide_region_from_region_list ();
1189 void remove_region_from_region_list ();
1191 void align (ARDOUR::RegionPoint);
1192 void align_relative (ARDOUR::RegionPoint);
1195 void reset_focus ();
1201 void paste (float times);
1203 int get_prefix (float&, bool&);
1205 void keyboard_paste ();
1206 void keyboard_insert_region_list_selection ();
1208 void region_from_selection ();
1209 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1211 void play_from_start ();
1212 void play_from_edit_point ();
1213 void play_from_edit_point_and_return ();
1214 void play_selected_region ();
1215 void play_edit_range ();
1216 void loop_selected_region ();
1217 void play_location (ARDOUR::Location&);
1218 void loop_location (ARDOUR::Location&);
1220 void temporal_zoom_selection ();
1221 void temporal_zoom_region (bool both_axes);
1222 void toggle_zoom_region (bool both_axes);
1223 bool zoomed_to_region;
1224 void temporal_zoom_session ();
1225 void temporal_zoom (gdouble scale);
1226 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const std::string & op);
1227 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1229 void amplitude_zoom (gdouble scale);
1230 void amplitude_zoom_step (bool in);
1232 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1233 void insert_region_list_selection (float times);
1235 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1237 /* import & embed */
1239 void add_external_audio_action (Editing::ImportMode);
1240 void external_audio_dialog ();
1241 void session_import_dialog ();
1243 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1244 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1246 SoundFileOmega* sfbrowser;
1248 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1250 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1251 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1253 void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1254 void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1256 int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1257 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1258 int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1259 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1261 int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1262 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1263 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1264 boost::shared_ptr<ARDOUR::Track>& existing_track);
1266 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1267 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1269 /* generic interthread progress window */
1271 ArdourDialog* interthread_progress_window;
1272 Gtk::Label interthread_progress_label;
1273 Gtk::VBox interthread_progress_vbox;
1274 Gtk::ProgressBar interthread_progress_bar;
1275 Gtk::Button interthread_cancel_button;
1276 Gtk::Label interthread_cancel_label;
1277 sigc::connection interthread_progress_connection;
1278 void interthread_cancel_clicked ();
1279 void build_interthread_progress_window ();
1280 ARDOUR::InterThreadInfo* current_interthread_info;
1282 AnalysisWindow* analysis_window;
1284 /* import specific info */
1286 struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
1287 Editing::ImportMode mode;
1291 boost::shared_ptr<ARDOUR::Track> track;
1295 EditorImportStatus import_status;
1296 gint import_progress_timeout (void *);
1297 static void *_import_thread (void *);
1298 void* import_thread ();
1299 void finish_import ();
1301 /* to support this ... */
1303 void import_audio (bool as_tracks);
1304 void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
1306 void move_to_start ();
1307 void move_to_end ();
1309 void center_playhead ();
1310 void center_edit_point ();
1311 void edit_cursor_backward ();
1312 void edit_cursor_forward ();
1313 void playhead_forward_to_grid ();
1314 void playhead_backward_to_grid ();
1315 void playhead_backward ();
1316 void playhead_forward ();
1317 void scroll_playhead (bool forward);
1318 void scroll_backward (float pages=0.8f);
1319 void scroll_forward (float pages=0.8f);
1320 void scroll_tracks_down ();
1321 void scroll_tracks_up ();
1322 void delete_sample_forward ();
1323 void delete_sample_backward ();
1324 void delete_screen ();
1325 void search_backwards ();
1326 void search_forwards ();
1328 void clear_markers ();
1329 void clear_ranges ();
1330 void clear_locations ();
1331 void unhide_markers ();
1332 void unhide_ranges ();
1333 void jump_forward_to_mark ();
1334 void jump_backward_to_mark ();
1335 void cursor_align (bool playhead_to_edit);
1337 void remove_last_capture ();
1338 void select_all_selectables_using_time_selection ();
1339 void select_all_selectables_using_loop();
1340 void select_all_selectables_using_punch();
1341 void set_selection_from_range (ARDOUR::Location&);
1342 void set_selection_from_punch ();
1343 void set_selection_from_loop ();
1344 void set_selection_from_region ();
1346 void add_location_mark (nframes64_t where);
1347 void add_location_from_audio_region ();
1348 void add_locations_from_audio_region ();
1349 void add_location_from_selection ();
1350 void set_loop_from_selection (bool play);
1351 void set_punch_from_selection ();
1352 void set_punch_from_region ();
1354 void set_loop_from_edit_range (bool play);
1355 void set_loop_from_region (bool play);
1356 void set_punch_from_edit_range ();
1358 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1359 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1361 void add_location_from_playhead_cursor ();
1362 bool select_new_marker;
1364 void reverse_selection ();
1365 void edit_envelope ();
1367 void start_scrolling ();
1368 void stop_scrolling ();
1370 double last_scrub_x;
1371 int scrubbing_direction;
1372 int scrub_reversals;
1373 int scrub_reverse_distance;
1376 void keyboard_selection_begin ();
1377 void keyboard_selection_finish (bool add);
1378 bool have_pending_keyboard_selection;
1379 nframes64_t pending_keyboard_selection_start;
1381 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1382 void extend_selection_to_end_of_region (bool next);
1383 void extend_selection_to_start_of_region (bool previous);
1385 Editing::SnapType snap_type;
1386 Editing::SnapMode snap_mode;
1388 /// Snap threshold in pixels
1389 double snap_threshold;
1391 void handle_gui_changes (const std::string &, void *);
1392 bool ignore_gui_changes;
1394 void hide_all_tracks (bool with_select);
1400 Gtk::Menu fade_context_menu;
1401 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1403 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1404 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1406 void set_fade_length (bool in);
1407 void toggle_fade_active (bool in);
1408 void set_fade_in_active (bool);
1409 void set_fade_out_active (bool);
1411 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1412 RegionSelection pre_drag_region_selection;
1414 bool _dragging_playhead;
1415 bool _dragging_edit_point;
1417 void marker_drag_motion_callback (GdkEvent*);
1418 void marker_drag_finished_callback (GdkEvent*);
1420 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1422 void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1423 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1424 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1425 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1426 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1428 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1430 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1431 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1433 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1434 void brush (nframes64_t);
1436 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1437 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1438 double clamp_verbose_cursor_x (double);
1439 double clamp_verbose_cursor_y (double);
1441 /* Canvas event handlers */
1443 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1444 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1445 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1446 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1447 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1448 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1449 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1450 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1451 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1452 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1455 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1457 ArdourCanvas::Item *last_item_entered;
1458 int last_item_entered_n;
1461 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1462 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1463 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1464 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1465 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1466 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1467 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1468 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1469 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1471 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1472 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1473 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1474 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1475 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1476 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1478 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1479 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1480 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1481 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1482 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1483 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1484 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1485 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1487 /* non-public event handlers */
1489 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1490 bool track_canvas_scroll (GdkEventScroll* event);
1492 bool track_canvas_scroll_event (GdkEventScroll* event);
1493 bool track_canvas_button_press_event (GdkEventButton* event);
1494 bool track_canvas_button_release_event (GdkEventButton* event);
1495 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1497 Gtk::Allocation canvas_allocation;
1498 void track_canvas_allocate (Gtk::Allocation alloc);
1499 bool track_canvas_size_allocated ();
1500 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1502 void set_playhead_cursor ();
1504 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1505 void kbd_mute_unmute_region ();
1508 void kbd_do_brush (GdkEvent*);
1509 void kbd_do_audition (GdkEvent*);
1511 void handle_new_duration ();
1512 void initialize_canvas ();
1514 /* display control */
1516 bool _show_measures;
1517 /// true if the editor should follow the playhead, otherwise false
1518 bool _follow_playhead;
1519 /// true if waveforms should be shown while recording audio tracks, otherwise false
1520 bool _show_waveforms_recording;
1522 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1524 TempoLines* tempo_lines;
1526 ArdourCanvas::Group* time_line_group;
1528 void hide_measures ();
1529 void draw_measures ();
1530 bool redraw_measures ();
1532 void new_tempo_section ();
1534 void mouse_add_new_tempo_event (nframes64_t where);
1535 void mouse_add_new_meter_event (nframes64_t where);
1537 void remove_tempo_marker (ArdourCanvas::Item*);
1538 void remove_meter_marker (ArdourCanvas::Item*);
1539 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1540 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1542 void edit_tempo_section (ARDOUR::TempoSection*);
1543 void edit_meter_section (ARDOUR::MeterSection*);
1544 void edit_tempo_marker (ArdourCanvas::Item*);
1545 void edit_meter_marker (ArdourCanvas::Item*);
1546 void edit_control_point (ArdourCanvas::Item*);
1548 void marker_menu_edit ();
1549 void marker_menu_remove ();
1550 void marker_menu_rename ();
1551 void marker_menu_lock (bool yn);
1552 void marker_menu_hide ();
1553 void marker_menu_loop_range ();
1554 void marker_menu_select_all_selectables_using_range ();
1555 void marker_menu_select_using_range ();
1556 void marker_menu_separate_regions_using_location ();
1557 void marker_menu_play_from ();
1558 void marker_menu_play_range ();
1559 void marker_menu_set_playhead ();
1560 void marker_menu_set_from_playhead ();
1561 void marker_menu_set_from_selection ();
1562 void marker_menu_range_to_next ();
1563 void new_transport_marker_menu_set_loop ();
1564 void new_transport_marker_menu_set_punch ();
1565 void update_loop_range_view (bool visibility=false);
1566 void update_punch_range_view (bool visibility=false);
1567 void new_transport_marker_menu_popdown ();
1568 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1569 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1570 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1571 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1572 void build_range_marker_menu (bool loop_or_punch);
1573 void build_marker_menu (bool start_or_end);
1574 void build_tm_marker_menu ();
1575 void build_new_transport_marker_menu ();
1577 Gtk::Menu* tm_marker_menu;
1578 Gtk::Menu* marker_menu;
1579 Gtk::Menu* start_end_marker_menu;
1580 Gtk::Menu* range_marker_menu;
1581 Gtk::Menu* transport_marker_menu;
1582 Gtk::Menu* new_transport_marker_menu;
1583 Gtk::Menu* cd_marker_menu;
1584 ArdourCanvas::Item* marker_menu_item;
1586 typedef std::list<Marker*> Marks;
1589 void remove_metric_marks ();
1590 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1592 void compute_current_bbt_points (nframes_t left, nframes_t right);
1593 void tempo_map_changed (ARDOUR::Change);
1594 void redisplay_tempo (bool immediate_redraw);
1596 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1598 double snap_length_beats (nframes64_t start);
1600 uint32_t bbt_beat_subdivision;
1604 Gtk::ToggleButton editor_mixer_button;
1605 Gtk::ToggleButton editor_list_button;
1606 void editor_mixer_button_toggled ();
1607 void editor_list_button_toggled ();
1609 AudioClock edit_point_clock;
1610 AudioClock zoom_range_clock;
1611 Gtk::Button zoom_in_button;
1612 Gtk::Button zoom_out_button;
1613 Gtk::Button zoom_out_full_button;
1614 Gtk::Button zoom_onetoone_button;
1616 Gtk::VBox toolbar_clock_vbox;
1617 Gtk::VBox toolbar_selection_clock_vbox;
1618 Gtk::Table toolbar_selection_clock_table;
1619 Gtk::Label toolbar_selection_cursor_label;
1621 Gtk::HBox mouse_mode_button_box;
1622 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1623 Gtk::ToggleButton mouse_select_button;
1624 Gtk::ToggleButton mouse_move_button;
1625 Gtk::ToggleButton mouse_gain_button;
1626 Gtk::ToggleButton mouse_zoom_button;
1627 Gtk::ToggleButton mouse_timefx_button;
1628 Gtk::ToggleButton mouse_audition_button;
1629 Gtk::ToggleButton mouse_note_button;
1630 GroupedButtons *mouse_mode_button_set;
1631 void mouse_mode_toggled (Editing::MouseMode m);
1632 bool ignore_mouse_mode_toggle;
1634 gint mouse_select_button_release (GdkEventButton*);
1636 Gtk::VBox automation_box;
1637 Gtk::Button automation_mode_button;
1638 Gtk::ToggleButton global_automation_button;
1640 Gtk::ComboBoxText edit_mode_selector;
1641 Gtk::VBox edit_mode_box;
1643 void set_edit_mode (ARDOUR::EditMode);
1644 void cycle_edit_mode ();
1645 void edit_mode_selection_done ();
1647 Gtk::ComboBoxText snap_type_selector;
1648 Gtk::ComboBoxText snap_mode_selector;
1651 std::vector<std::string> snap_type_strings;
1652 std::vector<std::string> snap_mode_strings;
1654 void snap_type_selection_done ();
1655 void snap_mode_selection_done ();
1656 void snap_mode_chosen (Editing::SnapMode);
1657 void snap_type_chosen (Editing::SnapType);
1659 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1660 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1662 Gtk::ComboBoxText zoom_focus_selector;
1663 Gtk::VBox zoom_focus_box;
1665 std::vector<std::string> zoom_focus_strings;
1667 void zoom_focus_selection_done ();
1668 void zoom_focus_chosen (Editing::ZoomFocus);
1670 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1674 void zoom_adjustment_changed();
1676 void edit_point_clock_changed();
1678 void setup_toolbar ();
1680 Gtkmm2ext::TearOff* tools_tearoff;
1681 Gtk::HBox toolbar_hbox;
1682 Gtk::EventBox toolbar_base;
1683 Gtk::Frame toolbar_frame;
1687 Gtk::HBox midi_tool_button_box;
1688 Gtk::ToggleButton midi_tool_pencil_button;
1689 Gtk::ToggleButton midi_tool_select_button;
1690 Gtk::ToggleButton midi_tool_resize_button;
1691 Gtk::ToggleButton midi_tool_erase_button;
1692 Gtk::Button midi_panic_button;
1693 Gtk::ToggleButton midi_sound_notes;
1694 GroupedButtons *midi_tool_button_set;
1695 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1696 void midi_panic_button_pressed ();
1697 bool sound_notes () const { return midi_sound_notes.get_active(); }
1699 bool ignore_midi_edit_mode_toggle;
1701 Gtkmm2ext::TearOff* midi_tools_tearoff;
1702 Gtk::HBox midi_toolbar_hbox;
1703 Gtk::EventBox midi_toolbar_base;
1704 Gtk::Frame midi_toolbar_frame;
1706 void setup_midi_toolbar ();
1708 /* selection process */
1710 Selection* selection;
1711 Selection* cut_buffer;
1713 void time_selection_changed ();
1714 void track_selection_changed ();
1715 void region_selection_changed ();
1716 sigc::connection editor_regions_selection_changed_connection;
1717 void sensitize_the_right_region_actions (bool have_selected_regions);
1718 void point_selection_changed ();
1719 void marker_selection_changed ();
1721 void cancel_selection ();
1723 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1724 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1725 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1727 bool audio_region_selection_covers (nframes64_t where);
1729 /* transport range select process */
1731 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1732 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1733 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1736 ArdourCanvas::SimpleRect *bogus_background_rect;
1738 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1739 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1740 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1741 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1742 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1743 ArdourCanvas::SimpleLine *transport_punchin_line;
1744 ArdourCanvas::SimpleLine *transport_punchout_line;
1745 ArdourCanvas::SimpleRect *transport_preroll_rect;
1746 ArdourCanvas::SimpleRect *transport_postroll_rect;
1748 ARDOUR::Location* transport_loop_location();
1749 ARDOUR::Location* transport_punch_location();
1751 ARDOUR::Location *temp_location;
1753 /* object rubberband select process */
1755 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1757 ArdourCanvas::SimpleRect *rubberband_rect;
1759 /* mouse zoom process */
1761 ArdourCanvas::SimpleRect *zoom_rect;
1762 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1764 /* diskstream/route display management */
1766 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1767 RouteDisplayModelColumns() {
1770 add (temporary_visible);
1774 Gtk::TreeModelColumn<Glib::ustring> text;
1775 Gtk::TreeModelColumn<bool> visible;
1776 Gtk::TreeModelColumn<bool> temporary_visible;
1777 Gtk::TreeModelColumn<TimeAxisView*> tv;
1778 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1781 RouteDisplayModelColumns route_display_columns;
1782 Glib::RefPtr<Gtk::ListStore> route_display_model;
1783 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1785 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1786 Gtk::ScrolledWindow route_list_scroller;
1787 Gtk::Menu* route_list_menu;
1789 void update_route_visibility ();
1791 void sync_order_keys (const char*);
1792 bool route_redisplay_does_not_sync_order_keys;
1793 bool route_redisplay_does_not_reset_order_keys;
1795 bool route_list_display_button_press (GdkEventButton*);
1796 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1799 const Gtk::SelectionData& data,
1803 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1805 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1806 void route_list_delete (const Gtk::TreeModel::Path&);
1807 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1809 void initial_route_list_display ();
1810 void redisplay_route_list();
1811 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1812 bool ignore_route_list_reorder;
1813 bool no_route_list_redisplay;
1814 bool sync_track_view_list_and_route_list ();
1816 void build_route_list_menu ();
1817 void show_route_list_menu ();
1819 void show_all_routes ();
1820 void hide_all_routes ();
1821 void show_all_audiotracks ();
1822 void hide_all_audiotracks ();
1823 void show_all_audiobus ();
1824 void hide_all_audiobus ();
1826 void set_all_tracks_visibility (bool yn);
1827 void set_all_audio_visibility (int type, bool yn);
1829 /* edit group management */
1831 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1832 GroupListModelColumns () {
1838 Gtk::TreeModelColumn<bool> is_active;
1839 Gtk::TreeModelColumn<bool> is_visible;
1840 Gtk::TreeModelColumn<std::string> text;
1841 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1844 GroupListModelColumns group_columns;
1845 Glib::RefPtr<Gtk::ListStore> group_model;
1846 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1848 Gtk::TreeView edit_group_display;
1849 Gtk::ScrolledWindow edit_group_display_scroller;
1850 Gtk::Menu* edit_group_list_menu;
1852 void build_edit_group_list_menu ();
1853 void activate_all_edit_groups ();
1854 void disable_all_edit_groups ();
1856 bool in_edit_group_row_change;
1857 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1858 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1859 void new_edit_group ();
1860 void edit_group_list_button_clicked ();
1861 gint edit_group_list_button_press_event (GdkEventButton* ev);
1862 void add_edit_group (ARDOUR::RouteGroup* group);
1863 void remove_selected_edit_group ();
1864 void edit_groups_changed ();
1865 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1867 Gtk::VBox list_vpacker;
1871 bool autoscroll_active;
1872 int autoscroll_timeout_tag;
1875 int last_autoscroll_x;
1876 int last_autoscroll_y;
1877 uint32_t autoscroll_cnt;
1878 nframes64_t autoscroll_x_distance;
1879 double autoscroll_y_distance;
1881 static gint _autoscroll_canvas (void *);
1882 bool autoscroll_canvas ();
1883 void start_canvas_autoscroll (int x, int y);
1884 void stop_canvas_autoscroll ();
1885 void maybe_autoscroll (GdkEventMotion*, bool);
1886 bool allow_vertical_scroll;
1889 void point_trim (GdkEvent*);
1890 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1891 void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
1892 void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
1894 void thaw_region_after_trim (RegionView& rv);
1896 void trim_region_front();
1897 void trim_region_back();
1898 void trim_region (bool front);
1900 void trim_region_to_edit_point ();
1901 void trim_region_from_edit_point ();
1902 void trim_region_to_loop ();
1903 void trim_region_to_punch ();
1904 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1906 void trim_to_region(bool forward);
1907 void trim_region_to_previous_region_end();
1908 void trim_region_to_next_region_start();
1910 bool show_gain_after_trim;
1914 int convert_drop_to_paths (
1915 std::vector<Glib::ustring>& paths,
1916 const Glib::RefPtr<Gdk::DragContext>& context,
1919 const Gtk::SelectionData& data,
1923 void track_canvas_drag_data_received (
1924 const Glib::RefPtr<Gdk::DragContext>& context,
1927 const Gtk::SelectionData& data,
1931 void region_list_display_drag_data_received (
1932 const Glib::RefPtr<Gdk::DragContext>& context,
1935 const Gtk::SelectionData& data,
1940 const Glib::RefPtr<Gdk::DragContext>& context,
1943 const Gtk::SelectionData& data,
1948 const Glib::RefPtr<Gdk::DragContext>& context,
1951 const Gtk::SelectionData& data,
1956 const Glib::RefPtr<Gdk::DragContext>& context,
1959 const Gtk::SelectionData& data,
1965 int write_region_selection(RegionSelection&);
1966 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1967 void bounce_region_selection ();
1968 void bounce_range_selection (bool replace, bool enable_processing);
1969 void external_edit_region ();
1971 int write_audio_selection (TimeSelection&);
1972 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1974 void write_selection ();
1976 XMLNode *before; /* used in *_reversible_command */
1978 void begin_reversible_command (std::string cmd_name);
1979 void commit_reversible_command ();
1981 void update_title ();
1982 void update_title_s (const std::string & snapshot_name);
1985 Selection* selection;
1986 double frames_per_unit;
1988 State (PublicEditor const * e);
1992 void store_state (State&) const;
1993 void restore_state (State *);
1995 void instant_save ();
1997 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1999 /* freeze operations */
2001 ARDOUR::InterThreadInfo freeze_status;
2002 gint freeze_progress_timeout (void *);
2003 static void* _freeze_thread (void*);
2004 void* freeze_thread ();
2006 void freeze_route ();
2007 void unfreeze_route ();
2009 /* edit-group solo + mute */
2011 void set_edit_group_solo (ARDOUR::Route&, bool);
2012 void set_edit_group_mute (ARDOUR::Route&, bool);
2016 void duplicate_dialog (bool with_dialog);
2018 nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
2020 /* returns false if mouse pointer is not in track or marker canvas
2022 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2024 /* "whats mine is yours" */
2026 TimeFXDialog* current_timefx;
2028 static void* timefx_thread (void *arg);
2029 void do_timefx (TimeFXDialog&);
2031 int time_stretch (RegionSelection&, float fraction);
2032 int pitch_shift (RegionSelection&, float cents);
2033 void pitch_shift_regions ();
2034 int time_fx (RegionSelection&, float val, bool pitching);
2036 /* editor-mixer strip */
2038 MixerStrip *current_mixer_strip;
2039 bool show_editor_mixer_when_tracks_arrive;
2040 Gtk::VBox current_mixer_strip_vbox;
2041 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2042 void cms_deleted ();
2043 void current_mixer_strip_hidden ();
2044 void current_mixer_strip_removed ();
2046 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2047 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2049 void ensure_all_elements_drawn ();
2051 /* nudging tracks */
2053 void nudge_track (bool use_edit_point, bool forwards);
2057 bool _xfade_visibility;
2060 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
2061 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
2063 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2064 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2066 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2067 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2068 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2070 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2071 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2072 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2073 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2075 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2076 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2077 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2078 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2080 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2081 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2082 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2083 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2084 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2085 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2087 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2088 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2089 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2090 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2091 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2092 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2094 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2095 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2097 ImageFrameSocketHandler* image_socket_listener ;
2100 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2101 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2102 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2103 void xfade_edit_left_region ();
2104 void xfade_edit_right_region ();
2106 static const int32_t default_width = 995;
2107 static const int32_t default_height = 765;
2111 Gtk::Button nudge_forward_button;
2112 Gtk::Button nudge_backward_button;
2113 Gtk::HBox nudge_hbox;
2114 Gtk::VBox nudge_vbox;
2115 AudioClock nudge_clock;
2117 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2119 bool nudge_forward_release (GdkEventButton*);
2120 bool nudge_backward_release (GdkEventButton*);
2124 void apply_filter (ARDOUR::Filter&, std::string cmd);
2126 /* handling cleanup */
2128 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2130 std::vector<sigc::connection> session_connections;
2132 /* tracking step changes of track height */
2134 TimeAxisView* current_stepping_trackview;
2135 ARDOUR::microseconds_t last_track_height_step_timestamp;
2136 gint track_height_step_timeout();
2137 sigc::connection step_timeout;
2139 TimeAxisView* entered_track;
2140 RegionView* entered_regionview;
2143 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2144 bool clear_entered_track;
2145 bool left_track_canvas (GdkEventCrossing*);
2146 bool entered_track_canvas (GdkEventCrossing*);
2147 void set_entered_track (TimeAxisView*);
2148 void set_entered_regionview (RegionView*);
2149 void ensure_track_visible (TimeAxisView*);
2150 gint left_automation_track ();
2152 bool _new_regionviews_show_envelope;
2154 void reset_canvas_action_sensitivity (bool);
2155 void toggle_gain_envelope_visibility ();
2156 void toggle_gain_envelope_active ();
2157 void reset_region_gain_envelopes ();
2159 bool on_key_press_event (GdkEventKey*);
2160 bool on_key_release_event (GdkEventKey*);
2162 void session_state_saved (std::string);
2164 Glib::RefPtr<Gtk::Action> undo_action;
2165 Glib::RefPtr<Gtk::Action> redo_action;
2167 void history_changed ();
2169 Gtk::HBox status_bar_hpacker;
2171 Editing::EditPoint _edit_point;
2173 Gtk::ComboBoxText edit_point_selector;
2175 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2176 void cycle_edit_point (bool with_marker);
2177 void set_edit_point ();
2178 void edit_point_selection_done ();
2179 void edit_point_chosen (Editing::EditPoint);
2180 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2181 std::vector<std::string> edit_point_strings;
2183 void selected_marker_moved (ARDOUR::Location*);
2184 sigc::connection edit_point_clock_connection_a;
2185 sigc::connection edit_point_clock_connection_b;
2187 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2189 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2190 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2192 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2194 sigc::connection fast_screen_update_connection;
2195 gint start_updating ();
2196 gint stop_updating ();
2197 void fast_update_strips ();
2198 bool meters_running;
2200 void select_next_route ();
2201 void select_prev_route ();
2203 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2205 RhythmFerret* rhythm_ferret;
2206 BundleManager* _bundle_manager;
2207 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2210 void set_track_height (uint32_t h);
2212 void remove_tracks ();
2213 void toggle_tracks_active ();
2217 int32_t resize_idle_target;
2219 friend gboolean _idle_resize (gpointer);
2220 std::vector<TimeAxisView*> pending_resizes;
2222 void visible_order_range (int*, int*) const;
2225 bool _pending_locate_request;
2227 EditorSummary* _summary;
2228 void region_view_added (RegionView *);
2230 void update_canvas_now ();
2231 void streamview_height_changed ();
2234 friend class RegionDrag;
2235 friend class RegionMoveDrag;
2236 friend class RegionSpliceDrag;
2237 friend class TrimDrag;
2238 friend class MeterMarkerDrag;
2239 friend class TempoMarkerDrag;
2240 friend class CursorDrag;
2241 friend class FadeInDrag;
2242 friend class FadeOutDrag;
2243 friend class MarkerDrag;
2244 friend class RegionGainDrag;
2245 friend class ControlPointDrag;
2246 friend class LineDrag;
2247 friend class RubberbandSelectDrag;
2248 friend class TimeFXDrag;
2249 friend class ScrubDrag;
2250 friend class SelectionDrag;
2251 friend class RangeMarkerBarDrag;
2252 friend class MouseZoomDrag;
2253 friend class RegionCreateDrag;
2254 friend class RegionMotionDrag;
2255 friend class RegionInsertDrag;
2257 friend class EditorSummary;
2260 #endif /* __ardour_editor_h__ */