Remove idiocy.
[ardour2.git] / gtk2_ardour / editor.h
blobe4cb5ec57d7ca39493d0d802ad6fcd66685bf26a
1 /*
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__
23 #include <list>
24 #include <map>
25 #include <set>
26 #include <string>
27 #include <sys/time.h>
28 #include <bitset>
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>
39 #include <cmath>
41 #include <gtkmm/comboboxtext.h>
42 #include <gtkmm/layout.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/location.h"
52 #include "ardour/audioregion.h"
53 #include "ardour/track.h"
54 #include "ardour/types.h"
55 #include "ardour/route_group.h"
57 #include "audio_clock.h"
58 #include "gtk-custom-ruler.h"
59 #include "ardour_dialog.h"
60 #include "public_editor.h"
61 #include "editing.h"
62 #include "enums.h"
63 #include "editor_items.h"
64 #include "region_selection.h"
65 #include "canvas.h"
66 #include "editor_summary.h"
68 namespace Gtkmm2ext {
69 class TearOff;
72 namespace ARDOUR {
73 class AudioDiskstream;
74 class RouteGroup;
75 class Playlist;
76 class AudioPlaylist;
77 class Region;
78 class Location;
79 class TempoSection;
80 class NamedSelection;
81 class Session;
82 class Filter;
83 class Crossfade;
84 class ChanCount;
85 class MidiOperator;
88 namespace LADSPA {
89 class Plugin;
92 class AnalysisWindow;
93 class AudioRegionView;
94 class AudioStreamView;
95 class AudioTimeAxisView;
96 class AutomationLine;
97 class AutomationSelection;
98 class AutomationTimeAxisView;
99 class BundleManager;
100 class ControlPoint;
101 class CrossfadeView;
102 class Drag;
103 class GlobalPortMatrixWindow;
104 class GroupedButtons;
105 class Marker;
106 class MidiRegionView;
107 class MixerStrip;
108 class PlaylistSelector;
109 class PluginSelector;
110 class RhythmFerret;
111 class Selection;
112 class SoundFileOmega;
113 class StreamView;
114 class TempoLines;
115 class TimeAxisView;
116 class TimeFXDialog;
117 class TimeSelection;
118 class TrackSelection;
119 class EditorGroupTabs;
120 class EditorRoutes;
121 class EditorRouteGroups;
122 class EditorRegions;
123 class EditorSnapshots;
125 /* <CMT Additions> */
126 class ImageFrameView;
127 class ImageFrameTimeAxisView;
128 class ImageFrameTimeAxis;
129 class MarkerTimeAxis ;
130 class MarkerView ;
131 class ImageFrameSocketHandler ;
132 class TimeAxisViewItem ;
133 /* </CMT Additions> */
135 struct EditorCursor {
136 Editor& editor;
137 ArdourCanvas::Points points;
138 ArdourCanvas::Line canvas_item;
139 nframes64_t current_frame;
140 double length;
142 EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
143 ~EditorCursor ();
145 void set_position (nframes64_t);
146 void set_length (double units);
147 void set_y_axis (double position);
149 sigc::signal<void, nframes64_t> PositionChanged;
152 class Editor : public PublicEditor
154 public:
155 Editor ();
156 ~Editor ();
158 void connect_to_session (ARDOUR::Session *);
159 ARDOUR::Session* current_session() const { return session; }
160 void first_idle ();
161 virtual bool have_idled () const { return _have_idled; }
163 nframes64_t leftmost_position() const { return leftmost_frame; }
165 nframes64_t current_page_frames() const {
166 return (nframes64_t) floor (_canvas_width * frames_per_unit);
169 double canvas_height () const {
170 return _canvas_height;
173 void cycle_snap_mode ();
174 void cycle_snap_choice ();
175 void set_snap_to (Editing::SnapType);
176 void set_snap_mode (Editing::SnapMode);
177 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
179 void undo (uint32_t n = 1);
180 void redo (uint32_t n = 1);
182 XMLNode& get_state ();
183 int set_state (const XMLNode&, int version);
185 void set_mouse_mode (Editing::MouseMode, bool force=true);
186 void step_mouse_mode (bool next);
187 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
188 Editing::MidiEditMode current_midi_edit_mode () const;
190 bool internal_editing() const { return _internal_editing ; }
191 void set_internal_edit (bool yn);
193 #ifdef WITH_CMT
194 void add_imageframe_time_axis(const std::string & track_name, void*) ;
195 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
196 void connect_to_image_compositor() ;
197 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
198 TimeAxisView* get_named_time_axis(const std::string & name) ;
199 #endif /* WITH_CMT */
201 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
202 void add_to_idle_resize (TimeAxisView*, int32_t);
204 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
206 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
207 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
208 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
210 #ifdef USE_RUBBERBAND
211 std::vector<std::string> rb_opt_strings;
212 #endif
214 /* option editor-access */
216 void set_show_waveforms_recording (bool yn);
217 bool show_waveforms_recording() const { return _show_waveforms_recording; }
219 /* things that need to be public to be used in the main menubar */
221 void new_region_from_selection ();
222 void separate_regions_between (const TimeSelection&);
223 void separate_region_from_selection ();
224 void separate_region_from_punch ();
225 void separate_region_from_loop ();
226 void separate_regions_using_location (ARDOUR::Location&);
227 void toggle_playback (bool with_abort);
228 void transition_to_rolling (bool forward);
230 /* undo related */
232 nframes64_t unit_to_frame (double unit) const {
233 return (nframes64_t) rint (unit * frames_per_unit);
236 double frame_to_unit (nframes64_t frame) const {
237 return rint ((double) frame / (double) frames_per_unit);
240 double frame_to_unit (double frame) const {
241 return rint (frame / frames_per_unit);
244 /* NOTE: these functions assume that the "pixel" coordinate is
245 the result of using the world->canvas affine transform on a
246 world coordinate. These coordinates already take into
247 account any scrolling carried out by adjusting the
248 xscroll_adjustment.
251 nframes64_t pixel_to_frame (double pixel) const {
253 /* pixel can be less than zero when motion events
254 are processed. since we've already run the world->canvas
255 affine, that means that the location *really* is "off
256 to the right" and thus really is "before the start".
259 if (pixel >= 0) {
260 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
261 } else {
262 return 0;
266 gulong frame_to_pixel (nframes64_t frame) const {
267 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
270 void flush_canvas ();
272 /* selection */
274 Selection& get_selection() const { return *selection; }
275 Selection& get_cut_buffer() const { return *cut_buffer; }
277 bool extend_selection_to_track (TimeAxisView&);
279 void play_selection ();
280 void select_all_in_track (Selection::Operation op);
281 void select_all (Selection::Operation op);
282 void invert_selection_in_track ();
283 void invert_selection ();
284 void deselect_all ();
286 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
288 /* tempo */
290 void set_show_measures (bool yn);
291 bool show_measures () const { return _show_measures; }
293 /* analysis window */
295 void analyze_region_selection();
296 void analyze_range_selection();
298 /* export */
300 void export_audio ();
301 void export_selection ();
302 void export_range ();
303 void export_region ();
305 void add_toplevel_controls (Gtk::Container&);
306 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
308 void set_zoom_focus (Editing::ZoomFocus);
309 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
310 double get_current_zoom () const { return frames_per_unit; }
312 void temporal_zoom_step (bool coarser);
313 void tav_zoom_step (bool coarser);
315 /* stuff that AudioTimeAxisView and related classes use */
317 PlaylistSelector& playlist_selector() const;
318 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
320 void new_playlists (TimeAxisView* v);
321 void copy_playlists (TimeAxisView* v);
322 void clear_playlists (TimeAxisView* v);
324 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
325 void get_onscreen_tracks (TrackViewList&);
327 Width editor_mixer_strip_width;
328 void maybe_add_mixer_strip_width (XMLNode&);
329 void show_editor_mixer (bool yn);
330 void create_editor_mixer ();
331 void show_editor_list (bool yn);
332 void set_selected_mixer_strip (TimeAxisView&);
333 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
335 /* nudge is initiated by transport controls owned by ARDOUR_UI */
337 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
338 Evoral::MusicalTime get_grid_type_as_beats (bool& success, nframes64_t position);
340 void nudge_forward (bool next, bool force_playhead);
341 void nudge_backward (bool next, bool force_playhead);
343 /* nudge initiated from context menu */
345 void nudge_forward_capture_offset ();
346 void nudge_backward_capture_offset ();
348 /* playhead/screen stuff */
350 void set_follow_playhead (bool yn);
351 void toggle_follow_playhead ();
352 bool follow_playhead() const { return _follow_playhead; }
353 bool dragging_playhead () const { return _dragging_playhead; }
355 void toggle_zero_line_visibility ();
356 void toggle_waveforms_while_recording ();
357 void set_summary ();
358 void set_group_tabs ();
359 void toggle_measure_visibility ();
360 void toggle_logo_visibility ();
362 double get_physical_screen_width () const { return physical_screen_width; };
363 double physical_screen_width;
364 double physical_screen_height;
366 /* fades/xfades */
368 void toggle_selected_region_fades (int dir);
369 void update_region_fade_visibility ();
370 bool xfade_visibility() const { return _xfade_visibility; }
371 void update_xfade_visibility ();
373 /* redirect shared ops menu. caller must free returned menu */
375 Gtk::Menu* redirect_menu ();
377 /* floating windows/transient */
379 void ensure_float (Gtk::Window&);
381 void show_window ();
383 void scroll_tracks_down_line ();
384 void scroll_tracks_up_line ();
386 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
387 void prepare_for_cleanup ();
388 void finish_cleanup ();
390 void maximise_editing_space();
391 void restore_editing_space();
393 void reset_x_origin (nframes64_t);
394 void reset_y_origin (double);
395 void reset_zoom (double);
396 void reposition_and_zoom (nframes64_t, double);
398 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
400 bool update_mouse_speed ();
401 bool decelerate_mouse_speed ();
403 void toggle_meter_updating();
405 void show_rhythm_ferret();
406 void show_bundle_manager ();
407 void show_global_port_matrix (ARDOUR::DataType);
409 void goto_visual_state (uint32_t);
410 void save_visual_state (uint32_t);
412 TrackViewList const & get_track_views () {
413 return track_views;
416 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region>);
418 void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
419 void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
421 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
423 void show_verbose_canvas_cursor_with (const std::string& txt);
424 void hide_verbose_canvas_cursor();
426 protected:
427 void map_transport_state ();
428 void map_position_change (nframes64_t);
430 void on_realize();
432 private:
434 void color_handler ();
436 ARDOUR::Session *session; ///< The session that we are editing, or 0
437 bool constructed;
439 // to keep track of the playhead position for control_scroll
440 boost::optional<nframes64_t> _control_scroll_target;
442 PlaylistSelector* _playlist_selector;
444 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
446 struct VisualState {
447 double y_position;
448 double frames_per_unit;
449 nframes64_t leftmost_frame;
450 Editing::ZoomFocus zoom_focus;
451 std::list<TAVState> track_states;
454 std::list<VisualState*> undo_visual_stack;
455 std::list<VisualState*> redo_visual_stack;
456 VisualState* current_visual_state (bool with_tracks = true);
457 void undo_visual_state ();
458 void redo_visual_state ();
459 void use_visual_state (VisualState&);
460 bool no_save_visual;
461 void swap_visual_state ();
463 std::vector<VisualState*> visual_states;
464 sigc::connection visual_state_op_connection;
465 void start_visual_state_op (uint32_t n);
466 void cancel_visual_state_op (uint32_t n);
467 bool end_visual_state_op (uint32_t n);
469 nframes64_t leftmost_frame;
470 double frames_per_unit;
471 Editing::ZoomFocus zoom_focus;
473 void set_frames_per_unit (double);
474 void post_zoom ();
476 Editing::MouseMode mouse_mode;
477 bool _internal_editing;
479 int post_maximal_editor_width;
480 int post_maximal_pane_position;
481 int pre_maximal_pane_position;
482 int pre_maximal_editor_width;
483 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
485 Gtk::Notebook the_notebook;
486 Gtk::HPaned edit_pane;
488 Gtk::EventBox meter_base;
489 Gtk::HBox meter_box;
490 Gtk::EventBox marker_base;
491 Gtk::HBox marker_box;
492 Gtk::VBox scrollers_rulers_markers_box;
494 void location_changed (ARDOUR::Location *);
495 void location_flags_changed (ARDOUR::Location *, void *);
496 void refresh_location_display ();
497 void refresh_location_display_s (ARDOUR::Change);
498 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
499 void add_new_location (ARDOUR::Location *);
500 void location_gone (ARDOUR::Location *);
501 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
502 gint really_remove_marker (ARDOUR::Location* loc);
503 void goto_nth_marker (int nth);
505 uint32_t location_marker_color;
506 uint32_t location_range_color;
507 uint32_t location_loop_color;
508 uint32_t location_punch_color;
509 uint32_t location_cd_marker_color;
511 struct LocationMarkers {
512 Marker* start;
513 Marker* end;
514 bool valid;
516 LocationMarkers () : start(0), end(0), valid (true) {}
518 ~LocationMarkers ();
520 void hide();
521 void show ();
522 void set_name (const std::string&);
523 void set_position (nframes64_t start, nframes64_t end = 0);
524 void set_color_rgba (uint32_t);
527 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
528 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
529 Marker* entered_marker;
531 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
532 LocationMarkerMap location_markers;
534 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
535 void clear_marker_display ();
536 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
537 bool choose_new_marker_name(std::string &name);
538 void update_cd_marker_display ();
539 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
541 TimeAxisView* clicked_axisview;
542 RouteTimeAxisView* clicked_routeview;
543 /** The last RegionView that was clicked on, or 0 if the last click was not
544 * on a RegionView. This is set up by the canvas event handlers in
545 * editor_canvas_events.cc
547 RegionView* clicked_regionview;
548 RegionSelection latest_regionviews;
549 uint32_t clicked_selection;
550 CrossfadeView* clicked_crossfadeview;
551 ControlPoint* clicked_control_point;
553 void sort_track_selection (TrackSelection* sel = 0);
555 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks) const;
556 void get_equivalent_tracks (RouteTimeAxisView*, std::set<RouteTimeAxisView*> &, ARDOUR::RouteGroup::Property) const;
557 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, ARDOUR::RouteGroup::Property) const;
558 RegionSelection get_equivalent_regions (RegionSelection &, ARDOUR::RouteGroup::Property) const;
559 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, ARDOUR::RouteGroup::Property) const;
561 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
563 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector<RegionView*>*) const;
564 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
565 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
566 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
568 /* end */
570 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
571 bool button_release_can_deselect;
573 void catch_vanishing_regionview (RegionView *);
575 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
576 void select_all_tracks ();
578 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
579 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
580 void set_selected_track_as_side_effect (bool force = false);
581 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
583 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
584 void collect_new_region_view (RegionView *);
585 void collect_and_select_new_region_view (RegionView *);
587 Gtk::Menu track_context_menu;
588 Gtk::Menu track_region_context_menu;
589 Gtk::Menu track_selection_context_menu;
590 Gtk::Menu track_crossfade_context_menu;
592 Gtk::MenuItem* region_edit_menu_split_item;
593 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
594 Gtk::Menu * track_region_edit_playlist_menu;
595 Gtk::Menu * track_edit_playlist_submenu;
596 Gtk::Menu * track_selection_edit_playlist_submenu;
598 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
599 Gtk::Menu* build_track_context_menu (nframes64_t);
600 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
601 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
602 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
603 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
604 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
605 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
606 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
607 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
608 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
610 void handle_new_route (ARDOUR::RouteList&);
611 void remove_route (TimeAxisView *);
612 bool route_removal;
614 Gtk::HBox global_hpacker;
615 Gtk::VBox global_vpacker;
616 Gtk::VBox vpacker;
618 Gdk::Cursor* current_canvas_cursor;
619 void set_canvas_cursor ();
620 Gdk::Cursor* which_grabber_cursor ();
622 ArdourCanvas::Canvas* track_canvas;
624 ArdourCanvas::Text* verbose_canvas_cursor;
625 bool verbose_cursor_visible;
627 void parameter_changed (std::string);
629 bool track_canvas_motion (GdkEvent*);
631 void set_verbose_canvas_cursor (const std::string &, double x, double y);
632 void set_verbose_canvas_cursor_text (const std::string &);
633 void show_verbose_canvas_cursor();
635 bool verbose_cursor_on; // so far unused
637 Gtk::EventBox time_canvas_event_box;
638 Gtk::EventBox track_canvas_event_box;
639 Gtk::EventBox time_button_event_box;
640 Gtk::EventBox ruler_label_event_box;
642 ArdourCanvas::Group *minsec_group;
643 ArdourCanvas::Pixbuf *logo_item;
644 ArdourCanvas::Group *bbt_group;
645 ArdourCanvas::Group *timecode_group;
646 ArdourCanvas::Group *frame_group;
647 ArdourCanvas::Group *tempo_group;
648 ArdourCanvas::Group *meter_group;
649 ArdourCanvas::Group *marker_group;
650 ArdourCanvas::Group *range_marker_group;
651 ArdourCanvas::Group *transport_marker_group;
652 ArdourCanvas::Group* cd_marker_group;
654 ArdourCanvas::Group* timebar_group;
656 /* These bars never need to be scrolled */
657 ArdourCanvas::Group* meter_bar_group;
658 ArdourCanvas::Group* tempo_bar_group;
659 ArdourCanvas::Group* marker_bar_group;
660 ArdourCanvas::Group* range_marker_bar_group;
661 ArdourCanvas::Group* transport_marker_bar_group;
662 ArdourCanvas::Group* cd_marker_bar_group;
664 /** The group containing all items that require horizontal scrolling. */
665 ArdourCanvas::Group* _background_group;
667 The _master_group is the group containing all items
668 that require horizontal scrolling..
669 It is primarily used to separate canvas items
670 that require horizontal scrolling from those that do not.
672 ArdourCanvas::Group* _master_group;
674 /* The group containing all trackviews. Only scrolled vertically. */
675 ArdourCanvas::Group* _trackview_group;
677 /* The group used for region motion. Sits on top of _trackview_group */
678 ArdourCanvas::Group* _region_motion_group;
680 enum RulerType {
681 ruler_metric_timecode = 0,
682 ruler_metric_bbt = 1,
683 ruler_metric_frames = 2,
684 ruler_metric_minsec = 3,
686 ruler_time_tempo = 4,
687 ruler_time_meter = 5,
688 ruler_time_marker = 6,
689 ruler_time_range_marker = 7,
690 ruler_time_transport_marker = 8,
691 ruler_time_cd_marker = 9,
694 static GtkCustomMetric ruler_metrics[4];
695 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
696 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
697 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
698 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
699 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
700 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
701 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
702 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
703 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
704 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
705 bool no_ruler_shown_update;
707 gint ruler_button_press (GdkEventButton*);
708 gint ruler_button_release (GdkEventButton*);
709 gint ruler_mouse_motion (GdkEventMotion*);
710 bool ruler_scroll (GdkEventScroll* event);
712 Gtk::Widget * ruler_grabbed_widget;
714 void initialize_rulers ();
715 void update_just_timecode ();
716 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
717 void update_fixed_rulers ();
718 void update_tempo_based_rulers ();
719 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
720 void update_ruler_visibility ();
721 void set_ruler_visible (RulerType, bool);
722 void toggle_ruler_visibility (RulerType rt);
723 void ruler_toggled (int);
724 gint ruler_label_button_release (GdkEventButton*);
725 void store_ruler_visibility ();
726 void restore_ruler_visibility ();
728 static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
729 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
730 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
731 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
733 enum MinsecRulerScale {
734 minsec_show_seconds,
735 minsec_show_minutes,
736 minsec_show_hours,
737 minsec_show_frames
740 MinsecRulerScale minsec_ruler_scale;
742 nframes_t minsec_mark_interval;
743 gint minsec_mark_modulo;
744 gint minsec_nmarks;
745 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
747 enum TimecodeRulerScale {
748 timecode_show_bits,
749 timecode_show_frames,
750 timecode_show_seconds,
751 timecode_show_minutes,
752 timecode_show_hours
755 TimecodeRulerScale timecode_ruler_scale;
757 nframes_t timecode_mark_interval;
758 gint timecode_mark_modulo;
759 gint timecode_nmarks;
760 void set_timecode_ruler_scale (gdouble lower, gdouble upper);
762 enum BBTRulerScale {
763 bbt_over,
764 bbt_show_64,
765 bbt_show_16,
766 bbt_show_4,
767 bbt_show_1,
768 bbt_show_beats,
769 bbt_show_ticks,
770 bbt_show_ticks_detail,
771 bbt_show_ticks_super_detail
774 BBTRulerScale bbt_ruler_scale;
776 uint32_t bbt_bars;
777 gint bbt_nmarks;
778 uint32_t bbt_bar_helper_on;
779 uint32_t bbt_accent_modulo;
780 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
782 gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
783 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
784 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
785 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
787 Gtk::Widget *_ruler_separator;
788 GtkWidget *_timecode_ruler;
789 GtkWidget *_bbt_ruler;
790 GtkWidget *_frames_ruler;
791 GtkWidget *_minsec_ruler;
792 Gtk::Widget *timecode_ruler;
793 Gtk::Widget *bbt_ruler;
794 Gtk::Widget *frames_ruler;
795 Gtk::Widget *minsec_ruler;
796 static Editor *ruler_editor;
798 static const double timebar_height;
799 guint32 visible_timebars;
800 gdouble canvas_timebars_vsize;
801 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
802 Gtk::Menu *editor_ruler_menu;
804 ArdourCanvas::SimpleRect* tempo_bar;
805 ArdourCanvas::SimpleRect* meter_bar;
806 ArdourCanvas::SimpleRect* marker_bar;
807 ArdourCanvas::SimpleRect* range_marker_bar;
808 ArdourCanvas::SimpleRect* transport_marker_bar;
809 ArdourCanvas::SimpleRect* cd_marker_bar;
811 Gtk::Label minsec_label;
812 Gtk::Label bbt_label;
813 Gtk::Label timecode_label;
814 Gtk::Label frame_label;
815 Gtk::Label tempo_label;
816 Gtk::Label meter_label;
817 Gtk::Label mark_label;
818 Gtk::Label range_mark_label;
819 Gtk::Label transport_mark_label;
820 Gtk::Label cd_mark_label;
822 Gtk::VBox time_button_vbox;
823 Gtk::HBox time_button_hbox;
825 friend class EditorCursor;
827 EditorCursor* playhead_cursor;
828 ArdourCanvas::Group* cursor_group;
830 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
832 void cursor_to_region_boundary (bool with_selection, int32_t dir);
833 void cursor_to_next_region_boundary (bool with_selection);
834 void cursor_to_previous_region_boundary (bool with_selection);
835 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
836 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
837 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
838 void cursor_to_selection_start (EditorCursor *);
839 void cursor_to_selection_end (EditorCursor *);
841 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
842 void selected_marker_to_next_region_boundary (bool with_selection);
843 void selected_marker_to_previous_region_boundary (bool with_selection);
844 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
845 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
846 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
847 void selected_marker_to_selection_start ();
848 void selected_marker_to_selection_end ();
850 void select_all_selectables_using_cursor (EditorCursor *, bool);
851 void select_all_selectables_using_edit (bool);
852 void select_all_selectables_between (bool within);
853 void select_range_between ();
855 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
856 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
858 std::vector<nframes64_t> region_boundary_cache;
859 void build_region_boundary_cache ();
861 Gtk::HBox top_hbox;
862 Gtk::HBox bottom_hbox;
864 Gtk::Table edit_packer;
865 Gtk::VScrollbar edit_vscrollbar;
867 Gtk::Adjustment vertical_adjustment;
868 Gtk::Adjustment horizontal_adjustment;
870 Gtk::Layout controls_layout;
871 bool control_layout_scroll (GdkEventScroll* ev);
872 void controls_layout_size_request (Gtk::Requisition*);
873 sigc::connection controls_layout_size_request_connection;
875 Gtk::HScrollbar edit_hscrollbar;
876 bool _dragging_hscrollbar;
878 void reset_hscrollbar_stepping ();
880 bool hscrollbar_button_press (GdkEventButton*);
881 bool hscrollbar_button_release (GdkEventButton*);
882 void hscrollbar_allocate (Gtk::Allocation &alloc);
884 double _canvas_width;
885 double _canvas_height;
886 double full_canvas_height;
888 bool track_canvas_map_handler (GdkEventAny*);
890 gint edit_controls_button_release (GdkEventButton*);
891 Gtk::Menu *edit_controls_left_menu;
892 Gtk::Menu *edit_controls_right_menu;
894 Gtk::VBox ruler_label_vbox;
895 Gtk::VBox track_canvas_vbox;
896 Gtk::VBox time_canvas_vbox;
897 Gtk::VBox edit_controls_vbox;
898 Gtk::HBox edit_controls_hbox;
900 void control_scroll (float);
901 void access_action (std::string,std::string);
902 bool deferred_control_scroll (nframes64_t);
903 sigc::connection control_scroll_connection;
905 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
907 ArdourCanvas::Group* get_background_group () const { return _background_group; }
908 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
909 double last_trackview_group_vertical_offset;
910 void tie_vertical_scrolling ();
911 void scroll_canvas_horizontally ();
912 void scroll_canvas_vertically ();
914 struct VisualChange {
915 enum Type {
916 TimeOrigin = 0x1,
917 ZoomLevel = 0x2,
918 YOrigin = 0x4
921 Type pending;
922 nframes64_t time_origin;
923 double frames_per_unit;
924 double y_origin;
926 int idle_handler_id;
928 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
929 void add (Type t) {
930 pending = Type (pending | t);
935 VisualChange pending_visual_change;
937 static int _idle_visual_changer (void *arg);
938 int idle_visual_changer ();
940 void queue_visual_change (nframes64_t);
941 void queue_visual_change (double);
942 void queue_visual_change_y (double);
943 void ensure_visual_change_idle_handler ();
945 void end_location_changed (ARDOUR::Location*);
947 /* named selections */
949 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
950 NamedSelectionDisplayModelColumns() {
951 add (text);
952 add (selection);
954 Gtk::TreeModelColumn<Glib::ustring> text;
955 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
958 NamedSelectionDisplayModelColumns named_selection_columns;
959 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
961 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
962 Gtk::ScrolledWindow named_selection_scroller;
964 void create_named_selection ();
965 void paste_named_selection (float times);
966 void remove_selected_named_selections ();
968 void handle_new_named_selection ();
969 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
970 void redisplay_named_selections ();
972 bool named_selection_display_button_release (GdkEventButton *ev);
973 bool named_selection_display_key_release (GdkEventKey *ev);
974 void named_selection_display_selection_changed ();
976 /* track views */
977 TrackViewList track_views;
978 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
979 TimeAxisView* axis_view_from_route (ARDOUR::Route *) const;
980 TrackSelection axis_views_from_routes (std::list<ARDOUR::Route *>) const;
982 TrackSelection get_tracks_for_range_action () const;
984 static Gdk::Cursor* cross_hair_cursor;
985 static Gdk::Cursor* trimmer_cursor;
986 static Gdk::Cursor* selector_cursor;
987 static Gdk::Cursor* grabber_cursor;
988 static Gdk::Cursor* grabber_edit_point_cursor;
989 static Gdk::Cursor* zoom_cursor;
990 static Gdk::Cursor* time_fx_cursor;
991 static Gdk::Cursor* fader_cursor;
992 static Gdk::Cursor* speaker_cursor;
993 static Gdk::Cursor* midi_pencil_cursor;
994 static Gdk::Cursor* midi_select_cursor;
995 static Gdk::Cursor* midi_resize_cursor;
996 static Gdk::Cursor* midi_erase_cursor;
997 static Gdk::Cursor* wait_cursor;
998 static Gdk::Cursor* timebar_cursor;
999 static Gdk::Cursor* transparent_cursor;
1001 static void build_cursors ();
1003 sigc::connection scroll_connection;
1004 nframes64_t last_update_frame;
1005 void center_screen (nframes64_t);
1006 void center_screen_internal (nframes64_t, float);
1008 void update_current_screen ();
1010 void session_going_away ();
1012 nframes64_t cut_buffer_start;
1013 nframes64_t cut_buffer_length;
1015 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1016 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1017 bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1018 bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1019 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1020 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1021 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1022 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1024 /* KEYMAP HANDLING */
1026 void register_actions ();
1028 int ensure_cursor (nframes64_t* pos);
1030 void cut_copy (Editing::CutCopyOp);
1031 bool can_cut_copy () const;
1032 void cut_copy_points (Editing::CutCopyOp);
1033 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1034 void cut_copy_ranges (Editing::CutCopyOp);
1035 void cut_copy_midi (Editing::CutCopyOp);
1037 void mouse_paste ();
1038 void paste_internal (nframes64_t position, float times);
1040 /* EDITING OPERATIONS */
1042 void reset_point_selection ();
1043 void toggle_region_mute ();
1044 void toggle_region_lock ();
1045 void toggle_region_opaque ();
1046 void toggle_record_enable ();
1047 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1048 void raise_region ();
1049 void raise_region_to_top ();
1050 void lower_region ();
1051 void lower_region_to_bottom ();
1052 void split_regions_at (nframes64_t, RegionSelection&);
1053 void split_region_at_transients ();
1054 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1055 void crop_region_to_selection ();
1056 void crop_region_to (nframes64_t start, nframes64_t end);
1057 void set_sync_point (nframes64_t, const RegionSelection&);
1058 void set_region_sync_from_edit_point ();
1059 void remove_region_sync();
1060 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1061 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1062 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1063 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1064 void remove_selected_regions ();
1065 void remove_clicked_region ();
1066 void edit_region ();
1067 void show_midi_list_editor ();
1068 void rename_region ();
1069 void duplicate_some_regions (RegionSelection&, float times);
1070 void duplicate_selection (float times);
1071 void region_fill_selection ();
1073 void region_fill_track ();
1074 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1075 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1076 void split_multichannel_region();
1077 void reverse_region ();
1078 void strip_region_silence ();
1079 void normalize_region ();
1080 double _last_normalization_value;
1081 void reset_region_scale_amplitude ();
1082 void adjust_region_scale_amplitude (bool up);
1083 void quantize_region ();
1085 void do_insert_time ();
1086 void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool);
1088 void tab_to_transient (bool forward);
1090 void use_region_as_bar ();
1091 void use_range_as_bar ();
1093 void define_one_bar (nframes64_t start, nframes64_t end);
1095 void audition_region_from_region_list ();
1096 void hide_region_from_region_list ();
1098 void align (ARDOUR::RegionPoint);
1099 void align_relative (ARDOUR::RegionPoint);
1100 void naturalize ();
1102 void reset_focus ();
1104 void split ();
1106 void cut ();
1107 void copy ();
1108 void paste (float times);
1110 int get_prefix (float&, bool&);
1112 void keyboard_paste ();
1113 void keyboard_insert_region_list_selection ();
1115 void region_from_selection ();
1116 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1118 void play_from_start ();
1119 void play_from_edit_point ();
1120 void play_from_edit_point_and_return ();
1121 void play_selected_region ();
1122 void play_edit_range ();
1123 void loop_selected_region ();
1124 void play_location (ARDOUR::Location&);
1125 void loop_location (ARDOUR::Location&);
1127 void temporal_zoom_selection ();
1128 void temporal_zoom_region (bool both_axes);
1129 void zoom_to_region (bool both_axes);
1130 void temporal_zoom_session ();
1131 void temporal_zoom (gdouble scale);
1132 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const std::string & op);
1133 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1135 void amplitude_zoom (gdouble scale);
1136 void amplitude_zoom_step (bool in);
1138 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1139 void insert_region_list_selection (float times);
1141 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1143 /* import & embed */
1145 void add_external_audio_action (Editing::ImportMode);
1146 void external_audio_dialog ();
1147 void session_import_dialog ();
1149 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1150 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1152 SoundFileOmega* sfbrowser;
1154 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1156 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1157 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1159 int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1160 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1161 int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1162 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1164 int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1165 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1166 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1167 boost::shared_ptr<ARDOUR::Track>& existing_track);
1169 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1170 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1172 /* generic interthread progress window */
1174 ArdourDialog* interthread_progress_window;
1175 Gtk::Label interthread_progress_label;
1176 Gtk::VBox interthread_progress_vbox;
1177 Gtk::ProgressBar interthread_progress_bar;
1178 Gtk::Button interthread_cancel_button;
1179 Gtk::Label interthread_cancel_label;
1180 sigc::connection interthread_progress_connection;
1181 void interthread_cancel_clicked ();
1182 void build_interthread_progress_window ();
1183 ARDOUR::InterThreadInfo* current_interthread_info;
1185 AnalysisWindow* analysis_window;
1187 /* import specific info */
1189 struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
1190 Editing::ImportMode mode;
1191 nframes64_t pos;
1192 int target_tracks;
1193 int target_regions;
1194 boost::shared_ptr<ARDOUR::Track> track;
1195 bool replace;
1198 EditorImportStatus import_status;
1199 gint import_progress_timeout (void *);
1200 static void *_import_thread (void *);
1201 void* import_thread ();
1202 void finish_import ();
1204 /* to support this ... */
1206 void import_audio (bool as_tracks);
1207 void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
1209 void move_to_start ();
1210 void move_to_end ();
1211 void goto_frame ();
1212 void center_playhead ();
1213 void center_edit_point ();
1214 void edit_cursor_backward ();
1215 void edit_cursor_forward ();
1216 void playhead_forward_to_grid ();
1217 void playhead_backward_to_grid ();
1218 void playhead_backward ();
1219 void playhead_forward ();
1220 void scroll_playhead (bool forward);
1221 void scroll_backward (float pages=0.8f);
1222 void scroll_forward (float pages=0.8f);
1223 void scroll_tracks_down ();
1224 void scroll_tracks_up ();
1225 void delete_sample_forward ();
1226 void delete_sample_backward ();
1227 void delete_screen ();
1228 void search_backwards ();
1229 void search_forwards ();
1230 void set_mark ();
1231 void clear_markers ();
1232 void clear_ranges ();
1233 void clear_locations ();
1234 void unhide_markers ();
1235 void unhide_ranges ();
1236 void jump_forward_to_mark ();
1237 void jump_backward_to_mark ();
1238 void cursor_align (bool playhead_to_edit);
1240 void remove_last_capture ();
1241 void select_all_selectables_using_time_selection ();
1242 void select_all_selectables_using_loop();
1243 void select_all_selectables_using_punch();
1244 void set_selection_from_range (ARDOUR::Location&);
1245 void set_selection_from_punch ();
1246 void set_selection_from_loop ();
1247 void set_selection_from_region ();
1249 void add_location_mark (nframes64_t where);
1250 void add_location_from_audio_region ();
1251 void add_locations_from_audio_region ();
1252 void add_location_from_selection ();
1253 void set_loop_from_selection (bool play);
1254 void set_punch_from_selection ();
1255 void set_punch_from_region ();
1257 void set_loop_from_edit_range (bool play);
1258 void set_loop_from_region (bool play);
1259 void set_punch_from_edit_range ();
1261 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1262 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1264 void add_location_from_playhead_cursor ();
1265 bool select_new_marker;
1267 void reverse_selection ();
1268 void edit_envelope ();
1270 void start_scrolling ();
1271 void stop_scrolling ();
1273 double last_scrub_x;
1274 int scrubbing_direction;
1275 int scrub_reversals;
1276 int scrub_reverse_distance;
1277 void scrub ();
1279 void keyboard_selection_begin ();
1280 void keyboard_selection_finish (bool add);
1281 bool have_pending_keyboard_selection;
1282 nframes64_t pending_keyboard_selection_start;
1284 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1285 void extend_selection_to_end_of_region (bool next);
1286 void extend_selection_to_start_of_region (bool previous);
1288 Editing::SnapType snap_type;
1289 Editing::SnapMode snap_mode;
1291 /// Snap threshold in pixels
1292 double snap_threshold;
1294 bool ignore_gui_changes;
1296 Drag* _drag;
1298 void break_drag ();
1300 Gtk::Menu fade_context_menu;
1301 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1303 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1304 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1306 void set_fade_length (bool in);
1307 void toggle_fade_active (bool in);
1308 void set_fade_in_active (bool);
1309 void set_fade_out_active (bool);
1311 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1312 RegionSelection pre_drag_region_selection;
1314 bool _dragging_playhead;
1315 bool _dragging_edit_point;
1317 void marker_drag_motion_callback (GdkEvent*);
1318 void marker_drag_finished_callback (GdkEvent*);
1320 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1322 void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1323 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1324 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1325 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1326 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1328 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1330 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1331 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1333 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1334 void brush (nframes64_t);
1336 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1337 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1338 double clamp_verbose_cursor_x (double);
1339 double clamp_verbose_cursor_y (double);
1341 /* Canvas event handlers */
1343 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1344 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1345 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1346 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1347 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1348 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1349 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1350 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1351 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1352 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1355 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1356 private:
1357 ArdourCanvas::Item *last_item_entered;
1358 int last_item_entered_n;
1359 public:
1361 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1362 bool canvas_frame_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1363 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1364 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1365 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1366 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1367 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1368 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1369 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1370 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1371 bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*);
1373 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1374 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1375 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1376 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1377 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1378 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1380 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1381 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1382 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1383 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1384 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1385 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1386 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1387 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1389 /* non-public event handlers */
1391 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1392 bool track_canvas_scroll (GdkEventScroll* event);
1394 bool track_canvas_scroll_event (GdkEventScroll* event);
1395 bool track_canvas_button_press_event (GdkEventButton* event);
1396 bool track_canvas_button_release_event (GdkEventButton* event);
1397 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1399 Gtk::Allocation canvas_allocation;
1400 void track_canvas_allocate (Gtk::Allocation alloc);
1401 bool track_canvas_size_allocated ();
1402 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1404 void set_playhead_cursor ();
1406 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1407 void kbd_mute_unmute_region ();
1408 void kbd_brush ();
1410 void kbd_do_brush (GdkEvent*);
1411 void kbd_do_audition (GdkEvent*);
1413 void handle_new_duration ();
1414 void initialize_canvas ();
1416 /* display control */
1418 bool _show_measures;
1419 /// true if the editor should follow the playhead, otherwise false
1420 bool _follow_playhead;
1421 /// true if waveforms should be shown while recording audio tracks, otherwise false
1422 bool _show_waveforms_recording;
1424 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1426 TempoLines* tempo_lines;
1428 ArdourCanvas::Group* time_line_group;
1430 void hide_measures ();
1431 void draw_measures ();
1432 bool redraw_measures ();
1434 void new_tempo_section ();
1436 void mouse_add_new_tempo_event (nframes64_t where);
1437 void mouse_add_new_meter_event (nframes64_t where);
1439 void remove_tempo_marker (ArdourCanvas::Item*);
1440 void remove_meter_marker (ArdourCanvas::Item*);
1441 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1442 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1444 void edit_tempo_section (ARDOUR::TempoSection*);
1445 void edit_meter_section (ARDOUR::MeterSection*);
1446 void edit_tempo_marker (ArdourCanvas::Item*);
1447 void edit_meter_marker (ArdourCanvas::Item*);
1448 void edit_control_point (ArdourCanvas::Item*);
1450 void marker_menu_edit ();
1451 void marker_menu_remove ();
1452 void marker_menu_rename ();
1453 void marker_menu_lock (bool yn);
1454 void marker_menu_hide ();
1455 void marker_menu_loop_range ();
1456 void marker_menu_select_all_selectables_using_range ();
1457 void marker_menu_select_using_range ();
1458 void marker_menu_separate_regions_using_location ();
1459 void marker_menu_play_from ();
1460 void marker_menu_play_range ();
1461 void marker_menu_set_playhead ();
1462 void marker_menu_set_from_playhead ();
1463 void marker_menu_set_from_selection ();
1464 void marker_menu_range_to_next ();
1465 void new_transport_marker_menu_set_loop ();
1466 void new_transport_marker_menu_set_punch ();
1467 void update_loop_range_view (bool visibility=false);
1468 void update_punch_range_view (bool visibility=false);
1469 void new_transport_marker_menu_popdown ();
1470 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1471 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1472 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1473 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1474 void build_range_marker_menu (bool loop_or_punch);
1475 void build_marker_menu (bool start_or_end);
1476 void build_tm_marker_menu ();
1477 void build_new_transport_marker_menu ();
1479 Gtk::Menu* tm_marker_menu;
1480 Gtk::Menu* marker_menu;
1481 Gtk::Menu* start_end_marker_menu;
1482 Gtk::Menu* range_marker_menu;
1483 Gtk::Menu* transport_marker_menu;
1484 Gtk::Menu* new_transport_marker_menu;
1485 Gtk::Menu* cd_marker_menu;
1486 ArdourCanvas::Item* marker_menu_item;
1488 typedef std::list<Marker*> Marks;
1489 Marks metric_marks;
1491 void remove_metric_marks ();
1492 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1494 void compute_current_bbt_points (nframes_t left, nframes_t right);
1495 void tempo_map_changed (ARDOUR::Change);
1496 void redisplay_tempo (bool immediate_redraw);
1498 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1499 void snap_to_with_modifier (nframes64_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
1500 void snap_to (nframes64_t& first, nframes64_t& last, int32_t direction = 0, bool for_mark = false);
1502 uint32_t bbt_beat_subdivision;
1504 /* toolbar */
1506 Gtk::ToggleButton editor_mixer_button;
1507 Gtk::ToggleButton editor_list_button;
1508 void editor_mixer_button_toggled ();
1509 void editor_list_button_toggled ();
1511 AudioClock edit_point_clock;
1512 AudioClock zoom_range_clock;
1513 Gtk::Button zoom_in_button;
1514 Gtk::Button zoom_out_button;
1515 Gtk::Button zoom_out_full_button;
1516 Gtk::Button zoom_onetoone_button;
1518 Gtk::Button tav_expand_button;
1519 Gtk::Button tav_shrink_button;
1521 Gtk::VBox toolbar_clock_vbox;
1522 Gtk::VBox toolbar_selection_clock_vbox;
1523 Gtk::Table toolbar_selection_clock_table;
1524 Gtk::Label toolbar_selection_cursor_label;
1526 Gtk::HBox mouse_mode_button_box;
1527 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1528 Gtk::ToggleButton mouse_select_button;
1529 Gtk::ToggleButton mouse_move_button;
1530 Gtk::ToggleButton mouse_gain_button;
1531 Gtk::ToggleButton mouse_zoom_button;
1532 Gtk::ToggleButton mouse_timefx_button;
1533 Gtk::ToggleButton mouse_audition_button;
1535 void mouse_mode_toggled (Editing::MouseMode m);
1536 bool ignore_mouse_mode_toggle;
1538 Gtk::ToggleButton internal_edit_button;
1539 void toggle_internal_editing ();
1541 gint mouse_select_button_release (GdkEventButton*);
1543 Gtk::VBox automation_box;
1544 Gtk::Button automation_mode_button;
1545 Gtk::ToggleButton global_automation_button;
1547 Gtk::ComboBoxText edit_mode_selector;
1548 Gtk::VBox edit_mode_box;
1550 void set_edit_mode (ARDOUR::EditMode);
1551 void cycle_edit_mode ();
1552 void edit_mode_selection_done ();
1554 Gtk::ComboBoxText snap_type_selector;
1555 Gtk::ComboBoxText snap_mode_selector;
1556 Gtk::HBox snap_box;
1558 std::vector<std::string> snap_type_strings;
1559 std::vector<std::string> snap_mode_strings;
1561 void snap_type_selection_done ();
1562 void snap_mode_selection_done ();
1563 void snap_mode_chosen (Editing::SnapMode);
1564 void snap_type_chosen (Editing::SnapType);
1566 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1567 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1569 Gtk::ComboBoxText zoom_focus_selector;
1570 Gtk::VBox zoom_focus_box;
1572 std::vector<std::string> zoom_focus_strings;
1574 void zoom_focus_selection_done ();
1575 void zoom_focus_chosen (Editing::ZoomFocus);
1577 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1579 Gtk::HBox zoom_box;
1580 Gtk::HBox track_zoom_box;
1581 Gtk::VBox zoom_vbox;
1583 void zoom_adjustment_changed();
1585 void edit_point_clock_changed();
1587 void setup_toolbar ();
1589 Gtkmm2ext::TearOff* tools_tearoff;
1590 Gtk::HBox toolbar_hbox;
1591 Gtk::EventBox toolbar_base;
1592 Gtk::Frame toolbar_frame;
1594 /* midi toolbar */
1596 Gtk::HBox panic_box;
1597 Gtk::Button midi_panic_button;
1598 Gtk::ToggleButton midi_sound_notes;
1599 void midi_panic ();
1600 bool sound_notes () const { return midi_sound_notes.get_active(); }
1602 void setup_midi_toolbar ();
1604 /* selection process */
1606 Selection* selection;
1607 Selection* cut_buffer;
1609 void time_selection_changed ();
1610 void track_selection_changed ();
1611 void region_selection_changed ();
1612 sigc::connection editor_regions_selection_changed_connection;
1613 void sensitize_the_right_region_actions (bool have_selected_regions);
1614 void point_selection_changed ();
1615 void marker_selection_changed ();
1617 void cancel_selection ();
1619 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1620 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1621 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1623 bool audio_region_selection_covers (nframes64_t where);
1625 /* transport range select process */
1627 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1628 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1629 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1631 #ifdef GTKOSX
1632 ArdourCanvas::SimpleRect *bogus_background_rect;
1633 #endif
1634 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1635 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1636 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1637 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1638 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1639 ArdourCanvas::SimpleLine *transport_punchin_line;
1640 ArdourCanvas::SimpleLine *transport_punchout_line;
1641 ArdourCanvas::SimpleRect *transport_preroll_rect;
1642 ArdourCanvas::SimpleRect *transport_postroll_rect;
1644 ARDOUR::Location* transport_loop_location();
1645 ARDOUR::Location* transport_punch_location();
1647 ARDOUR::Location *temp_location;
1649 /* object rubberband select process */
1651 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1653 ArdourCanvas::SimpleRect *rubberband_rect;
1655 /* mouse zoom process */
1657 ArdourCanvas::SimpleRect *zoom_rect;
1658 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1660 EditorRouteGroups* _route_groups;
1661 EditorRoutes* _routes;
1662 EditorRegions* _regions;
1663 EditorSnapshots* _snapshots;
1665 /* diskstream/route display management */
1666 Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
1667 Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
1669 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1671 bool sync_track_view_list_and_routes ();
1673 Gtk::VBox list_vpacker;
1675 /* autoscrolling */
1677 bool autoscroll_active;
1678 int autoscroll_timeout_tag;
1679 int autoscroll_x;
1680 int autoscroll_y;
1681 int last_autoscroll_x;
1682 int last_autoscroll_y;
1683 uint32_t autoscroll_cnt;
1684 nframes64_t autoscroll_x_distance;
1685 double autoscroll_y_distance;
1687 static gint _autoscroll_canvas (void *);
1688 bool autoscroll_canvas ();
1689 void start_canvas_autoscroll (int x, int y);
1690 void stop_canvas_autoscroll ();
1691 void maybe_autoscroll (GdkEventMotion*, bool);
1692 bool allow_vertical_scroll;
1694 /* trimming */
1695 void point_trim (GdkEvent*);
1696 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1697 void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
1698 void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
1700 void thaw_region_after_trim (RegionView& rv);
1702 void trim_region_front();
1703 void trim_region_back();
1704 void trim_region (bool front);
1706 void trim_region_to_edit_point ();
1707 void trim_region_from_edit_point ();
1708 void trim_region_to_loop ();
1709 void trim_region_to_punch ();
1710 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1712 void trim_to_region(bool forward);
1713 void trim_region_to_previous_region_end();
1714 void trim_region_to_next_region_start();
1716 bool show_gain_after_trim;
1718 /* Drag-n-Drop */
1720 int convert_drop_to_paths (
1721 std::vector<Glib::ustring>& paths,
1722 const Glib::RefPtr<Gdk::DragContext>& context,
1723 gint x,
1724 gint y,
1725 const Gtk::SelectionData& data,
1726 guint info,
1727 guint time);
1729 void track_canvas_drag_data_received (
1730 const Glib::RefPtr<Gdk::DragContext>& context,
1731 gint x,
1732 gint y,
1733 const Gtk::SelectionData& data,
1734 guint info,
1735 guint time);
1737 void drop_paths (
1738 const Glib::RefPtr<Gdk::DragContext>& context,
1739 gint x,
1740 gint y,
1741 const Gtk::SelectionData& data,
1742 guint info,
1743 guint time);
1745 void drop_regions (
1746 const Glib::RefPtr<Gdk::DragContext>& context,
1747 gint x,
1748 gint y,
1749 const Gtk::SelectionData& data,
1750 guint info,
1751 guint time);
1753 void drop_routes (
1754 const Glib::RefPtr<Gdk::DragContext>& context,
1755 gint x,
1756 gint y,
1757 const Gtk::SelectionData& data,
1758 guint info,
1759 guint time);
1761 /* audio export */
1763 int write_region_selection(RegionSelection&);
1764 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1765 void bounce_region_selection ();
1766 void bounce_range_selection (bool replace, bool enable_processing);
1767 void external_edit_region ();
1769 int write_audio_selection (TimeSelection&);
1770 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1772 void write_selection ();
1774 XMLNode *before; /* used in *_reversible_command */
1776 void begin_reversible_command (std::string cmd_name);
1777 void commit_reversible_command ();
1779 void update_title ();
1780 void update_title_s (const std::string & snapshot_name);
1782 struct State {
1783 Selection* selection;
1784 double frames_per_unit;
1786 State (PublicEditor const * e);
1787 ~State ();
1790 void store_state (State&) const;
1791 void restore_state (State *);
1793 void instant_save ();
1795 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1797 /* freeze operations */
1799 ARDOUR::InterThreadInfo freeze_status;
1800 gint freeze_progress_timeout (void *);
1801 static void* _freeze_thread (void*);
1802 void* freeze_thread ();
1804 void freeze_route ();
1805 void unfreeze_route ();
1807 /* route-group solo + mute */
1809 void set_route_group_solo (ARDOUR::Route&, bool);
1810 void set_route_group_mute (ARDOUR::Route&, bool);
1812 /* duplication */
1814 void duplicate_dialog (bool with_dialog);
1816 nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
1818 /* returns false if mouse pointer is not in track or marker canvas
1820 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1822 /* "whats mine is yours" */
1824 TimeFXDialog* current_timefx;
1826 static void* timefx_thread (void *arg);
1827 void do_timefx (TimeFXDialog&);
1829 int time_stretch (RegionSelection&, float fraction);
1830 int pitch_shift (RegionSelection&, float cents);
1831 void pitch_shift_regions ();
1832 int time_fx (RegionSelection&, float val, bool pitching);
1834 /* editor-mixer strip */
1836 MixerStrip *current_mixer_strip;
1837 bool show_editor_mixer_when_tracks_arrive;
1838 Gtk::VBox current_mixer_strip_vbox;
1839 void cms_new (boost::shared_ptr<ARDOUR::Route>);
1840 void cms_deleted ();
1841 void current_mixer_strip_hidden ();
1842 void current_mixer_strip_removed ();
1844 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1845 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1846 #ifdef GTKOSX
1847 void ensure_all_elements_drawn ();
1848 #endif
1849 /* nudging tracks */
1851 void nudge_track (bool use_edit_point, bool forwards);
1853 /* xfades */
1855 bool _xfade_visibility;
1857 #ifdef WITH_CMT
1858 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
1859 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
1861 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1862 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1864 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1865 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1866 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1868 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1869 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1870 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1871 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1873 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1874 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1875 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1876 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1878 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1879 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1880 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1881 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1882 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1883 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1885 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1886 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1887 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1888 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1889 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1890 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1892 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1893 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1895 ImageFrameSocketHandler* image_socket_listener ;
1896 #endif
1898 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
1899 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
1900 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
1901 void xfade_edit_left_region ();
1902 void xfade_edit_right_region ();
1904 static const int32_t default_width = 995;
1905 static const int32_t default_height = 765;
1907 /* nudge */
1909 Gtk::Button nudge_forward_button;
1910 Gtk::Button nudge_backward_button;
1911 Gtk::HBox nudge_hbox;
1912 Gtk::VBox nudge_vbox;
1913 AudioClock nudge_clock;
1915 bool nudge_forward_release (GdkEventButton*);
1916 bool nudge_backward_release (GdkEventButton*);
1918 /* audio filters */
1920 void apply_filter (ARDOUR::Filter&, std::string cmd);
1922 Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
1923 void apply_midi_note_edit_op (ARDOUR::MidiOperator& op);
1925 /* handling cleanup */
1927 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
1929 std::vector<sigc::connection> session_connections;
1931 /* tracking step changes of track height */
1933 TimeAxisView* current_stepping_trackview;
1934 ARDOUR::microseconds_t last_track_height_step_timestamp;
1935 gint track_height_step_timeout();
1936 sigc::connection step_timeout;
1938 TimeAxisView* entered_track;
1939 RegionView* entered_regionview;
1942 void ensure_entered_track_selected (bool op_acts_on_objects = false);
1943 bool clear_entered_track;
1944 bool left_track_canvas (GdkEventCrossing*);
1945 bool entered_track_canvas (GdkEventCrossing*);
1946 void set_entered_track (TimeAxisView*);
1947 void set_entered_regionview (RegionView*);
1948 void ensure_track_visible (TimeAxisView*);
1949 gint left_automation_track ();
1951 bool _new_regionviews_show_envelope;
1953 void reset_canvas_action_sensitivity (bool);
1954 void toggle_gain_envelope_visibility ();
1955 void toggle_gain_envelope_active ();
1956 void reset_region_gain_envelopes ();
1958 bool on_key_press_event (GdkEventKey*);
1959 bool on_key_release_event (GdkEventKey*);
1961 void session_state_saved (std::string);
1963 Glib::RefPtr<Gtk::Action> undo_action;
1964 Glib::RefPtr<Gtk::Action> redo_action;
1966 void history_changed ();
1968 Gtk::HBox status_bar_hpacker;
1970 Editing::EditPoint _edit_point;
1972 Gtk::ComboBoxText edit_point_selector;
1974 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
1975 void cycle_edit_point (bool with_marker);
1976 void set_edit_point ();
1977 void edit_point_selection_done ();
1978 void edit_point_chosen (Editing::EditPoint);
1979 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
1980 std::vector<std::string> edit_point_strings;
1982 void selected_marker_moved (ARDOUR::Location*);
1983 sigc::connection edit_point_clock_connection_a;
1984 sigc::connection edit_point_clock_connection_b;
1986 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
1988 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
1989 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
1991 void get_regions_for_action (RegionSelection&, bool allow_entered = false, bool allow_edit_position = true);
1993 sigc::connection fast_screen_update_connection;
1994 gint start_updating ();
1995 gint stop_updating ();
1996 void fast_update_strips ();
1997 bool meters_running;
1999 void select_next_route ();
2000 void select_prev_route ();
2002 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2003 void timecode_snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2005 RhythmFerret* rhythm_ferret;
2006 BundleManager* _bundle_manager;
2007 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2009 void fit_tracks (TrackSelection &);
2010 void fit_selected_tracks ();
2011 void set_track_height (uint32_t h);
2013 void remove_tracks ();
2014 void toggle_tracks_active ();
2016 bool _have_idled;
2017 int resize_idle_id;
2018 bool idle_resize();
2019 friend gboolean _idle_resize (gpointer);
2020 int32_t _pending_resize_amount;
2021 TimeAxisView* _pending_resize_view;
2023 void visible_order_range (int*, int*) const;
2025 void located ();
2026 bool _pending_locate_request;
2028 EditorSummary* _summary;
2029 void region_view_added (RegionView *);
2031 void update_canvas_now ();
2032 void streamview_height_changed ();
2034 EditorGroupTabs* _group_tabs;
2035 void fit_route_group (ARDOUR::RouteGroup *);
2037 void start_step_editing ();
2038 void stop_step_editing ();
2039 bool check_step_edit ();
2040 sigc::connection step_edit_connection;
2042 friend class Drag;
2043 friend class RegionDrag;
2044 friend class RegionMoveDrag;
2045 friend class RegionSpliceDrag;
2046 friend class TrimDrag;
2047 friend class MeterMarkerDrag;
2048 friend class TempoMarkerDrag;
2049 friend class CursorDrag;
2050 friend class FadeInDrag;
2051 friend class FadeOutDrag;
2052 friend class MarkerDrag;
2053 friend class RegionGainDrag;
2054 friend class ControlPointDrag;
2055 friend class LineDrag;
2056 friend class RubberbandSelectDrag;
2057 friend class TimeFXDrag;
2058 friend class ScrubDrag;
2059 friend class SelectionDrag;
2060 friend class RangeMarkerBarDrag;
2061 friend class MouseZoomDrag;
2062 friend class RegionCreateDrag;
2063 friend class RegionMotionDrag;
2064 friend class RegionInsertDrag;
2066 friend class EditorSummary;
2067 friend class EditorGroupTabs;
2069 friend class EditorRoutes;
2072 #endif /* __ardour_editor_h__ */