when tabbing between track/bus name entries, attempt to scroll appropriately (#4223)
[ardour2.git] / gtk2_ardour / editor.h
blob4533f99481d58bce2992c7415eb9786178767a21
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>
29 #include <boost/optional.hpp>
31 #include <libgnomecanvasmm/canvas.h>
32 #include <libgnomecanvasmm/group.h>
33 #include <libgnomecanvasmm/line.h>
34 #include <libgnomecanvasmm/pixbuf.h>
36 #include <cmath>
38 #include <gtkmm/comboboxtext.h>
39 #include <gtkmm/layout.h>
41 #include "gtkmm2ext/selector.h"
42 #include "gtkmm2ext/click_box.h"
43 #include "gtkmm2ext/dndtreeview.h"
44 #include "gtkmm2ext/stateful_button.h"
46 #include "pbd/stateful.h"
47 #include "pbd/signals.h"
49 #include "ardour/import_status.h"
50 #include "ardour/tempo.h"
51 #include "ardour/location.h"
52 #include "ardour/types.h"
54 #include "gtk-custom-ruler.h"
55 #include "ardour_dialog.h"
56 #include "public_editor.h"
57 #include "editing.h"
58 #include "enums.h"
59 #include "editor_items.h"
60 #include "region_selection.h"
61 #include "canvas.h"
62 #include "window_proxy.h"
64 namespace Gnome { namespace Canvas {
65 class NoEventText;
66 } }
68 namespace Gtkmm2ext {
69 class TearOff;
70 class Bindings;
73 namespace ARDOUR {
74 class RouteGroup;
75 class Playlist;
76 class AudioPlaylist;
77 class AudioRegion;
78 class Region;
79 class Location;
80 class TempoSection;
81 class NamedSelection;
82 class Session;
83 class Filter;
84 class Crossfade;
85 class ChanCount;
86 class MidiOperator;
87 class Track;
88 class MidiTrack;
89 class AudioTrack;
92 namespace LADSPA {
93 class Plugin;
96 class AnalysisWindow;
97 class AudioClock;
98 class AudioRegionView;
99 class AudioStreamView;
100 class AudioTimeAxisView;
101 class AutomationLine;
102 class AutomationSelection;
103 class AutomationTimeAxisView;
104 class BundleManager;
105 class ControlPoint;
106 class CrossfadeView;
107 class DragManager;
108 class GroupedButtons;
109 class GUIObjectState;
110 class Marker;
111 class MidiRegionView;
112 class MixerStrip;
113 class PlaylistSelector;
114 class PluginSelector;
115 class RhythmFerret;
116 class Selection;
117 class SoundFileOmega;
118 class StreamView;
119 class TempoLines;
120 class TimeAxisView;
121 class TimeFXDialog;
122 class TimeSelection;
123 class EditorGroupTabs;
124 class EditorRoutes;
125 class EditorRouteGroups;
126 class EditorRegions;
127 class EditorLocations;
128 class EditorSnapshots;
129 class EditorSummary;
130 class RegionLayeringOrderEditor;
131 class ProgressReporter;
132 class EditorCursor;
133 class MouseCursors;
134 class VerboseCursor;
136 /* <CMT Additions> */
137 class ImageFrameView;
138 class ImageFrameTimeAxisView;
139 class ImageFrameTimeAxis;
140 class MarkerTimeAxis ;
141 class MarkerView ;
142 class ImageFrameSocketHandler ;
143 class TimeAxisViewItem ;
144 /* </CMT Additions> */
146 class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
148 public:
149 Editor ();
150 ~Editor ();
152 void set_session (ARDOUR::Session *);
153 ARDOUR::Session* session() const { return _session; }
155 void first_idle ();
156 virtual bool have_idled () const { return _have_idled; }
158 framepos_t leftmost_position() const { return leftmost_frame; }
160 framecnt_t current_page_frames() const {
161 return (framecnt_t) floor (_canvas_width * frames_per_unit);
164 double canvas_height () const {
165 return _canvas_height;
168 void cycle_snap_mode ();
169 void cycle_snap_choice ();
170 void set_snap_to (Editing::SnapType);
171 void set_snap_mode (Editing::SnapMode);
172 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
174 Editing::SnapMode snap_mode () const;
175 Editing::SnapType snap_type () const;
177 void undo (uint32_t n = 1);
178 void redo (uint32_t n = 1);
180 XMLNode& get_state ();
181 int set_state (const XMLNode&, int version);
183 void set_mouse_mode (Editing::MouseMode, bool force=true);
184 void step_mouse_mode (bool next);
185 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
186 Editing::MidiEditMode current_midi_edit_mode () const;
187 void remove_midi_note (ArdourCanvas::Item *, GdkEvent *);
189 bool internal_editing() const { return _internal_editing ; }
190 void set_internal_edit (bool yn);
192 #ifdef WITH_CMT
193 void add_imageframe_time_axis(const std::string & track_name, void*) ;
194 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
195 void connect_to_image_compositor() ;
196 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
197 TimeAxisView* get_named_time_axis(const std::string & name) ;
198 #endif /* WITH_CMT */
200 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
201 void add_to_idle_resize (TimeAxisView*, int32_t);
203 RouteTimeAxisView* get_route_view_by_route_id (PBD::ID& id) const;
205 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
206 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
207 void show_a_region (boost::shared_ptr<ARDOUR::Region>);
209 #ifdef USE_RUBBERBAND
210 std::vector<std::string> rb_opt_strings;
211 int rb_current_opt;
212 #endif
214 /* things that need to be public to be used in the main menubar */
216 void new_region_from_selection ();
217 void separate_regions_between (const TimeSelection&);
218 void separate_region_from_selection ();
219 void separate_under_selected_regions ();
220 void separate_region_from_punch ();
221 void separate_region_from_loop ();
222 void separate_regions_using_location (ARDOUR::Location&);
223 void transition_to_rolling (bool forward);
225 /* undo related */
227 framepos_t unit_to_frame (double unit) const {
228 return (framepos_t) rint (unit * frames_per_unit);
231 double frame_to_unit (framepos_t frame) const {
232 return rint ((double) frame / (double) frames_per_unit);
235 double frame_to_unit (double frame) const {
236 return rint (frame / frames_per_unit);
239 /* NOTE: these functions assume that the "pixel" coordinate is
240 the result of using the world->canvas affine transform on a
241 world coordinate. These coordinates already take into
242 account any scrolling carried out by adjusting the
243 xscroll_adjustment.
246 framepos_t pixel_to_frame (double pixel) const {
248 /* pixel can be less than zero when motion events
249 are processed. since we've already run the world->canvas
250 affine, that means that the location *really* is "off
251 to the right" and thus really is "before the start".
254 if (pixel >= 0) {
255 return (framepos_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
256 } else {
257 return 0;
261 gulong frame_to_pixel (framepos_t frame) const {
262 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
265 void flush_canvas ();
267 /* selection */
269 Selection& get_selection() const { return *selection; }
270 Selection& get_cut_buffer() const { return *cut_buffer; }
272 bool extend_selection_to_track (TimeAxisView&);
274 void play_selection ();
275 void select_all_in_track (Selection::Operation op);
276 void select_all (Selection::Operation op);
277 void invert_selection_in_track ();
278 void invert_selection ();
279 void deselect_all ();
281 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
283 /* tempo */
285 void set_show_measures (bool yn);
286 bool show_measures () const { return _show_measures; }
288 /* analysis window */
290 void analyze_region_selection();
291 void analyze_range_selection();
293 /* export */
295 void export_audio ();
296 void stem_export ();
297 void export_selection ();
298 void export_range ();
299 void export_region ();
301 void add_toplevel_controls (Gtk::Container&);
302 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
304 void set_zoom_focus (Editing::ZoomFocus);
305 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
306 double get_current_zoom () const { return frames_per_unit; }
308 void temporal_zoom_step (bool coarser);
309 void tav_zoom_step (bool coarser);
311 /* stuff that AudioTimeAxisView and related classes use */
313 PlaylistSelector& playlist_selector() const;
314 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
316 void new_playlists (TimeAxisView* v);
317 void copy_playlists (TimeAxisView* v);
318 void clear_playlists (TimeAxisView* v);
320 void get_onscreen_tracks (TrackViewList&);
322 Width editor_mixer_strip_width;
323 void maybe_add_mixer_strip_width (XMLNode&);
324 void show_editor_mixer (bool yn);
325 void create_editor_mixer ();
326 void show_editor_list (bool yn);
327 void set_selected_mixer_strip (TimeAxisView&);
328 void mixer_strip_width_changed ();
329 void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
331 /* nudge is initiated by transport controls owned by ARDOUR_UI */
333 framecnt_t get_nudge_distance (framepos_t pos, framecnt_t& next);
334 Evoral::MusicalTime get_grid_type_as_beats (bool& success, framepos_t position);
336 void nudge_forward (bool next, bool force_playhead);
337 void nudge_backward (bool next, bool force_playhead);
339 /* nudge initiated from context menu */
341 void nudge_forward_capture_offset ();
342 void nudge_backward_capture_offset ();
344 /* playhead/screen stuff */
346 void set_stationary_playhead (bool yn);
347 void toggle_stationary_playhead ();
348 bool stationary_playhead() const { return _stationary_playhead; }
350 void set_follow_playhead (bool yn, bool catch_up = true);
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 set_summary ();
357 void set_group_tabs ();
358 void toggle_measure_visibility ();
359 void toggle_logo_visibility ();
361 /* fades/xfades */
363 void toggle_region_fades (int dir);
364 void update_region_fade_visibility ();
365 bool xfade_visibility() const { return _xfade_visibility; }
366 void update_xfade_visibility ();
368 /* redirect shared ops menu. caller must free returned menu */
370 Gtk::Menu* redirect_menu ();
372 /* floating windows/transient */
374 void ensure_float (Gtk::Window&);
376 void show_window ();
378 void ensure_time_axis_view_is_visible (const TimeAxisView& tav);
379 void scroll_tracks_down_line ();
380 void scroll_tracks_up_line ();
382 void prepare_for_cleanup ();
383 void finish_cleanup ();
385 void maximise_editing_space();
386 void restore_editing_space();
388 void reset_x_origin (framepos_t);
389 void reset_x_origin_to_follow_playhead ();
390 void reset_y_origin (double);
391 void reset_zoom (double);
392 void reposition_and_zoom (framepos_t, double);
394 framepos_t get_preferred_edit_position (bool ignore_playhead = false);
396 bool update_mouse_speed ();
397 bool decelerate_mouse_speed ();
399 void toggle_meter_updating();
401 void show_rhythm_ferret();
403 void goto_visual_state (uint32_t);
404 void save_visual_state (uint32_t);
406 void queue_draw_resize_line (int at);
407 void start_resize_line_ops ();
408 void end_resize_line_ops ();
410 TrackViewList const & get_track_views () {
411 return track_views;
414 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region>);
416 void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t&);
417 void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, framepos_t&);
419 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
421 void center_screen (framepos_t);
423 TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
424 Gtkmm2ext::TearOff* mouse_mode_tearoff () const { return _mouse_mode_tearoff; }
425 Gtkmm2ext::TearOff* tools_tearoff () const { return _tools_tearoff; }
427 void snap_to (framepos_t& first, int32_t direction = 0, bool for_mark = false);
428 void snap_to_with_modifier (framepos_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
429 void snap_to (framepos_t& first, framepos_t& last, int32_t direction = 0, bool for_mark = false);
431 void begin_reversible_command (std::string cmd_name);
432 void begin_reversible_command (GQuark);
433 void commit_reversible_command ();
435 DragManager* drags () const {
436 return _drags;
439 void maybe_autoscroll (bool, bool);
441 Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
442 void set_canvas_cursor (Gdk::Cursor*, bool save=false);
443 void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
444 void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
446 MouseCursors const * cursors () const {
447 return _cursors;
450 VerboseCursor* verbose_cursor () const {
451 return _verbose_cursor;
454 void get_pointer_position (double &, double &) const;
456 protected:
457 void map_transport_state ();
458 void map_position_change (framepos_t);
460 void on_realize();
462 private:
464 void color_handler ();
466 bool constructed;
468 // to keep track of the playhead position for control_scroll
469 boost::optional<framepos_t> _control_scroll_target;
471 PlaylistSelector* _playlist_selector;
473 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
475 struct VisualState {
476 VisualState();
477 ~VisualState ();
478 double y_position;
479 double frames_per_unit;
480 framepos_t leftmost_frame;
481 Editing::ZoomFocus zoom_focus;
482 GUIObjectState* gui_state;
485 std::list<VisualState*> undo_visual_stack;
486 std::list<VisualState*> redo_visual_stack;
487 VisualState* current_visual_state (bool with_tracks = true);
488 void undo_visual_state ();
489 void redo_visual_state ();
490 void use_visual_state (VisualState&);
491 bool no_save_visual;
492 void swap_visual_state ();
494 std::vector<VisualState*> visual_states;
495 sigc::connection visual_state_op_connection;
496 void start_visual_state_op (uint32_t n);
497 void cancel_visual_state_op (uint32_t n);
498 bool end_visual_state_op (uint32_t n);
500 framepos_t leftmost_frame;
501 double frames_per_unit;
502 Editing::ZoomFocus zoom_focus;
504 void set_frames_per_unit (double);
505 void post_zoom ();
507 Editing::MouseMode mouse_mode;
508 Editing::MouseMode pre_internal_mouse_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 int post_maximal_editor_width;
525 int post_maximal_editor_height;
526 int post_maximal_horizontal_pane_position;
527 int post_maximal_vertical_pane_position;
528 int pre_maximal_horizontal_pane_position;
529 int pre_maximal_vertical_pane_position;
530 int pre_maximal_editor_width;
531 int pre_maximal_editor_height;
532 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
534 Gtk::Notebook _the_notebook;
535 bool _notebook_shrunk;
536 void add_notebook_page (std::string const &, Gtk::Widget &);
537 bool notebook_tab_clicked (GdkEventButton *, Gtk::Widget *);
539 Gtk::HPaned edit_pane;
540 Gtk::VPaned editor_summary_pane;
542 bool idle_reset_vertical_pane_position (int);
544 Gtk::EventBox meter_base;
545 Gtk::HBox meter_box;
546 Gtk::EventBox marker_base;
547 Gtk::HBox marker_box;
548 Gtk::VBox scrollers_rulers_markers_box;
550 void location_changed (ARDOUR::Location *);
551 void location_flags_changed (ARDOUR::Location *, void *);
552 void refresh_location_display ();
553 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
554 void add_new_location (ARDOUR::Location *);
555 ArdourCanvas::Group* add_new_location_internal (ARDOUR::Location *);
556 void location_gone (ARDOUR::Location *);
557 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
558 gint really_remove_marker (ARDOUR::Location* loc);
559 void goto_nth_marker (int nth);
560 void toggle_marker_lines ();
561 void set_marker_line_visibility (bool);
563 uint32_t location_marker_color;
564 uint32_t location_range_color;
565 uint32_t location_loop_color;
566 uint32_t location_punch_color;
567 uint32_t location_cd_marker_color;
569 struct LocationMarkers {
570 Marker* start;
571 Marker* end;
572 bool valid;
574 LocationMarkers () : start(0), end(0), valid (true) {}
576 ~LocationMarkers ();
578 void hide ();
579 void show ();
581 void set_show_lines (bool);
582 void set_selected (bool);
583 void canvas_height_set (double);
584 void setup_lines ();
586 void set_name (const std::string&);
587 void set_position (framepos_t start, framepos_t end = 0);
588 void set_color_rgba (uint32_t);
591 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
592 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
593 Marker* entered_marker;
594 bool _show_marker_lines;
596 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
597 LocationMarkerMap location_markers;
599 void update_marker_labels ();
600 void update_marker_labels (ArdourCanvas::Group *);
601 void check_marker_label (Marker *);
603 /** A set of lists of Markers that are in each of the canvas groups
604 * for the marker sections at the top of the editor. These lists
605 * are kept sorted in time order between marker movements, so that after
606 * a marker has moved we can decide whether we need to update the labels
607 * for all markers or for just a few.
609 std::map<ArdourCanvas::Group *, std::list<Marker *> > _sorted_marker_lists;
610 void remove_sorted_marker (Marker *);
612 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
613 void clear_marker_display ();
614 void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
615 bool choose_new_marker_name(std::string &name);
616 void update_cd_marker_display ();
617 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
619 TimeAxisView* clicked_axisview;
620 RouteTimeAxisView* clicked_routeview;
621 /** The last RegionView that was clicked on, or 0 if the last click was not
622 * on a RegionView. This is set up by the canvas event handlers in
623 * editor_canvas_events.cc
625 RegionView* clicked_regionview;
626 RegionSelection latest_regionviews;
627 uint32_t clicked_selection;
628 CrossfadeView* clicked_crossfadeview;
629 ControlPoint* clicked_control_point;
631 void sort_track_selection (TrackViewList* sel = 0);
633 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
634 RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
635 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
637 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
639 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector<RegionView*>*) const;
640 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
641 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
642 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
644 /* end */
646 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
647 bool button_release_can_deselect;
649 void catch_vanishing_regionview (RegionView *);
651 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
652 void select_all_tracks ();
653 void select_all_internal_edit (Selection::Operation);
655 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
656 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
657 void set_selected_track_as_side_effect (Selection::Operation op, bool force = false);
658 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
660 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
661 void collect_new_region_view (RegionView *);
662 void collect_and_select_new_region_view (RegionView *);
664 long select_range_around_region (RegionView *);
666 Gtk::Menu track_context_menu;
667 Gtk::Menu track_region_context_menu;
668 Gtk::Menu track_selection_context_menu;
669 Gtk::Menu track_crossfade_context_menu;
671 Gtk::MenuItem* region_edit_menu_split_item;
672 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
673 Gtk::Menu * track_region_edit_playlist_menu;
674 Gtk::Menu * track_edit_playlist_submenu;
675 Gtk::Menu * track_selection_edit_playlist_submenu;
677 void popup_track_context_menu (int, int, ItemType, bool);
678 Gtk::Menu* build_track_context_menu ();
679 Gtk::Menu* build_track_bus_context_menu ();
680 Gtk::Menu* build_track_region_context_menu ();
681 Gtk::Menu* build_track_crossfade_context_menu ();
682 Gtk::Menu* build_track_selection_context_menu ();
683 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
684 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
685 void add_region_context_items (Gtk::Menu_Helpers::MenuList&, boost::shared_ptr<ARDOUR::Track>);
686 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
687 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
688 Gtk::MenuItem* _popup_region_menu_item;
690 void popup_control_point_context_menu (ArdourCanvas::Item *, GdkEvent *);
691 Gtk::Menu _control_point_context_menu;
693 void handle_new_route (ARDOUR::RouteList&);
694 void timeaxisview_deleted (TimeAxisView *);
696 Gtk::HBox global_hpacker;
697 Gtk::VBox global_vpacker;
698 Gtk::VBox vpacker;
700 Gdk::Cursor* current_canvas_cursor;
701 Gdk::Cursor* which_grabber_cursor ();
702 void set_canvas_cursor ();
704 ArdourCanvas::Canvas* track_canvas;
706 friend class VerboseCursor;
707 VerboseCursor* _verbose_cursor;
709 void parameter_changed (std::string);
711 bool track_canvas_motion (GdkEvent*);
713 Gtk::EventBox time_canvas_event_box;
714 Gtk::EventBox track_canvas_event_box;
715 Gtk::EventBox time_button_event_box;
716 Gtk::EventBox ruler_label_event_box;
718 ArdourCanvas::Group *minsec_group;
719 ArdourCanvas::Pixbuf *logo_item;
720 ArdourCanvas::Group *bbt_group;
721 ArdourCanvas::Group *timecode_group;
722 ArdourCanvas::Group *frame_group;
723 ArdourCanvas::Group *tempo_group;
724 ArdourCanvas::Group *meter_group;
725 ArdourCanvas::Group *marker_group;
726 ArdourCanvas::Group *range_marker_group;
727 ArdourCanvas::Group *transport_marker_group;
728 ArdourCanvas::Group* cd_marker_group;
730 ArdourCanvas::Group* timebar_group;
732 /* These bars never need to be scrolled */
733 ArdourCanvas::Group* meter_bar_group;
734 ArdourCanvas::Group* tempo_bar_group;
735 ArdourCanvas::Group* marker_bar_group;
736 ArdourCanvas::Group* range_marker_bar_group;
737 ArdourCanvas::Group* transport_marker_bar_group;
738 ArdourCanvas::Group* cd_marker_bar_group;
740 /** The group containing all items that require horizontal scrolling. */
741 ArdourCanvas::Group* _background_group;
743 The _master_group is the group containing all items
744 that require horizontal scrolling..
745 It is primarily used to separate canvas items
746 that require horizontal scrolling from those that do not.
748 ArdourCanvas::Group* _master_group;
750 /* The group containing all trackviews. Only scrolled vertically. */
751 ArdourCanvas::Group* _trackview_group;
753 /* The group used for region motion. Sits on top of _trackview_group */
754 ArdourCanvas::Group* _region_motion_group;
756 enum RulerType {
757 ruler_metric_timecode = 0,
758 ruler_metric_bbt = 1,
759 ruler_metric_samples = 2,
760 ruler_metric_minsec = 3,
762 ruler_time_tempo = 4,
763 ruler_time_meter = 5,
764 ruler_time_marker = 6,
765 ruler_time_range_marker = 7,
766 ruler_time_transport_marker = 8,
767 ruler_time_cd_marker = 9,
770 static GtkCustomMetric ruler_metrics[4];
771 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
772 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
773 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
774 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
775 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
776 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
777 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
778 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
779 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
780 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
781 bool no_ruler_shown_update;
783 bool ruler_button_press (GdkEventButton*);
784 bool ruler_button_release (GdkEventButton*);
785 bool ruler_mouse_motion (GdkEventMotion*);
786 bool ruler_scroll (GdkEventScroll* event);
788 Gtk::Widget * ruler_grabbed_widget;
790 void initialize_rulers ();
791 void update_just_timecode ();
792 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
793 void update_fixed_rulers ();
794 void update_tempo_based_rulers ();
795 void popup_ruler_menu (framepos_t where = 0, ItemType type = RegionItem);
796 void update_ruler_visibility ();
797 void set_ruler_visible (RulerType, bool);
798 void toggle_ruler_visibility (RulerType rt);
799 void ruler_toggled (int);
800 bool ruler_label_button_release (GdkEventButton*);
801 void store_ruler_visibility ();
802 void restore_ruler_visibility ();
804 static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
805 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
806 static gint _metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
807 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
809 enum MinsecRulerScale {
810 minsec_show_seconds,
811 minsec_show_minutes,
812 minsec_show_hours,
813 minsec_show_frames
816 MinsecRulerScale minsec_ruler_scale;
818 framecnt_t minsec_mark_interval;
819 gint minsec_mark_modulo;
820 gint minsec_nmarks;
821 void set_minsec_ruler_scale (framepos_t, framepos_t);
823 enum TimecodeRulerScale {
824 timecode_show_bits,
825 timecode_show_frames,
826 timecode_show_seconds,
827 timecode_show_minutes,
828 timecode_show_hours
831 TimecodeRulerScale timecode_ruler_scale;
833 gint timecode_mark_modulo;
834 gint timecode_nmarks;
835 void set_timecode_ruler_scale (framepos_t, framepos_t);
837 framecnt_t _samples_ruler_interval;
838 void set_samples_ruler_scale (framepos_t, framepos_t);
840 enum BBTRulerScale {
841 bbt_over,
842 bbt_show_64,
843 bbt_show_16,
844 bbt_show_4,
845 bbt_show_1,
846 bbt_show_beats,
847 bbt_show_ticks,
848 bbt_show_ticks_detail,
849 bbt_show_ticks_super_detail
852 BBTRulerScale bbt_ruler_scale;
854 uint32_t bbt_bars;
855 gint bbt_nmarks;
856 uint32_t bbt_bar_helper_on;
857 uint32_t bbt_accent_modulo;
858 void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper);
860 gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
861 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
862 gint metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
863 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
865 Gtk::Widget *_ruler_separator;
866 GtkWidget *_timecode_ruler;
867 GtkWidget *_bbt_ruler;
868 GtkWidget *_samples_ruler;
869 GtkWidget *_minsec_ruler;
870 Gtk::Widget *timecode_ruler;
871 Gtk::Widget *bbt_ruler;
872 Gtk::Widget *samples_ruler;
873 Gtk::Widget *minsec_ruler;
874 static Editor *ruler_editor;
876 static const double timebar_height;
877 guint32 visible_timebars;
878 gdouble canvas_timebars_vsize;
879 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
880 Gtk::Menu *editor_ruler_menu;
882 ArdourCanvas::SimpleRect* tempo_bar;
883 ArdourCanvas::SimpleRect* meter_bar;
884 ArdourCanvas::SimpleRect* marker_bar;
885 ArdourCanvas::SimpleRect* range_marker_bar;
886 ArdourCanvas::SimpleRect* transport_marker_bar;
887 ArdourCanvas::SimpleRect* cd_marker_bar;
889 Gtk::Label minsec_label;
890 Gtk::Label bbt_label;
891 Gtk::Label timecode_label;
892 Gtk::Label samples_label;
893 Gtk::Label tempo_label;
894 Gtk::Label meter_label;
895 Gtk::Label mark_label;
896 Gtk::Label range_mark_label;
897 Gtk::Label transport_mark_label;
898 Gtk::Label cd_mark_label;
900 Gtk::VBox time_button_vbox;
901 Gtk::HBox time_button_hbox;
903 friend class EditorCursor;
905 EditorCursor* playhead_cursor;
906 ArdourCanvas::Group* cursor_group;
908 framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
910 void cursor_to_region_boundary (bool with_selection, int32_t dir);
911 void cursor_to_next_region_boundary (bool with_selection);
912 void cursor_to_previous_region_boundary (bool with_selection);
913 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
914 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
915 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
916 void cursor_to_selection_start (EditorCursor *);
917 void cursor_to_selection_end (EditorCursor *);
919 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
920 void selected_marker_to_next_region_boundary (bool with_selection);
921 void selected_marker_to_previous_region_boundary (bool with_selection);
922 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
923 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
924 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
925 void selected_marker_to_selection_start ();
926 void selected_marker_to_selection_end ();
928 void select_all_selectables_using_cursor (EditorCursor *, bool);
929 void select_all_selectables_using_edit (bool);
930 void select_all_selectables_between (bool within);
931 void select_range_between ();
933 boost::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::framepos_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
934 ARDOUR::framepos_t find_next_region_boundary (ARDOUR::framepos_t, int32_t dir, const TrackViewList&);
936 std::vector<ARDOUR::framepos_t> region_boundary_cache;
937 void build_region_boundary_cache ();
939 Gtk::HBox top_hbox;
940 Gtk::HBox bottom_hbox;
942 Gtk::Table edit_packer;
944 Gtk::Adjustment vertical_adjustment;
946 Gtk::Layout controls_layout;
947 bool control_layout_scroll (GdkEventScroll* ev);
948 void reset_controls_layout_width ();
949 void reset_controls_layout_height (int32_t height);
951 enum Direction {
952 LEFT,
953 RIGHT,
955 DOWN
958 bool scroll_press (Direction);
959 void scroll_release ();
960 sigc::connection _scroll_connection;
961 int _scroll_callbacks;
963 double _canvas_width;
964 double _canvas_height; ///< height of the visible area of the track canvas
965 double full_canvas_height; ///< full height of the canvas
967 bool track_canvas_map_handler (GdkEventAny*);
969 bool edit_controls_button_release (GdkEventButton*);
970 Gtk::Menu *edit_controls_left_menu;
971 Gtk::Menu *edit_controls_right_menu;
973 Gtk::VBox ruler_label_vbox;
974 Gtk::VBox track_canvas_vbox;
975 Gtk::VBox time_canvas_vbox;
976 Gtk::VBox edit_controls_vbox;
977 Gtk::HBox edit_controls_hbox;
979 void control_scroll (float);
980 void access_action (std::string,std::string);
981 bool deferred_control_scroll (framepos_t);
982 sigc::connection control_scroll_connection;
984 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
986 ArdourCanvas::Group* get_background_group () const { return _background_group; }
987 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
988 double last_trackview_group_vertical_offset;
989 void tie_vertical_scrolling ();
990 void set_horizontal_position (double);
991 double horizontal_position () const;
992 void scroll_canvas_vertically ();
994 struct VisualChange {
995 enum Type {
996 TimeOrigin = 0x1,
997 ZoomLevel = 0x2,
998 YOrigin = 0x4
1001 Type pending;
1002 framepos_t time_origin;
1003 double frames_per_unit;
1004 double y_origin;
1006 int idle_handler_id;
1008 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
1009 void add (Type t) {
1010 pending = Type (pending | t);
1015 VisualChange pending_visual_change;
1017 static int _idle_visual_changer (void *arg);
1018 int idle_visual_changer ();
1020 void queue_visual_change (framepos_t);
1021 void queue_visual_change (double);
1022 void queue_visual_change_y (double);
1023 void ensure_visual_change_idle_handler ();
1025 /* track views */
1026 TrackViewList track_views;
1027 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1028 TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const;
1030 TrackViewList get_tracks_for_range_action () const;
1032 sigc::connection super_rapid_screen_update_connection;
1033 framepos_t last_update_frame;
1034 void center_screen_internal (framepos_t, float);
1036 void super_rapid_screen_update ();
1038 void session_going_away ();
1040 framepos_t cut_buffer_start;
1041 framecnt_t cut_buffer_length;
1043 Gdk::Cursor* pre_press_cursor;
1044 boost::weak_ptr<ARDOUR::Trimmable> _trimmable;
1045 boost::weak_ptr<ARDOUR::Movable> _movable;
1047 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1048 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1049 bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1050 bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1051 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1052 bool button_press_dispatch (GdkEventButton*);
1053 bool button_release_dispatch (GdkEventButton*);
1054 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1055 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1056 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1058 Gtkmm2ext::Bindings* button_bindings;
1059 XMLNode* button_settings () const;
1061 /* KEYMAP HANDLING */
1063 void register_actions ();
1064 void register_region_actions ();
1066 int ensure_cursor (framepos_t* pos);
1068 void cut_copy (Editing::CutCopyOp);
1069 bool can_cut_copy () const;
1070 void cut_copy_points (Editing::CutCopyOp);
1071 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1072 void cut_copy_ranges (Editing::CutCopyOp);
1073 void cut_copy_midi (Editing::CutCopyOp);
1075 void mouse_paste ();
1076 void paste_internal (framepos_t position, float times);
1078 /* EDITING OPERATIONS */
1080 void reset_point_selection ();
1081 void toggle_region_lock ();
1082 void toggle_opaque_region ();
1083 void toggle_record_enable ();
1084 void toggle_region_lock_style ();
1085 void raise_region ();
1086 void raise_region_to_top ();
1087 void change_region_layering_order ();
1088 void lower_region ();
1089 void lower_region_to_bottom ();
1090 void split_regions_at (framepos_t, RegionSelection&);
1091 void split_region_at_transients ();
1092 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
1093 void crop_region_to_selection ();
1094 void crop_region_to (framepos_t start, framepos_t end);
1095 void set_sync_point (framepos_t, const RegionSelection&);
1096 void set_region_sync_position ();
1097 void remove_region_sync();
1098 void align_regions (ARDOUR::RegionPoint);
1099 void align_regions_relative (ARDOUR::RegionPoint point);
1100 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
1101 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
1102 void remove_selected_regions ();
1103 void remove_clicked_region ();
1104 void show_region_properties ();
1105 void show_midi_list_editor ();
1106 void rename_region ();
1107 void duplicate_some_regions (RegionSelection&, float times);
1108 void duplicate_selection (float times);
1109 void region_fill_selection ();
1110 void combine_regions ();
1111 void uncombine_regions ();
1113 void region_fill_track ();
1114 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1115 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1116 void split_multichannel_region();
1117 void reverse_region ();
1118 void strip_region_silence ();
1119 void normalize_region ();
1120 void reset_region_scale_amplitude ();
1121 void adjust_region_gain (bool up);
1122 void quantize_region ();
1123 void insert_patch_change ();
1124 void fork_region ();
1126 void do_insert_time ();
1127 void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool);
1129 void tab_to_transient (bool forward);
1131 void set_tempo_from_region ();
1132 void use_range_as_bar ();
1134 void define_one_bar (framepos_t start, framepos_t end);
1136 void audition_region_from_region_list ();
1137 void hide_region_from_region_list ();
1138 void show_region_in_region_list ();
1140 void naturalize_region ();
1142 void reset_focus ();
1144 void split_region ();
1146 void delete_ ();
1147 void cut ();
1148 void copy ();
1149 void paste (float times);
1151 void place_transient ();
1152 void remove_transient (ArdourCanvas::Item* item);
1153 void snap_regions_to_grid ();
1154 void close_region_gaps ();
1156 void keyboard_paste ();
1158 void region_from_selection ();
1159 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1161 void play_from_start ();
1162 void play_from_edit_point ();
1163 void play_from_edit_point_and_return ();
1164 void play_selected_region ();
1165 void play_edit_range ();
1166 void play_location (ARDOUR::Location&);
1167 void loop_location (ARDOUR::Location&);
1169 void temporal_zoom_selection ();
1170 void temporal_zoom_region (bool both_axes);
1171 void zoom_to_region (bool both_axes);
1172 void temporal_zoom_session ();
1173 void temporal_zoom (gdouble scale);
1174 void temporal_zoom_by_frame (framepos_t start, framepos_t end, const std::string & op);
1175 void temporal_zoom_to_frame (bool coarser, framepos_t frame);
1177 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1178 void insert_region_list_selection (float times);
1180 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1182 /* import & embed */
1184 void add_external_audio_action (Editing::ImportMode);
1185 void external_audio_dialog ();
1186 void session_import_dialog ();
1188 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1189 bool check_multichannel_status (const std::vector<std::string>& paths);
1191 SoundFileOmega* sfbrowser;
1193 void bring_in_external_audio (Editing::ImportMode mode, framepos_t& pos);
1195 bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos);
1196 void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos);
1198 int import_sndfiles (std::vector<std::string> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t& pos,
1199 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
1200 int embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1201 framepos_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1203 int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, framepos_t& pos, Editing::ImportMode,
1204 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1205 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, framepos_t& pos, Editing::ImportMode mode,
1206 boost::shared_ptr<ARDOUR::Track>& existing_track);
1208 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1209 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1211 ARDOUR::InterThreadInfo* current_interthread_info;
1213 AnalysisWindow* analysis_window;
1215 /* import specific info */
1217 struct EditorImportStatus : public ARDOUR::ImportStatus {
1218 Editing::ImportMode mode;
1219 framepos_t pos;
1220 int target_tracks;
1221 int target_regions;
1222 boost::shared_ptr<ARDOUR::Track> track;
1223 bool replace;
1226 EditorImportStatus import_status;
1227 static void *_import_thread (void *);
1228 void* import_thread ();
1229 void finish_import ();
1231 /* to support this ... */
1233 void import_audio (bool as_tracks);
1234 void do_import (std::vector<std::string> paths, bool split, bool as_tracks);
1236 void move_to_start ();
1237 void move_to_end ();
1238 void center_playhead ();
1239 void center_edit_point ();
1240 void playhead_forward_to_grid ();
1241 void playhead_backward_to_grid ();
1242 void scroll_playhead (bool forward);
1243 void scroll_backward (float pages=0.8f);
1244 void scroll_forward (float pages=0.8f);
1245 void scroll_tracks_down ();
1246 void scroll_tracks_up ();
1247 void set_mark ();
1248 void clear_markers ();
1249 void clear_ranges ();
1250 void clear_locations ();
1251 void unhide_markers ();
1252 void unhide_ranges ();
1253 void jump_forward_to_mark ();
1254 void jump_backward_to_mark ();
1255 void cursor_align (bool playhead_to_edit);
1257 void remove_last_capture ();
1258 void select_all_selectables_using_time_selection ();
1259 void select_all_selectables_using_loop();
1260 void select_all_selectables_using_punch();
1261 void set_selection_from_range (ARDOUR::Location&);
1262 void set_selection_from_punch ();
1263 void set_selection_from_loop ();
1264 void set_selection_from_region ();
1266 void add_location_mark (framepos_t where);
1267 void add_location_from_region ();
1268 void add_locations_from_region ();
1269 void add_location_from_selection ();
1270 void set_loop_from_selection (bool play);
1271 void set_punch_from_selection ();
1272 void set_punch_from_region ();
1274 void set_loop_from_edit_range (bool play);
1275 void set_loop_from_region (bool play);
1276 void set_punch_from_edit_range ();
1278 void set_loop_range (framepos_t start, framepos_t end, std::string cmd);
1279 void set_punch_range (framepos_t start, framepos_t end, std::string cmd);
1281 void add_location_from_playhead_cursor ();
1282 bool select_new_marker;
1284 void reverse_selection ();
1285 void edit_envelope ();
1287 double last_scrub_x;
1288 int scrubbing_direction;
1289 int scrub_reversals;
1290 int scrub_reverse_distance;
1291 void scrub (framepos_t, double);
1293 void keyboard_selection_begin ();
1294 void keyboard_selection_finish (bool add);
1295 bool have_pending_keyboard_selection;
1296 framepos_t pending_keyboard_selection_start;
1298 void move_range_selection_start_or_end_to_region_boundary (bool, bool);
1300 Editing::SnapType _snap_type;
1301 Editing::SnapMode _snap_mode;
1303 /// Snap threshold in pixels
1304 double snap_threshold;
1306 bool ignore_gui_changes;
1308 DragManager* _drags;
1310 void escape ();
1312 Gtk::Menu fade_context_menu;
1313 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1315 void set_fade_in_shape (ARDOUR::FadeShape);
1316 void set_fade_out_shape (ARDOUR::FadeShape);
1318 void set_fade_length (bool in);
1319 void set_fade_in_active (bool);
1320 void set_fade_out_active (bool);
1322 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1324 bool _dragging_playhead;
1325 bool _dragging_edit_point;
1327 void marker_drag_motion_callback (GdkEvent*);
1328 void marker_drag_finished_callback (GdkEvent*);
1330 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1332 void add_region_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1333 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1334 void add_region_copy_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1335 void add_region_brush_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1336 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1338 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1340 bool can_remove_control_point (ArdourCanvas::Item *);
1341 void remove_control_point (ArdourCanvas::Item *);
1343 void mouse_brush_insert_region (RegionView*, framepos_t pos);
1345 /* Canvas event handlers */
1347 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1348 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1349 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1350 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1351 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1352 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1353 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1354 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1355 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1356 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1357 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1358 bool canvas_frame_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1359 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1360 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1361 bool canvas_feature_line_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*);
1362 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1363 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1364 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1365 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1366 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1367 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1368 bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*);
1370 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1371 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1372 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1373 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1374 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1375 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1377 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1378 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1379 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1380 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1381 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1382 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1383 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1384 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1386 PBD::Signal0<void> EditorFreeze;
1387 PBD::Signal0<void> EditorThaw;
1389 private:
1390 friend class DragManager;
1391 friend class EditorRouteGroups;
1392 friend class EditorRegions;
1394 ArdourCanvas::Item *last_item_entered;
1395 /** true if the mouse is over a place where region trim can happen */
1396 bool _over_region_trim_target;
1398 /* non-public event handlers */
1400 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1401 bool track_canvas_scroll (GdkEventScroll* event);
1403 bool track_canvas_scroll_event (GdkEventScroll* event);
1404 bool track_canvas_button_press_event (GdkEventButton* event);
1405 bool track_canvas_button_release_event (GdkEventButton* event);
1406 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1408 Gtk::Allocation canvas_allocation;
1409 void track_canvas_allocate (Gtk::Allocation alloc);
1410 bool track_canvas_size_allocated ();
1411 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1412 bool track_canvas_key_press (GdkEventKey *);
1413 bool track_canvas_key_release (GdkEventKey *);
1415 void set_playhead_cursor ();
1417 void toggle_region_mute ();
1419 void initialize_canvas ();
1421 /* display control */
1423 bool _show_measures;
1424 /// true if the editor should follow the playhead, otherwise false
1425 bool _follow_playhead;
1426 /// true if we scroll the tracks rather than the playhead
1427 bool _stationary_playhead;
1429 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1431 TempoLines* tempo_lines;
1433 ArdourCanvas::Group* time_line_group;
1435 void hide_measures ();
1436 void draw_measures ();
1437 bool redraw_measures ();
1439 void new_tempo_section ();
1441 void mouse_add_new_tempo_event (framepos_t where);
1442 void mouse_add_new_meter_event (framepos_t where);
1444 void remove_tempo_marker (ArdourCanvas::Item*);
1445 void remove_meter_marker (ArdourCanvas::Item*);
1446 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1447 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1449 void edit_tempo_section (ARDOUR::TempoSection*);
1450 void edit_meter_section (ARDOUR::MeterSection*);
1451 void edit_tempo_marker (ArdourCanvas::Item*);
1452 void edit_meter_marker (ArdourCanvas::Item*);
1453 void edit_control_point (ArdourCanvas::Item*);
1454 void edit_note (ArdourCanvas::Item *);
1456 void marker_menu_edit ();
1457 void marker_menu_remove ();
1458 void marker_menu_rename ();
1459 void toggle_marker_menu_lock ();
1460 void toggle_marker_menu_glue ();
1461 void marker_menu_hide ();
1462 void marker_menu_loop_range ();
1463 void marker_menu_select_all_selectables_using_range ();
1464 void marker_menu_select_using_range ();
1465 void marker_menu_separate_regions_using_location ();
1466 void marker_menu_play_from ();
1467 void marker_menu_play_range ();
1468 void marker_menu_set_playhead ();
1469 void marker_menu_set_from_playhead ();
1470 void marker_menu_set_from_selection ();
1471 void marker_menu_range_to_next ();
1472 void new_transport_marker_menu_set_loop ();
1473 void new_transport_marker_menu_set_punch ();
1474 void update_loop_range_view (bool visibility=false);
1475 void update_punch_range_view (bool visibility=false);
1476 void new_transport_marker_menu_popdown ();
1477 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1478 void tempo_or_meter_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1479 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1480 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1481 void build_range_marker_menu (bool);
1482 void build_marker_menu (ARDOUR::Location *);
1483 void build_tempo_or_meter_marker_menu (bool);
1484 void build_new_transport_marker_menu ();
1485 void dynamic_cast_marker_object (void*, MeterMarker**, TempoMarker**) const;
1487 Gtk::Menu* tempo_or_meter_marker_menu;
1488 Gtk::Menu* marker_menu;
1489 Gtk::Menu* range_marker_menu;
1490 Gtk::Menu* transport_marker_menu;
1491 Gtk::Menu* new_transport_marker_menu;
1492 Gtk::Menu* cd_marker_menu;
1493 ArdourCanvas::Item* marker_menu_item;
1495 typedef std::list<Marker*> Marks;
1496 Marks metric_marks;
1498 void remove_metric_marks ();
1499 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1501 void compute_current_bbt_points (framepos_t left, framepos_t right);
1502 void tempo_map_changed (const PBD::PropertyChange&);
1503 void redisplay_tempo (bool immediate_redraw);
1505 uint32_t bbt_beat_subdivision;
1507 /* toolbar */
1509 Gtk::ToggleButton editor_mixer_button;
1510 Gtk::ToggleButton editor_list_button;
1511 void editor_mixer_button_toggled ();
1512 void editor_list_button_toggled ();
1514 AudioClock* zoom_range_clock;
1515 Gtk::Button zoom_in_button;
1516 Gtk::Button zoom_out_button;
1517 Gtk::Button zoom_out_full_button;
1518 Gtk::Button zoom_onetoone_button;
1520 Gtk::Button tav_expand_button;
1521 Gtk::Button tav_shrink_button;
1523 Gtk::VBox toolbar_clock_vbox;
1524 Gtk::VBox toolbar_selection_clock_vbox;
1525 Gtk::Table toolbar_selection_clock_table;
1526 Gtk::Label toolbar_selection_cursor_label;
1528 Gtkmm2ext::TearOff* _mouse_mode_tearoff;
1529 Gtkmm2ext::StatefulToggleButton mouse_select_button;
1530 Gtkmm2ext::StatefulToggleButton mouse_move_button;
1531 Gtkmm2ext::StatefulToggleButton mouse_gain_button;
1532 Gtkmm2ext::StatefulToggleButton mouse_zoom_button;
1533 Gtkmm2ext::StatefulToggleButton mouse_timefx_button;
1534 Gtkmm2ext::StatefulToggleButton mouse_audition_button;
1535 Gtkmm2ext::StatefulToggleButton join_object_range_button;
1537 void mouse_mode_toggled (Editing::MouseMode m);
1538 void mouse_mode_object_range_toggled () {}
1539 bool ignore_mouse_mode_toggle;
1541 Gtkmm2ext::StatefulToggleButton internal_edit_button;
1542 void toggle_internal_editing ();
1544 bool mouse_select_button_release (GdkEventButton*);
1546 Gtk::VBox automation_box;
1547 Gtk::Button automation_mode_button;
1548 Gtk::ToggleButton global_automation_button;
1550 Gtk::ComboBoxText edit_mode_selector;
1551 Gtk::VBox edit_mode_box;
1552 std::vector<std::string> edit_mode_strings;
1554 void set_edit_mode (ARDOUR::EditMode);
1555 void cycle_edit_mode ();
1556 void edit_mode_selection_done ();
1558 Gtk::ComboBoxText snap_type_selector;
1559 Gtk::ComboBoxText snap_mode_selector;
1560 Gtk::HBox snap_box;
1562 std::vector<std::string> snap_type_strings;
1563 std::vector<std::string> snap_mode_strings;
1565 void snap_type_selection_done ();
1566 void snap_mode_selection_done ();
1567 void snap_mode_chosen (Editing::SnapMode);
1568 void snap_type_chosen (Editing::SnapType);
1570 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1571 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1573 Gtk::ComboBoxText zoom_focus_selector;
1574 Gtk::VBox zoom_focus_box;
1576 std::vector<std::string> zoom_focus_strings;
1578 void zoom_focus_selection_done ();
1579 void zoom_focus_chosen (Editing::ZoomFocus);
1581 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1583 Gtk::HBox _zoom_box;
1584 Gtkmm2ext::TearOff* _zoom_tearoff;
1585 void zoom_adjustment_changed();
1587 void setup_toolbar ();
1589 void setup_tooltips ();
1591 Gtkmm2ext::TearOff* _tools_tearoff;
1592 Gtk::HBox toolbar_hbox;
1593 Gtk::EventBox toolbar_base;
1594 Gtk::Frame toolbar_frame;
1595 Gtk::Viewport _toolbar_viewport;
1597 /* midi toolbar */
1599 Gtk::HBox panic_box;
1600 Gtk::Button midi_panic_button;
1601 Gtk::ToggleButton midi_sound_notes;
1602 void midi_panic ();
1603 bool sound_notes () const { return midi_sound_notes.get_active(); }
1605 void setup_midi_toolbar ();
1607 /* selection process */
1609 Selection* selection;
1610 Selection* cut_buffer;
1612 void time_selection_changed ();
1613 void track_selection_changed ();
1614 void region_selection_changed ();
1615 sigc::connection editor_regions_selection_changed_connection;
1616 void sensitize_all_region_actions (bool);
1617 void sensitize_the_right_region_actions ();
1618 bool _all_region_actions_sensitized;
1619 /** Flag to block region action handlers from doing what they normally do;
1620 * I tried Gtk::Action::block_activate() but this doesn't work (ie it doesn't
1621 * block) when setting a ToggleAction's active state.
1623 bool _ignore_region_action;
1624 bool _last_region_menu_was_main;
1625 void point_selection_changed ();
1626 void marker_selection_changed ();
1628 void cancel_selection ();
1630 bool audio_region_selection_covers (framepos_t where);
1632 /* transport range select process */
1634 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1635 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1636 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1638 #ifdef GTKOSX
1639 ArdourCanvas::SimpleRect *bogus_background_rect;
1640 #endif
1641 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1642 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1643 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1644 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1645 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1646 ArdourCanvas::SimpleLine *transport_punchin_line;
1647 ArdourCanvas::SimpleLine *transport_punchout_line;
1648 ArdourCanvas::SimpleRect *transport_preroll_rect;
1649 ArdourCanvas::SimpleRect *transport_postroll_rect;
1651 ARDOUR::Location* transport_loop_location();
1652 ARDOUR::Location* transport_punch_location();
1654 ARDOUR::Location *temp_location;
1656 /* object rubberband select process */
1658 void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
1660 ArdourCanvas::SimpleRect *rubberband_rect;
1662 /* mouse zoom process */
1664 ArdourCanvas::SimpleRect *zoom_rect;
1665 void reposition_zoom_rect (framepos_t start, framepos_t end);
1667 EditorRouteGroups* _route_groups;
1668 EditorRoutes* _routes;
1669 EditorRegions* _regions;
1670 EditorSnapshots* _snapshots;
1671 EditorLocations* _locations;
1673 /* diskstream/route display management */
1674 Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
1675 Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
1677 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1679 bool sync_track_view_list_and_routes ();
1681 Gtk::VBox list_vpacker;
1683 /* autoscrolling */
1685 bool autoscroll_active;
1686 int autoscroll_timeout_tag;
1687 int autoscroll_x;
1688 int autoscroll_y;
1689 int last_autoscroll_x;
1690 int last_autoscroll_y;
1691 uint32_t autoscroll_cnt;
1692 framecnt_t autoscroll_x_distance;
1693 double autoscroll_y_distance;
1695 static gint _autoscroll_canvas (void *);
1696 bool autoscroll_canvas ();
1697 void start_canvas_autoscroll (int x, int y);
1698 void stop_canvas_autoscroll ();
1700 /* trimming */
1701 void point_trim (GdkEvent *, framepos_t);
1703 void trim_region_front();
1704 void trim_region_back();
1705 void trim_region (bool front);
1707 void trim_region_to_loop ();
1708 void trim_region_to_punch ();
1709 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1711 void trim_to_region(bool forward);
1712 void trim_region_to_previous_region_end();
1713 void trim_region_to_next_region_start();
1715 bool show_gain_after_trim;
1717 /* Drag-n-Drop */
1719 int convert_drop_to_paths (
1720 std::vector<std::string>& paths,
1721 const Glib::RefPtr<Gdk::DragContext>& context,
1722 gint x,
1723 gint y,
1724 const Gtk::SelectionData& data,
1725 guint info,
1726 guint time);
1728 void track_canvas_drag_data_received (
1729 const Glib::RefPtr<Gdk::DragContext>& context,
1730 gint x,
1731 gint y,
1732 const Gtk::SelectionData& data,
1733 guint info,
1734 guint time);
1736 void drop_paths (
1737 const Glib::RefPtr<Gdk::DragContext>& context,
1738 gint x,
1739 gint y,
1740 const Gtk::SelectionData& data,
1741 guint info,
1742 guint time);
1744 void drop_regions (
1745 const Glib::RefPtr<Gdk::DragContext>& context,
1746 gint x,
1747 gint y,
1748 const Gtk::SelectionData& data,
1749 guint info,
1750 guint time);
1752 void drop_routes (
1753 const Glib::RefPtr<Gdk::DragContext>& context,
1754 gint x,
1755 gint y,
1756 const Gtk::SelectionData& data,
1757 guint info,
1758 guint time);
1760 /* audio export */
1762 int write_region_selection(RegionSelection&);
1763 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1764 void bounce_region_selection (bool with_processing);
1765 void bounce_range_selection (bool replace, bool enable_processing);
1766 void external_edit_region ();
1768 int write_audio_selection (TimeSelection&);
1769 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1771 void write_selection ();
1773 XMLNode *before; /* used in *_reversible_command */
1775 void update_title ();
1776 void update_title_s (const std::string & snapshot_name);
1778 struct State {
1779 Selection* selection;
1780 double frames_per_unit;
1782 State (PublicEditor const * e);
1783 ~State ();
1786 void instant_save ();
1788 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1790 /* freeze operations */
1792 ARDOUR::InterThreadInfo freeze_status;
1793 static void* _freeze_thread (void*);
1794 void* freeze_thread ();
1796 void freeze_route ();
1797 void unfreeze_route ();
1799 /* duplication */
1801 void duplicate_dialog (bool with_dialog);
1803 framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
1805 /* returns false if mouse pointer is not in track or marker canvas
1807 bool mouse_frame (framepos_t&, bool& in_track_canvas) const;
1809 /* "whats mine is yours" */
1811 TimeFXDialog* current_timefx;
1813 static void* timefx_thread (void *arg);
1814 void do_timefx (TimeFXDialog&);
1816 int time_stretch (RegionSelection&, float fraction);
1817 int pitch_shift (RegionSelection&, float cents);
1818 void pitch_shift_region ();
1819 int time_fx (RegionSelection&, float val, bool pitching);
1821 void transpose_region ();
1823 /* editor-mixer strip */
1825 MixerStrip *current_mixer_strip;
1826 bool show_editor_mixer_when_tracks_arrive;
1827 Gtk::VBox current_mixer_strip_vbox;
1828 void cms_new (boost::shared_ptr<ARDOUR::Route>);
1829 void current_mixer_strip_hidden ();
1831 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1832 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1833 #ifdef GTKOSX
1834 void ensure_all_elements_drawn ();
1835 #endif
1836 /* nudging tracks */
1838 void nudge_track (bool use_edit_point, bool forwards);
1840 /* xfades */
1842 bool _xfade_visibility;
1844 #ifdef WITH_CMT
1845 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
1846 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
1848 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1849 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1851 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1852 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1853 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1855 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1856 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1857 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1858 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1860 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1861 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1862 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1863 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1865 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1866 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1867 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1868 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1869 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1870 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1872 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1873 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1874 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1875 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1876 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1877 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1879 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1880 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1882 ImageFrameSocketHandler* image_socket_listener ;
1883 #endif
1885 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
1886 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
1887 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
1888 void xfade_edit_left_region ();
1889 void xfade_edit_right_region ();
1891 static const int32_t default_width = 995;
1892 static const int32_t default_height = 765;
1894 /* nudge */
1896 Gtk::Button nudge_forward_button;
1897 Gtk::Button nudge_backward_button;
1898 Gtk::HBox nudge_hbox;
1899 Gtk::VBox nudge_vbox;
1900 AudioClock* nudge_clock;
1902 bool nudge_forward_release (GdkEventButton*);
1903 bool nudge_backward_release (GdkEventButton*);
1905 /* audio filters */
1907 void apply_filter (ARDOUR::Filter&, std::string cmd, ProgressReporter* progress = 0);
1909 Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
1910 void apply_midi_note_edit_op (ARDOUR::MidiOperator& op);
1912 /* handling cleanup */
1914 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
1916 PBD::ScopedConnectionList session_connections;
1918 /* tracking step changes of track height */
1920 TimeAxisView* current_stepping_trackview;
1921 ARDOUR::microseconds_t last_track_height_step_timestamp;
1922 gint track_height_step_timeout();
1923 sigc::connection step_timeout;
1925 TimeAxisView* entered_track;
1926 /** If the mouse is over a RegionView or one of its child canvas items, this is set up
1927 to point to the RegionView. Otherwise it is 0.
1929 RegionView* entered_regionview;
1932 void ensure_entered_track_selected (bool op_acts_on_objects = false);
1933 bool clear_entered_track;
1934 bool left_track_canvas (GdkEventCrossing*);
1935 bool entered_track_canvas (GdkEventCrossing*);
1936 void set_entered_track (TimeAxisView*);
1937 void set_entered_regionview (RegionView*);
1938 void ensure_track_visible (TimeAxisView*);
1939 gint left_automation_track ();
1941 void reset_canvas_action_sensitivity (bool);
1942 void toggle_gain_envelope_visibility ();
1943 void toggle_gain_envelope_active ();
1944 void reset_region_gain_envelopes ();
1946 bool on_key_press_event (GdkEventKey*);
1947 bool on_key_release_event (GdkEventKey*);
1949 void session_state_saved (std::string);
1951 Glib::RefPtr<Gtk::Action> undo_action;
1952 Glib::RefPtr<Gtk::Action> redo_action;
1954 void history_changed ();
1956 Gtk::HBox status_bar_hpacker;
1958 Editing::EditPoint _edit_point;
1960 Gtk::ComboBoxText edit_point_selector;
1962 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
1963 void cycle_edit_point (bool with_marker);
1964 void set_edit_point ();
1965 void edit_point_selection_done ();
1966 void edit_point_chosen (Editing::EditPoint);
1967 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
1968 std::vector<std::string> edit_point_strings;
1970 void selected_marker_moved (ARDOUR::Location*);
1972 bool get_edit_op_range (framepos_t& start, framepos_t& end) const;
1974 void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
1975 void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
1977 RegionSelection get_regions_from_selection ();
1978 RegionSelection get_regions_from_selection_and_edit_point ();
1979 RegionSelection get_regions_from_selection_and_entered ();
1981 void start_updating_meters ();
1982 void stop_updating_meters ();
1983 bool meters_running;
1985 void select_next_route ();
1986 void select_prev_route ();
1988 void snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
1989 void timecode_snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
1991 RhythmFerret* rhythm_ferret;
1993 void fit_tracks (TrackViewList &);
1994 void fit_selected_tracks ();
1995 void set_track_height (Height);
1997 void remove_tracks ();
1998 void toggle_tracks_active ();
2000 bool _have_idled;
2001 int resize_idle_id;
2002 static gboolean _idle_resize (gpointer);
2003 bool idle_resize();
2004 int32_t _pending_resize_amount;
2005 TimeAxisView* _pending_resize_view;
2007 void visible_order_range (int*, int*) const;
2009 void located ();
2011 /** true if we've made a locate request that hasn't yet been processed */
2012 bool _pending_locate_request;
2014 /** if true, there is a pending Session locate which is the initial one when loading a session;
2015 we need to know this so that we don't (necessarily) set the viewport to show the playhead
2016 initially.
2018 bool _pending_initial_locate;
2020 Gtk::HBox _summary_hbox;
2021 EditorSummary* _summary;
2023 void region_view_added (RegionView *);
2024 void region_view_removed ();
2026 void update_canvas_now ();
2028 EditorGroupTabs* _group_tabs;
2029 void fit_route_group (ARDOUR::RouteGroup *);
2031 void step_edit_status_change (bool);
2032 void start_step_editing ();
2033 void stop_step_editing ();
2034 bool check_step_edit ();
2035 sigc::connection step_edit_connection;
2037 double _last_motion_y;
2039 RegionLayeringOrderEditor* layering_order_editor;
2040 void update_region_layering_order_editor ();
2042 /** Track that was the source for the last cut/copy operation. Used as a place
2043 to paste things iff there is no selected track.
2045 TimeAxisView* _last_cut_copy_source_track;
2047 /** true if a change in Selection->regions should change the selection in the region list.
2048 See EditorRegions::selection_changed.
2050 bool _region_selection_change_updates_region_list;
2052 void setup_fade_images ();
2053 std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images;
2054 std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images;
2056 Gtk::MenuItem& action_menu_item (std::string const &);
2057 void action_pre_activated (Glib::RefPtr<Gtk::Action> const &);
2059 void set_canvas_cursor_for_region_view (double, RegionView *);
2061 MouseCursors* _cursors;
2063 void resize_text_widgets ();
2065 friend class Drag;
2066 friend class RegionDrag;
2067 friend class RegionMoveDrag;
2068 friend class RegionSpliceDrag;
2069 friend class TrimDrag;
2070 friend class MeterMarkerDrag;
2071 friend class TempoMarkerDrag;
2072 friend class CursorDrag;
2073 friend class FadeInDrag;
2074 friend class FadeOutDrag;
2075 friend class MarkerDrag;
2076 friend class RegionGainDrag;
2077 friend class ControlPointDrag;
2078 friend class LineDrag;
2079 friend class RubberbandSelectDrag;
2080 friend class TimeFXDrag;
2081 friend class ScrubDrag;
2082 friend class SelectionDrag;
2083 friend class RangeMarkerBarDrag;
2084 friend class MouseZoomDrag;
2085 friend class RegionCreateDrag;
2086 friend class RegionMotionDrag;
2087 friend class RegionInsertDrag;
2089 friend class EditorSummary;
2090 friend class EditorGroupTabs;
2092 friend class EditorRoutes;
2093 friend class RhythmFerret;
2096 #endif /* __ardour_editor_h__ */