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 <boost/optional.hpp>
32 #include <gtkmm/comboboxtext.h>
33 #include <gtkmm/layout.h>
35 #include "gtkmm2ext/selector.h"
36 #include "gtkmm2ext/click_box.h"
37 #include "gtkmm2ext/dndtreeview.h"
38 #include "gtkmm2ext/stateful_button.h"
39 #include "gtkmm2ext/bindings.h"
41 #include "pbd/stateful.h"
42 #include "pbd/signals.h"
44 #include "ardour/import_status.h"
45 #include "ardour/tempo.h"
46 #include "ardour/location.h"
47 #include "ardour/types.h"
49 #include "canvas/fwd.h"
51 #include "gtk-custom-ruler.h"
52 #include "ardour_button.h"
53 #include "ardour_dialog.h"
54 #include "public_editor.h"
57 #include "editor_items.h"
58 #include "region_selection.h"
88 class AudioRegionView;
89 class AudioStreamView;
90 class AudioTimeAxisView;
92 class AutomationSelection;
93 class AutomationTimeAxisView;
100 class EditorGroupTabs;
101 class EditorLocations;
104 class EditorRouteGroups;
105 class EditorSnapshots;
107 class GroupedButtons;
108 class GUIObjectState;
110 class MidiRegionView;
114 class PlaylistSelector;
115 class PluginSelector;
116 class ProgressReporter;
119 class SoundFileOmega;
125 class RegionLayeringOrderEditor;
128 class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
134 void set_session (ARDOUR::Session *);
135 ARDOUR::Session* session() const { return _session; }
138 virtual bool have_idled () const { return _have_idled; }
140 framepos_t leftmost_sample() const { return leftmost_frame; }
142 framecnt_t current_page_samples() const {
143 return (framecnt_t) floor (_visible_canvas_width * samples_per_pixel);
146 double visible_canvas_height () const {
147 return _visible_canvas_height;
150 void cycle_snap_mode ();
151 void next_snap_choice ();
152 void next_snap_choice_music_only ();
153 void next_snap_choice_music_and_time ();
154 void prev_snap_choice ();
155 void prev_snap_choice_music_only ();
156 void prev_snap_choice_music_and_time ();
157 void set_snap_to (Editing::SnapType);
158 void set_snap_mode (Editing::SnapMode);
159 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
161 Editing::SnapMode snap_mode () const;
162 Editing::SnapType snap_type () const;
164 void undo (uint32_t n = 1);
165 void redo (uint32_t n = 1);
167 XMLNode& get_state ();
168 int set_state (const XMLNode&, int version);
170 void set_mouse_mode (Editing::MouseMode, bool force=true);
171 void step_mouse_mode (bool next);
172 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
173 Editing::MidiEditMode current_midi_edit_mode () const;
174 void remove_midi_note (ArdourCanvas::Item *, GdkEvent *);
176 bool internal_editing() const { return _internal_editing ; }
177 void set_internal_edit (bool yn);
178 bool toggle_internal_editing_from_double_click (GdkEvent*);
181 void add_imageframe_time_axis(const std::string & track_name, void*) ;
182 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
183 void connect_to_image_compositor() ;
184 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
185 TimeAxisView* get_named_time_axis(const std::string & name) ;
186 #endif /* WITH_CMT */
188 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
189 void add_to_idle_resize (TimeAxisView*, int32_t);
191 RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const;
193 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
194 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
195 void show_a_region (boost::shared_ptr<ARDOUR::Region>);
197 #ifdef USE_RUBBERBAND
198 std::vector<std::string> rb_opt_strings;
202 /* things that need to be public to be used in the main menubar */
204 void new_region_from_selection ();
205 void separate_regions_between (const TimeSelection&);
206 void separate_region_from_selection ();
207 void separate_under_selected_regions ();
208 void separate_region_from_punch ();
209 void separate_region_from_loop ();
210 void separate_regions_using_location (ARDOUR::Location&);
211 void transition_to_rolling (bool forward);
213 /* NOTE: these functions assume that the "pixel" coordinate is
214 in canvas coordinates. These coordinates already take into
215 account any scrolling offsets.
218 framepos_t pixel_to_sample (double pixel) const {
220 /* pixel can be less than zero when motion events
221 are processed. since we've already run the world->canvas
222 affine, that means that the location *really* is "off
223 to the right" and thus really is "before the start".
227 return (framepos_t) rint (pixel * samples_per_pixel);
233 double sample_to_pixel (framepos_t sample) const {
234 return rint (sample / samples_per_pixel);
237 double sample_to_pixel_unrounded (framepos_t sample) const {
238 return sample / samples_per_pixel;
243 Selection& get_selection() const { return *selection; }
244 Selection& get_cut_buffer() const { return *cut_buffer; }
245 void track_mixer_selection ();
247 bool extend_selection_to_track (TimeAxisView&);
249 void play_selection ();
250 framepos_t get_preroll ();
251 void maybe_locate_with_edit_preroll (framepos_t);
252 void play_with_preroll ();
253 void select_all_in_track (Selection::Operation op);
254 void select_all (Selection::Operation op);
255 void invert_selection_in_track ();
256 void invert_selection ();
257 void deselect_all ();
258 long select_range (framepos_t, framepos_t);
260 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
264 void set_show_measures (bool yn);
265 bool show_measures () const { return _show_measures; }
267 /* analysis window */
269 void analyze_region_selection();
270 void analyze_range_selection();
274 void export_audio ();
276 void export_selection ();
277 void export_range ();
278 void export_region ();
280 void add_toplevel_controls (Gtk::Container&);
281 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
283 void set_zoom_focus (Editing::ZoomFocus);
284 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
285 double get_current_zoom () const { return samples_per_pixel; }
286 void cycle_zoom_focus ();
287 void temporal_zoom_step (bool coarser);
288 void tav_zoom_step (bool coarser);
289 void tav_zoom_smooth (bool coarser, bool force_all);
291 /* stuff that AudioTimeAxisView and related classes use */
293 PlaylistSelector& playlist_selector() const;
294 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
296 void new_playlists (TimeAxisView* v);
297 void copy_playlists (TimeAxisView* v);
298 void clear_playlists (TimeAxisView* v);
300 void get_onscreen_tracks (TrackViewList&);
302 Width editor_mixer_strip_width;
303 void maybe_add_mixer_strip_width (XMLNode&);
304 void show_editor_mixer (bool yn);
305 void create_editor_mixer ();
306 void show_editor_list (bool yn);
307 void set_selected_mixer_strip (TimeAxisView&);
308 void mixer_strip_width_changed ();
309 void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
311 /* nudge is initiated by transport controls owned by ARDOUR_UI */
313 framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next);
314 Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position);
316 void nudge_forward (bool next, bool force_playhead);
317 void nudge_backward (bool next, bool force_playhead);
319 /* nudge initiated from context menu */
321 void nudge_forward_capture_offset ();
322 void nudge_backward_capture_offset ();
324 /* playhead/screen stuff */
326 void set_stationary_playhead (bool yn);
327 void toggle_stationary_playhead ();
328 bool stationary_playhead() const { return _stationary_playhead; }
330 void set_follow_playhead (bool yn, bool catch_up = true);
331 void toggle_follow_playhead ();
332 bool follow_playhead() const { return _follow_playhead; }
333 bool dragging_playhead () const { return _dragging_playhead; }
335 void toggle_zero_line_visibility ();
337 void set_group_tabs ();
338 void toggle_measure_visibility ();
339 void toggle_logo_visibility ();
343 void toggle_region_fades (int dir);
344 void update_region_fade_visibility ();
346 /* redirect shared ops menu. caller must free returned menu */
348 Gtk::Menu* redirect_menu ();
350 /* floating windows/transient */
352 void ensure_float (Gtk::Window&);
356 void ensure_time_axis_view_is_visible (const TimeAxisView& tav);
357 void scroll_tracks_down_line ();
358 void scroll_tracks_up_line ();
360 void prepare_for_cleanup ();
361 void finish_cleanup ();
363 void maximise_editing_space();
364 void restore_editing_space();
366 void update_tearoff_visibility();
368 void reset_x_origin (framepos_t);
369 void reset_x_origin_to_follow_playhead ();
370 void reset_y_origin (double);
371 void reset_zoom (double);
372 void reposition_and_zoom (framepos_t, double);
374 framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool use_context_click = false);
376 bool update_mouse_speed ();
377 bool decelerate_mouse_speed ();
379 void toggle_meter_updating();
381 void show_rhythm_ferret();
383 void goto_visual_state (uint32_t);
384 void save_visual_state (uint32_t);
386 void queue_draw_resize_line (int at);
387 void start_resize_line_ops ();
388 void end_resize_line_ops ();
390 TrackViewList const & get_track_views () {
394 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region>);
396 void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t&);
397 void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, framepos_t&);
399 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions, bool src_comparison);
401 void center_screen (framepos_t);
403 TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
404 Gtkmm2ext::TearOff* mouse_mode_tearoff () const { return _mouse_mode_tearoff; }
405 Gtkmm2ext::TearOff* tools_tearoff () const { return _tools_tearoff; }
407 void snap_to (framepos_t& first, int32_t direction = 0, bool for_mark = false);
408 void snap_to_with_modifier (framepos_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
409 void snap_to (framepos_t& first, framepos_t& last, int32_t direction = 0, bool for_mark = false);
411 void begin_reversible_command (std::string cmd_name);
412 void begin_reversible_command (GQuark);
413 void commit_reversible_command ();
415 DragManager* drags () const {
419 void maybe_autoscroll (bool, bool, bool, bool);
421 Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
422 void set_canvas_cursor (Gdk::Cursor*, bool save=false);
423 void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
424 void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
426 MouseCursors const * cursors () const {
430 VerboseCursor* verbose_cursor () const {
431 return _verbose_cursor;
434 double clamp_verbose_cursor_x (double);
435 double clamp_verbose_cursor_y (double);
437 void get_pointer_position (double &, double &) const;
439 TimeAxisView* stepping_axis_view () {
440 return _stepping_axis_view;
443 void set_stepping_axis_view (TimeAxisView* v) {
444 _stepping_axis_view = v;
447 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
448 ArdourCanvas::Group* get_time_bars_group () const;
449 ArdourCanvas::Group* get_track_canvas_group () const;
450 ArdourCanvas::GtkCanvasViewport* get_time_bars_canvas () const;
451 ArdourCanvas::GtkCanvasViewport* get_track_canvas () const;
455 void map_transport_state ();
456 void map_position_change (framepos_t);
462 void color_handler ();
466 // to keep track of the playhead position for control_scroll
467 boost::optional<framepos_t> _control_scroll_target;
469 PlaylistSelector* _playlist_selector;
471 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
474 VisualState (bool with_tracks);
477 double samples_per_pixel;
478 framepos_t leftmost_frame;
479 Editing::ZoomFocus zoom_focus;
480 GUIObjectState* gui_state;
483 std::list<VisualState*> undo_visual_stack;
484 std::list<VisualState*> redo_visual_stack;
485 VisualState* current_visual_state (bool with_tracks = true);
486 void undo_visual_state ();
487 void redo_visual_state ();
488 void use_visual_state (VisualState&);
490 void swap_visual_state ();
492 std::vector<VisualState*> visual_states;
493 void start_visual_state_op (uint32_t n);
494 void cancel_visual_state_op (uint32_t n);
496 framepos_t leftmost_frame;
497 double samples_per_pixel;
498 Editing::ZoomFocus zoom_focus;
500 void set_samples_per_pixel (double);
501 bool clamp_samples_per_pixel (double &) const;
503 Editing::MouseMode mouse_mode;
504 Editing::MouseMode pre_internal_mouse_mode;
505 Editing::SnapType pre_internal_snap_type;
506 Editing::SnapMode pre_internal_snap_mode;
507 Editing::SnapType internal_snap_type;
508 Editing::SnapMode internal_snap_mode;
509 bool _internal_editing;
510 Editing::MouseMode effective_mouse_mode () const;
512 enum JoinObjectRangeState {
513 JOIN_OBJECT_RANGE_NONE,
514 /** `join object/range' mode is active and the mouse is over a place where object mode should happen */
515 JOIN_OBJECT_RANGE_OBJECT,
516 /** `join object/range' mode is active and the mouse is over a place where range mode should happen */
517 JOIN_OBJECT_RANGE_RANGE
520 JoinObjectRangeState _join_object_range_state;
522 void update_join_object_range_location (double, double);
524 boost::optional<int> pre_notebook_shrink_pane_width;
526 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
528 Gtk::Notebook _the_notebook;
529 bool _notebook_shrunk;
530 void add_notebook_page (std::string const &, Gtk::Widget &);
531 bool notebook_tab_clicked (GdkEventButton *, Gtk::Widget *);
533 Gtk::HPaned edit_pane;
534 Gtk::VPaned editor_summary_pane;
536 Gtk::EventBox meter_base;
538 Gtk::EventBox marker_base;
539 Gtk::HBox marker_box;
540 Gtk::VBox scrollers_rulers_markers_box;
542 void location_changed (ARDOUR::Location *);
543 void location_flags_changed (ARDOUR::Location *, void *);
544 void refresh_location_display ();
545 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
546 void add_new_location (ARDOUR::Location *);
547 ArdourCanvas::Group* add_new_location_internal (ARDOUR::Location *);
548 void location_gone (ARDOUR::Location *);
549 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
550 gint really_remove_marker (ARDOUR::Location* loc);
551 void goto_nth_marker (int nth);
552 void toggle_marker_lines ();
553 void set_marker_line_visibility (bool);
555 uint32_t location_marker_color;
556 uint32_t location_range_color;
557 uint32_t location_loop_color;
558 uint32_t location_punch_color;
559 uint32_t location_cd_marker_color;
561 struct LocationMarkers {
566 LocationMarkers () : start(0), end(0), valid (true) {}
573 void set_show_lines (bool);
574 void set_selected (bool);
575 void canvas_height_set (double);
578 void set_name (const std::string&);
579 void set_position (framepos_t start, framepos_t end = 0);
580 void set_color_rgba (uint32_t);
583 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
584 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
585 Marker* find_marker_from_location_id (PBD::ID const &, bool) const;
586 Marker* entered_marker;
587 bool _show_marker_lines;
589 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
590 LocationMarkerMap location_markers;
592 void update_marker_labels ();
593 void update_marker_labels (ArdourCanvas::Group *);
594 void check_marker_label (Marker *);
596 /** A set of lists of Markers that are in each of the canvas groups
597 * for the marker sections at the top of the editor. These lists
598 * are kept sorted in time order between marker movements, so that after
599 * a marker has moved we can decide whether we need to update the labels
600 * for all markers or for just a few.
602 std::map<ArdourCanvas::Group *, std::list<Marker *> > _sorted_marker_lists;
603 void remove_sorted_marker (Marker *);
605 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
606 void clear_marker_display ();
607 void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
608 void mouse_add_new_range (framepos_t);
609 bool choose_new_marker_name(std::string &name);
610 void update_cd_marker_display ();
611 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
613 TimeAxisView* clicked_axisview;
614 RouteTimeAxisView* clicked_routeview;
615 /** The last RegionView that was clicked on, or 0 if the last click was not
616 * on a RegionView. This is set up by the canvas event handlers in
617 * editor_canvas_events.cc
619 RegionView* clicked_regionview;
620 RegionSelection latest_regionviews;
621 uint32_t clicked_selection;
622 ControlPoint* clicked_control_point;
624 void sort_track_selection (TrackViewList&);
626 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
627 RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
628 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
629 void mapover_tracks_with_unique_playlists (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
631 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
632 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector<RegionView*>*) const;
633 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
634 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
635 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
637 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
638 bool button_release_can_deselect;
640 void catch_vanishing_regionview (RegionView *);
642 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
643 void select_all_tracks ();
644 void select_all_internal_edit (Selection::Operation);
646 bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set);
647 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
648 void set_selected_track_as_side_effect (Selection::Operation op);
649 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set);
651 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
652 void collect_new_region_view (RegionView *);
653 void collect_and_select_new_region_view (RegionView *);
655 Gtk::Menu track_context_menu;
656 Gtk::Menu track_region_context_menu;
657 Gtk::Menu track_selection_context_menu;
659 Gtk::MenuItem* region_edit_menu_split_item;
660 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
661 Gtk::Menu * track_region_edit_playlist_menu;
662 Gtk::Menu * track_edit_playlist_submenu;
663 Gtk::Menu * track_selection_edit_playlist_submenu;
665 GdkEvent context_click_event;
667 void popup_track_context_menu (int, int, ItemType, bool);
668 Gtk::Menu* build_track_context_menu ();
669 Gtk::Menu* build_track_bus_context_menu ();
670 Gtk::Menu* build_track_region_context_menu ();
671 Gtk::Menu* build_track_selection_context_menu ();
672 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
673 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
674 void add_region_context_items (Gtk::Menu_Helpers::MenuList&, boost::shared_ptr<ARDOUR::Track>);
675 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
676 Gtk::MenuItem* _popup_region_menu_item;
678 void popup_control_point_context_menu (ArdourCanvas::Item *, GdkEvent *);
679 Gtk::Menu _control_point_context_menu;
681 void add_routes (ARDOUR::RouteList&);
682 void timeaxisview_deleted (TimeAxisView *);
684 Gtk::HBox global_hpacker;
685 Gtk::VBox global_vpacker;
688 Gdk::Cursor* current_canvas_cursor;
689 Gdk::Cursor* which_grabber_cursor ();
690 void set_canvas_cursor ();
692 ArdourCanvas::GtkCanvas* _track_canvas;
693 ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport;
695 ArdourCanvas::GtkCanvas* _time_bars_canvas;
696 ArdourCanvas::GtkCanvasViewport* _time_bars_canvas_viewport;
698 bool within_track_canvas;
700 friend class VerboseCursor;
701 VerboseCursor* _verbose_cursor;
703 void parameter_changed (std::string);
705 bool track_canvas_motion (GdkEvent*);
707 Gtk::EventBox time_canvas_event_box;
708 Gtk::EventBox time_bars_event_box;
709 Gtk::EventBox ruler_label_event_box;
711 ArdourCanvas::Group *minsec_group;
712 ArdourCanvas::Pixbuf *logo_item;
713 ArdourCanvas::Group *bbt_group;
714 ArdourCanvas::Group *timecode_group;
715 ArdourCanvas::Group *frame_group;
716 ArdourCanvas::Group *tempo_group;
717 ArdourCanvas::Group *meter_group;
718 ArdourCanvas::Group *marker_group;
719 ArdourCanvas::Group *range_marker_group;
720 ArdourCanvas::Group *transport_marker_group;
721 ArdourCanvas::Group* cd_marker_group;
723 /* parent for groups which themselves contain time markers */
724 ArdourCanvas::Group* _time_markers_group;
726 ArdourCanvas::Group* meter_bar_group;
727 ArdourCanvas::Group* tempo_bar_group;
728 ArdourCanvas::Group* marker_bar_group;
729 ArdourCanvas::Group* range_marker_bar_group;
730 ArdourCanvas::Group* transport_marker_bar_group;
731 ArdourCanvas::Group* cd_marker_bar_group;
733 /* The group containing all trackviews. Only scrolled vertically. */
734 ArdourCanvas::Group* _trackview_group;
736 /* The group used for region motion. Sits on top of _trackview_group */
737 ArdourCanvas::Group* _region_motion_group;
740 ruler_metric_timecode = 0,
741 ruler_metric_bbt = 1,
742 ruler_metric_samples = 2,
743 ruler_metric_minsec = 3,
745 ruler_time_tempo = 4,
746 ruler_time_meter = 5,
747 ruler_time_marker = 6,
748 ruler_time_range_marker = 7,
749 ruler_time_transport_marker = 8,
750 ruler_time_cd_marker = 9,
751 ruler_video_timeline = 10,
754 static GtkCustomMetric ruler_metrics[4];
755 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
756 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
757 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
758 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
759 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
760 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
761 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
762 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
763 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
764 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
765 bool no_ruler_shown_update;
767 bool ruler_button_press (GdkEventButton*);
768 bool ruler_button_release (GdkEventButton*);
769 bool ruler_mouse_motion (GdkEventMotion*);
770 bool ruler_scroll (GdkEventScroll* event);
772 Gtk::Widget * ruler_grabbed_widget;
774 void initialize_rulers ();
775 void update_just_timecode ();
776 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
777 void update_fixed_rulers ();
778 void update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
779 ARDOUR::TempoMap::BBTPointList::const_iterator& end);
780 void popup_ruler_menu (framepos_t where = 0, ItemType type = RegionItem);
781 void update_ruler_visibility ();
782 void set_ruler_visible (RulerType, bool);
783 void toggle_ruler_visibility (RulerType rt);
784 void ruler_toggled (int);
785 bool ruler_label_button_release (GdkEventButton*);
786 void store_ruler_visibility ();
787 void restore_ruler_visibility ();
789 static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
790 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
791 static gint _metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
792 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
794 enum MinsecRulerScale {
801 MinsecRulerScale minsec_ruler_scale;
803 framecnt_t minsec_mark_interval;
804 gint minsec_mark_modulo;
806 void set_minsec_ruler_scale (framepos_t, framepos_t);
808 enum TimecodeRulerScale {
810 timecode_show_frames,
811 timecode_show_seconds,
812 timecode_show_minutes,
816 TimecodeRulerScale timecode_ruler_scale;
818 gint timecode_mark_modulo;
819 gint timecode_nmarks;
820 void set_timecode_ruler_scale (framepos_t, framepos_t);
822 framecnt_t _samples_ruler_interval;
823 void set_samples_ruler_scale (framepos_t, framepos_t);
833 bbt_show_ticks_detail,
834 bbt_show_ticks_super_detail
837 BBTRulerScale bbt_ruler_scale;
841 uint32_t bbt_bar_helper_on;
842 uint32_t bbt_accent_modulo;
843 void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper,
844 ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin,
845 ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end);
847 gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
848 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
849 gint metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
850 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
852 Gtk::Widget *_ruler_separator;
853 GtkWidget *_timecode_ruler;
854 GtkWidget *_bbt_ruler;
855 GtkWidget *_samples_ruler;
856 GtkWidget *_minsec_ruler;
857 Gtk::Widget *timecode_ruler;
858 Gtk::Widget *bbt_ruler;
859 Gtk::Widget *samples_ruler;
860 Gtk::Widget *minsec_ruler;
861 static Editor *ruler_editor;
863 static const double timebar_height;
864 guint32 visible_timebars;
865 Gtk::Menu *editor_ruler_menu;
867 ArdourCanvas::Rectangle* tempo_bar;
868 ArdourCanvas::Rectangle* meter_bar;
869 ArdourCanvas::Rectangle* marker_bar;
870 ArdourCanvas::Rectangle* range_marker_bar;
871 ArdourCanvas::Rectangle* transport_marker_bar;
872 ArdourCanvas::Rectangle* cd_marker_bar;
874 Gtk::Label minsec_label;
875 Gtk::Label bbt_label;
876 Gtk::Label timecode_label;
877 Gtk::Label samples_label;
878 Gtk::Label tempo_label;
879 Gtk::Label meter_label;
880 Gtk::Label mark_label;
881 Gtk::Label range_mark_label;
882 Gtk::Label transport_mark_label;
883 Gtk::Label cd_mark_label;
885 /* videtimline related actions */
886 Gtk::Label videotl_label;
887 ArdourCanvas::Group* videotl_group;
888 Glib::RefPtr<Gtk::ToggleAction> ruler_video_action;
889 Glib::RefPtr<Gtk::ToggleAction> xjadeo_proc_action;
890 Glib::RefPtr<Gtk::ToggleAction> xjadeo_ontop_action;
891 Glib::RefPtr<Gtk::ToggleAction> xjadeo_timecode_action;
892 Glib::RefPtr<Gtk::ToggleAction> xjadeo_frame_action;
893 Glib::RefPtr<Gtk::ToggleAction> xjadeo_osdbg_action;
894 Glib::RefPtr<Gtk::ToggleAction> xjadeo_fullscreen_action;
895 Glib::RefPtr<Gtk::ToggleAction> xjadeo_letterbox_action;
896 Glib::RefPtr<Gtk::Action> xjadeo_zoom_100;
897 void set_xjadeo_proc ();
898 void toggle_xjadeo_proc (int state=-1);
899 void set_xjadeo_sensitive (bool onoff);
900 void set_xjadeo_viewoption (int);
901 void toggle_xjadeo_viewoption (int what, int state=-1);
902 void toggle_ruler_video (bool onoff) {ruler_video_action->set_active(onoff);}
903 int videotl_bar_height; /* in units of timebar_height; default: 4 */
904 int get_videotl_bar_height () const { return videotl_bar_height; }
905 void export_video ();
906 void toggle_region_video_lock ();
908 Gtk::VBox time_bars_vbox;
910 friend class EditorCursor;
912 EditorCursor* playhead_cursor;
914 framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
916 void cursor_to_region_boundary (bool with_selection, int32_t dir);
917 void cursor_to_next_region_boundary (bool with_selection);
918 void cursor_to_previous_region_boundary (bool with_selection);
919 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
920 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
921 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
922 void cursor_to_selection_start (EditorCursor *);
923 void cursor_to_selection_end (EditorCursor *);
925 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
926 void selected_marker_to_next_region_boundary (bool with_selection);
927 void selected_marker_to_previous_region_boundary (bool with_selection);
928 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
929 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
930 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
931 void selected_marker_to_selection_start ();
932 void selected_marker_to_selection_end ();
934 void select_all_selectables_using_cursor (EditorCursor *, bool);
935 void select_all_selectables_using_edit (bool);
936 void select_all_selectables_between (bool within);
937 void select_range_between ();
939 boost::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::framepos_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
940 ARDOUR::framepos_t find_next_region_boundary (ARDOUR::framepos_t, int32_t dir, const TrackViewList&);
942 std::vector<ARDOUR::framepos_t> region_boundary_cache;
943 void build_region_boundary_cache ();
946 Gtk::HBox bottom_hbox;
948 Gtk::Table edit_packer;
950 /** the adjustment that controls the overall editor vertical scroll position */
951 Gtk::Adjustment vertical_adjustment;
952 Gtk::Adjustment horizontal_adjustment;
954 Gtk::Adjustment unused_adjustment; // yes, really; Gtk::Layout constructor requires refs
955 Gtk::Layout controls_layout;
956 bool control_layout_scroll (GdkEventScroll* ev);
957 void reset_controls_layout_width ();
958 void reset_controls_layout_height (int32_t height);
967 bool scroll_press (Direction);
968 void scroll_release ();
969 sigc::connection _scroll_connection;
970 int _scroll_callbacks;
972 double _visible_canvas_width;
973 double _visible_canvas_height; ///< height of the visible area of the track canvas
974 double _full_canvas_height; ///< full height of the canvas
976 bool track_canvas_map_handler (GdkEventAny*);
978 bool edit_controls_button_release (GdkEventButton*);
979 Gtk::Menu *edit_controls_left_menu;
980 Gtk::Menu *edit_controls_right_menu;
982 Gtk::VBox ruler_label_vbox;
983 Gtk::VBox track_canvas_vbox;
984 Gtk::VBox time_canvas_vbox;
985 Gtk::VBox edit_controls_vbox;
986 Gtk::HBox edit_controls_hbox;
988 void control_vertical_zoom_in_all ();
989 void control_vertical_zoom_out_all ();
990 void control_vertical_zoom_in_selected ();
991 void control_vertical_zoom_out_selected ();
992 void control_step_tracks_up ();
993 void control_step_tracks_down ();
994 void control_view (uint32_t);
995 void control_scroll (float);
996 void control_select (uint32_t rid, Selection::Operation);
997 void control_unselect ();
998 void access_action (std::string,std::string);
999 bool deferred_control_scroll (framepos_t);
1000 sigc::connection control_scroll_connection;
1002 void tie_vertical_scrolling ();
1003 void set_horizontal_position (double);
1004 double horizontal_position () const;
1006 struct VisualChange {
1014 framepos_t time_origin;
1015 double samples_per_pixel;
1018 int idle_handler_id;
1019 /** true if we are currently in the idle handler */
1022 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), samples_per_pixel (0), idle_handler_id (-1), being_handled (false) {}
1024 pending = Type (pending | t);
1028 VisualChange pending_visual_change;
1030 static int _idle_visual_changer (void *arg);
1031 int idle_visual_changer ();
1032 void ensure_visual_change_idle_handler ();
1035 TrackViewList track_views;
1036 std::pair<TimeAxisView*, double> trackview_by_y_position (double);
1037 TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const;
1039 TrackViewList get_tracks_for_range_action () const;
1041 sigc::connection super_rapid_screen_update_connection;
1042 framepos_t last_update_frame;
1043 void center_screen_internal (framepos_t, float);
1045 void super_rapid_screen_update ();
1047 void session_going_away ();
1049 framepos_t cut_buffer_start;
1050 framecnt_t cut_buffer_length;
1052 Gdk::Cursor* pre_press_cursor;
1053 boost::weak_ptr<ARDOUR::Trimmable> _trimmable;
1054 boost::weak_ptr<ARDOUR::Movable> _movable;
1056 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1057 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1058 bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1059 bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1060 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1061 bool button_press_dispatch (GdkEventButton*);
1062 bool button_release_dispatch (GdkEventButton*);
1063 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1064 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1065 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1066 bool key_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1067 bool key_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1069 Gtkmm2ext::Bindings* button_bindings;
1070 XMLNode* button_settings () const;
1072 /* KEYMAP HANDLING */
1074 void register_actions ();
1075 void register_region_actions ();
1077 void load_bindings ();
1078 Gtkmm2ext::ActionMap editor_action_map;
1079 Gtkmm2ext::Bindings key_bindings;
1081 int ensure_cursor (framepos_t* pos);
1083 void cut_copy (Editing::CutCopyOp);
1084 bool can_cut_copy () const;
1085 void cut_copy_points (Editing::CutCopyOp);
1086 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1087 void cut_copy_ranges (Editing::CutCopyOp);
1088 void cut_copy_midi (Editing::CutCopyOp);
1090 void mouse_paste ();
1091 void paste_internal (framepos_t position, float times);
1093 /* EDITING OPERATIONS */
1095 void reset_point_selection ();
1096 void toggle_region_lock ();
1097 void toggle_opaque_region ();
1098 void toggle_record_enable ();
1099 void toggle_solo ();
1100 void toggle_solo_isolate ();
1101 void toggle_mute ();
1102 void toggle_region_lock_style ();
1104 enum LayerOperation {
1111 void do_layer_operation (LayerOperation);
1112 void raise_region ();
1113 void raise_region_to_top ();
1114 void change_region_layering_order (bool from_context_menu);
1115 void lower_region ();
1116 void lower_region_to_bottom ();
1117 void split_regions_at (framepos_t, RegionSelection&);
1118 void split_region_at_transients ();
1119 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
1120 void crop_region_to_selection ();
1121 void crop_region_to (framepos_t start, framepos_t end);
1122 void set_sync_point (framepos_t, const RegionSelection&);
1123 void set_region_sync_position ();
1124 void remove_region_sync();
1125 void align_regions (ARDOUR::RegionPoint);
1126 void align_regions_relative (ARDOUR::RegionPoint point);
1127 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
1128 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
1129 void remove_selected_regions ();
1130 void remove_clicked_region ();
1131 void show_region_properties ();
1132 void show_midi_list_editor ();
1133 void rename_region ();
1134 void duplicate_some_regions (RegionSelection&, float times);
1135 void duplicate_selection (float times);
1136 void region_fill_selection ();
1137 void combine_regions ();
1138 void uncombine_regions ();
1140 void region_fill_track ();
1141 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1142 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1143 void split_multichannel_region();
1144 void reverse_region ();
1145 void strip_region_silence ();
1146 void normalize_region ();
1147 void reset_region_scale_amplitude ();
1148 void adjust_region_gain (bool up);
1149 void quantize_region ();
1150 void insert_patch_change (bool from_context);
1151 void fork_region ();
1153 void do_insert_time ();
1154 void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool, bool);
1156 void tab_to_transient (bool forward);
1158 void set_tempo_from_region ();
1159 void use_range_as_bar ();
1161 void define_one_bar (framepos_t start, framepos_t end);
1163 void audition_region_from_region_list ();
1164 void hide_region_from_region_list ();
1165 void show_region_in_region_list ();
1167 void naturalize_region ();
1169 void reset_focus ();
1171 void split_region ();
1176 void paste (float times, bool from_context_menu = false);
1178 void place_transient ();
1179 void remove_transient (ArdourCanvas::Item* item);
1180 void snap_regions_to_grid ();
1181 void close_region_gaps ();
1183 void keyboard_paste ();
1185 void region_from_selection ();
1186 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1188 void play_from_start ();
1189 void play_from_edit_point ();
1190 void play_from_edit_point_and_return ();
1191 void play_selected_region ();
1192 void play_edit_range ();
1193 void play_location (ARDOUR::Location&);
1194 void loop_location (ARDOUR::Location&);
1196 void temporal_zoom_selection ();
1197 void temporal_zoom_region (bool both_axes);
1198 void zoom_to_region (bool both_axes);
1199 void temporal_zoom_session ();
1200 void temporal_zoom (double scale);
1201 void temporal_zoom_by_frame (framepos_t start, framepos_t end);
1202 void temporal_zoom_to_frame (bool coarser, framepos_t frame);
1204 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1205 void insert_region_list_selection (float times);
1207 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1209 /* import & embed */
1211 void add_external_audio_action (Editing::ImportMode);
1212 void external_audio_dialog ();
1213 void session_import_dialog ();
1215 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1216 bool check_multichannel_status (const std::vector<std::string>& paths);
1218 SoundFileOmega* sfbrowser;
1220 void bring_in_external_audio (Editing::ImportMode mode, framepos_t& pos);
1222 bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos, bool copy);
1223 void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos, bool copy);
1225 int import_sndfiles (std::vector<std::string> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t& pos,
1226 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
1227 int embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1228 framepos_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1230 int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, framepos_t& pos, Editing::ImportMode,
1231 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1232 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, framepos_t& pos, Editing::ImportMode mode,
1233 boost::shared_ptr<ARDOUR::Track>& existing_track);
1235 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1236 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1238 void toggle_midi_input_active (bool flip_others);
1240 ARDOUR::InterThreadInfo* current_interthread_info;
1242 AnalysisWindow* analysis_window;
1244 /* import specific info */
1246 struct EditorImportStatus : public ARDOUR::ImportStatus {
1247 Editing::ImportMode mode;
1251 boost::shared_ptr<ARDOUR::Track> track;
1255 EditorImportStatus import_status;
1256 static void *_import_thread (void *);
1257 void* import_thread ();
1258 void finish_import ();
1260 /* to support this ... */
1262 void import_audio (bool as_tracks);
1263 void do_import (std::vector<std::string> paths, bool split, bool as_tracks);
1265 void move_to_start ();
1266 void move_to_end ();
1267 void center_playhead ();
1268 void center_edit_point ();
1269 void playhead_forward_to_grid ();
1270 void playhead_backward_to_grid ();
1271 void scroll_playhead (bool forward);
1272 void scroll_backward (float pages=0.8f);
1273 void scroll_forward (float pages=0.8f);
1274 void scroll_tracks_down ();
1275 void scroll_tracks_up ();
1277 void clear_markers ();
1278 void clear_ranges ();
1279 void clear_locations ();
1280 void unhide_markers ();
1281 void unhide_ranges ();
1282 void jump_forward_to_mark ();
1283 void jump_backward_to_mark ();
1284 void cursor_align (bool playhead_to_edit);
1286 void remove_last_capture ();
1287 void select_all_selectables_using_time_selection ();
1288 void select_all_selectables_using_loop();
1289 void select_all_selectables_using_punch();
1290 void set_selection_from_range (ARDOUR::Location&);
1291 void set_selection_from_punch ();
1292 void set_selection_from_loop ();
1293 void set_selection_from_region ();
1295 void add_location_mark (framepos_t where);
1296 void add_location_from_region ();
1297 void add_locations_from_region ();
1298 void add_location_from_selection ();
1299 void set_loop_from_selection (bool play);
1300 void set_punch_from_selection ();
1301 void set_punch_from_region ();
1303 void set_loop_from_edit_range (bool play);
1304 void set_loop_from_region (bool play);
1305 void set_punch_from_edit_range ();
1307 void set_loop_range (framepos_t start, framepos_t end, std::string cmd);
1308 void set_punch_range (framepos_t start, framepos_t end, std::string cmd);
1310 void add_location_from_playhead_cursor ();
1311 bool select_new_marker;
1313 void reverse_selection ();
1314 void edit_envelope ();
1316 double last_scrub_x;
1317 int scrubbing_direction;
1318 int scrub_reversals;
1319 int scrub_reverse_distance;
1320 void scrub (framepos_t, double);
1322 void keyboard_selection_begin ();
1323 void keyboard_selection_finish (bool add);
1324 bool have_pending_keyboard_selection;
1325 framepos_t pending_keyboard_selection_start;
1327 void move_range_selection_start_or_end_to_region_boundary (bool, bool);
1329 Editing::SnapType _snap_type;
1330 Editing::SnapMode _snap_mode;
1332 /// Snap threshold in pixels
1333 double snap_threshold;
1335 bool ignore_gui_changes;
1337 DragManager* _drags;
1341 Gtk::Menu fade_context_menu;
1342 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1344 Gtk::Menu xfade_in_context_menu;
1345 Gtk::Menu xfade_out_context_menu;
1346 void popup_xfade_in_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1347 void popup_xfade_out_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1348 void fill_xfade_menu (Gtk::Menu_Helpers::MenuList& items, bool start);
1350 void set_fade_in_shape (ARDOUR::FadeShape);
1351 void set_fade_out_shape (ARDOUR::FadeShape);
1353 void set_fade_length (bool in);
1354 void set_fade_in_active (bool);
1355 void set_fade_out_active (bool);
1357 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1359 bool _dragging_playhead;
1360 bool _dragging_edit_point;
1362 void marker_drag_motion_callback (GdkEvent*);
1363 void marker_drag_finished_callback (GdkEvent*);
1365 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1367 void add_region_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1368 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1369 void add_region_copy_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1370 void add_region_brush_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1371 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1373 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1375 bool can_remove_control_point (ArdourCanvas::Item *);
1376 void remove_control_point (ArdourCanvas::Item *);
1378 void mouse_brush_insert_region (RegionView*, framepos_t pos);
1380 /* Canvas event handlers */
1382 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1383 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1384 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1385 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1386 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1387 bool canvas_start_xfade_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1388 bool canvas_end_xfade_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1389 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1390 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1391 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1392 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1393 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1394 bool canvas_frame_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1395 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1396 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1397 bool canvas_feature_line_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*);
1398 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1399 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1400 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1401 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1402 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1403 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*);
1404 bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item *);
1406 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1407 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1408 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1409 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1410 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1411 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1413 bool canvas_videotl_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1414 void update_video_timeline (bool flush = false);
1415 void set_video_timeline_height (const int);
1416 bool is_video_timeline_locked ();
1417 void toggle_video_timeline_locked ();
1418 void set_video_timeline_locked (const bool);
1419 void queue_visual_videotimeline_update ();
1420 void embed_audio_from_video (std::string, framepos_t n = 0);
1422 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1423 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1424 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1425 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1426 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1427 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1428 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1429 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1431 PBD::Signal0<void> EditorFreeze;
1432 PBD::Signal0<void> EditorThaw;
1435 friend class DragManager;
1436 friend class EditorRouteGroups;
1437 friend class EditorRegions;
1439 /** true if the mouse is over a place where region trim can happen */
1440 bool _over_region_trim_target;
1442 /* non-public event handlers */
1444 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1445 bool track_canvas_scroll (GdkEventScroll* event);
1447 bool track_canvas_scroll_event (GdkEventScroll* event);
1448 bool track_canvas_button_press_event (GdkEventButton* event);
1449 bool track_canvas_button_release_event (GdkEventButton* event);
1450 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1452 Gtk::Allocation _canvas_viewport_allocation;
1453 void track_canvas_viewport_allocate (Gtk::Allocation alloc);
1454 bool track_canvas_viewport_size_allocated ();
1455 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1456 bool track_canvas_key_press (GdkEventKey *);
1457 bool track_canvas_key_release (GdkEventKey *);
1459 void set_playhead_cursor ();
1461 void toggle_region_mute ();
1463 void initialize_canvas ();
1465 /* display control */
1467 bool _show_measures;
1468 /// true if the editor should follow the playhead, otherwise false
1469 bool _follow_playhead;
1470 /// true if we scroll the tracks rather than the playhead
1471 bool _stationary_playhead;
1472 /// true if we are in fullscreen mode
1475 TempoLines* tempo_lines;
1477 ArdourCanvas::Group* time_line_group;
1479 void hide_measures ();
1480 void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
1481 ARDOUR::TempoMap::BBTPointList::const_iterator& end);
1483 void new_tempo_section ();
1485 void mouse_add_new_tempo_event (framepos_t where);
1486 void mouse_add_new_meter_event (framepos_t where);
1488 void remove_tempo_marker (ArdourCanvas::Item*);
1489 void remove_meter_marker (ArdourCanvas::Item*);
1490 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1491 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1493 void edit_tempo_section (ARDOUR::TempoSection*);
1494 void edit_meter_section (ARDOUR::MeterSection*);
1495 void edit_tempo_marker (ArdourCanvas::Item*);
1496 void edit_meter_marker (ArdourCanvas::Item*);
1497 void edit_control_point (ArdourCanvas::Item*);
1498 void edit_notes (TimeAxisViewItem&);
1500 void marker_menu_edit ();
1501 void marker_menu_remove ();
1502 void marker_menu_rename ();
1503 void toggle_marker_menu_lock ();
1504 void toggle_marker_menu_glue ();
1505 void marker_menu_hide ();
1506 void marker_menu_loop_range ();
1507 void marker_menu_select_all_selectables_using_range ();
1508 void marker_menu_select_using_range ();
1509 void marker_menu_separate_regions_using_location ();
1510 void marker_menu_play_from ();
1511 void marker_menu_play_range ();
1512 void marker_menu_set_playhead ();
1513 void marker_menu_set_from_playhead ();
1514 void marker_menu_set_from_selection (bool force_regions);
1515 void marker_menu_range_to_next ();
1516 void marker_menu_zoom_to_range ();
1517 void new_transport_marker_menu_set_loop ();
1518 void new_transport_marker_menu_set_punch ();
1519 void update_loop_range_view (bool visibility=false);
1520 void update_punch_range_view (bool visibility=false);
1521 void new_transport_marker_menu_popdown ();
1522 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1523 void tempo_or_meter_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1524 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1525 void build_range_marker_menu (bool, bool);
1526 void build_marker_menu (ARDOUR::Location *);
1527 void build_tempo_or_meter_marker_menu (bool);
1528 void build_new_transport_marker_menu ();
1529 void dynamic_cast_marker_object (void*, MeterMarker**, TempoMarker**) const;
1531 Gtk::Menu* tempo_or_meter_marker_menu;
1532 Gtk::Menu* marker_menu;
1533 Gtk::Menu* range_marker_menu;
1534 Gtk::Menu* transport_marker_menu;
1535 Gtk::Menu* new_transport_marker_menu;
1536 Gtk::Menu* cd_marker_menu;
1537 ArdourCanvas::Item* marker_menu_item;
1539 typedef std::list<Marker*> Marks;
1542 void remove_metric_marks ();
1543 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1545 void compute_current_bbt_points (framepos_t left, framepos_t right,
1546 ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
1547 ARDOUR::TempoMap::BBTPointList::const_iterator& end);
1549 void tempo_map_changed (const PBD::PropertyChange&);
1550 void redisplay_tempo (bool immediate_redraw);
1552 uint32_t bbt_beat_subdivision;
1556 Gtk::ToggleButton editor_mixer_button;
1557 Gtk::ToggleButton editor_list_button;
1558 void editor_mixer_button_toggled ();
1559 void editor_list_button_toggled ();
1561 AudioClock* zoom_range_clock;
1563 ArdourButton zoom_in_button;
1564 ArdourButton zoom_out_button;
1565 ArdourButton zoom_out_full_button;
1567 ArdourButton tav_expand_button;
1568 ArdourButton tav_shrink_button;
1570 Gtk::VBox toolbar_clock_vbox;
1571 Gtk::VBox toolbar_selection_clock_vbox;
1572 Gtk::Table toolbar_selection_clock_table;
1573 Gtk::Label toolbar_selection_cursor_label;
1575 Gtkmm2ext::TearOff* _mouse_mode_tearoff;
1576 ArdourButton mouse_select_button;
1577 ArdourButton mouse_draw_button;
1578 ArdourButton mouse_move_button;
1579 ArdourButton mouse_gain_button;
1580 ArdourButton mouse_zoom_button;
1581 ArdourButton mouse_timefx_button;
1582 ArdourButton mouse_audition_button;
1584 ArdourButton smart_mode_button;
1585 Glib::RefPtr<Gtk::ToggleAction> smart_mode_action;
1587 void mouse_mode_toggled (Editing::MouseMode m);
1588 void mouse_mode_object_range_toggled ();
1589 bool ignore_mouse_mode_toggle;
1591 ArdourButton internal_edit_button;
1592 void toggle_internal_editing ();
1594 bool mouse_select_button_release (GdkEventButton*);
1596 Gtk::VBox automation_box;
1597 Gtk::Button automation_mode_button;
1599 Gtk::ComboBoxText edit_mode_selector;
1600 Gtk::VBox edit_mode_box;
1601 std::vector<std::string> edit_mode_strings;
1603 void set_edit_mode (ARDOUR::EditMode);
1604 void cycle_edit_mode ();
1605 void edit_mode_selection_done ();
1607 Gtk::ComboBoxText snap_type_selector;
1608 Gtk::ComboBoxText snap_mode_selector;
1611 std::vector<std::string> snap_type_strings;
1612 std::vector<std::string> snap_mode_strings;
1614 void snap_type_selection_done ();
1615 void snap_mode_selection_done ();
1616 void snap_mode_chosen (Editing::SnapMode);
1617 void snap_type_chosen (Editing::SnapType);
1619 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1620 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1622 Gtk::ComboBoxText zoom_focus_selector;
1623 Gtk::VBox zoom_focus_box;
1625 std::vector<std::string> zoom_focus_strings;
1627 void zoom_focus_selection_done ();
1628 void zoom_focus_chosen (Editing::ZoomFocus);
1630 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1632 Gtk::HBox _zoom_box;
1633 Gtkmm2ext::TearOff* _zoom_tearoff;
1634 void zoom_adjustment_changed();
1636 void setup_toolbar ();
1638 void setup_tooltips ();
1640 Gtkmm2ext::TearOff* _tools_tearoff;
1641 Gtk::HBox toolbar_hbox;
1642 Gtk::EventBox toolbar_base;
1643 Gtk::Frame toolbar_frame;
1644 Gtk::Viewport _toolbar_viewport;
1648 Gtk::HBox panic_box;
1650 void setup_midi_toolbar ();
1652 /* selection process */
1654 Selection* selection;
1655 Selection* cut_buffer;
1657 void time_selection_changed ();
1658 void track_selection_changed ();
1659 void region_selection_changed ();
1660 sigc::connection editor_regions_selection_changed_connection;
1661 void sensitize_all_region_actions (bool);
1662 void sensitize_the_right_region_actions ();
1663 bool _all_region_actions_sensitized;
1664 /** Flag to block region action handlers from doing what they normally do;
1665 * I tried Gtk::Action::block_activate() but this doesn't work (ie it doesn't
1666 * block) when setting a ToggleAction's active state.
1668 bool _ignore_region_action;
1669 bool _last_region_menu_was_main;
1670 void point_selection_changed ();
1671 void marker_selection_changed ();
1673 void cancel_selection ();
1674 void cancel_time_selection ();
1676 bool get_smart_mode() const;
1678 bool audio_region_selection_covers (framepos_t where);
1680 /* transport range select process */
1682 ArdourCanvas::Rectangle* cd_marker_bar_drag_rect;
1683 ArdourCanvas::Rectangle* range_bar_drag_rect;
1684 ArdourCanvas::Rectangle* transport_bar_drag_rect;
1687 ArdourCanvas::Rectangle *bogus_background_rect;
1689 ArdourCanvas::Rectangle *transport_bar_range_rect;
1690 ArdourCanvas::Rectangle *transport_bar_preroll_rect;
1691 ArdourCanvas::Rectangle *transport_bar_postroll_rect;
1692 ArdourCanvas::Rectangle *transport_loop_range_rect;
1693 ArdourCanvas::Rectangle *transport_punch_range_rect;
1694 ArdourCanvas::Line *transport_punchin_line;
1695 ArdourCanvas::Line *transport_punchout_line;
1696 ArdourCanvas::Rectangle *transport_preroll_rect;
1697 ArdourCanvas::Rectangle *transport_postroll_rect;
1699 ARDOUR::Location* transport_loop_location();
1700 ARDOUR::Location* transport_punch_location();
1702 ARDOUR::Location *temp_location;
1704 /* object rubberband select process */
1706 void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
1708 ArdourCanvas::Rectangle *rubberband_rect;
1710 /* mouse zoom process */
1712 ArdourCanvas::Rectangle *zoom_rect;
1713 void reposition_zoom_rect (framepos_t start, framepos_t end);
1715 EditorRouteGroups* _route_groups;
1716 EditorRoutes* _routes;
1717 EditorRegions* _regions;
1718 EditorSnapshots* _snapshots;
1719 EditorLocations* _locations;
1721 /* diskstream/route display management */
1722 Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
1723 Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
1725 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1727 bool sync_track_view_list_and_routes ();
1729 Gtk::VBox list_vpacker;
1733 bool autoscroll_active;
1734 int autoscroll_timeout_tag;
1737 int last_autoscroll_x;
1738 int last_autoscroll_y;
1739 uint32_t autoscroll_cnt;
1740 framecnt_t autoscroll_x_distance;
1741 double autoscroll_y_distance;
1743 bool _autoscroll_fudging;
1744 int autoscroll_fudge_threshold () const;
1746 static gint _autoscroll_canvas (void *);
1747 bool autoscroll_canvas ();
1748 void start_canvas_autoscroll (int x, int y);
1749 void stop_canvas_autoscroll ();
1752 void point_trim (GdkEvent *, framepos_t);
1754 void trim_region_front();
1755 void trim_region_back();
1756 void trim_region (bool front);
1758 void trim_region_to_loop ();
1759 void trim_region_to_punch ();
1760 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1762 void trim_to_region(bool forward);
1763 void trim_region_to_previous_region_end();
1764 void trim_region_to_next_region_start();
1766 bool show_gain_after_trim;
1770 int convert_drop_to_paths (
1771 std::vector<std::string>& paths,
1772 const Glib::RefPtr<Gdk::DragContext>& context,
1775 const Gtk::SelectionData& data,
1779 void track_canvas_drag_data_received (
1780 const Glib::RefPtr<Gdk::DragContext>& context,
1783 const Gtk::SelectionData& data,
1788 const Glib::RefPtr<Gdk::DragContext>& context,
1791 const Gtk::SelectionData& data,
1796 const Glib::RefPtr<Gdk::DragContext>& context,
1799 const Gtk::SelectionData& data,
1804 const Glib::RefPtr<Gdk::DragContext>& context,
1807 const Gtk::SelectionData& data,
1813 int write_region_selection(RegionSelection&);
1814 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1815 void bounce_region_selection (bool with_processing);
1816 void bounce_range_selection (bool replace, bool enable_processing);
1817 void external_edit_region ();
1819 int write_audio_selection (TimeSelection&);
1820 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1822 void write_selection ();
1824 XMLNode *before; /* used in *_reversible_command */
1826 void update_title ();
1827 void update_title_s (const std::string & snapshot_name);
1829 void instant_save ();
1831 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1833 /* freeze operations */
1835 ARDOUR::InterThreadInfo freeze_status;
1836 static void* _freeze_thread (void*);
1837 void* freeze_thread ();
1839 void freeze_route ();
1840 void unfreeze_route ();
1844 void duplicate_range (bool with_dialog);
1846 /** computes the timeline frame (sample) of an event whose coordinates
1847 * are in canvas units (pixels, scroll offset included).
1849 framepos_t canvas_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
1851 /** computes the timeline frame (sample) of an event whose coordinates
1852 * are in window units (pixels, no scroll offset).
1854 framepos_t window_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
1856 /* returns false if mouse pointer is not in track or marker canvas
1858 bool mouse_frame (framepos_t&, bool& in_track_canvas) const;
1860 TimeFXDialog* current_timefx;
1861 static void* timefx_thread (void *arg);
1864 int time_stretch (RegionSelection&, float fraction);
1865 int pitch_shift (RegionSelection&, float cents);
1866 void pitch_shift_region ();
1868 void transpose_region ();
1870 /* editor-mixer strip */
1872 MixerStrip *current_mixer_strip;
1873 bool show_editor_mixer_when_tracks_arrive;
1874 Gtk::VBox current_mixer_strip_vbox;
1875 void cms_new (boost::shared_ptr<ARDOUR::Route>);
1876 void current_mixer_strip_hidden ();
1878 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1879 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1881 void ensure_all_elements_drawn ();
1883 /* nudging tracks */
1885 void nudge_track (bool use_edit_point, bool forwards);
1888 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
1889 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
1891 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1892 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1894 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1895 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1896 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1898 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1899 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1900 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1901 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1903 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1904 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1905 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1906 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1908 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1909 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1910 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1911 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1912 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1913 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1915 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1916 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1917 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1918 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1919 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1920 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1922 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1923 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1925 ImageFrameSocketHandler* image_socket_listener ;
1928 static const int32_t default_width = 995;
1929 static const int32_t default_height = 765;
1933 ArdourButton nudge_forward_button;
1934 ArdourButton nudge_backward_button;
1935 Gtk::HBox nudge_hbox;
1936 Gtk::VBox nudge_vbox;
1937 AudioClock* nudge_clock;
1939 bool nudge_forward_release (GdkEventButton*);
1940 bool nudge_backward_release (GdkEventButton*);
1944 void apply_filter (ARDOUR::Filter&, std::string cmd, ProgressReporter* progress = 0);
1946 Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
1947 void apply_midi_note_edit_op (ARDOUR::MidiOperator& op);
1949 /* handling cleanup */
1951 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
1953 PBD::ScopedConnectionList session_connections;
1955 /* tracking step changes of track height */
1957 TimeAxisView* current_stepping_trackview;
1958 ARDOUR::microseconds_t last_track_height_step_timestamp;
1959 gint track_height_step_timeout();
1960 sigc::connection step_timeout;
1962 TimeAxisView* entered_track;
1963 /** If the mouse is over a RegionView or one of its child canvas items, this is set up
1964 to point to the RegionView. Otherwise it is 0.
1966 RegionView* entered_regionview;
1968 bool clear_entered_track;
1969 bool left_track_canvas (GdkEventCrossing*);
1970 bool entered_track_canvas (GdkEventCrossing*);
1971 void set_entered_track (TimeAxisView*);
1972 void set_entered_regionview (RegionView*);
1973 void ensure_track_visible (TimeAxisView*);
1974 gint left_automation_track ();
1976 void reset_canvas_action_sensitivity (bool);
1977 void set_gain_envelope_visibility ();
1978 void set_region_gain_visibility (RegionView*);
1979 void toggle_gain_envelope_active ();
1980 void reset_region_gain_envelopes ();
1982 bool on_key_press_event (GdkEventKey*);
1983 bool on_key_release_event (GdkEventKey*);
1985 void session_state_saved (std::string);
1987 Glib::RefPtr<Gtk::Action> undo_action;
1988 Glib::RefPtr<Gtk::Action> redo_action;
1990 void history_changed ();
1992 Gtk::HBox status_bar_hpacker;
1994 Editing::EditPoint _edit_point;
1996 Gtk::ComboBoxText edit_point_selector;
1998 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
1999 void cycle_edit_point (bool with_marker);
2000 void set_edit_point ();
2001 void edit_point_selection_done ();
2002 void edit_point_chosen (Editing::EditPoint);
2003 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2004 std::vector<std::string> edit_point_strings;
2006 void selected_marker_moved (ARDOUR::Location*);
2008 bool get_edit_op_range (framepos_t& start, framepos_t& end) const;
2010 void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
2011 void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
2013 RegionSelection get_regions_from_selection_and_edit_point ();
2014 RegionSelection get_regions_from_selection_and_entered ();
2016 void start_updating_meters ();
2017 void stop_updating_meters ();
2018 bool meters_running;
2020 void select_next_route ();
2021 void select_prev_route ();
2023 void snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
2024 void timecode_snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
2026 RhythmFerret* rhythm_ferret;
2028 void fit_tracks (TrackViewList &);
2029 void fit_selected_tracks ();
2030 void set_track_height (Height);
2032 void remove_tracks ();
2033 void toggle_tracks_active ();
2037 static gboolean _idle_resize (gpointer);
2039 int32_t _pending_resize_amount;
2040 TimeAxisView* _pending_resize_view;
2042 void visible_order_range (int*, int*) const;
2046 /** true if we've made a locate request that hasn't yet been processed */
2047 bool _pending_locate_request;
2049 /** if true, there is a pending Session locate which is the initial one when loading a session;
2050 we need to know this so that we don't (necessarily) set the viewport to show the playhead
2053 bool _pending_initial_locate;
2055 Gtk::HBox _summary_hbox;
2056 EditorSummary* _summary;
2058 void region_view_added (RegionView *);
2059 void region_view_removed ();
2061 EditorGroupTabs* _group_tabs;
2062 void fit_route_group (ARDOUR::RouteGroup *);
2064 void step_edit_status_change (bool);
2065 void start_step_editing ();
2066 void stop_step_editing ();
2067 bool check_step_edit ();
2068 sigc::connection step_edit_connection;
2070 double _last_motion_y;
2072 RegionLayeringOrderEditor* layering_order_editor;
2073 void update_region_layering_order_editor ();
2075 /** Track that was the source for the last cut/copy operation. Used as a place
2076 to paste things iff there is no selected track.
2078 TimeAxisView* _last_cut_copy_source_track;
2080 /** true if a change in Selection->regions should change the selection in the region list.
2081 See EditorRegions::selection_changed.
2083 bool _region_selection_change_updates_region_list;
2085 void setup_fade_images ();
2086 std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images;
2087 std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images;
2088 std::map<ARDOUR::FadeShape, Gtk::Image*> _xfade_in_images;
2089 std::map<ARDOUR::FadeShape, Gtk::Image*> _xfade_out_images;
2091 Gtk::MenuItem& action_menu_item (std::string const &);
2092 void action_pre_activated (Glib::RefPtr<Gtk::Action> const &);
2094 void set_canvas_cursor_for_region_view (double, RegionView *);
2096 MouseCursors* _cursors;
2098 void follow_mixer_selection ();
2099 bool _following_mixer_selection;
2101 int time_fx (ARDOUR::RegionList&, float val, bool pitching);
2102 void note_edit_done (int, EditNoteDialog*);
2103 void toggle_sound_midi_notes ();
2105 /** Flag for a bit of a hack wrt control point selection; see set_selected_control_point_from_click */
2106 bool _control_point_toggled_on_press;
2108 /** This is used by TimeAxisView to keep a track of the TimeAxisView that is currently being
2109 stepped in height using Shift-Scrollwheel. When a scroll event occurs, we do the step on
2110 this _stepping_axis_view if it is non-0 (and we set up this _stepping_axis_view with the
2111 TimeAxisView underneath the mouse if it is 0). Then Editor resets _stepping_axis_view when
2112 the shift key is released. In this (hacky) way, pushing shift and moving the scroll wheel
2113 will operate on the same track until shift is released (rather than skipping about to whatever
2114 happens to be underneath the mouse at the time).
2116 TimeAxisView* _stepping_axis_view;
2117 void shift_key_released ();
2120 friend class RegionDrag;
2121 friend class RegionMoveDrag;
2122 friend class RegionSpliceDrag;
2123 friend class TrimDrag;
2124 friend class MeterMarkerDrag;
2125 friend class TempoMarkerDrag;
2126 friend class CursorDrag;
2127 friend class FadeInDrag;
2128 friend class FadeOutDrag;
2129 friend class MarkerDrag;
2130 friend class RegionGainDrag;
2131 friend class ControlPointDrag;
2132 friend class LineDrag;
2133 friend class RubberbandSelectDrag;
2134 friend class EditorRubberbandSelectDrag;
2135 friend class TimeFXDrag;
2136 friend class ScrubDrag;
2137 friend class SelectionDrag;
2138 friend class RangeMarkerBarDrag;
2139 friend class MouseZoomDrag;
2140 friend class RegionCreateDrag;
2141 friend class RegionMotionDrag;
2142 friend class RegionInsertDrag;
2143 friend class VideoTimeLineDrag;
2145 friend class EditorSummary;
2146 friend class EditorGroupTabs;
2148 friend class EditorRoutes;
2149 friend class RhythmFerret;
2152 #endif /* __ardour_editor_h__ */