Fix vertical pane resizing during fullscreen/unfullscreen
[ardour2.git] / gtk2_ardour / editor.h
blobfe3275611bdcf78442af5cfd935c5b2b16c55f4e
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 scroll_tracks_down_line ();
379 void scroll_tracks_up_line ();
381 void prepare_for_cleanup ();
382 void finish_cleanup ();
384 void maximise_editing_space();
385 void restore_editing_space();
387 void reset_x_origin (framepos_t);
388 void reset_x_origin_to_follow_playhead ();
389 void reset_y_origin (double);
390 void reset_zoom (double);
391 void reposition_and_zoom (framepos_t, double);
393 framepos_t get_preferred_edit_position (bool ignore_playhead = false);
395 bool update_mouse_speed ();
396 bool decelerate_mouse_speed ();
398 void toggle_meter_updating();
400 void show_rhythm_ferret();
402 void goto_visual_state (uint32_t);
403 void save_visual_state (uint32_t);
405 void queue_draw_resize_line (int at);
406 void start_resize_line_ops ();
407 void end_resize_line_ops ();
409 TrackViewList const & get_track_views () {
410 return track_views;
413 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region>);
415 void do_import (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t&);
416 void do_embed (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode, framepos_t&);
418 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
420 void center_screen (framepos_t);
422 TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
423 Gtkmm2ext::TearOff* mouse_mode_tearoff () const { return _mouse_mode_tearoff; }
424 Gtkmm2ext::TearOff* tools_tearoff () const { return _tools_tearoff; }
426 void snap_to (framepos_t& first, int32_t direction = 0, bool for_mark = false);
427 void snap_to_with_modifier (framepos_t& first, GdkEvent const *, int32_t direction = 0, bool for_mark = false);
428 void snap_to (framepos_t& first, framepos_t& last, int32_t direction = 0, bool for_mark = false);
430 void begin_reversible_command (std::string cmd_name);
431 void begin_reversible_command (GQuark);
432 void commit_reversible_command ();
434 DragManager* drags () const {
435 return _drags;
438 void maybe_autoscroll (bool, bool);
440 Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
441 void set_canvas_cursor (Gdk::Cursor*, bool save=false);
442 void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
443 void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
445 MouseCursors const * cursors () const {
446 return _cursors;
449 VerboseCursor* verbose_cursor () const {
450 return _verbose_cursor;
453 void get_pointer_position (double &, double &) const;
455 protected:
456 void map_transport_state ();
457 void map_position_change (framepos_t);
459 void on_realize();
461 private:
463 void color_handler ();
465 bool constructed;
467 // to keep track of the playhead position for control_scroll
468 boost::optional<framepos_t> _control_scroll_target;
470 PlaylistSelector* _playlist_selector;
472 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
474 struct VisualState {
475 VisualState();
476 ~VisualState ();
477 double y_position;
478 double frames_per_unit;
479 framepos_t leftmost_frame;
480 Editing::ZoomFocus zoom_focus;
481 GUIObjectState* gui_state;
484 std::list<VisualState*> undo_visual_stack;
485 std::list<VisualState*> redo_visual_stack;
486 VisualState* current_visual_state (bool with_tracks = true);
487 void undo_visual_state ();
488 void redo_visual_state ();
489 void use_visual_state (VisualState&);
490 bool no_save_visual;
491 void swap_visual_state ();
493 std::vector<VisualState*> visual_states;
494 sigc::connection visual_state_op_connection;
495 void start_visual_state_op (uint32_t n);
496 void cancel_visual_state_op (uint32_t n);
497 bool end_visual_state_op (uint32_t n);
499 framepos_t leftmost_frame;
500 double frames_per_unit;
501 Editing::ZoomFocus zoom_focus;
503 void set_frames_per_unit (double);
504 void post_zoom ();
506 Editing::MouseMode mouse_mode;
507 Editing::MouseMode pre_internal_mouse_mode;
508 bool _internal_editing;
509 Editing::MouseMode effective_mouse_mode () const;
511 enum JoinObjectRangeState {
512 JOIN_OBJECT_RANGE_NONE,
513 /** `join object/range' mode is active and the mouse is over a place where object mode should happen */
514 JOIN_OBJECT_RANGE_OBJECT,
515 /** `join object/range' mode is active and the mouse is over a place where range mode should happen */
516 JOIN_OBJECT_RANGE_RANGE
519 JoinObjectRangeState _join_object_range_state;
521 void update_join_object_range_location (double, double);
523 int post_maximal_editor_width;
524 int post_maximal_editor_height;
525 int post_maximal_horizontal_pane_position;
526 int post_maximal_vertical_pane_position;
527 int pre_maximal_horizontal_pane_position;
528 int pre_maximal_vertical_pane_position;
529 int pre_maximal_editor_width;
530 int pre_maximal_editor_height;
531 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
533 Gtk::Notebook _the_notebook;
534 bool _notebook_shrunk;
535 void add_notebook_page (std::string const &, Gtk::Widget &);
536 bool notebook_tab_clicked (GdkEventButton *, Gtk::Widget *);
538 Gtk::HPaned edit_pane;
539 Gtk::VPaned editor_summary_pane;
541 bool idle_reset_vertical_pane_position (int);
543 Gtk::EventBox meter_base;
544 Gtk::HBox meter_box;
545 Gtk::EventBox marker_base;
546 Gtk::HBox marker_box;
547 Gtk::VBox scrollers_rulers_markers_box;
549 void location_changed (ARDOUR::Location *);
550 void location_flags_changed (ARDOUR::Location *, void *);
551 void refresh_location_display ();
552 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
553 void add_new_location (ARDOUR::Location *);
554 ArdourCanvas::Group* add_new_location_internal (ARDOUR::Location *);
555 void location_gone (ARDOUR::Location *);
556 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
557 gint really_remove_marker (ARDOUR::Location* loc);
558 void goto_nth_marker (int nth);
559 void toggle_marker_lines ();
560 void set_marker_line_visibility (bool);
562 uint32_t location_marker_color;
563 uint32_t location_range_color;
564 uint32_t location_loop_color;
565 uint32_t location_punch_color;
566 uint32_t location_cd_marker_color;
568 struct LocationMarkers {
569 Marker* start;
570 Marker* end;
571 bool valid;
573 LocationMarkers () : start(0), end(0), valid (true) {}
575 ~LocationMarkers ();
577 void hide ();
578 void show ();
580 void set_show_lines (bool);
581 void set_selected (bool);
582 void canvas_height_set (double);
583 void setup_lines ();
585 void set_name (const std::string&);
586 void set_position (framepos_t start, framepos_t end = 0);
587 void set_color_rgba (uint32_t);
590 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
591 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
592 Marker* entered_marker;
593 bool _show_marker_lines;
595 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
596 LocationMarkerMap location_markers;
598 void update_marker_labels ();
599 void update_marker_labels (ArdourCanvas::Group *);
600 void check_marker_label (Marker *);
602 /** A set of lists of Markers that are in each of the canvas groups
603 * for the marker sections at the top of the editor. These lists
604 * are kept sorted in time order between marker movements, so that after
605 * a marker has moved we can decide whether we need to update the labels
606 * for all markers or for just a few.
608 std::map<ArdourCanvas::Group *, std::list<Marker *> > _sorted_marker_lists;
609 void remove_sorted_marker (Marker *);
611 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
612 void clear_marker_display ();
613 void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
614 bool choose_new_marker_name(std::string &name);
615 void update_cd_marker_display ();
616 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
618 TimeAxisView* clicked_axisview;
619 RouteTimeAxisView* clicked_routeview;
620 /** The last RegionView that was clicked on, or 0 if the last click was not
621 * on a RegionView. This is set up by the canvas event handlers in
622 * editor_canvas_events.cc
624 RegionView* clicked_regionview;
625 RegionSelection latest_regionviews;
626 uint32_t clicked_selection;
627 CrossfadeView* clicked_crossfadeview;
628 ControlPoint* clicked_control_point;
630 void sort_track_selection (TrackViewList* sel = 0);
632 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
633 RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
634 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
636 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
638 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector<RegionView*>*) const;
639 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
640 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
641 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
643 /* end */
645 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
646 bool button_release_can_deselect;
648 void catch_vanishing_regionview (RegionView *);
650 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
651 void select_all_tracks ();
652 void select_all_internal_edit (Selection::Operation);
654 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
655 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
656 void set_selected_track_as_side_effect (Selection::Operation op, bool force = false);
657 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
659 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
660 void collect_new_region_view (RegionView *);
661 void collect_and_select_new_region_view (RegionView *);
663 long select_range_around_region (RegionView *);
665 Gtk::Menu track_context_menu;
666 Gtk::Menu track_region_context_menu;
667 Gtk::Menu track_selection_context_menu;
668 Gtk::Menu track_crossfade_context_menu;
670 Gtk::MenuItem* region_edit_menu_split_item;
671 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
672 Gtk::Menu * track_region_edit_playlist_menu;
673 Gtk::Menu * track_edit_playlist_submenu;
674 Gtk::Menu * track_selection_edit_playlist_submenu;
676 void popup_track_context_menu (int, int, ItemType, bool);
677 Gtk::Menu* build_track_context_menu ();
678 Gtk::Menu* build_track_bus_context_menu ();
679 Gtk::Menu* build_track_region_context_menu ();
680 Gtk::Menu* build_track_crossfade_context_menu ();
681 Gtk::Menu* build_track_selection_context_menu ();
682 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
683 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
684 void add_region_context_items (Gtk::Menu_Helpers::MenuList&, boost::shared_ptr<ARDOUR::Track>);
685 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
686 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
687 Gtk::MenuItem* _popup_region_menu_item;
689 void handle_new_route (ARDOUR::RouteList&);
690 void timeaxisview_deleted (TimeAxisView *);
692 Gtk::HBox global_hpacker;
693 Gtk::VBox global_vpacker;
694 Gtk::VBox vpacker;
696 Gdk::Cursor* current_canvas_cursor;
697 Gdk::Cursor* which_grabber_cursor ();
698 void set_canvas_cursor ();
700 ArdourCanvas::Canvas* track_canvas;
702 friend class VerboseCursor;
703 VerboseCursor* _verbose_cursor;
705 void parameter_changed (std::string);
707 bool track_canvas_motion (GdkEvent*);
709 Gtk::EventBox time_canvas_event_box;
710 Gtk::EventBox track_canvas_event_box;
711 Gtk::EventBox time_button_event_box;
712 Gtk::EventBox ruler_label_event_box;
714 ArdourCanvas::Group *minsec_group;
715 ArdourCanvas::Pixbuf *logo_item;
716 ArdourCanvas::Group *bbt_group;
717 ArdourCanvas::Group *timecode_group;
718 ArdourCanvas::Group *frame_group;
719 ArdourCanvas::Group *tempo_group;
720 ArdourCanvas::Group *meter_group;
721 ArdourCanvas::Group *marker_group;
722 ArdourCanvas::Group *range_marker_group;
723 ArdourCanvas::Group *transport_marker_group;
724 ArdourCanvas::Group* cd_marker_group;
726 ArdourCanvas::Group* timebar_group;
728 /* These bars never need to be scrolled */
729 ArdourCanvas::Group* meter_bar_group;
730 ArdourCanvas::Group* tempo_bar_group;
731 ArdourCanvas::Group* marker_bar_group;
732 ArdourCanvas::Group* range_marker_bar_group;
733 ArdourCanvas::Group* transport_marker_bar_group;
734 ArdourCanvas::Group* cd_marker_bar_group;
736 /** The group containing all items that require horizontal scrolling. */
737 ArdourCanvas::Group* _background_group;
739 The _master_group is the group containing all items
740 that require horizontal scrolling..
741 It is primarily used to separate canvas items
742 that require horizontal scrolling from those that do not.
744 ArdourCanvas::Group* _master_group;
746 /* The group containing all trackviews. Only scrolled vertically. */
747 ArdourCanvas::Group* _trackview_group;
749 /* The group used for region motion. Sits on top of _trackview_group */
750 ArdourCanvas::Group* _region_motion_group;
752 enum RulerType {
753 ruler_metric_timecode = 0,
754 ruler_metric_bbt = 1,
755 ruler_metric_samples = 2,
756 ruler_metric_minsec = 3,
758 ruler_time_tempo = 4,
759 ruler_time_meter = 5,
760 ruler_time_marker = 6,
761 ruler_time_range_marker = 7,
762 ruler_time_transport_marker = 8,
763 ruler_time_cd_marker = 9,
766 static GtkCustomMetric ruler_metrics[4];
767 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
768 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
769 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
770 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
771 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
772 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
773 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
774 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
775 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
776 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
777 bool no_ruler_shown_update;
779 bool ruler_button_press (GdkEventButton*);
780 bool ruler_button_release (GdkEventButton*);
781 bool ruler_mouse_motion (GdkEventMotion*);
782 bool ruler_scroll (GdkEventScroll* event);
784 Gtk::Widget * ruler_grabbed_widget;
786 void initialize_rulers ();
787 void update_just_timecode ();
788 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
789 void update_fixed_rulers ();
790 void update_tempo_based_rulers ();
791 void popup_ruler_menu (framepos_t where = 0, ItemType type = RegionItem);
792 void update_ruler_visibility ();
793 void set_ruler_visible (RulerType, bool);
794 void toggle_ruler_visibility (RulerType rt);
795 void ruler_toggled (int);
796 bool ruler_label_button_release (GdkEventButton*);
797 void store_ruler_visibility ();
798 void restore_ruler_visibility ();
800 static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
801 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
802 static gint _metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
803 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
805 enum MinsecRulerScale {
806 minsec_show_seconds,
807 minsec_show_minutes,
808 minsec_show_hours,
809 minsec_show_frames
812 MinsecRulerScale minsec_ruler_scale;
814 framecnt_t minsec_mark_interval;
815 gint minsec_mark_modulo;
816 gint minsec_nmarks;
817 void set_minsec_ruler_scale (framepos_t, framepos_t);
819 enum TimecodeRulerScale {
820 timecode_show_bits,
821 timecode_show_frames,
822 timecode_show_seconds,
823 timecode_show_minutes,
824 timecode_show_hours
827 TimecodeRulerScale timecode_ruler_scale;
829 gint timecode_mark_modulo;
830 gint timecode_nmarks;
831 void set_timecode_ruler_scale (framepos_t, framepos_t);
833 framecnt_t _samples_ruler_interval;
834 void set_samples_ruler_scale (framepos_t, framepos_t);
836 enum BBTRulerScale {
837 bbt_over,
838 bbt_show_64,
839 bbt_show_16,
840 bbt_show_4,
841 bbt_show_1,
842 bbt_show_beats,
843 bbt_show_ticks,
844 bbt_show_ticks_detail,
845 bbt_show_ticks_super_detail
848 BBTRulerScale bbt_ruler_scale;
850 uint32_t bbt_bars;
851 gint bbt_nmarks;
852 uint32_t bbt_bar_helper_on;
853 uint32_t bbt_accent_modulo;
854 void compute_bbt_ruler_scale (framepos_t lower, framepos_t upper);
856 gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
857 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
858 gint metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
859 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
861 Gtk::Widget *_ruler_separator;
862 GtkWidget *_timecode_ruler;
863 GtkWidget *_bbt_ruler;
864 GtkWidget *_samples_ruler;
865 GtkWidget *_minsec_ruler;
866 Gtk::Widget *timecode_ruler;
867 Gtk::Widget *bbt_ruler;
868 Gtk::Widget *samples_ruler;
869 Gtk::Widget *minsec_ruler;
870 static Editor *ruler_editor;
872 static const double timebar_height;
873 guint32 visible_timebars;
874 gdouble canvas_timebars_vsize;
875 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
876 Gtk::Menu *editor_ruler_menu;
878 ArdourCanvas::SimpleRect* tempo_bar;
879 ArdourCanvas::SimpleRect* meter_bar;
880 ArdourCanvas::SimpleRect* marker_bar;
881 ArdourCanvas::SimpleRect* range_marker_bar;
882 ArdourCanvas::SimpleRect* transport_marker_bar;
883 ArdourCanvas::SimpleRect* cd_marker_bar;
885 Gtk::Label minsec_label;
886 Gtk::Label bbt_label;
887 Gtk::Label timecode_label;
888 Gtk::Label samples_label;
889 Gtk::Label tempo_label;
890 Gtk::Label meter_label;
891 Gtk::Label mark_label;
892 Gtk::Label range_mark_label;
893 Gtk::Label transport_mark_label;
894 Gtk::Label cd_mark_label;
896 Gtk::VBox time_button_vbox;
897 Gtk::HBox time_button_hbox;
899 friend class EditorCursor;
901 EditorCursor* playhead_cursor;
902 ArdourCanvas::Group* cursor_group;
904 framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
906 void cursor_to_region_boundary (bool with_selection, int32_t dir);
907 void cursor_to_next_region_boundary (bool with_selection);
908 void cursor_to_previous_region_boundary (bool with_selection);
909 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
910 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
911 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
912 void cursor_to_selection_start (EditorCursor *);
913 void cursor_to_selection_end (EditorCursor *);
915 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
916 void selected_marker_to_next_region_boundary (bool with_selection);
917 void selected_marker_to_previous_region_boundary (bool with_selection);
918 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
919 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
920 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
921 void selected_marker_to_selection_start ();
922 void selected_marker_to_selection_end ();
924 void select_all_selectables_using_cursor (EditorCursor *, bool);
925 void select_all_selectables_using_edit (bool);
926 void select_all_selectables_between (bool within);
927 void select_range_between ();
929 boost::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::framepos_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
930 ARDOUR::framepos_t find_next_region_boundary (ARDOUR::framepos_t, int32_t dir, const TrackViewList&);
932 std::vector<ARDOUR::framepos_t> region_boundary_cache;
933 void build_region_boundary_cache ();
935 Gtk::HBox top_hbox;
936 Gtk::HBox bottom_hbox;
938 Gtk::Table edit_packer;
940 Gtk::Adjustment vertical_adjustment;
942 Gtk::Layout controls_layout;
943 bool control_layout_scroll (GdkEventScroll* ev);
944 void reset_controls_layout_width ();
945 void reset_controls_layout_height (int32_t height);
947 enum Direction {
948 LEFT,
949 RIGHT,
951 DOWN
954 bool scroll_press (Direction);
955 void scroll_release ();
956 sigc::connection _scroll_connection;
957 int _scroll_callbacks;
959 double _canvas_width;
960 double _canvas_height; ///< height of the visible area of the track canvas
961 double full_canvas_height; ///< full height of the canvas
963 bool track_canvas_map_handler (GdkEventAny*);
965 bool edit_controls_button_release (GdkEventButton*);
966 Gtk::Menu *edit_controls_left_menu;
967 Gtk::Menu *edit_controls_right_menu;
969 Gtk::VBox ruler_label_vbox;
970 Gtk::VBox track_canvas_vbox;
971 Gtk::VBox time_canvas_vbox;
972 Gtk::VBox edit_controls_vbox;
973 Gtk::HBox edit_controls_hbox;
975 void control_scroll (float);
976 void access_action (std::string,std::string);
977 bool deferred_control_scroll (framepos_t);
978 sigc::connection control_scroll_connection;
980 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
982 ArdourCanvas::Group* get_background_group () const { return _background_group; }
983 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
984 double last_trackview_group_vertical_offset;
985 void tie_vertical_scrolling ();
986 void set_horizontal_position (double);
987 double horizontal_position () const;
988 void scroll_canvas_vertically ();
990 struct VisualChange {
991 enum Type {
992 TimeOrigin = 0x1,
993 ZoomLevel = 0x2,
994 YOrigin = 0x4
997 Type pending;
998 framepos_t time_origin;
999 double frames_per_unit;
1000 double y_origin;
1002 int idle_handler_id;
1004 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
1005 void add (Type t) {
1006 pending = Type (pending | t);
1011 VisualChange pending_visual_change;
1013 static int _idle_visual_changer (void *arg);
1014 int idle_visual_changer ();
1016 void queue_visual_change (framepos_t);
1017 void queue_visual_change (double);
1018 void queue_visual_change_y (double);
1019 void ensure_visual_change_idle_handler ();
1021 /* track views */
1022 TrackViewList track_views;
1023 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1024 TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const;
1026 TrackViewList get_tracks_for_range_action () const;
1028 sigc::connection super_rapid_screen_update_connection;
1029 framepos_t last_update_frame;
1030 void center_screen_internal (framepos_t, float);
1032 void super_rapid_screen_update ();
1034 void session_going_away ();
1036 framepos_t cut_buffer_start;
1037 framecnt_t cut_buffer_length;
1039 Gdk::Cursor* pre_press_cursor;
1040 boost::weak_ptr<ARDOUR::Trimmable> _trimmable;
1041 boost::weak_ptr<ARDOUR::Movable> _movable;
1043 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1044 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1045 bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1046 bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
1047 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1048 bool button_press_dispatch (GdkEventButton*);
1049 bool button_release_dispatch (GdkEventButton*);
1050 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1051 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1052 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1054 Gtkmm2ext::Bindings* button_bindings;
1055 XMLNode* button_settings () const;
1057 /* KEYMAP HANDLING */
1059 void register_actions ();
1060 void register_region_actions ();
1062 int ensure_cursor (framepos_t* pos);
1064 void cut_copy (Editing::CutCopyOp);
1065 bool can_cut_copy () const;
1066 void cut_copy_points (Editing::CutCopyOp);
1067 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1068 void cut_copy_ranges (Editing::CutCopyOp);
1069 void cut_copy_midi (Editing::CutCopyOp);
1071 void mouse_paste ();
1072 void paste_internal (framepos_t position, float times);
1074 /* EDITING OPERATIONS */
1076 void reset_point_selection ();
1077 void toggle_region_lock ();
1078 void toggle_opaque_region ();
1079 void toggle_record_enable ();
1080 void toggle_region_lock_style ();
1081 void raise_region ();
1082 void raise_region_to_top ();
1083 void change_region_layering_order ();
1084 void lower_region ();
1085 void lower_region_to_bottom ();
1086 void split_regions_at (framepos_t, RegionSelection&);
1087 void split_region_at_transients ();
1088 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
1089 void crop_region_to_selection ();
1090 void crop_region_to (framepos_t start, framepos_t end);
1091 void set_sync_point (framepos_t, const RegionSelection&);
1092 void set_region_sync_position ();
1093 void remove_region_sync();
1094 void align_regions (ARDOUR::RegionPoint);
1095 void align_regions_relative (ARDOUR::RegionPoint point);
1096 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
1097 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, framepos_t position);
1098 void remove_selected_regions ();
1099 void remove_clicked_region ();
1100 void show_region_properties ();
1101 void show_midi_list_editor ();
1102 void rename_region ();
1103 void duplicate_some_regions (RegionSelection&, float times);
1104 void duplicate_selection (float times);
1105 void region_fill_selection ();
1106 void combine_regions ();
1107 void uncombine_regions ();
1109 void region_fill_track ();
1110 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1111 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1112 void split_multichannel_region();
1113 void reverse_region ();
1114 void strip_region_silence ();
1115 void normalize_region ();
1116 void reset_region_scale_amplitude ();
1117 void adjust_region_gain (bool up);
1118 void quantize_region ();
1119 void insert_patch_change ();
1120 void fork_region ();
1122 void do_insert_time ();
1123 void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool);
1125 void tab_to_transient (bool forward);
1127 void set_tempo_from_region ();
1128 void use_range_as_bar ();
1130 void define_one_bar (framepos_t start, framepos_t end);
1132 void audition_region_from_region_list ();
1133 void hide_region_from_region_list ();
1134 void show_region_in_region_list ();
1136 void naturalize_region ();
1138 void reset_focus ();
1140 void split_region ();
1142 void delete_ ();
1143 void cut ();
1144 void copy ();
1145 void paste (float times);
1147 void place_transient ();
1148 void remove_transient (ArdourCanvas::Item* item);
1149 void snap_regions_to_grid ();
1150 void close_region_gaps ();
1152 void keyboard_paste ();
1154 void region_from_selection ();
1155 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1157 void play_from_start ();
1158 void play_from_edit_point ();
1159 void play_from_edit_point_and_return ();
1160 void play_selected_region ();
1161 void play_edit_range ();
1162 void play_location (ARDOUR::Location&);
1163 void loop_location (ARDOUR::Location&);
1165 void temporal_zoom_selection ();
1166 void temporal_zoom_region (bool both_axes);
1167 void zoom_to_region (bool both_axes);
1168 void temporal_zoom_session ();
1169 void temporal_zoom (gdouble scale);
1170 void temporal_zoom_by_frame (framepos_t start, framepos_t end, const std::string & op);
1171 void temporal_zoom_to_frame (bool coarser, framepos_t frame);
1173 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1174 void insert_region_list_selection (float times);
1176 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1178 /* import & embed */
1180 void add_external_audio_action (Editing::ImportMode);
1181 void external_audio_dialog ();
1182 void session_import_dialog ();
1184 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1185 bool check_multichannel_status (const std::vector<std::string>& paths);
1187 SoundFileOmega* sfbrowser;
1189 void bring_in_external_audio (Editing::ImportMode mode, framepos_t& pos);
1191 bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos);
1192 void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos);
1194 int import_sndfiles (std::vector<std::string> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t& pos,
1195 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
1196 int embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1197 framepos_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1199 int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, framepos_t& pos, Editing::ImportMode,
1200 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1201 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, framepos_t& pos, Editing::ImportMode mode,
1202 boost::shared_ptr<ARDOUR::Track>& existing_track);
1204 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1205 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1207 ARDOUR::InterThreadInfo* current_interthread_info;
1209 AnalysisWindow* analysis_window;
1211 /* import specific info */
1213 struct EditorImportStatus : public ARDOUR::ImportStatus {
1214 Editing::ImportMode mode;
1215 framepos_t pos;
1216 int target_tracks;
1217 int target_regions;
1218 boost::shared_ptr<ARDOUR::Track> track;
1219 bool replace;
1222 EditorImportStatus import_status;
1223 static void *_import_thread (void *);
1224 void* import_thread ();
1225 void finish_import ();
1227 /* to support this ... */
1229 void import_audio (bool as_tracks);
1230 void do_import (std::vector<std::string> paths, bool split, bool as_tracks);
1232 void move_to_start ();
1233 void move_to_end ();
1234 void center_playhead ();
1235 void center_edit_point ();
1236 void playhead_forward_to_grid ();
1237 void playhead_backward_to_grid ();
1238 void scroll_playhead (bool forward);
1239 void scroll_backward (float pages=0.8f);
1240 void scroll_forward (float pages=0.8f);
1241 void scroll_tracks_down ();
1242 void scroll_tracks_up ();
1243 void set_mark ();
1244 void clear_markers ();
1245 void clear_ranges ();
1246 void clear_locations ();
1247 void unhide_markers ();
1248 void unhide_ranges ();
1249 void jump_forward_to_mark ();
1250 void jump_backward_to_mark ();
1251 void cursor_align (bool playhead_to_edit);
1253 void remove_last_capture ();
1254 void select_all_selectables_using_time_selection ();
1255 void select_all_selectables_using_loop();
1256 void select_all_selectables_using_punch();
1257 void set_selection_from_range (ARDOUR::Location&);
1258 void set_selection_from_punch ();
1259 void set_selection_from_loop ();
1260 void set_selection_from_region ();
1262 void add_location_mark (framepos_t where);
1263 void add_location_from_region ();
1264 void add_locations_from_region ();
1265 void add_location_from_selection ();
1266 void set_loop_from_selection (bool play);
1267 void set_punch_from_selection ();
1268 void set_punch_from_region ();
1270 void set_loop_from_edit_range (bool play);
1271 void set_loop_from_region (bool play);
1272 void set_punch_from_edit_range ();
1274 void set_loop_range (framepos_t start, framepos_t end, std::string cmd);
1275 void set_punch_range (framepos_t start, framepos_t end, std::string cmd);
1277 void add_location_from_playhead_cursor ();
1278 bool select_new_marker;
1280 void reverse_selection ();
1281 void edit_envelope ();
1283 double last_scrub_x;
1284 int scrubbing_direction;
1285 int scrub_reversals;
1286 int scrub_reverse_distance;
1287 void scrub (framepos_t, double);
1289 void keyboard_selection_begin ();
1290 void keyboard_selection_finish (bool add);
1291 bool have_pending_keyboard_selection;
1292 framepos_t pending_keyboard_selection_start;
1294 void move_range_selection_start_or_end_to_region_boundary (bool, bool);
1296 Editing::SnapType _snap_type;
1297 Editing::SnapMode _snap_mode;
1299 /// Snap threshold in pixels
1300 double snap_threshold;
1302 bool ignore_gui_changes;
1304 DragManager* _drags;
1306 void escape ();
1308 Gtk::Menu fade_context_menu;
1309 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1311 void set_fade_in_shape (ARDOUR::FadeShape);
1312 void set_fade_out_shape (ARDOUR::FadeShape);
1314 void set_fade_length (bool in);
1315 void set_fade_in_active (bool);
1316 void set_fade_out_active (bool);
1318 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1320 bool _dragging_playhead;
1321 bool _dragging_edit_point;
1323 void marker_drag_motion_callback (GdkEvent*);
1324 void marker_drag_finished_callback (GdkEvent*);
1326 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1328 void add_region_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1329 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1330 void add_region_copy_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1331 void add_region_brush_drag (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1332 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1334 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1336 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1337 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1339 void mouse_brush_insert_region (RegionView*, framepos_t pos);
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*);
1353 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1354 bool canvas_frame_handle_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1355 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1356 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1357 bool canvas_feature_line_event (GdkEvent* event, ArdourCanvas::Item*, RegionView*);
1358 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1359 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1360 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1361 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1362 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1363 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1364 bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*);
1366 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1367 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1368 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1369 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1370 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1371 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1373 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1374 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1375 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1376 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1377 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1378 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1379 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1380 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1382 PBD::Signal0<void> EditorFreeze;
1383 PBD::Signal0<void> EditorThaw;
1385 private:
1386 friend class DragManager;
1387 friend class EditorRouteGroups;
1388 friend class EditorRegions;
1390 ArdourCanvas::Item *last_item_entered;
1391 /** true if the mouse is over a place where region trim can happen */
1392 bool _over_region_trim_target;
1394 /* non-public event handlers */
1396 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1397 bool track_canvas_scroll (GdkEventScroll* event);
1399 bool track_canvas_scroll_event (GdkEventScroll* event);
1400 bool track_canvas_button_press_event (GdkEventButton* event);
1401 bool track_canvas_button_release_event (GdkEventButton* event);
1402 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1404 Gtk::Allocation canvas_allocation;
1405 void track_canvas_allocate (Gtk::Allocation alloc);
1406 bool track_canvas_size_allocated ();
1407 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1408 bool track_canvas_key_press (GdkEventKey *);
1409 bool track_canvas_key_release (GdkEventKey *);
1411 void set_playhead_cursor ();
1413 void toggle_region_mute ();
1415 void initialize_canvas ();
1417 /* display control */
1419 bool _show_measures;
1420 /// true if the editor should follow the playhead, otherwise false
1421 bool _follow_playhead;
1422 /// true if we scroll the tracks rather than the playhead
1423 bool _stationary_playhead;
1425 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1427 TempoLines* tempo_lines;
1429 ArdourCanvas::Group* time_line_group;
1431 void hide_measures ();
1432 void draw_measures ();
1433 bool redraw_measures ();
1435 void new_tempo_section ();
1437 void mouse_add_new_tempo_event (framepos_t where);
1438 void mouse_add_new_meter_event (framepos_t where);
1440 void remove_tempo_marker (ArdourCanvas::Item*);
1441 void remove_meter_marker (ArdourCanvas::Item*);
1442 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1443 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1445 void edit_tempo_section (ARDOUR::TempoSection*);
1446 void edit_meter_section (ARDOUR::MeterSection*);
1447 void edit_tempo_marker (ArdourCanvas::Item*);
1448 void edit_meter_marker (ArdourCanvas::Item*);
1449 void edit_control_point (ArdourCanvas::Item*);
1450 void edit_note (ArdourCanvas::Item *);
1452 void marker_menu_edit ();
1453 void marker_menu_remove ();
1454 void marker_menu_rename ();
1455 void toggle_marker_menu_lock ();
1456 void toggle_marker_menu_glue ();
1457 void marker_menu_hide ();
1458 void marker_menu_loop_range ();
1459 void marker_menu_select_all_selectables_using_range ();
1460 void marker_menu_select_using_range ();
1461 void marker_menu_separate_regions_using_location ();
1462 void marker_menu_play_from ();
1463 void marker_menu_play_range ();
1464 void marker_menu_set_playhead ();
1465 void marker_menu_set_from_playhead ();
1466 void marker_menu_set_from_selection ();
1467 void marker_menu_range_to_next ();
1468 void new_transport_marker_menu_set_loop ();
1469 void new_transport_marker_menu_set_punch ();
1470 void update_loop_range_view (bool visibility=false);
1471 void update_punch_range_view (bool visibility=false);
1472 void new_transport_marker_menu_popdown ();
1473 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1474 void tempo_or_meter_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1475 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1476 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1477 void build_range_marker_menu (bool);
1478 void build_marker_menu (ARDOUR::Location *);
1479 void build_tempo_or_meter_marker_menu (bool);
1480 void build_new_transport_marker_menu ();
1481 void dynamic_cast_marker_object (void*, MeterMarker**, TempoMarker**) const;
1483 Gtk::Menu* tempo_or_meter_marker_menu;
1484 Gtk::Menu* marker_menu;
1485 Gtk::Menu* range_marker_menu;
1486 Gtk::Menu* transport_marker_menu;
1487 Gtk::Menu* new_transport_marker_menu;
1488 Gtk::Menu* cd_marker_menu;
1489 ArdourCanvas::Item* marker_menu_item;
1491 typedef std::list<Marker*> Marks;
1492 Marks metric_marks;
1494 void remove_metric_marks ();
1495 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1497 void compute_current_bbt_points (framepos_t left, framepos_t right);
1498 void tempo_map_changed (const PBD::PropertyChange&);
1499 void redisplay_tempo (bool immediate_redraw);
1501 uint32_t bbt_beat_subdivision;
1503 /* toolbar */
1505 Gtk::ToggleButton editor_mixer_button;
1506 Gtk::ToggleButton editor_list_button;
1507 void editor_mixer_button_toggled ();
1508 void editor_list_button_toggled ();
1510 AudioClock* zoom_range_clock;
1511 Gtk::Button zoom_in_button;
1512 Gtk::Button zoom_out_button;
1513 Gtk::Button zoom_out_full_button;
1514 Gtk::Button zoom_onetoone_button;
1516 Gtk::Button tav_expand_button;
1517 Gtk::Button tav_shrink_button;
1519 Gtk::VBox toolbar_clock_vbox;
1520 Gtk::VBox toolbar_selection_clock_vbox;
1521 Gtk::Table toolbar_selection_clock_table;
1522 Gtk::Label toolbar_selection_cursor_label;
1524 Gtkmm2ext::TearOff* _mouse_mode_tearoff;
1525 Gtkmm2ext::StatefulToggleButton mouse_select_button;
1526 Gtkmm2ext::StatefulToggleButton mouse_move_button;
1527 Gtkmm2ext::StatefulToggleButton mouse_gain_button;
1528 Gtkmm2ext::StatefulToggleButton mouse_zoom_button;
1529 Gtkmm2ext::StatefulToggleButton mouse_timefx_button;
1530 Gtkmm2ext::StatefulToggleButton mouse_audition_button;
1531 Gtkmm2ext::StatefulToggleButton join_object_range_button;
1533 void mouse_mode_toggled (Editing::MouseMode m);
1534 void mouse_mode_object_range_toggled () {}
1535 bool ignore_mouse_mode_toggle;
1537 Gtkmm2ext::StatefulToggleButton internal_edit_button;
1538 void toggle_internal_editing ();
1540 bool mouse_select_button_release (GdkEventButton*);
1542 Gtk::VBox automation_box;
1543 Gtk::Button automation_mode_button;
1544 Gtk::ToggleButton global_automation_button;
1546 Gtk::ComboBoxText edit_mode_selector;
1547 Gtk::VBox edit_mode_box;
1548 std::vector<std::string> edit_mode_strings;
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 Gtkmm2ext::TearOff* _zoom_tearoff;
1581 void zoom_adjustment_changed();
1583 void setup_toolbar ();
1585 void setup_tooltips ();
1587 Gtkmm2ext::TearOff* _tools_tearoff;
1588 Gtk::HBox toolbar_hbox;
1589 Gtk::EventBox toolbar_base;
1590 Gtk::Frame toolbar_frame;
1591 Gtk::Viewport _toolbar_viewport;
1593 /* midi toolbar */
1595 Gtk::HBox panic_box;
1596 Gtk::Button midi_panic_button;
1597 Gtk::ToggleButton midi_sound_notes;
1598 void midi_panic ();
1599 bool sound_notes () const { return midi_sound_notes.get_active(); }
1601 void setup_midi_toolbar ();
1603 /* selection process */
1605 Selection* selection;
1606 Selection* cut_buffer;
1608 void time_selection_changed ();
1609 void track_selection_changed ();
1610 void region_selection_changed ();
1611 sigc::connection editor_regions_selection_changed_connection;
1612 void sensitize_all_region_actions (bool);
1613 void sensitize_the_right_region_actions ();
1614 bool _all_region_actions_sensitized;
1615 /** Flag to block region action handlers from doing what they normally do;
1616 * I tried Gtk::Action::block_activate() but this doesn't work (ie it doesn't
1617 * block) when setting a ToggleAction's active state.
1619 bool _ignore_region_action;
1620 bool _last_region_menu_was_main;
1621 void point_selection_changed ();
1622 void marker_selection_changed ();
1624 void cancel_selection ();
1626 bool audio_region_selection_covers (framepos_t where);
1628 /* transport range select process */
1630 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1631 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1632 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1634 #ifdef GTKOSX
1635 ArdourCanvas::SimpleRect *bogus_background_rect;
1636 #endif
1637 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1638 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1639 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1640 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1641 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1642 ArdourCanvas::SimpleLine *transport_punchin_line;
1643 ArdourCanvas::SimpleLine *transport_punchout_line;
1644 ArdourCanvas::SimpleRect *transport_preroll_rect;
1645 ArdourCanvas::SimpleRect *transport_postroll_rect;
1647 ARDOUR::Location* transport_loop_location();
1648 ARDOUR::Location* transport_punch_location();
1650 ARDOUR::Location *temp_location;
1652 /* object rubberband select process */
1654 void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
1656 ArdourCanvas::SimpleRect *rubberband_rect;
1658 /* mouse zoom process */
1660 ArdourCanvas::SimpleRect *zoom_rect;
1661 void reposition_zoom_rect (framepos_t start, framepos_t end);
1663 EditorRouteGroups* _route_groups;
1664 EditorRoutes* _routes;
1665 EditorRegions* _regions;
1666 EditorSnapshots* _snapshots;
1667 EditorLocations* _locations;
1669 /* diskstream/route display management */
1670 Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
1671 Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
1673 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1675 bool sync_track_view_list_and_routes ();
1677 Gtk::VBox list_vpacker;
1679 /* autoscrolling */
1681 bool autoscroll_active;
1682 int autoscroll_timeout_tag;
1683 int autoscroll_x;
1684 int autoscroll_y;
1685 int last_autoscroll_x;
1686 int last_autoscroll_y;
1687 uint32_t autoscroll_cnt;
1688 framecnt_t autoscroll_x_distance;
1689 double autoscroll_y_distance;
1691 static gint _autoscroll_canvas (void *);
1692 bool autoscroll_canvas ();
1693 void start_canvas_autoscroll (int x, int y);
1694 void stop_canvas_autoscroll ();
1696 /* trimming */
1697 void point_trim (GdkEvent *, framepos_t);
1699 void trim_region_front();
1700 void trim_region_back();
1701 void trim_region (bool front);
1703 void trim_region_to_loop ();
1704 void trim_region_to_punch ();
1705 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1707 void trim_to_region(bool forward);
1708 void trim_region_to_previous_region_end();
1709 void trim_region_to_next_region_start();
1711 bool show_gain_after_trim;
1713 /* Drag-n-Drop */
1715 int convert_drop_to_paths (
1716 std::vector<std::string>& paths,
1717 const Glib::RefPtr<Gdk::DragContext>& context,
1718 gint x,
1719 gint y,
1720 const Gtk::SelectionData& data,
1721 guint info,
1722 guint time);
1724 void track_canvas_drag_data_received (
1725 const Glib::RefPtr<Gdk::DragContext>& context,
1726 gint x,
1727 gint y,
1728 const Gtk::SelectionData& data,
1729 guint info,
1730 guint time);
1732 void drop_paths (
1733 const Glib::RefPtr<Gdk::DragContext>& context,
1734 gint x,
1735 gint y,
1736 const Gtk::SelectionData& data,
1737 guint info,
1738 guint time);
1740 void drop_regions (
1741 const Glib::RefPtr<Gdk::DragContext>& context,
1742 gint x,
1743 gint y,
1744 const Gtk::SelectionData& data,
1745 guint info,
1746 guint time);
1748 void drop_routes (
1749 const Glib::RefPtr<Gdk::DragContext>& context,
1750 gint x,
1751 gint y,
1752 const Gtk::SelectionData& data,
1753 guint info,
1754 guint time);
1756 /* audio export */
1758 int write_region_selection(RegionSelection&);
1759 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1760 void bounce_region_selection (bool with_processing);
1761 void bounce_range_selection (bool replace, bool enable_processing);
1762 void external_edit_region ();
1764 int write_audio_selection (TimeSelection&);
1765 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
1767 void write_selection ();
1769 XMLNode *before; /* used in *_reversible_command */
1771 void update_title ();
1772 void update_title_s (const std::string & snapshot_name);
1774 struct State {
1775 Selection* selection;
1776 double frames_per_unit;
1778 State (PublicEditor const * e);
1779 ~State ();
1782 void instant_save ();
1784 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1786 /* freeze operations */
1788 ARDOUR::InterThreadInfo freeze_status;
1789 static void* _freeze_thread (void*);
1790 void* freeze_thread ();
1792 void freeze_route ();
1793 void unfreeze_route ();
1795 /* duplication */
1797 void duplicate_dialog (bool with_dialog);
1799 framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
1801 /* returns false if mouse pointer is not in track or marker canvas
1803 bool mouse_frame (framepos_t&, bool& in_track_canvas) const;
1805 /* "whats mine is yours" */
1807 TimeFXDialog* current_timefx;
1809 static void* timefx_thread (void *arg);
1810 void do_timefx (TimeFXDialog&);
1812 int time_stretch (RegionSelection&, float fraction);
1813 int pitch_shift (RegionSelection&, float cents);
1814 void pitch_shift_region ();
1815 int time_fx (RegionSelection&, float val, bool pitching);
1817 void transpose_region ();
1819 /* editor-mixer strip */
1821 MixerStrip *current_mixer_strip;
1822 bool show_editor_mixer_when_tracks_arrive;
1823 Gtk::VBox current_mixer_strip_vbox;
1824 void cms_new (boost::shared_ptr<ARDOUR::Route>);
1825 void current_mixer_strip_hidden ();
1827 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1828 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1829 #ifdef GTKOSX
1830 void ensure_all_elements_drawn ();
1831 #endif
1832 /* nudging tracks */
1834 void nudge_track (bool use_edit_point, bool forwards);
1836 /* xfades */
1838 bool _xfade_visibility;
1840 #ifdef WITH_CMT
1841 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
1842 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
1844 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1845 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1847 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1848 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1849 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1851 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1852 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1853 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1854 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1856 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1857 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1858 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1859 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1861 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1862 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1863 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1864 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1865 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1866 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1868 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1869 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1870 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1871 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1872 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1873 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1875 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1876 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1878 ImageFrameSocketHandler* image_socket_listener ;
1879 #endif
1881 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
1882 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
1883 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
1884 void xfade_edit_left_region ();
1885 void xfade_edit_right_region ();
1887 static const int32_t default_width = 995;
1888 static const int32_t default_height = 765;
1890 /* nudge */
1892 Gtk::Button nudge_forward_button;
1893 Gtk::Button nudge_backward_button;
1894 Gtk::HBox nudge_hbox;
1895 Gtk::VBox nudge_vbox;
1896 AudioClock* nudge_clock;
1898 bool nudge_forward_release (GdkEventButton*);
1899 bool nudge_backward_release (GdkEventButton*);
1901 /* audio filters */
1903 void apply_filter (ARDOUR::Filter&, std::string cmd, ProgressReporter* progress = 0);
1905 Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
1906 void apply_midi_note_edit_op (ARDOUR::MidiOperator& op);
1908 /* handling cleanup */
1910 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
1912 PBD::ScopedConnectionList session_connections;
1914 /* tracking step changes of track height */
1916 TimeAxisView* current_stepping_trackview;
1917 ARDOUR::microseconds_t last_track_height_step_timestamp;
1918 gint track_height_step_timeout();
1919 sigc::connection step_timeout;
1921 TimeAxisView* entered_track;
1922 /** If the mouse is over a RegionView or one of its child canvas items, this is set up
1923 to point to the RegionView. Otherwise it is 0.
1925 RegionView* entered_regionview;
1928 void ensure_entered_track_selected (bool op_acts_on_objects = false);
1929 bool clear_entered_track;
1930 bool left_track_canvas (GdkEventCrossing*);
1931 bool entered_track_canvas (GdkEventCrossing*);
1932 void set_entered_track (TimeAxisView*);
1933 void set_entered_regionview (RegionView*);
1934 void ensure_track_visible (TimeAxisView*);
1935 gint left_automation_track ();
1937 void reset_canvas_action_sensitivity (bool);
1938 void toggle_gain_envelope_visibility ();
1939 void toggle_gain_envelope_active ();
1940 void reset_region_gain_envelopes ();
1942 bool on_key_press_event (GdkEventKey*);
1943 bool on_key_release_event (GdkEventKey*);
1945 void session_state_saved (std::string);
1947 Glib::RefPtr<Gtk::Action> undo_action;
1948 Glib::RefPtr<Gtk::Action> redo_action;
1950 void history_changed ();
1952 Gtk::HBox status_bar_hpacker;
1954 Editing::EditPoint _edit_point;
1956 Gtk::ComboBoxText edit_point_selector;
1958 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
1959 void cycle_edit_point (bool with_marker);
1960 void set_edit_point ();
1961 void edit_point_selection_done ();
1962 void edit_point_chosen (Editing::EditPoint);
1963 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
1964 std::vector<std::string> edit_point_strings;
1966 void selected_marker_moved (ARDOUR::Location*);
1968 bool get_edit_op_range (framepos_t& start, framepos_t& end) const;
1970 void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
1971 void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
1973 RegionSelection get_regions_from_selection ();
1974 RegionSelection get_regions_from_selection_and_edit_point ();
1975 RegionSelection get_regions_from_selection_and_entered ();
1977 void start_updating_meters ();
1978 void stop_updating_meters ();
1979 bool meters_running;
1981 void select_next_route ();
1982 void select_prev_route ();
1984 void snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
1985 void timecode_snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
1987 RhythmFerret* rhythm_ferret;
1989 void fit_tracks (TrackViewList &);
1990 void fit_selected_tracks ();
1991 void set_track_height (Height);
1993 void remove_tracks ();
1994 void toggle_tracks_active ();
1996 bool _have_idled;
1997 int resize_idle_id;
1998 static gboolean _idle_resize (gpointer);
1999 bool idle_resize();
2000 int32_t _pending_resize_amount;
2001 TimeAxisView* _pending_resize_view;
2003 void visible_order_range (int*, int*) const;
2005 void located ();
2007 /** true if we've made a locate request that hasn't yet been processed */
2008 bool _pending_locate_request;
2010 /** if true, there is a pending Session locate which is the initial one when loading a session;
2011 we need to know this so that we don't (necessarily) set the viewport to show the playhead
2012 initially.
2014 bool _pending_initial_locate;
2016 Gtk::HBox _summary_hbox;
2017 EditorSummary* _summary;
2019 void region_view_added (RegionView *);
2020 void region_view_removed ();
2022 void update_canvas_now ();
2024 EditorGroupTabs* _group_tabs;
2025 void fit_route_group (ARDOUR::RouteGroup *);
2027 void step_edit_status_change (bool);
2028 void start_step_editing ();
2029 void stop_step_editing ();
2030 bool check_step_edit ();
2031 sigc::connection step_edit_connection;
2033 double _last_motion_y;
2035 RegionLayeringOrderEditor* layering_order_editor;
2036 void update_region_layering_order_editor ();
2038 /** Track that was the source for the last cut/copy operation. Used as a place
2039 to paste things iff there is no selected track.
2041 TimeAxisView* _last_cut_copy_source_track;
2043 /** true if a change in Selection->regions should change the selection in the region list.
2044 See EditorRegions::selection_changed.
2046 bool _region_selection_change_updates_region_list;
2048 void setup_fade_images ();
2049 std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images;
2050 std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images;
2052 Gtk::MenuItem& action_menu_item (std::string const &);
2053 void action_pre_activated (Glib::RefPtr<Gtk::Action> const &);
2055 void set_canvas_cursor_for_region_view (double, RegionView *);
2057 MouseCursors* _cursors;
2059 void resize_text_widgets ();
2061 friend class Drag;
2062 friend class RegionDrag;
2063 friend class RegionMoveDrag;
2064 friend class RegionSpliceDrag;
2065 friend class TrimDrag;
2066 friend class MeterMarkerDrag;
2067 friend class TempoMarkerDrag;
2068 friend class CursorDrag;
2069 friend class FadeInDrag;
2070 friend class FadeOutDrag;
2071 friend class MarkerDrag;
2072 friend class RegionGainDrag;
2073 friend class ControlPointDrag;
2074 friend class LineDrag;
2075 friend class RubberbandSelectDrag;
2076 friend class TimeFXDrag;
2077 friend class ScrubDrag;
2078 friend class SelectionDrag;
2079 friend class RangeMarkerBarDrag;
2080 friend class MouseZoomDrag;
2081 friend class RegionCreateDrag;
2082 friend class RegionMotionDrag;
2083 friend class RegionInsertDrag;
2085 friend class EditorSummary;
2086 friend class EditorGroupTabs;
2088 friend class EditorRoutes;
2089 friend class RhythmFerret;
2092 #endif /* __ardour_editor_h__ */