2 Copyright (C) 2000-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_editor_h__
21 #define __ardour_editor_h__
30 #include <glibmm/ustring.h>
32 #include <boost/optional.hpp>
34 #include <libgnomecanvasmm/canvas.h>
35 #include <libgnomecanvasmm/group.h>
36 #include <libgnomecanvasmm/line.h>
37 #include <libgnomecanvasmm/pixbuf.h>
41 #include <gtkmm/layout.h>
42 #include <gtkmm/comboboxtext.h>
44 #include <gtkmm2ext/selector.h>
45 #include <gtkmm2ext/click_box.h>
46 #include <gtkmm2ext/dndtreeview.h>
48 #include <pbd/stateful.h>
49 #include <ardour/session.h>
50 #include <ardour/tempo.h>
51 #include <ardour/stretch.h>
52 #include <ardour/location.h>
53 #include <ardour/audioregion.h>
54 #include <ardour/track.h>
55 #include <ardour/types.h>
57 #include "audio_clock.h"
58 #include "gtk-custom-ruler.h"
59 #include "ardour_dialog.h"
60 #include "public_editor.h"
63 #include "editor_items.h"
64 #include "region_selection.h"
73 class AudioDiskstream;
92 class AudioTimeAxisView;
93 class AutomationTimeAxisView;
94 class AudioRegionView;
97 class PlaylistSelector;
100 class AutomationLine;
104 class TrackSelection;
105 class AutomationSelection;
108 class AudioStreamView;
110 class SoundFileOmega;
112 class AnalysisWindow;
114 class GlobalPortMatrixWindow;
116 /* <CMT Additions> */
117 class ImageFrameView;
118 class ImageFrameTimeAxisView;
119 class ImageFrameTimeAxis;
120 class MarkerTimeAxis ;
122 class ImageFrameSocketHandler ;
123 class TimeAxisViewItem ;
124 /* </CMT Additions> */
127 class Editor : public PublicEditor
133 void connect_to_session (ARDOUR::Session *);
134 ARDOUR::Session* current_session() const { return session; }
136 virtual bool have_idled() const { return _have_idled; }
138 nframes64_t leftmost_position() const { return leftmost_frame; }
139 nframes64_t current_page_frames() const {
140 return (nframes64_t) floor (canvas_width * frames_per_unit);
143 void cycle_snap_mode ();
144 void cycle_snap_choice ();
145 void set_snap_to (Editing::SnapType);
146 void set_snap_mode (Editing::SnapMode);
147 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
149 void undo (uint32_t n = 1);
150 void redo (uint32_t n = 1);
152 XMLNode& get_state ();
153 int set_state (const XMLNode& );
155 void set_mouse_mode (Editing::MouseMode, bool force=true);
156 void step_mouse_mode (bool next);
157 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
159 void set_midi_edit_cursor (Editing::MidiEditMode);
160 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
161 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
164 void add_imageframe_time_axis(const std::string & track_name, void*) ;
165 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
166 void connect_to_image_compositor() ;
167 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
170 TimeAxisView* get_named_time_axis(const std::string & name) ;
171 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
172 void add_to_idle_resize (TimeAxisView*, uint32_t);
174 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
176 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
177 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
178 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
180 #ifdef USE_RUBBERBAND
181 std::vector<std::string> rb_opt_strings;
184 /* option editor-access */
186 void set_show_waveforms (bool yn);
187 bool show_waveforms() const { return _show_waveforms; }
189 void set_waveform_scale (Editing::WaveformScale);
191 void set_show_waveforms_recording (bool yn);
192 bool show_waveforms_recording() const { return _show_waveforms_recording; }
194 /* things that need to be public to be used in the main menubar */
196 void new_region_from_selection ();
197 void separate_regions_between (const TimeSelection&);
198 void separate_region_from_selection ();
199 void separate_region_from_punch ();
200 void separate_region_from_loop ();
201 void separate_regions_using_location (ARDOUR::Location&);
202 void toggle_playback (bool with_abort);
203 void transition_to_rolling (bool forward);
207 nframes64_t unit_to_frame (double unit) const {
208 return (nframes64_t) rint (unit * frames_per_unit);
211 double frame_to_unit (nframes64_t frame) const {
212 return rint ((double) frame / (double) frames_per_unit);
215 double frame_to_unit (double frame) const {
216 return rint (frame / frames_per_unit);
219 /* NOTE: these functions assume that the "pixel" coordinate is
220 the result of using the world->canvas affine transform on a
221 world coordinate. These coordinates already take into
222 account any scrolling carried out by adjusting the
226 nframes64_t pixel_to_frame (double pixel) const {
228 /* pixel can be less than zero when motion events
229 are processed. since we've already run the world->canvas
230 affine, that means that the location *really* is "off
231 to the right" and thus really is "before the start".
235 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
241 gulong frame_to_pixel (nframes64_t frame) const {
242 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
245 void flush_canvas ();
249 Selection& get_selection() const { return *selection; }
250 Selection& get_cut_buffer() const { return *cut_buffer; }
252 bool extend_selection_to_track (TimeAxisView&);
254 void play_selection ();
255 void select_all_in_track (Selection::Operation op);
256 void select_all (Selection::Operation op);
257 void invert_selection_in_track ();
258 void invert_selection ();
259 void deselect_all ();
263 void set_show_measures (bool yn);
264 bool show_measures () const { return _show_measures; }
266 /* analysis window */
267 void analyze_region_selection();
268 void analyze_range_selection();
272 void export_audio ();
273 void export_selection ();
274 void export_range ();
275 void export_region ();
277 void add_toplevel_controls (Gtk::Container&);
278 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
280 void set_zoom_focus (Editing::ZoomFocus);
281 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
282 double get_current_zoom () const { return frames_per_unit; }
284 void temporal_zoom_step (bool coarser);
286 /* stuff that AudioTimeAxisView and related classes use */
288 PlaylistSelector& playlist_selector() const;
289 void route_name_changed (TimeAxisView *);
290 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
292 void new_playlists (TimeAxisView* v);
293 void copy_playlists (TimeAxisView* v);
294 void clear_playlists (TimeAxisView* v);
296 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
298 Width editor_mixer_strip_width;
299 void maybe_add_mixer_strip_width (XMLNode&);
300 void show_editor_mixer (bool yn);
301 void create_editor_mixer ();
302 void show_editor_list (bool yn);
303 void set_selected_mixer_strip (TimeAxisView&);
304 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
305 void show_track_in_display (TimeAxisView& tv);
307 /* nudge is initiated by transport controls owned by ARDOUR_UI */
309 void nudge_forward (bool next, bool force_playhead);
310 void nudge_backward (bool next, bool force_playhead);
312 /* nudge initiated from context menu */
314 void nudge_forward_capture_offset ();
315 void nudge_backward_capture_offset ();
317 /* playhead/screen stuff */
319 void set_follow_playhead (bool yn);
320 void toggle_follow_playhead ();
321 bool follow_playhead() const { return _follow_playhead; }
322 bool dragging_playhead () const { return _dragging_playhead; }
324 void toggle_waveform_visibility ();
325 void toggle_zero_line_visibility ();
326 void toggle_waveforms_while_recording ();
327 void toggle_measure_visibility ();
328 void toggle_logo_visibility ();
330 double get_physical_screen_width () const { return physical_screen_width; };
331 double physical_screen_width;
332 double physical_screen_height;
334 /* SMPTE timecode & video sync */
336 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
337 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
338 void subframes_per_frame_chosen (uint32_t);
340 void update_smpte_mode();
341 void update_video_pullup();
342 void update_subframes_per_frame ();
346 void toggle_region_fades ();
347 void toggle_region_fades_visible ();
348 void toggle_selected_region_fades (int dir);
349 void update_region_fade_visibility ();
350 void toggle_auto_xfade ();
351 void toggle_xfades_active ();
352 void toggle_xfade_visibility ();
353 bool xfade_visibility() const { return _xfade_visibility; }
354 void update_xfade_visibility ();
355 void update_crossfade_model ();
356 void set_crossfade_model (ARDOUR::CrossfadeModel);
359 void set_layer_model (ARDOUR::LayerModel);
360 void update_layering_model ();
362 void toggle_link_region_and_track_selection ();
363 void toggle_automation_follows_regions ();
365 /* redirect shared ops menu. caller must free returned menu */
367 Gtk::Menu* redirect_menu ();
369 /* floating windows/transient */
371 void ensure_float (Gtk::Window&);
375 void scroll_tracks_down_line ();
376 void scroll_tracks_up_line ();
378 void move_selected_tracks (bool up);
380 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
381 void prepare_for_cleanup ();
382 void finish_cleanup ();
384 void maximise_editing_space();
385 void restore_editing_space();
387 void reset_x_origin (nframes64_t);
388 void reset_zoom (double);
389 void reposition_and_zoom (nframes64_t, double);
391 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
393 bool update_mouse_speed ();
394 bool decelerate_mouse_speed ();
396 void toggle_meter_updating();
398 void show_rhythm_ferret();
399 void show_bundle_manager ();
400 void show_global_port_matrix (ARDOUR::DataType);
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 ();
410 void map_transport_state ();
411 void map_position_change (nframes64_t);
414 bool on_expose_event (GdkEventExpose*);
418 /// The session that we are editing, or 0
419 void color_handler ();
420 ARDOUR::Session *session;
423 // to keep track of the playhead position for control_scroll
424 boost::optional<nframes64_t> _control_scroll_target;
426 PlaylistSelector* _playlist_selector;
428 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
432 double frames_per_unit;
433 nframes64_t leftmost_frame;
434 Editing::ZoomFocus zoom_focus;
435 bool zoomed_to_region;
436 std::list<TAVState> track_states;
439 std::list<VisualState*> undo_visual_stack;
440 std::list<VisualState*> redo_visual_stack;
441 VisualState* current_visual_state (bool with_tracks = true);
442 void undo_visual_state ();
443 void redo_visual_state ();
444 void use_visual_state (VisualState&);
446 void swap_visual_state ();
448 std::vector<VisualState*> visual_states;
449 sigc::connection visual_state_op_connection;
450 void start_visual_state_op (uint32_t n);
451 void cancel_visual_state_op (uint32_t n);
452 bool end_visual_state_op (uint32_t n);
454 nframes64_t leftmost_frame;
455 double frames_per_unit;
456 Editing::ZoomFocus zoom_focus;
458 void set_frames_per_unit (double);
461 Editing::MouseMode mouse_mode;
462 Editing::MidiEditMode midi_edit_mode;
464 int post_maximal_editor_width;
465 int post_maximal_pane_position;
466 int pre_maximal_pane_position;
467 int pre_maximal_editor_width;
468 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
470 Gtk::Notebook the_notebook;
471 Gtk::HPaned edit_pane;
473 Gtk::EventBox meter_base;
475 Gtk::EventBox marker_base;
476 Gtk::HBox marker_box;
477 Gtk::VBox scrollers_rulers_markers_box;
479 void location_changed (ARDOUR::Location *);
480 void location_flags_changed (ARDOUR::Location *, void *);
481 void refresh_location_display ();
482 void refresh_location_display_s (ARDOUR::Change);
483 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
484 void add_new_location (ARDOUR::Location *);
485 void location_gone (ARDOUR::Location *);
486 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
487 gint really_remove_marker (ARDOUR::Location* loc);
488 void goto_nth_marker (int nth);
490 uint32_t location_marker_color;
491 uint32_t location_range_color;
492 uint32_t location_loop_color;
493 uint32_t location_punch_color;
494 uint32_t location_cd_marker_color;
496 struct LocationMarkers {
501 LocationMarkers () : start(0), end(0), valid (true) {}
507 void set_name (const string&);
508 void set_position (nframes64_t start, nframes64_t end = 0);
509 void set_color_rgba (uint32_t);
512 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
513 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
514 Marker* entered_marker;
516 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
517 LocationMarkerMap location_markers;
519 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
520 void clear_marker_display ();
521 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
522 bool choose_new_marker_name(string &name);
523 void update_cd_marker_display ();
524 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
526 TimeAxisView* clicked_axisview;
527 RouteTimeAxisView* clicked_routeview;
528 /** The last RegionView that was clicked on, or 0 if the last click was not
529 * on a RegionView. This is set up by the canvas event handlers in
530 * editor_canvas_events.cc
532 RegionView* clicked_regionview;
533 RegionSelection latest_regionviews;
534 uint32_t clicked_selection;
535 CrossfadeView* clicked_crossfadeview;
536 ControlPoint* clicked_control_point;
538 void sort_track_selection (TrackSelection* sel = 0);
540 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
541 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
542 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
544 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
546 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
547 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
548 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
549 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
553 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
554 bool button_release_can_deselect;
556 void catch_vanishing_regionview (RegionView *);
558 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
559 void select_all_tracks ();
561 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
563 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
564 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
565 void set_selected_track_as_side_effect (bool force = false);
566 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
568 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
569 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
570 void collect_new_region_view (RegionView *);
571 void collect_and_select_new_region_view (RegionView *);
573 Gtk::Menu track_context_menu;
574 Gtk::Menu track_region_context_menu;
575 Gtk::Menu track_selection_context_menu;
576 Gtk::Menu track_crossfade_context_menu;
578 Gtk::MenuItem* region_edit_menu_split_item;
579 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
580 Gtk::Menu * track_region_edit_playlist_menu;
581 Gtk::Menu * track_edit_playlist_submenu;
582 Gtk::Menu * track_selection_edit_playlist_submenu;
584 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
585 Gtk::Menu* build_track_context_menu (nframes64_t);
586 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
587 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
588 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
589 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
590 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
591 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
592 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
593 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
594 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
596 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
598 void handle_new_route (ARDOUR::RouteList&);
599 void remove_route (TimeAxisView *);
602 Gtk::HBox global_hpacker;
603 Gtk::VBox global_vpacker;
606 bool need_resize_line;
608 int old_resize_line_y;
610 Gdk::Cursor* current_canvas_cursor;
611 void set_canvas_cursor ();
612 Gdk::Cursor* which_grabber_cursor ();
614 ArdourCanvas::Canvas* track_canvas;
616 ArdourCanvas::Text* first_action_message;
617 ArdourCanvas::Text* verbose_canvas_cursor;
618 bool verbose_cursor_visible;
620 void parameter_changed (const char *);
622 bool track_canvas_motion (GdkEvent*);
624 void set_verbose_canvas_cursor (const string &, double x, double y);
625 void set_verbose_canvas_cursor_text (const string &);
626 void show_verbose_canvas_cursor();
627 void hide_verbose_canvas_cursor();
629 bool verbose_cursor_on; // so far unused
631 Gtk::EventBox time_canvas_event_box;
632 Gtk::EventBox track_canvas_event_box;
633 Gtk::EventBox time_button_event_box;
634 Gtk::EventBox ruler_label_event_box;
636 ArdourCanvas::Group *minsec_group;
637 ArdourCanvas::Pixbuf *logo_item;
638 ArdourCanvas::Group *bbt_group;
639 ArdourCanvas::Group *smpte_group;
640 ArdourCanvas::Group *frame_group;
641 ArdourCanvas::Group *tempo_group;
642 ArdourCanvas::Group *meter_group;
643 ArdourCanvas::Group *marker_group;
644 ArdourCanvas::Group *range_marker_group;
645 ArdourCanvas::Group *transport_marker_group;
646 ArdourCanvas::Group* cd_marker_group;
648 ArdourCanvas::Group* timebar_group;
650 /* These bars never need to be scrolled */
651 ArdourCanvas::Group* meter_bar_group;
652 ArdourCanvas::Group* tempo_bar_group;
653 ArdourCanvas::Group* marker_bar_group;
654 ArdourCanvas::Group* range_marker_bar_group;
655 ArdourCanvas::Group* transport_marker_bar_group;
656 ArdourCanvas::Group* cd_marker_bar_group;
658 /** The group containing all items that require horizontal scrolling. */
659 ArdourCanvas::Group* _background_group;
661 The _master_group is the group containing all items
662 that require horizontal scrolling..
663 It is primarily used to separate canvas items
664 that require horizontal scrolling from those that do not.
666 ArdourCanvas::Group* _master_group;
668 /* The group containing all trackviews. Only scrolled vertically. */
669 ArdourCanvas::Group* _trackview_group;
671 /* The group used for region motion. Sits on top of _trackview_group */
672 ArdourCanvas::Group* _region_motion_group;
675 ruler_metric_smpte = 0,
676 ruler_metric_bbt = 1,
677 ruler_metric_frames = 2,
678 ruler_metric_minsec = 3,
680 ruler_time_tempo = 4,
681 ruler_time_meter = 5,
682 ruler_time_marker = 6,
683 ruler_time_range_marker = 7,
684 ruler_time_transport_marker = 8,
685 ruler_time_cd_marker = 9,
688 static GtkCustomMetric ruler_metrics[4];
689 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
690 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
691 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
692 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
693 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
694 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
695 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
696 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
697 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
698 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
699 bool no_ruler_shown_update;
701 gint ruler_button_press (GdkEventButton*);
702 gint ruler_button_release (GdkEventButton*);
703 gint ruler_mouse_motion (GdkEventMotion*);
704 bool ruler_scroll (GdkEventScroll* event);
706 gint ruler_pressed_button;
707 Gtk::Widget * ruler_grabbed_widget;
709 void initialize_rulers ();
710 void update_just_smpte ();
711 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
712 void update_fixed_rulers ();
713 void update_tempo_based_rulers ();
714 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
715 void update_ruler_visibility ();
716 void set_ruler_visible (RulerType, bool);
717 void toggle_ruler_visibility (RulerType rt);
718 void ruler_toggled (int);
719 gint ruler_label_button_release (GdkEventButton*);
720 void store_ruler_visibility ();
721 void restore_ruler_visibility ();
723 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
724 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
725 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
726 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
728 enum MinsecRulerScale {
735 MinsecRulerScale minsec_ruler_scale;
737 nframes_t minsec_mark_interval;
738 gint minsec_mark_modulo;
740 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
742 enum SMPTERulerScale {
750 SMPTERulerScale smpte_ruler_scale;
752 nframes_t smpte_mark_interval;
753 gint smpte_mark_modulo;
755 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
765 bbt_show_ticks_detail,
766 bbt_show_ticks_super_detail
769 BBTRulerScale bbt_ruler_scale;
773 uint32_t bbt_bar_helper_on;
774 uint32_t bbt_accent_modulo;
775 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
777 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
778 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
779 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
780 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
782 Gtk::Widget *_ruler_separator;
783 GtkWidget *_smpte_ruler;
784 GtkWidget *_bbt_ruler;
785 GtkWidget *_frames_ruler;
786 GtkWidget *_minsec_ruler;
787 Gtk::Widget *smpte_ruler;
788 Gtk::Widget *bbt_ruler;
789 Gtk::Widget *frames_ruler;
790 Gtk::Widget *minsec_ruler;
791 static Editor *ruler_editor;
793 static const double timebar_height;
794 guint32 visible_timebars;
795 gdouble canvas_timebars_vsize;
796 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
797 Gtk::Menu *editor_ruler_menu;
799 ArdourCanvas::SimpleRect* tempo_bar;
800 ArdourCanvas::SimpleRect* meter_bar;
801 ArdourCanvas::SimpleRect* marker_bar;
802 ArdourCanvas::SimpleRect* range_marker_bar;
803 ArdourCanvas::SimpleRect* transport_marker_bar;
804 ArdourCanvas::SimpleRect* cd_marker_bar;
806 Gtk::Label minsec_label;
807 Gtk::Label bbt_label;
808 Gtk::Label smpte_label;
809 Gtk::Label frame_label;
810 Gtk::Label tempo_label;
811 Gtk::Label meter_label;
812 Gtk::Label mark_label;
813 Gtk::Label range_mark_label;
814 Gtk::Label transport_mark_label;
815 Gtk::Label cd_mark_label;
818 Gtk::VBox time_button_vbox;
819 Gtk::HBox time_button_hbox;
823 ArdourCanvas::Points points;
824 ArdourCanvas::Line canvas_item;
825 nframes64_t current_frame;
828 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
831 void set_position (nframes64_t);
832 void set_length (double units);
833 void set_y_axis (double position);
836 friend struct Cursor; /* it needs access to several private
840 Cursor* playhead_cursor;
841 ArdourCanvas::Group* cursor_group;
843 void cursor_to_region_boundary (Cursor*, int32_t dir);
844 void cursor_to_next_region_boundary (Cursor*);
845 void cursor_to_previous_region_boundary (Cursor*);
846 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
847 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
848 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
849 void cursor_to_selection_start (Cursor *);
850 void cursor_to_selection_end (Cursor *);
852 void selected_marker_to_region_boundary (int32_t dir);
853 void selected_marker_to_next_region_boundary ();
854 void selected_marker_to_previous_region_boundary ();
855 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
856 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
857 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
858 void selected_marker_to_selection_start ();
859 void selected_marker_to_selection_end ();
861 void select_all_selectables_using_cursor (Cursor *, bool);
862 void select_all_selectables_using_edit (bool);
863 void select_all_selectables_between (bool within);
864 void select_range_between ();
866 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
867 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
869 vector<nframes64_t> region_boundary_cache;
870 void build_region_boundary_cache ();
873 Gtk::HBox bottom_hbox;
875 Gtk::Table edit_packer;
876 Gtk::VScrollbar edit_vscrollbar;
878 Gtk::Adjustment vertical_adjustment;
879 Gtk::Adjustment horizontal_adjustment;
881 Gtk::Layout controls_layout;
882 bool control_layout_scroll (GdkEventScroll* ev);
883 void controls_layout_size_request (Gtk::Requisition*);
884 sigc::connection controls_layout_size_request_connection;
886 Gtk::HScrollbar edit_hscrollbar;
887 bool _dragging_hscrollbar;
889 void reset_hscrollbar_stepping ();
891 bool hscrollbar_button_press (GdkEventButton*);
892 bool hscrollbar_button_release (GdkEventButton*);
893 void hscrollbar_allocate (Gtk::Allocation &alloc);
896 double canvas_height;
897 double full_canvas_height;
899 bool track_canvas_map_handler (GdkEventAny*);
901 gint edit_controls_button_release (GdkEventButton*);
902 Gtk::Menu *edit_controls_left_menu;
903 Gtk::Menu *edit_controls_right_menu;
905 Gtk::VBox ruler_label_vbox;
906 Gtk::VBox track_canvas_vbox;
907 Gtk::VBox time_canvas_vbox;
908 Gtk::VBox edit_controls_vbox;
909 Gtk::HBox edit_controls_hbox;
911 void control_scroll (float);
912 void access_action (std::string,std::string);
913 bool deferred_control_scroll (nframes64_t);
914 sigc::connection control_scroll_connection;
916 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
918 ArdourCanvas::Group* get_background_group () const { return _background_group; }
919 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
920 double last_trackview_group_vertical_offset;
921 void tie_vertical_scrolling ();
922 void scroll_canvas_horizontally ();
923 void scroll_canvas_vertically ();
924 void canvas_horizontally_scrolled ();
925 void canvas_scroll_to (nframes64_t);
927 struct VisualChange {
934 nframes64_t time_origin;
935 double frames_per_unit;
939 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
943 VisualChange pending_visual_change;
945 static int _idle_visual_changer (void *arg);
946 int idle_visual_changer ();
948 void queue_visual_change (nframes64_t);
949 void queue_visual_change (double);
951 void end_location_changed (ARDOUR::Location*);
953 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
954 RegionListDisplayModelColumns() {
971 Gtk::TreeModelColumn<Glib::ustring> name;
972 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
973 Gtk::TreeModelColumn<Gdk::Color> color_;
974 Gtk::TreeModelColumn<Glib::ustring> start;
975 Gtk::TreeModelColumn<Glib::ustring> end;
976 Gtk::TreeModelColumn<Glib::ustring> length;
977 Gtk::TreeModelColumn<Glib::ustring> sync;
978 Gtk::TreeModelColumn<Glib::ustring> fadein;
979 Gtk::TreeModelColumn<Glib::ustring> fadeout;
980 Gtk::TreeModelColumn<bool> locked;
981 Gtk::TreeModelColumn<bool> glued;
982 Gtk::TreeModelColumn<bool> muted;
983 Gtk::TreeModelColumn<bool> opaque;
984 Gtk::TreeModelColumn<Glib::ustring> used;
985 Gtk::TreeModelColumn<Glib::ustring> path;
988 RegionListDisplayModelColumns region_list_columns;
989 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
991 Glib::RefPtr<Gtk::TreeStore> region_list_model;
992 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
993 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
995 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
996 void region_list_selection_changed ();
997 sigc::connection region_list_change_connection;
998 void set_selected_in_region_list(RegionSelection&);
999 bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1000 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1001 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
1002 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
1004 Gtk::Menu *region_list_menu;
1005 Gtk::ScrolledWindow region_list_scroller;
1006 Gtk::Frame region_list_frame;
1008 bool region_list_display_key_press (GdkEventKey *);
1009 bool region_list_display_key_release (GdkEventKey *);
1010 bool region_list_display_button_press (GdkEventButton *);
1011 bool region_list_display_button_release (GdkEventButton *);
1012 void region_list_clear ();
1013 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
1014 void build_region_list_menu ();
1015 void show_region_list_display_context_menu (int button, int time);
1017 bool show_automatic_regions_in_region_list;
1018 Editing::RegionListSortType region_list_sort_type;
1020 void reset_region_list_sort_direction (bool);
1021 void reset_region_list_sort_type (Editing::RegionListSortType);
1023 void toggle_full_region_list ();
1024 void toggle_show_auto_regions ();
1026 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1030 Gtk::ScrolledWindow snapshot_display_scroller;
1031 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1032 SnapshotDisplayModelColumns() {
1036 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1037 Gtk::TreeModelColumn<Glib::ustring> real_name;
1040 SnapshotDisplayModelColumns snapshot_display_columns;
1041 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1042 Gtk::TreeView snapshot_display;
1043 Gtk::Menu snapshot_context_menu;
1045 bool snapshot_display_button_press (GdkEventButton*);
1046 void snapshot_display_selection_changed ();
1047 void redisplay_snapshots();
1048 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1050 /* named selections */
1052 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1053 NamedSelectionDisplayModelColumns() {
1057 Gtk::TreeModelColumn<Glib::ustring> text;
1058 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1061 NamedSelectionDisplayModelColumns named_selection_columns;
1062 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1064 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1065 Gtk::ScrolledWindow named_selection_scroller;
1067 void create_named_selection ();
1068 void paste_named_selection (float times);
1069 void remove_selected_named_selections ();
1070 void remove_snapshot (Glib::ustring);
1071 void rename_snapshot (Glib::ustring);
1073 void handle_new_named_selection ();
1074 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1075 void redisplay_named_selections ();
1077 bool named_selection_display_button_release (GdkEventButton *ev);
1078 bool named_selection_display_key_release (GdkEventKey *ev);
1079 void named_selection_display_selection_changed ();
1082 TrackViewList track_views;
1083 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1085 static Gdk::Cursor* cross_hair_cursor;
1086 static Gdk::Cursor* trimmer_cursor;
1087 static Gdk::Cursor* selector_cursor;
1088 static Gdk::Cursor* grabber_cursor;
1089 static Gdk::Cursor* grabber_edit_point_cursor;
1090 static Gdk::Cursor* zoom_cursor;
1091 static Gdk::Cursor* time_fx_cursor;
1092 static Gdk::Cursor* fader_cursor;
1093 static Gdk::Cursor* speaker_cursor;
1094 static Gdk::Cursor* midi_pencil_cursor;
1095 static Gdk::Cursor* midi_select_cursor;
1096 static Gdk::Cursor* midi_resize_cursor;
1097 static Gdk::Cursor* midi_erase_cursor;
1098 static Gdk::Cursor* wait_cursor;
1099 static Gdk::Cursor* timebar_cursor;
1100 static Gdk::Cursor* transparent_cursor;
1102 static void build_cursors ();
1104 sigc::connection scroll_connection;
1105 nframes64_t last_update_frame;
1106 void center_screen (nframes64_t);
1107 void center_screen_internal (nframes64_t, float);
1109 void update_current_screen ();
1111 void session_going_away ();
1113 nframes64_t cut_buffer_start;
1114 nframes64_t cut_buffer_length;
1116 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1117 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1118 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1119 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1120 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1121 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1123 /* KEYMAP HANDLING */
1125 void register_actions ();
1127 int ensure_cursor (nframes64_t* pos);
1129 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1130 void handle_new_regions (vector<boost::weak_ptr<ARDOUR::Region> >& );
1131 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1132 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1133 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1134 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1135 void redisplay_regions ();
1136 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1137 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1138 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1139 void update_all_region_rows ();
1140 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1141 bool no_region_list_redisplay;
1142 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1144 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1146 void cut_copy (Editing::CutCopyOp);
1147 bool can_cut_copy () const;
1148 void cut_copy_points (Editing::CutCopyOp);
1149 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1150 void cut_copy_ranges (Editing::CutCopyOp);
1152 void mouse_paste ();
1153 void paste_internal (nframes64_t position, float times);
1155 /* EDITING OPERATIONS */
1157 void reset_point_selection ();
1158 void toggle_region_mute ();
1159 void toggle_region_lock ();
1160 void toggle_region_opaque ();
1161 void toggle_record_enable ();
1162 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1163 void raise_region ();
1164 void raise_region_to_top ();
1165 void lower_region ();
1166 void lower_region_to_bottom ();
1167 void split_region ();
1168 void split_region_at (nframes64_t);
1169 void split_regions_at (nframes64_t, RegionSelection&);
1170 void split_region_at_transients ();
1171 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1172 void crop_region_to_selection ();
1173 void crop_region_to (nframes64_t start, nframes64_t end);
1174 void set_sync_point (nframes64_t, const RegionSelection&);
1175 void set_region_sync_from_edit_point ();
1176 void remove_region_sync();
1177 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1178 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1179 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1180 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1181 void remove_selected_regions ();
1182 void remove_clicked_region ();
1183 void edit_region ();
1184 void rename_region ();
1185 void duplicate_some_regions (RegionSelection&, float times);
1186 void duplicate_selection (float times);
1187 void region_fill_selection ();
1189 void region_fill_track ();
1190 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1191 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1192 void split_multichannel_region();
1193 void reverse_region ();
1194 void normalize_region ();
1195 void denormalize_region ();
1196 void adjust_region_scale_amplitude (bool up);
1197 void quantize_region ();
1199 void do_insert_time ();
1200 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1202 void tab_to_transient (bool forward);
1204 void use_region_as_bar ();
1205 void use_range_as_bar ();
1207 void define_one_bar (nframes64_t start, nframes64_t end);
1209 void audition_region_from_region_list ();
1210 void hide_region_from_region_list ();
1211 void remove_region_from_region_list ();
1213 void align (ARDOUR::RegionPoint);
1214 void align_relative (ARDOUR::RegionPoint);
1217 void reset_focus ();
1223 void paste (float times);
1225 int get_prefix (float&, bool&);
1227 void keyboard_paste ();
1228 void keyboard_insert_region_list_selection ();
1230 void region_from_selection ();
1231 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1233 void play_from_start ();
1234 void play_from_edit_point ();
1235 void play_from_edit_point_and_return ();
1236 void play_selected_region ();
1237 void play_edit_range ();
1238 void loop_selected_region ();
1239 void play_location (ARDOUR::Location&);
1240 void loop_location (ARDOUR::Location&);
1242 void temporal_zoom_selection ();
1243 void temporal_zoom_region (bool both_axes);
1244 void toggle_zoom_region (bool both_axes);
1245 bool zoomed_to_region;
1246 void temporal_zoom_session ();
1247 void temporal_zoom (gdouble scale);
1248 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1249 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1251 void amplitude_zoom (gdouble scale);
1252 void amplitude_zoom_step (bool in);
1254 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1255 void insert_region_list_selection (float times);
1257 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1259 /* import & embed */
1261 void add_external_audio_action (Editing::ImportMode);
1262 void external_audio_dialog ();
1263 void session_import_dialog ();
1265 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1266 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1268 SoundFileOmega* sfbrowser;
1270 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1272 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1273 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1275 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1276 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1278 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1279 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1280 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1281 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1283 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1284 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1285 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1286 boost::shared_ptr<ARDOUR::Track>& existing_track);
1288 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1289 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1291 /* generic interthread progress window */
1293 ArdourDialog* interthread_progress_window;
1294 Gtk::Label interthread_progress_label;
1295 Gtk::VBox interthread_progress_vbox;
1296 Gtk::ProgressBar interthread_progress_bar;
1297 Gtk::Button interthread_cancel_button;
1298 Gtk::Label interthread_cancel_label;
1299 sigc::connection interthread_progress_connection;
1300 void interthread_cancel_clicked ();
1301 void build_interthread_progress_window ();
1302 ARDOUR::InterThreadInfo* current_interthread_info;
1304 AnalysisWindow* analysis_window;
1306 /* import specific info */
1308 struct EditorImportStatus : public ARDOUR::Session::import_status {
1309 Editing::ImportMode mode;
1313 boost::shared_ptr<ARDOUR::Track> track;
1317 EditorImportStatus import_status;
1318 gint import_progress_timeout (void *);
1319 static void *_import_thread (void *);
1320 void* import_thread ();
1321 void finish_import ();
1323 /* to support this ... */
1325 void import_audio (bool as_tracks);
1326 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1328 void move_to_start ();
1329 void move_to_end ();
1331 void center_playhead ();
1332 void center_edit_point ();
1333 void edit_cursor_backward ();
1334 void edit_cursor_forward ();
1335 void playhead_forward_to_grid ();
1336 void playhead_backward_to_grid ();
1337 void playhead_backward ();
1338 void playhead_forward ();
1339 void scroll_playhead (bool forward);
1340 void scroll_backward (float pages=0.8f);
1341 void scroll_forward (float pages=0.8f);
1342 void scroll_tracks_down ();
1343 void scroll_tracks_up ();
1344 void delete_sample_forward ();
1345 void delete_sample_backward ();
1346 void delete_screen ();
1347 void search_backwards ();
1348 void search_forwards ();
1350 void clear_markers ();
1351 void clear_ranges ();
1352 void clear_locations ();
1353 void unhide_markers ();
1354 void unhide_ranges ();
1355 void jump_forward_to_mark ();
1356 void jump_backward_to_mark ();
1357 void cursor_align (bool playhead_to_edit);
1359 void remove_last_capture ();
1360 void select_all_selectables_using_time_selection ();
1361 void select_all_selectables_using_loop();
1362 void select_all_selectables_using_punch();
1363 void set_selection_from_range (ARDOUR::Location&);
1364 void set_selection_from_punch ();
1365 void set_selection_from_loop ();
1366 void set_selection_from_region ();
1368 void add_location_mark (nframes64_t where);
1369 void add_location_from_audio_region ();
1370 void add_locations_from_audio_region ();
1371 void add_location_from_selection ();
1372 void set_loop_from_selection (bool play);
1373 void set_punch_from_selection ();
1374 void set_punch_from_region ();
1376 void set_loop_from_edit_range (bool play);
1377 void set_loop_from_region (bool play);
1378 void set_punch_from_edit_range ();
1380 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1381 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1383 void add_location_from_playhead_cursor ();
1384 bool select_new_marker;
1386 void reverse_selection ();
1387 void edit_envelope ();
1389 void start_scrolling ();
1390 void stop_scrolling ();
1393 double last_scrub_x;
1394 int scrubbing_direction;
1395 int scrub_reversals;
1396 int scrub_reverse_distance;
1399 void keyboard_selection_begin ();
1400 void keyboard_selection_finish (bool add);
1401 bool have_pending_keyboard_selection;
1402 nframes64_t pending_keyboard_selection_start;
1404 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1405 void extend_selection_to_end_of_region (bool next);
1406 void extend_selection_to_start_of_region (bool previous);
1408 Editing::SnapType snap_type;
1409 Editing::SnapMode snap_mode;
1411 /// Snap threshold in pixels
1412 double snap_threshold;
1414 void handle_gui_changes (const string &, void *);
1415 bool ignore_gui_changes;
1417 void hide_all_tracks (bool with_select);
1420 LineDragInfo current_line_drag_info;
1422 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1423 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1424 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1426 void finalize_drag ();
1428 Gtk::Menu fade_context_menu;
1429 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1431 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1433 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1434 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1435 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1436 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1437 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1438 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1440 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1441 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1443 void set_fade_length (bool in);
1444 void toggle_fade_active (bool in);
1445 void set_fade_in_active (bool);
1446 void set_fade_out_active (bool);
1448 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1449 RegionSelection pre_drag_region_selection;
1450 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1451 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1452 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1453 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1454 bool check_region_drag_possible (RouteTimeAxisView**, ARDOUR::layer_t*);
1455 void possibly_copy_regions_during_grab (GdkEvent*);
1456 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1457 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1459 bool _dragging_playhead;
1460 bool _dragging_edit_point;
1462 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1463 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1464 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1465 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1466 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1467 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1468 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1469 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1470 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1472 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1473 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1474 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1475 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1477 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1479 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1480 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1481 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1482 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1483 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1484 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1485 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1486 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1487 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1488 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1489 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1490 void start_line_grab (AutomationLine *, GdkEvent*);
1491 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1492 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1493 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1494 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1496 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1498 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1499 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1501 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1502 void brush (nframes64_t);
1504 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1505 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1506 double clamp_verbose_cursor_x (double);
1507 double clamp_verbose_cursor_y (double);
1509 /* Canvas event handlers */
1511 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1512 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1513 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1514 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1515 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1516 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1517 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1518 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1519 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1520 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1523 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1525 ArdourCanvas::Item *last_item_entered;
1526 int last_item_entered_n;
1529 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1530 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1531 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1532 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1533 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1534 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1535 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1536 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1537 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1539 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1540 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1541 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1542 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1543 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1544 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1546 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1547 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1548 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1549 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1550 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1551 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1552 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1553 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1555 /* non-public event handlers */
1557 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1558 bool track_canvas_scroll (GdkEventScroll* event);
1560 bool track_canvas_scroll_event (GdkEventScroll* event);
1561 bool track_canvas_button_press_event (GdkEventButton* event);
1562 bool track_canvas_button_release_event (GdkEventButton* event);
1563 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1565 Gtk::Allocation canvas_allocation;
1566 void track_canvas_allocate (Gtk::Allocation alloc);
1567 bool track_canvas_size_allocated ();
1569 void set_playhead_cursor ();
1571 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1572 void kbd_mute_unmute_region ();
1575 void kbd_do_brush (GdkEvent*);
1576 void kbd_do_audition (GdkEvent*);
1578 void handle_new_duration ();
1579 void initialize_canvas ();
1581 /* display control */
1583 bool _show_measures;
1584 /// true to show waveforms, otherwise false
1585 bool _show_waveforms;
1586 /// true if the editor should follow the playhead, otherwise false
1587 bool _follow_playhead;
1588 /// true if waveforms should be shown while recording audio tracks, otherwise false
1589 bool _show_waveforms_recording;
1591 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1593 TempoLines* tempo_lines;
1595 ArdourCanvas::Group* time_line_group;
1597 void hide_measures ();
1598 void draw_measures ();
1599 bool redraw_measures ();
1601 void new_tempo_section ();
1603 void mouse_add_new_tempo_event (nframes64_t where);
1604 void mouse_add_new_meter_event (nframes64_t where);
1606 void remove_tempo_marker (ArdourCanvas::Item*);
1607 void remove_meter_marker (ArdourCanvas::Item*);
1608 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1609 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1611 void edit_tempo_section (ARDOUR::TempoSection*);
1612 void edit_meter_section (ARDOUR::MeterSection*);
1613 void edit_tempo_marker (ArdourCanvas::Item*);
1614 void edit_meter_marker (ArdourCanvas::Item*);
1615 void edit_control_point (ArdourCanvas::Item*);
1617 void marker_menu_edit ();
1618 void marker_menu_remove ();
1619 void marker_menu_rename ();
1620 void marker_menu_lock (bool yn);
1621 void marker_menu_hide ();
1622 void marker_menu_loop_range ();
1623 void marker_menu_select_all_selectables_using_range ();
1624 void marker_menu_select_using_range ();
1625 void marker_menu_separate_regions_using_location ();
1626 void marker_menu_play_from ();
1627 void marker_menu_play_range ();
1628 void marker_menu_set_playhead ();
1629 void marker_menu_set_from_playhead ();
1630 void marker_menu_set_from_selection ();
1631 void marker_menu_range_to_next ();
1632 void new_transport_marker_menu_set_loop ();
1633 void new_transport_marker_menu_set_punch ();
1634 void update_loop_range_view (bool visibility=false);
1635 void update_punch_range_view (bool visibility=false);
1636 void new_transport_marker_menu_popdown ();
1637 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1638 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1639 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1640 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1641 void build_range_marker_menu (bool loop_or_punch);
1642 void build_marker_menu (bool start_or_end);
1643 void build_tm_marker_menu ();
1644 void build_new_transport_marker_menu ();
1646 Gtk::Menu* tm_marker_menu;
1647 Gtk::Menu* marker_menu;
1648 Gtk::Menu* start_end_marker_menu;
1649 Gtk::Menu* range_marker_menu;
1650 Gtk::Menu* transport_marker_menu;
1651 Gtk::Menu* new_transport_marker_menu;
1652 Gtk::Menu* cd_marker_menu;
1653 ArdourCanvas::Item* marker_menu_item;
1655 typedef list<Marker*> Marks;
1658 void remove_metric_marks ();
1659 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1661 void compute_current_bbt_points (nframes_t left, nframes_t right);
1662 void tempo_map_changed (ARDOUR::Change);
1663 void redisplay_tempo (bool immediate_redraw);
1665 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1667 double snap_length_beats (nframes64_t start);
1669 uint32_t bbt_beat_subdivision;
1673 Gtk::ToggleButton editor_mixer_button;
1674 Gtk::ToggleButton editor_list_button;
1675 void editor_mixer_button_toggled ();
1676 void editor_list_button_toggled ();
1678 AudioClock edit_point_clock;
1679 AudioClock zoom_range_clock;
1680 Gtk::Button zoom_in_button;
1681 Gtk::Button zoom_out_button;
1682 Gtk::Button zoom_out_full_button;
1683 Gtk::Button zoom_onetoone_button;
1685 Gtk::VBox toolbar_clock_vbox;
1686 Gtk::VBox toolbar_selection_clock_vbox;
1687 Gtk::Table toolbar_selection_clock_table;
1688 Gtk::Label toolbar_selection_cursor_label;
1690 Gtk::HBox mouse_mode_button_box;
1691 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1692 Gtk::ToggleButton mouse_select_button;
1693 Gtk::ToggleButton mouse_move_button;
1694 Gtk::ToggleButton mouse_gain_button;
1695 Gtk::ToggleButton mouse_zoom_button;
1696 Gtk::ToggleButton mouse_timefx_button;
1697 Gtk::ToggleButton mouse_audition_button;
1698 Gtk::ToggleButton mouse_note_button;
1699 GroupedButtons *mouse_mode_button_set;
1700 void mouse_mode_toggled (Editing::MouseMode m);
1701 bool ignore_mouse_mode_toggle;
1703 gint mouse_select_button_release (GdkEventButton*);
1705 Gtk::VBox automation_box;
1706 Gtk::Button automation_mode_button;
1707 Gtk::ToggleButton global_automation_button;
1709 Gtk::ComboBoxText edit_mode_selector;
1710 Gtk::VBox edit_mode_box;
1712 void set_edit_mode (ARDOUR::EditMode);
1713 void cycle_edit_mode ();
1714 void edit_mode_selection_done ();
1716 Gtk::ComboBoxText snap_type_selector;
1717 Gtk::ComboBoxText snap_mode_selector;
1720 std::vector<std::string> snap_type_strings;
1721 std::vector<std::string> snap_mode_strings;
1723 void snap_type_selection_done ();
1724 void snap_mode_selection_done ();
1725 void snap_mode_chosen (Editing::SnapMode);
1726 void snap_type_chosen (Editing::SnapType);
1728 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1729 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1731 Gtk::ComboBoxText zoom_focus_selector;
1732 Gtk::VBox zoom_focus_box;
1734 std::vector<std::string> zoom_focus_strings;
1736 void zoom_focus_selection_done ();
1737 void zoom_focus_chosen (Editing::ZoomFocus);
1739 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1743 void zoom_adjustment_changed();
1745 void edit_point_clock_changed();
1747 void setup_toolbar ();
1749 Gtkmm2ext::TearOff* tools_tearoff;
1750 Gtk::HBox toolbar_hbox;
1751 Gtk::EventBox toolbar_base;
1752 Gtk::Frame toolbar_frame;
1756 Gtk::HBox midi_tool_button_box;
1757 Gtk::ToggleButton midi_tool_pencil_button;
1758 Gtk::ToggleButton midi_tool_select_button;
1759 Gtk::ToggleButton midi_tool_resize_button;
1760 Gtk::ToggleButton midi_tool_erase_button;
1761 Gtk::Button midi_panic_button;
1762 Gtk::ToggleButton midi_sound_notes;
1763 GroupedButtons *midi_tool_button_set;
1764 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1765 void midi_panic_button_pressed ();
1766 bool sound_notes () const { return midi_sound_notes.get_active(); }
1768 bool ignore_midi_edit_mode_toggle;
1770 Gtkmm2ext::TearOff* midi_tools_tearoff;
1771 Gtk::HBox midi_toolbar_hbox;
1772 Gtk::EventBox midi_toolbar_base;
1773 Gtk::Frame midi_toolbar_frame;
1775 void setup_midi_toolbar ();
1777 /* selection process */
1779 Selection* selection;
1780 Selection* cut_buffer;
1782 void time_selection_changed ();
1783 void track_selection_changed ();
1784 void region_selection_changed ();
1785 sigc::connection editor_regions_selection_changed_connection;
1786 void sensitize_the_right_region_actions (bool have_selected_regions);
1787 void point_selection_changed ();
1788 void marker_selection_changed ();
1797 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1798 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1799 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1800 void cancel_selection ();
1802 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1803 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1804 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1806 bool audio_region_selection_covers (nframes64_t where);
1808 /* transport range select process */
1809 enum RangeMarkerOp {
1811 CreateTransportMarker,
1815 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1816 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1817 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1819 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1820 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1821 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1822 ArdourCanvas::Line* marker_drag_line;
1823 ArdourCanvas::Points marker_drag_line_points;
1824 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1826 void update_marker_drag_item (ARDOUR::Location *);
1828 ArdourCanvas::SimpleRect *bogus_background_rect;
1830 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1831 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1832 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1833 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1834 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1835 ArdourCanvas::SimpleLine *transport_punchin_line;
1836 ArdourCanvas::SimpleLine *transport_punchout_line;
1837 ArdourCanvas::SimpleRect *transport_preroll_rect;
1838 ArdourCanvas::SimpleRect *transport_postroll_rect;
1840 ARDOUR::Location* transport_loop_location();
1841 ARDOUR::Location* transport_punch_location();
1843 ARDOUR::Location *temp_location;
1845 /* object rubberband select process */
1847 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1848 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1849 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1851 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1853 ArdourCanvas::SimpleRect *rubberband_rect;
1855 /* mouse zoom process */
1857 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1858 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1859 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1861 ArdourCanvas::SimpleRect *zoom_rect;
1862 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1864 /* diskstream/route display management */
1866 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1867 RouteDisplayModelColumns() {
1870 add (temporary_visible);
1874 Gtk::TreeModelColumn<Glib::ustring> text;
1875 Gtk::TreeModelColumn<bool> visible;
1876 Gtk::TreeModelColumn<bool> temporary_visible;
1877 Gtk::TreeModelColumn<TimeAxisView*> tv;
1878 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1881 RouteDisplayModelColumns route_display_columns;
1882 Glib::RefPtr<Gtk::ListStore> route_display_model;
1883 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1885 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1886 Gtk::ScrolledWindow route_list_scroller;
1887 Gtk::Menu* route_list_menu;
1889 void update_route_visibility ();
1891 void sync_order_keys (const char*);
1892 bool route_redisplay_does_not_sync_order_keys;
1893 bool route_redisplay_does_not_reset_order_keys;
1895 bool route_list_display_button_press (GdkEventButton*);
1896 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1899 const Gtk::SelectionData& data,
1903 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1905 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1906 void route_list_delete (const Gtk::TreeModel::Path&);
1907 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1909 void initial_route_list_display ();
1910 void redisplay_route_list();
1911 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1912 bool ignore_route_list_reorder;
1913 bool no_route_list_redisplay;
1915 void build_route_list_menu ();
1916 void show_route_list_menu ();
1918 void show_all_routes ();
1919 void hide_all_routes ();
1920 void show_all_audiotracks ();
1921 void hide_all_audiotracks ();
1922 void show_all_audiobus ();
1923 void hide_all_audiobus ();
1925 void set_all_tracks_visibility (bool yn);
1926 void set_all_audio_visibility (int type, bool yn);
1928 /* edit group management */
1930 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1931 GroupListModelColumns () {
1937 Gtk::TreeModelColumn<bool> is_active;
1938 Gtk::TreeModelColumn<bool> is_visible;
1939 Gtk::TreeModelColumn<std::string> text;
1940 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1943 GroupListModelColumns group_columns;
1944 Glib::RefPtr<Gtk::ListStore> group_model;
1945 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1947 Gtk::TreeView edit_group_display;
1948 Gtk::ScrolledWindow edit_group_display_scroller;
1949 Gtk::Menu* edit_group_list_menu;
1951 void build_edit_group_list_menu ();
1952 void activate_all_edit_groups ();
1953 void disable_all_edit_groups ();
1955 bool in_edit_group_row_change;
1956 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1957 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1958 void new_edit_group ();
1959 void edit_group_list_button_clicked ();
1960 gint edit_group_list_button_press_event (GdkEventButton* ev);
1961 void add_edit_group (ARDOUR::RouteGroup* group);
1962 void remove_selected_edit_group ();
1963 void edit_groups_changed ();
1964 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1966 Gtk::VBox list_vpacker;
1970 bool autoscroll_active;
1971 int autoscroll_timeout_tag;
1974 int last_autoscroll_x;
1975 int last_autoscroll_y;
1976 uint32_t autoscroll_cnt;
1977 nframes64_t autoscroll_x_distance;
1978 double autoscroll_y_distance;
1980 static gint _autoscroll_canvas (void *);
1981 bool autoscroll_canvas ();
1982 void start_canvas_autoscroll (int x, int y);
1983 void stop_canvas_autoscroll ();
1984 void maybe_autoscroll (GdkEventMotion*);
1985 void maybe_autoscroll_horizontally (GdkEventMotion*);
1986 bool allow_vertical_scroll;
1995 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1996 void point_trim (GdkEvent*);
1997 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1998 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1999 void single_start_trim (RegionView&, nframes64_t, bool, bool);
2000 void single_end_trim (RegionView&, nframes64_t, bool, bool);
2002 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
2003 void thaw_region_after_trim (RegionView& rv);
2005 void trim_region_front();
2006 void trim_region_back();
2007 void trim_region (bool front);
2009 void trim_region_to_edit_point ();
2010 void trim_region_from_edit_point ();
2011 void trim_region_to_loop ();
2012 void trim_region_to_punch ();
2013 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
2015 bool show_gain_after_trim;
2019 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
2020 const Glib::RefPtr<Gdk::DragContext>& context,
2023 const Gtk::SelectionData& data,
2027 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
2030 const Gtk::SelectionData& data,
2034 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
2037 const Gtk::SelectionData& data,
2041 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
2044 const Gtk::SelectionData& data,
2048 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
2051 const Gtk::SelectionData& data,
2055 void drop_routes (const Glib::RefPtr<Gdk::DragContext>& context,
2058 const Gtk::SelectionData& data,
2064 int write_region_selection(RegionSelection&);
2065 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
2066 void bounce_region_selection ();
2067 void bounce_range_selection (bool replace);
2068 void external_edit_region ();
2070 int write_audio_selection (TimeSelection&);
2071 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
2073 void write_selection ();
2077 UndoAction get_memento() const;
2079 XMLNode *before; /* used in *_reversible_command */
2081 void begin_reversible_command (string cmd_name);
2082 void commit_reversible_command ();
2084 void update_title ();
2085 void update_title_s (const string & snapshot_name);
2088 Selection* selection;
2089 double frames_per_unit;
2091 State (PublicEditor const * e);
2095 void store_state (State&) const;
2096 void restore_state (State *);
2098 void instant_save ();
2100 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
2102 /* freeze operations */
2104 ARDOUR::InterThreadInfo freeze_status;
2105 gint freeze_progress_timeout (void *);
2106 static void* _freeze_thread (void*);
2107 void* freeze_thread ();
2109 void freeze_route ();
2110 void unfreeze_route ();
2112 /* edit-group solo + mute */
2114 void set_edit_group_solo (ARDOUR::Route&, bool);
2115 void set_edit_group_mute (ARDOUR::Route&, bool);
2119 void duplicate_dialog (bool with_dialog);
2121 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
2123 /* returns false if mouse pointer is not in track or marker canvas
2125 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2127 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
2128 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
2129 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
2131 struct TimeFXDialog : public ArdourDialog {
2132 ARDOUR::TimeFXRequest request;
2135 Gtk::Adjustment pitch_octave_adjustment;
2136 Gtk::Adjustment pitch_semitone_adjustment;
2137 Gtk::Adjustment pitch_cent_adjustment;
2138 Gtk::SpinButton pitch_octave_spinner;
2139 Gtk::SpinButton pitch_semitone_spinner;
2140 Gtk::SpinButton pitch_cent_spinner;
2141 RegionSelection regions;
2142 Gtk::ProgressBar progress_bar;
2145 Gtk::ToggleButton quick_button;
2146 Gtk::ToggleButton antialias_button;
2147 Gtk::HBox upper_button_box;
2150 Gtk::ComboBoxText stretch_opts_selector;
2151 Gtk::Label stretch_opts_label;
2152 Gtk::ToggleButton precise_button;
2153 Gtk::ToggleButton preserve_formants_button;
2156 Gtk::Button* cancel_button;
2157 Gtk::Button* action_button;
2161 TimeFXDialog (Editor& e, bool for_pitch);
2163 gint update_progress ();
2164 sigc::connection first_cancel;
2165 sigc::connection first_delete;
2166 void cancel_in_progress ();
2167 gint delete_in_progress (GdkEventAny*);
2170 /* "whats mine is yours" */
2172 friend class TimeFXDialog;
2174 TimeFXDialog* current_timefx;
2176 static void* timefx_thread (void *arg);
2177 void do_timefx (TimeFXDialog&);
2179 int time_stretch (RegionSelection&, float fraction);
2180 int pitch_shift (RegionSelection&, float cents);
2181 void pitch_shift_regions ();
2182 int time_fx (RegionSelection&, float val, bool pitching);
2184 /* editor-mixer strip */
2186 MixerStrip *current_mixer_strip;
2187 bool show_editor_mixer_when_tracks_arrive;
2188 Gtk::VBox current_mixer_strip_vbox;
2189 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2190 void cms_deleted ();
2191 void current_mixer_strip_hidden ();
2192 void current_mixer_strip_removed ();
2194 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2195 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2197 void ensure_all_elements_drawn ();
2199 /* nudging tracks */
2201 void nudge_track (bool use_edit_point, bool forwards);
2205 bool _xfade_visibility;
2208 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2209 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2211 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2212 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2214 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2215 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2216 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2218 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2219 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2220 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2221 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2223 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2224 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2225 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2226 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2228 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2229 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2230 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2231 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2232 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2233 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2235 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2236 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2237 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2238 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2239 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2240 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2242 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2243 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2245 ImageFrameSocketHandler* image_socket_listener ;
2248 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2249 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2250 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2251 void xfade_edit_left_region ();
2252 void xfade_edit_right_region ();
2254 static const int32_t default_width = 995;
2255 static const int32_t default_height = 765;
2259 Gtk::Button nudge_forward_button;
2260 Gtk::Button nudge_backward_button;
2261 Gtk::HBox nudge_hbox;
2262 Gtk::VBox nudge_vbox;
2263 AudioClock nudge_clock;
2265 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2267 bool nudge_forward_release (GdkEventButton*);
2268 bool nudge_backward_release (GdkEventButton*);
2272 void apply_filter (ARDOUR::Filter&, string cmd);
2274 /* handling cleanup */
2276 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2278 vector<sigc::connection> session_connections;
2280 /* tracking step changes of track height */
2282 TimeAxisView* current_stepping_trackview;
2283 ARDOUR::microseconds_t last_track_height_step_timestamp;
2284 gint track_height_step_timeout();
2285 sigc::connection step_timeout;
2287 TimeAxisView* entered_track;
2288 RegionView* entered_regionview;
2291 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2292 bool clear_entered_track;
2293 bool left_track_canvas (GdkEventCrossing*);
2294 bool entered_track_canvas (GdkEventCrossing*);
2295 void set_entered_track (TimeAxisView*);
2296 void set_entered_regionview (RegionView*);
2297 void ensure_track_visible (TimeAxisView*);
2298 gint left_automation_track ();
2300 bool _new_regionviews_show_envelope;
2302 void reset_canvas_action_sensitivity (bool);
2303 void toggle_gain_envelope_visibility ();
2304 void toggle_gain_envelope_active ();
2305 void reset_region_gain_envelopes ();
2307 bool on_key_press_event (GdkEventKey*);
2308 bool on_key_release_event (GdkEventKey*);
2310 void session_state_saved (string);
2312 Glib::RefPtr<Gtk::Action> undo_action;
2313 Glib::RefPtr<Gtk::Action> redo_action;
2315 void history_changed ();
2317 Gtk::HBox status_bar_hpacker;
2319 Editing::EditPoint _edit_point;
2321 Gtk::ComboBoxText edit_point_selector;
2323 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2324 void cycle_edit_point (bool with_marker);
2325 void set_edit_point ();
2326 void edit_point_selection_done ();
2327 void edit_point_chosen (Editing::EditPoint);
2328 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2329 std::vector<std::string> edit_point_strings;
2331 void selected_marker_moved (ARDOUR::Location*);
2332 sigc::connection edit_point_clock_connection_a;
2333 sigc::connection edit_point_clock_connection_b;
2335 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2337 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2338 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2340 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2342 sigc::connection fast_screen_update_connection;
2343 gint start_updating ();
2344 gint stop_updating ();
2345 void fast_update_strips ();
2346 bool meters_running;
2348 void select_next_route ();
2349 void select_prev_route ();
2351 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2353 RhythmFerret* rhythm_ferret;
2354 BundleManager* _bundle_manager;
2355 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2358 void set_track_height (uint32_t h);
2359 void set_track_height_largest ();
2360 void set_track_height_large ();
2361 void set_track_height_larger ();
2362 void set_track_height_normal ();
2363 void set_track_height_smaller ();
2364 void set_track_height_small ();
2366 void remove_tracks ();
2367 void toggle_tracks_active ();
2368 void waveform_scale_chosen (Editing::WaveformScale);
2372 int32_t resize_idle_target;
2374 friend gboolean _idle_resize (gpointer);
2375 std::vector<TimeAxisView*> pending_resizes;
2377 void visible_order_range (int*, int*) const;
2378 bool y_movement_disallowed (int, int, int, int, int, std::bitset<512> const &, std::vector<int32_t> const &) const;
2381 #endif /* __ardour_editor_h__ */