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__
28 #include <glibmm/ustring.h>
30 #include <boost/optional.hpp>
32 #include <libgnomecanvasmm/canvas.h>
33 #include <libgnomecanvasmm/group.h>
34 #include <libgnomecanvasmm/line.h>
35 #include <libgnomecanvasmm/pixbuf.h>
39 #include <gtkmm/layout.h>
40 #include <gtkmm/comboboxtext.h>
42 #include <gtkmm2ext/selector.h>
43 #include <gtkmm2ext/click_box.h>
44 #include <gtkmm2ext/dndtreeview.h>
46 #include <pbd/stateful.h>
47 #include <ardour/session.h>
48 #include <ardour/tempo.h>
49 #include <ardour/stretch.h>
50 #include <ardour/location.h>
51 #include <ardour/audioregion.h>
53 #include "audio_clock.h"
54 #include "gtk-custom-ruler.h"
55 #include "ardour_dialog.h"
56 #include "public_editor.h"
59 #include "editor_items.h"
60 #include "region_selection.h"
62 #include "time_axis_view.h"
70 class AudioDiskstream;
88 class RouteTimeAxisView;
89 class AudioTimeAxisView;
90 class AutomationTimeAxisView;
91 class AudioRegionView;
94 class PlaylistSelector;
98 class UIExportSpecification;
103 class TrackSelection;
104 class AutomationSelection;
107 class AudioStreamView;
109 class SoundFileOmega;
112 class AnalysisWindow;
115 /* <CMT Additions> */
116 class ImageFrameView;
117 class ImageFrameTimeAxisView;
118 class ImageFrameTimeAxis;
119 class MarkerTimeAxis ;
121 class ImageFrameSocketHandler ;
122 class TimeAxisViewItem ;
123 /* </CMT Additions> */
126 class Editor : public PublicEditor
132 void connect_to_session (ARDOUR::Session *);
133 ARDOUR::Session* current_session() const { return session; }
135 virtual bool have_idled() const { return _have_idled; }
137 nframes64_t leftmost_position() const { return leftmost_frame; }
138 nframes64_t current_page_frames() const {
139 return (nframes64_t) floor (canvas_width * frames_per_unit);
142 void cycle_snap_mode ();
143 void cycle_snap_choice ();
144 void set_snap_to (Editing::SnapType);
145 void set_snap_mode (Editing::SnapMode);
146 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
148 void undo (uint32_t n = 1);
149 void redo (uint32_t n = 1);
151 XMLNode& get_state ();
152 int set_state (const XMLNode& );
154 void set_mouse_mode (Editing::MouseMode, bool force=true);
155 void step_mouse_mode (bool next);
156 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
158 void add_imageframe_time_axis(const std::string & track_name, void*) ;
159 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
160 void connect_to_image_compositor() ;
161 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
162 TimeAxisView* get_named_time_axis(const std::string & name) ;
163 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
164 void add_to_idle_resize (TimeAxisView*, uint32_t);
166 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
167 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
168 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
170 #ifdef USE_RUBBERBAND
171 std::vector<std::string> rb_opt_strings;
174 //global waveform options
176 void set_show_waveforms (bool yn);
177 bool show_waveforms() const { return _show_waveforms; }
179 void set_show_waveforms_rectified (bool yn);
180 bool show_waveforms_rectified() const { return _show_waveforms_rectified; }
182 void set_show_waveforms_recording (bool yn);
183 bool show_waveforms_recording() const { return _show_waveforms_recording; }
185 //per-track waveform options
187 void set_waveform_scale (Editing::WaveformScale);
189 /* things that need to be public to be used in the main menubar */
191 void new_region_from_selection ();
192 void separate_regions_between (const TimeSelection&);
193 void separate_region_from_selection ();
194 void separate_region_from_punch ();
195 void separate_region_from_loop ();
196 void separate_regions_using_location (ARDOUR::Location&);
197 void toggle_playback (bool with_abort);
198 void transition_to_rolling (bool forward);
202 nframes64_t unit_to_frame (double unit) const {
203 return (nframes64_t) rint (unit * frames_per_unit);
206 double frame_to_unit (nframes64_t frame) const {
207 return rint ((double) frame / (double) frames_per_unit);
210 double frame_to_unit (double frame) const {
211 return rint (frame / frames_per_unit);
214 /* NOTE: these functions assume that the "pixel" coordinate is
215 the result of using the world->canvas affine transform on a
216 world coordinate. These coordinates already take into
217 account any scrolling carried out by adjusting the
221 nframes64_t pixel_to_frame (double pixel) const {
223 /* pixel can be less than zero when motion events
224 are processed. since we've already run the world->canvas
225 affine, that means that the location *really* is "off
226 to the right" and thus really is "before the start".
230 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
236 gulong frame_to_pixel (nframes64_t frame) const {
237 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
240 void flush_canvas ();
244 Selection& get_selection() const { return *selection; }
245 Selection& get_cut_buffer() const { return *cut_buffer; }
247 bool extend_selection_to_track (TimeAxisView&);
249 void play_selection ();
250 void select_all_in_track (Selection::Operation op);
251 void select_all (Selection::Operation op);
252 void invert_selection_in_track ();
253 void invert_selection ();
254 void deselect_all ();
258 void set_show_measures (bool yn);
259 bool show_measures () const { return _show_measures; }
262 /* analysis window */
263 void analyze_region_selection();
264 void analyze_range_selection();
269 /* these initiate export ... */
271 void export_session();
272 void export_selection();
274 void add_toplevel_controls (Gtk::Container&);
275 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
277 void set_zoom_focus (Editing::ZoomFocus);
278 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
279 double get_current_zoom () const { return frames_per_unit; }
281 void temporal_zoom_step (bool coarser);
283 /* stuff that AudioTimeAxisView and related classes use */
285 PlaylistSelector& playlist_selector() const;
286 void route_name_changed (TimeAxisView *);
287 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
289 void new_playlists (TimeAxisView*);
290 void copy_playlists (TimeAxisView*);
291 void clear_playlists (TimeAxisView*);
293 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
294 void get_onscreen_tracks (TrackViewList&);
296 Width editor_mixer_strip_width;
297 void maybe_add_mixer_strip_width (XMLNode&);
298 void show_editor_mixer (bool yn);
299 void create_editor_mixer ();
300 void set_selected_mixer_strip (TimeAxisView&);
301 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
302 void show_track_in_display (TimeAxisView& tv);
304 /* nudge is initiated by transport controls owned by ARDOUR_UI */
306 void nudge_forward (bool next, bool force_playhead);
307 void nudge_backward (bool next, bool force_playhead);
309 /* nudge initiated from context menu */
311 void nudge_forward_capture_offset ();
312 void nudge_backward_capture_offset ();
314 /* playhead/screen stuff */
316 void set_stationary_playhead (bool yn);
317 void toggle_stationary_playhead ();
318 bool stationary_playhead() const { return _stationary_playhead; }
320 void set_follow_playhead (bool yn);
321 void toggle_follow_playhead ();
322 bool follow_playhead() const { return _follow_playhead; }
323 bool dragging_playhead () const { return _dragging_playhead; }
325 void toggle_waveform_visibility ();
326 void toggle_waveform_rectified ();
327 void toggle_waveforms_while_recording ();
329 void toggle_measure_visibility ();
330 void toggle_logo_visibility ();
332 double get_physical_screen_width () const { return physical_screen_width; };
333 double physical_screen_width;
334 double physical_screen_height;
336 /* SMPTE timecode & video sync */
338 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
339 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
340 void subframes_per_frame_chosen (uint32_t);
342 void update_smpte_mode();
343 void update_video_pullup();
344 void update_subframes_per_frame ();
348 void toggle_region_fades ();
349 void toggle_region_fades_visible ();
350 void toggle_selected_region_fades (int dir);
351 void update_region_fade_visibility ();
353 void toggle_auto_xfade ();
354 void toggle_xfades_active ();
355 void toggle_xfade_visibility ();
356 bool xfade_visibility() const { return _xfade_visibility; }
357 void update_xfade_visibility ();
358 void update_crossfade_model ();
359 void set_crossfade_model (ARDOUR::CrossfadeModel);
362 void set_layer_model (ARDOUR::LayerModel);
363 void update_layering_model ();
365 void toggle_link_region_and_track_selection ();
367 /* redirect shared ops menu. caller must free returned menu */
369 Gtk::Menu* redirect_menu ();
371 /* floating windows/transient */
373 void ensure_float (Gtk::Window&);
377 void scroll_tracks_down_line ();
378 void scroll_tracks_up_line ();
380 void move_selected_tracks (bool up);
382 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
383 void prepare_for_cleanup ();
384 void finish_cleanup ();
386 void maximise_editing_space();
387 void restore_editing_space();
389 void reset_x_origin (nframes64_t);
390 void reset_zoom (double);
391 void reposition_and_zoom (nframes64_t, double);
393 nframes64_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 ();
410 void map_transport_state ();
411 void map_position_change (nframes64_t);
414 bool on_expose_event (GdkEventExpose*);
418 ARDOUR::Session *session;
421 // to keep track of the playhead position for control_scroll
422 boost::optional<nframes64_t> _control_scroll_target;
424 PlaylistSelector* _playlist_selector;
426 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
430 double frames_per_unit;
431 nframes64_t leftmost_frame;
432 Editing::ZoomFocus zoom_focus;
433 std::list<TAVState> track_states;
436 std::list<VisualState*> undo_visual_stack;
437 std::list<VisualState*> redo_visual_stack;
438 VisualState* current_visual_state (bool with_tracks = true);
439 void undo_visual_state ();
440 void redo_visual_state ();
441 void use_visual_state (VisualState&);
443 void swap_visual_state ();
445 std::vector<VisualState*> visual_states;
446 sigc::connection visual_state_op_connection;
447 void start_visual_state_op (uint32_t n);
448 void cancel_visual_state_op (uint32_t n);
449 bool end_visual_state_op (uint32_t n);
451 nframes64_t leftmost_frame;
452 double frames_per_unit;
453 Editing::ZoomFocus zoom_focus;
455 void set_frames_per_unit (double);
458 Editing::MouseMode mouse_mode;
460 int post_maximal_editor_width;
461 int post_maximal_pane_position;
462 int pre_maximal_pane_position;
463 int pre_maximal_editor_width;
464 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
466 Gtk::Notebook the_notebook;
467 Gtk::HPaned edit_pane;
469 Gtk::EventBox meter_base;
471 Gtk::EventBox marker_base;
472 Gtk::HBox marker_box;
473 Gtk::VBox scrollers_rulers_markers_box;
475 void location_changed (ARDOUR::Location *);
476 void location_flags_changed (ARDOUR::Location *, void *);
477 void refresh_location_display ();
478 void refresh_location_display_s (ARDOUR::Change);
479 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
480 void add_new_location (ARDOUR::Location *);
481 void location_gone (ARDOUR::Location *);
482 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
483 gint really_remove_marker (ARDOUR::Location* loc);
484 void goto_nth_marker (int nth);
486 uint32_t location_marker_color;
487 uint32_t location_range_color;
488 uint32_t location_loop_color;
489 uint32_t location_punch_color;
490 uint32_t location_cd_marker_color;
492 struct LocationMarkers {
497 LocationMarkers () : start(0), end(0), valid (true) {}
503 void set_name (const string&);
504 void set_position (nframes64_t start, nframes64_t end = 0);
505 void set_color_rgba (uint32_t);
508 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
509 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
510 Marker* entered_marker;
512 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
513 LocationMarkerMap location_markers;
515 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
516 void clear_marker_display ();
517 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
518 bool choose_new_marker_name(string &name);
519 void update_cd_marker_display ();
520 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
522 TimeAxisView* clicked_trackview;
523 AudioTimeAxisView* clicked_audio_trackview;
524 RegionView* clicked_regionview;
525 RegionSelection latest_regionviews;
526 uint32_t clicked_selection;
527 CrossfadeView* clicked_crossfadeview;
528 ControlPoint* clicked_control_point;
530 void sort_track_selection (TrackSelection* sel = 0);
532 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
533 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
534 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
536 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
538 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
539 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
540 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
541 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
545 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
546 bool button_release_can_deselect;
548 void catch_vanishing_regionview (RegionView *);
550 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
551 void select_all_tracks ();
553 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
554 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
555 void set_selected_track_as_side_effect (bool force = false);
556 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
558 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
559 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
560 void collect_new_region_view (RegionView *);
562 Gtk::Menu track_context_menu;
563 Gtk::Menu track_region_context_menu;
564 Gtk::Menu track_selection_context_menu;
565 Gtk::Menu track_crossfade_context_menu;
567 Gtk::MenuItem* region_edit_menu_split_item;
568 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
569 Gtk::Menu * track_region_edit_playlist_menu;
570 Gtk::Menu * track_edit_playlist_submenu;
571 Gtk::Menu * track_selection_edit_playlist_submenu;
573 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
574 Gtk::Menu* build_track_context_menu (nframes64_t);
575 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
576 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
577 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
578 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
579 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
580 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
581 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
582 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
583 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
585 void handle_new_route (ARDOUR::Session::RouteList&);
586 void remove_route (TimeAxisView *);
589 Gtk::HBox global_hpacker;
590 Gtk::VBox global_vpacker;
593 bool need_resize_line;
595 int old_resize_line_y;
597 Gdk::Cursor* current_canvas_cursor;
598 void set_canvas_cursor ();
599 Gdk::Cursor* which_grabber_cursor ();
601 ArdourCanvas::Canvas* track_canvas;
602 ArdourCanvas::Text* verbose_canvas_cursor;
603 bool verbose_cursor_visible;
605 void parameter_changed (const char *);
607 bool track_canvas_motion (GdkEvent*);
609 void set_verbose_canvas_cursor (const string &, double x, double y);
610 void set_verbose_canvas_cursor_text (const string &);
611 void show_verbose_canvas_cursor();
612 void hide_verbose_canvas_cursor();
614 bool verbose_cursor_on; // so far unused
616 Gtk::EventBox time_canvas_event_box;
617 Gtk::EventBox track_canvas_event_box;
618 Gtk::EventBox time_button_event_box;
619 Gtk::EventBox ruler_label_event_box;
621 ArdourCanvas::Pixbuf* logo_item;
622 ArdourCanvas::Group* minsec_group;
623 ArdourCanvas::Group* bbt_group;
624 ArdourCanvas::Group* smpte_group;
625 ArdourCanvas::Group* frame_group;
626 ArdourCanvas::Group* tempo_group;
627 ArdourCanvas::Group* meter_group;
628 ArdourCanvas::Group* marker_group;
629 ArdourCanvas::Group* range_marker_group;
630 ArdourCanvas::Group* transport_marker_group;
631 ArdourCanvas::Group* cd_marker_group;
633 ArdourCanvas::Group* timebar_group;
635 /* These bars never need to be scrolled */
636 ArdourCanvas::Group* meter_bar_group;
637 ArdourCanvas::Group* tempo_bar_group;
638 ArdourCanvas::Group* marker_bar_group;
639 ArdourCanvas::Group* range_marker_bar_group;
640 ArdourCanvas::Group* transport_marker_bar_group;
641 ArdourCanvas::Group* cd_marker_bar_group;
643 ArdourCanvas::Group* _background_group;
645 The _master_group is the group containing all items
646 that require horizontal scrolling..
647 It is primarily used to separate canvas items
648 that require horizontal scrolling from those that do not.
650 ArdourCanvas::Group* _master_group;
652 The _trackview_group is the group containing all trackviews.
653 It is only scrolled vertically.
655 ArdourCanvas::Group* _trackview_group;
657 This canvas group is used for region motion.
658 It sits on top of the _trackview_group
660 ArdourCanvas::Group* _region_motion_group;
663 ruler_metric_smpte = 0,
664 ruler_metric_bbt = 1,
665 ruler_metric_frames = 2,
666 ruler_metric_minsec = 3,
668 ruler_time_tempo = 4,
669 ruler_time_meter = 5,
670 ruler_time_marker = 6,
671 ruler_time_range_marker = 7,
672 ruler_time_transport_marker = 8,
673 ruler_time_cd_marker = 9,
676 static GtkCustomMetric ruler_metrics[4];
677 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
678 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
679 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
680 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
681 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
682 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
683 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
686 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
687 bool no_ruler_shown_update;
689 gint ruler_button_press (GdkEventButton*);
690 gint ruler_button_release (GdkEventButton*);
691 gint ruler_mouse_motion (GdkEventMotion*);
692 bool ruler_scroll (GdkEventScroll* event);
694 gint ruler_pressed_button;
695 Gtk::Widget * ruler_grabbed_widget;
697 void initialize_rulers ();
698 void update_just_smpte ();
699 void update_fixed_rulers ();
700 void update_tempo_based_rulers ();
701 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
702 void update_ruler_visibility ();
703 void set_ruler_visible (RulerType, bool);
704 void toggle_ruler_visibility (RulerType rt);
705 void ruler_toggled (int);
706 gint ruler_label_button_release (GdkEventButton*);
707 void store_ruler_visibility ();
708 void restore_ruler_visibility ();
710 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
711 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
712 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
713 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
715 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
716 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
717 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
718 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
720 Gtk::Widget *_ruler_separator;
721 GtkWidget *_smpte_ruler;
722 GtkWidget *_bbt_ruler;
723 GtkWidget *_frames_ruler;
724 GtkWidget *_minsec_ruler;
725 Gtk::Widget *smpte_ruler;
726 Gtk::Widget *bbt_ruler;
727 Gtk::Widget *frames_ruler;
728 Gtk::Widget *minsec_ruler;
729 static Editor *ruler_editor;
731 static const double timebar_height;
732 guint32 visible_timebars;
733 gdouble canvas_timebars_vsize;
734 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
735 Gtk::Menu *editor_ruler_menu;
737 ArdourCanvas::SimpleRect* tempo_bar;
738 ArdourCanvas::SimpleRect* meter_bar;
739 ArdourCanvas::SimpleRect* marker_bar;
740 ArdourCanvas::SimpleRect* range_marker_bar;
741 ArdourCanvas::SimpleRect* transport_marker_bar;
742 ArdourCanvas::SimpleRect* cd_marker_bar;
745 ArdourCanvas::SimpleLine* tempo_line;
746 ArdourCanvas::SimpleLine* meter_line;
747 ArdourCanvas::SimpleLine* marker_line;
748 ArdourCanvas::SimpleLine* range_marker_line;
749 ArdourCanvas::SimpleLine* transport_marker_line;
750 ArdourCanvas::SimpleLine* cd_marker_line;
752 Gtk::Label minsec_label;
753 Gtk::Label bbt_label;
754 Gtk::Label smpte_label;
755 Gtk::Label frame_label;
756 Gtk::Label tempo_label;
757 Gtk::Label meter_label;
758 Gtk::Label mark_label;
759 Gtk::Label range_mark_label;
760 Gtk::Label transport_mark_label;
761 Gtk::Label cd_mark_label;
764 Gtk::VBox time_button_vbox;
765 Gtk::HBox time_button_hbox;
769 ArdourCanvas::Points points;
770 ArdourCanvas::Line canvas_item;
771 nframes64_t current_frame;
774 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
777 void set_position (nframes64_t);
778 void set_length (double units);
779 void set_y_axis (double position);
782 friend struct Cursor; /* it needs access to several private
786 Cursor* playhead_cursor;
787 ArdourCanvas::Group* cursor_group;
789 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
791 void cursor_to_region_boundary (bool with_selection, int32_t dir);
792 void cursor_to_next_region_boundary (bool with_selection);
793 void cursor_to_previous_region_boundary (bool with_selection);
794 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
795 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
796 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
797 void cursor_to_selection_start (Cursor *);
798 void cursor_to_selection_end (Cursor *);
800 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
801 void selected_marker_to_next_region_boundary (bool with_selection);
802 void selected_marker_to_previous_region_boundary (bool with_selection);
803 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
804 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
805 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
806 void selected_marker_to_selection_start ();
807 void selected_marker_to_selection_end ();
809 void select_all_selectables_using_cursor (Cursor *, bool);
810 void select_all_selectables_using_edit (bool);
811 void select_all_selectables_between (bool within);
812 void select_range_between ();
814 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
815 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
817 vector<nframes64_t> region_boundary_cache;
818 void build_region_boundary_cache ();
821 Gtk::HBox bottom_hbox;
823 Gtk::Table edit_packer;
824 Gtk::VScrollbar edit_vscrollbar;
826 Gtk::Adjustment vertical_adjustment;
827 Gtk::Adjustment horizontal_adjustment;
829 Gtk::Layout controls_layout;
830 bool control_layout_scroll (GdkEventScroll* ev);
831 void controls_layout_size_request (Gtk::Requisition*);
832 sigc::connection controls_layout_size_request_connection;
834 Gtk::HScrollbar edit_hscrollbar;
835 bool _dragging_hscrollbar;
837 void reset_hscrollbar_stepping ();
839 bool hscrollbar_button_press (GdkEventButton*);
840 bool hscrollbar_button_release (GdkEventButton*);
841 void hscrollbar_allocate (Gtk::Allocation &alloc);
844 double canvas_height;
845 double full_canvas_height;
847 bool track_canvas_map_handler (GdkEventAny*);
849 gint edit_controls_button_release (GdkEventButton*);
850 Gtk::Menu *edit_controls_left_menu;
851 Gtk::Menu *edit_controls_right_menu;
853 Gtk::VBox ruler_label_vbox;
854 Gtk::VBox track_canvas_vbox;
855 Gtk::VBox time_canvas_vbox;
856 Gtk::VBox edit_controls_vbox;
857 Gtk::HBox edit_controls_hbox;
859 void control_scroll (float);
860 void access_action (std::string,std::string);
861 bool deferred_control_scroll (nframes64_t);
862 sigc::connection control_scroll_connection;
864 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
866 ArdourCanvas::Group* get_background_group () const { return _background_group; }
867 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
868 double last_trackview_group_vertical_offset;
869 void tie_vertical_scrolling ();
870 void scroll_canvas_horizontally ();
871 void scroll_canvas_vertically ();
873 struct VisualChange {
880 nframes64_t time_origin;
881 double frames_per_unit;
885 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
889 VisualChange pending_visual_change;
891 static int _idle_visual_changer (void *arg);
892 int idle_visual_changer ();
894 void queue_visual_change (nframes64_t);
895 void queue_visual_change (double);
897 void end_location_changed (ARDOUR::Location*);
899 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
900 RegionListDisplayModelColumns() {
905 Gtk::TreeModelColumn<Glib::ustring> name;
906 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
907 Gtk::TreeModelColumn<Gdk::Color> color_;
910 RegionListDisplayModelColumns region_list_columns;
911 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
913 Glib::RefPtr<Gtk::TreeStore> region_list_model;
914 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
915 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
917 void region_list_selection_changed ();
918 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
919 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
920 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
922 Gtk::Menu *region_list_menu;
923 Gtk::ScrolledWindow region_list_scroller;
924 Gtk::Frame region_list_frame;
926 bool region_list_display_key_press (GdkEventKey *);
927 bool region_list_display_key_release (GdkEventKey *);
928 bool region_list_display_button_press (GdkEventButton *);
929 bool region_list_display_button_release (GdkEventButton *);
930 void region_list_clear ();
931 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
932 void build_region_list_menu ();
933 void show_region_list_display_context_menu (int button, int time);
935 bool show_automatic_regions_in_region_list;
936 Editing::RegionListSortType region_list_sort_type;
938 void reset_region_list_sort_direction (bool);
939 void reset_region_list_sort_type (Editing::RegionListSortType);
941 void toggle_full_region_list ();
942 void toggle_show_auto_regions ();
944 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
948 Gtk::ScrolledWindow snapshot_display_scroller;
949 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
950 SnapshotDisplayModelColumns() {
954 Gtk::TreeModelColumn<Glib::ustring> visible_name;
955 Gtk::TreeModelColumn<Glib::ustring> real_name;
958 SnapshotDisplayModelColumns snapshot_display_columns;
959 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
960 Gtk::TreeView snapshot_display;
961 Gtk::Menu snapshot_context_menu;
963 bool snapshot_display_button_press (GdkEventButton*);
964 void snapshot_display_selection_changed ();
965 void redisplay_snapshots();
966 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
968 /* named selections */
970 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
971 NamedSelectionDisplayModelColumns() {
975 Gtk::TreeModelColumn<Glib::ustring> text;
976 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
979 NamedSelectionDisplayModelColumns named_selection_columns;
980 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
982 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
983 Gtk::ScrolledWindow named_selection_scroller;
985 void create_named_selection ();
986 void paste_named_selection (float times);
987 void remove_selected_named_selections ();
988 void remove_snapshot (Glib::ustring);
989 void rename_snapshot (Glib::ustring);
991 void handle_new_named_selection ();
992 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
993 void redisplay_named_selections ();
995 bool named_selection_display_button_release (GdkEventButton *ev);
996 bool named_selection_display_key_release (GdkEventKey *ev);
997 void named_selection_display_selection_changed ();
1000 TrackViewList track_views;
1001 TimeAxisView *trackview_by_y_position (double ypos);
1003 static Gdk::Cursor* cross_hair_cursor;
1004 static Gdk::Cursor* trimmer_cursor;
1005 static Gdk::Cursor* selector_cursor;
1006 static Gdk::Cursor* grabber_cursor;
1007 static Gdk::Cursor* grabber_edit_point_cursor;
1008 static Gdk::Cursor* zoom_cursor;
1009 static Gdk::Cursor* time_fx_cursor;
1010 static Gdk::Cursor* fader_cursor;
1011 static Gdk::Cursor* speaker_cursor;
1012 static Gdk::Cursor* wait_cursor;
1013 static Gdk::Cursor* timebar_cursor;
1014 static Gdk::Cursor* transparent_cursor;
1016 static void build_cursors ();
1018 sigc::connection scroll_connection;
1019 nframes64_t last_update_frame;
1020 void center_screen (nframes64_t);
1021 void center_screen_internal (nframes64_t, float);
1023 void update_current_screen ();
1025 void session_going_away ();
1027 nframes64_t cut_buffer_start;
1028 nframes64_t cut_buffer_length;
1030 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1031 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1032 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1033 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1034 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1035 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1037 /* KEYMAP HANDLING */
1039 void register_actions ();
1041 int ensure_cursor (nframes64_t* pos);
1043 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
1044 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
1045 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
1046 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
1047 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
1048 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1049 void redisplay_regions ();
1050 bool no_region_list_redisplay;
1051 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
1053 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
1055 void cut_copy (Editing::CutCopyOp);
1056 void cut_copy_points (Editing::CutCopyOp);
1057 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1058 void cut_copy_ranges (Editing::CutCopyOp);
1060 void mouse_paste ();
1061 void paste_internal (nframes64_t position, float times);
1063 /* EDITING OPERATIONS */
1065 void reset_point_selection ();
1066 void toggle_region_mute ();
1067 void toggle_region_lock ();
1068 void toggle_region_opaque ();
1069 void toggle_record_enable ();
1070 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1071 void raise_region ();
1072 void raise_region_to_top ();
1073 void lower_region ();
1074 void lower_region_to_bottom ();
1075 void split_region ();
1076 void split_region_at (nframes64_t);
1077 void split_regions_at (nframes64_t, RegionSelection&);
1078 void split_region_at_transients ();
1079 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1080 void crop_region_to_selection ();
1081 void crop_region_to (nframes64_t start, nframes64_t end);
1082 void set_sync_point (nframes64_t, const RegionSelection&);
1083 void set_region_sync_from_edit_point ();
1084 void remove_region_sync();
1085 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1086 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1087 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1088 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1089 void remove_region ();
1090 void remove_clicked_region ();
1091 void edit_region ();
1092 void rename_region ();
1093 void duplicate_some_regions (RegionSelection&, float times);
1094 void duplicate_selection (float times);
1095 void region_fill_selection ();
1097 void region_fill_track ();
1098 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1099 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1100 void split_multichannel_region();
1101 void reverse_region ();
1102 void normalize_region ();
1103 void denormalize_region ();
1104 void adjust_region_scale_amplitude (bool up);
1106 void do_insert_time ();
1107 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too, bool tempo_too);
1109 void tab_to_transient (bool forward);
1111 void use_region_as_bar ();
1112 void use_range_as_bar ();
1114 void define_one_bar (nframes64_t start, nframes64_t end);
1116 void audition_region_from_region_list ();
1117 void hide_region_from_region_list ();
1118 void remove_region_from_region_list ();
1120 void align (ARDOUR::RegionPoint);
1121 void align_relative (ARDOUR::RegionPoint);
1124 void reset_focus ();
1130 void paste (float times);
1132 int get_prefix (float&, bool&);
1134 void keyboard_paste ();
1135 void keyboard_insert_region_list_selection ();
1137 void region_from_selection ();
1138 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1140 void play_from_start ();
1141 void play_from_edit_point ();
1142 void play_from_edit_point_and_return ();
1143 void play_selected_region ();
1144 void play_edit_range ();
1145 void loop_selected_region ();
1146 void play_location (ARDOUR::Location&);
1147 void loop_location (ARDOUR::Location&);
1149 void temporal_zoom_selection ();
1150 void temporal_zoom_region (bool both_axes);
1151 void toggle_zoom_region (bool both_axes);
1152 void temporal_zoom_session ();
1153 void temporal_zoom (gdouble scale);
1154 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1155 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1157 void amplitude_zoom (gdouble scale);
1158 void amplitude_zoom_step (bool in);
1160 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1161 void insert_region_list_selection (float times);
1163 void add_external_audio_action (Editing::ImportMode);
1164 void external_audio_dialog ();
1166 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1167 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1169 SoundFileOmega* sfbrowser;
1171 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1173 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1174 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1176 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1177 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1179 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1180 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>, bool, uint32_t total);
1181 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1182 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>);
1184 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1185 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1186 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1187 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1189 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1191 /* generic interthread progress window */
1193 ArdourDialog* interthread_progress_window;
1194 Gtk::Label interthread_progress_label;
1195 Gtk::VBox interthread_progress_vbox;
1196 Gtk::ProgressBar interthread_progress_bar;
1197 Gtk::Button interthread_cancel_button;
1198 Gtk::Label interthread_cancel_label;
1199 sigc::connection interthread_progress_connection;
1200 void interthread_cancel_clicked ();
1201 void build_interthread_progress_window ();
1202 ARDOUR::InterThreadInfo* current_interthread_info;
1205 AnalysisWindow* analysis_window;
1208 /* import specific info */
1210 struct EditorImportStatus : public ARDOUR::Session::import_status {
1211 Editing::ImportMode mode;
1215 boost::shared_ptr<ARDOUR::AudioTrack> track;
1219 EditorImportStatus import_status;
1220 gint import_progress_timeout (void *);
1221 static void *_import_thread (void *);
1222 void* import_thread ();
1223 void finish_import ();
1225 /* to support this ... */
1227 void import_audio (bool as_tracks);
1228 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1230 void move_to_start ();
1231 void move_to_end ();
1233 void center_playhead ();
1234 void center_edit_point ();
1235 void edit_cursor_backward ();
1236 void edit_cursor_forward ();
1237 void playhead_forward_to_grid ();
1238 void playhead_backward_to_grid ();
1239 void playhead_backward ();
1240 void playhead_forward ();
1241 void scroll_playhead (bool forward);
1242 void scroll_backward (float pages=0.8f);
1243 void scroll_forward (float pages=0.8f);
1244 void scroll_tracks_down ();
1245 void scroll_tracks_up ();
1246 void delete_sample_forward ();
1247 void delete_sample_backward ();
1248 void delete_screen ();
1249 void search_backwards ();
1250 void search_forwards ();
1252 void clear_markers ();
1253 void clear_ranges ();
1254 void clear_locations ();
1255 void unhide_markers ();
1256 void unhide_ranges ();
1257 void jump_forward_to_mark ();
1258 void jump_backward_to_mark ();
1259 void cursor_align (bool playhead_to_edit);
1261 void remove_last_capture ();
1262 void select_all_selectables_using_time_selection ();
1263 void select_all_selectables_using_loop();
1264 void select_all_selectables_using_punch();
1265 void set_selection_from_range (ARDOUR::Location&);
1266 void set_selection_from_punch ();
1267 void set_selection_from_loop ();
1268 void set_selection_from_audio_region ();
1270 void add_location_mark (nframes64_t where);
1271 void add_location_from_audio_region ();
1272 void add_locations_from_audio_region ();
1273 void add_location_from_selection ();
1274 void set_loop_from_selection (bool play);
1275 void set_punch_from_selection ();
1276 void set_punch_from_region ();
1278 void set_loop_from_edit_range (bool play);
1279 void set_loop_from_region (bool play);
1280 void set_punch_from_edit_range ();
1282 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1283 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1285 void add_location_from_playhead_cursor ();
1286 bool select_new_marker;
1288 void reverse_selection ();
1289 void edit_envelope ();
1291 void start_scrolling ();
1292 void stop_scrolling ();
1295 double last_scrub_x;
1296 int scrubbing_direction;
1297 int scrub_reversals;
1298 int scrub_reverse_distance;
1301 void keyboard_selection_begin ();
1302 void keyboard_selection_finish (bool add);
1303 bool have_pending_keyboard_selection;
1304 nframes64_t pending_keyboard_selection_start;
1306 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1307 void extend_selection_to_end_of_region (bool next);
1308 void extend_selection_to_start_of_region (bool previous);
1310 Editing::SnapType snap_type;
1311 Editing::SnapMode snap_mode;
1312 double snap_threshold;
1314 void handle_gui_changes (const string &, void *);
1315 bool ignore_gui_changes;
1317 void hide_all_tracks (bool with_select);
1320 LineDragInfo current_line_drag_info;
1322 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1323 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1324 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1326 void finalize_drag ();
1328 Gtk::Menu fade_context_menu;
1329 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1331 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1333 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1334 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1335 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1336 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1337 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1338 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1340 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1341 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1343 void set_fade_length (bool in);
1344 void toggle_fade_active (bool in);
1345 void set_fade_in_active (bool);
1346 void set_fade_out_active (bool);
1348 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1349 RegionSelection pre_drag_region_selection;
1350 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1351 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1352 bool check_region_drag_possible (AudioTimeAxisView**);
1353 void possibly_copy_regions_during_grab (GdkEvent*);
1354 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1355 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1357 bool _dragging_playhead;
1358 bool _dragging_edit_point;
1360 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1361 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1362 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1363 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1364 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1365 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1366 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1367 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1368 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1370 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1371 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1372 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1373 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1375 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1377 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1378 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1379 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1380 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1381 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1382 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1383 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1384 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1385 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1386 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1387 void start_line_grab (AutomationLine *, GdkEvent*);
1388 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1389 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1390 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1391 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1393 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1395 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1396 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1398 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1399 void brush (nframes64_t);
1401 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1402 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1403 double clamp_verbose_cursor_x (double);
1404 double clamp_verbose_cursor_y (double);
1406 /* Canvas event handlers */
1408 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1409 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1410 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1411 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1412 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1413 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1414 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1415 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1416 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1417 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1420 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1422 ArdourCanvas::Item *last_item_entered;
1423 int last_item_entered_n;
1426 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1427 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1428 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1429 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1430 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1431 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1432 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1433 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1434 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1436 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1437 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1438 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1439 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1440 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1441 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1443 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1444 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1445 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1446 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1447 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1448 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1449 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1450 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1452 /* non-public event handlers */
1454 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1455 bool track_canvas_scroll (GdkEventScroll* event);
1457 bool track_canvas_scroll_event (GdkEventScroll* event);
1458 bool track_canvas_button_press_event (GdkEventButton* event);
1459 bool track_canvas_button_release_event (GdkEventButton* event);
1460 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1462 Gtk::Allocation canvas_allocation;
1463 void track_canvas_allocate (Gtk::Allocation alloc);
1464 bool track_canvas_size_allocated ();
1466 void set_playhead_cursor ();
1468 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1469 void kbd_mute_unmute_region ();
1472 void kbd_do_brush (GdkEvent*);
1473 void kbd_do_audition (GdkEvent*);
1475 void handle_new_duration ();
1476 void initialize_canvas ();
1478 /* display control */
1480 bool _show_measures;
1482 bool _show_waveforms;
1483 bool _show_waveforms_rectified;
1484 bool _show_waveforms_recording;
1486 bool _stationary_playhead;
1487 bool _follow_playhead;
1489 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1491 TempoLines* tempo_lines;
1493 ArdourCanvas::Group* time_line_group;
1494 ArdourCanvas::SimpleLine* get_time_line ();
1495 void hide_measures ();
1496 void draw_measures ();
1497 bool redraw_measures ();
1499 void new_tempo_section ();
1501 void mouse_add_new_tempo_event (nframes64_t where);
1502 void mouse_add_new_meter_event (nframes64_t where);
1504 void remove_tempo_marker (ArdourCanvas::Item*);
1505 void remove_meter_marker (ArdourCanvas::Item*);
1506 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1507 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1509 void edit_tempo_section (ARDOUR::TempoSection*);
1510 void edit_meter_section (ARDOUR::MeterSection*);
1511 void edit_tempo_marker (ArdourCanvas::Item*);
1512 void edit_meter_marker (ArdourCanvas::Item*);
1514 void marker_menu_edit ();
1515 void marker_menu_remove ();
1516 void marker_menu_rename ();
1517 void marker_menu_lock (bool yn);
1518 void marker_menu_hide ();
1519 void marker_menu_loop_range ();
1520 void marker_menu_select_all_selectables_using_range ();
1521 void marker_menu_select_using_range ();
1522 void marker_menu_separate_regions_using_location ();
1523 void marker_menu_play_from ();
1524 void marker_menu_play_range ();
1525 void marker_menu_set_playhead ();
1526 void marker_menu_set_from_playhead ();
1527 void marker_menu_set_from_selection ();
1528 void marker_menu_range_to_next ();
1529 void marker_menu_export_range ();
1530 void new_transport_marker_menu_set_loop ();
1531 void new_transport_marker_menu_set_punch ();
1532 void update_loop_range_view (bool visibility=false);
1533 void update_punch_range_view (bool visibility=false);
1534 void new_transport_marker_menu_popdown ();
1535 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1536 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1537 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1538 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1539 void build_range_marker_menu (bool loop_or_punch);
1540 void build_marker_menu (bool start_or_end);
1541 void build_tm_marker_menu ();
1542 void build_new_transport_marker_menu ();
1544 Gtk::Menu* tm_marker_menu;
1545 Gtk::Menu* marker_menu;
1546 Gtk::Menu* start_end_marker_menu;
1547 Gtk::Menu* range_marker_menu;
1548 Gtk::Menu* transport_marker_menu;
1549 Gtk::Menu* new_transport_marker_menu;
1550 Gtk::Menu* cd_marker_menu;
1551 ArdourCanvas::Item* marker_menu_item;
1553 typedef list<Marker*> Marks;
1556 void remove_metric_marks ();
1557 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1559 void compute_current_bbt_points (nframes_t left, nframes_t right);
1560 void tempo_map_changed (ARDOUR::Change);
1561 void redisplay_tempo (bool immediate_redraw);
1563 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1565 uint32_t bbt_beat_subdivision;
1569 void editor_mixer_button_toggled ();
1571 AudioClock edit_point_clock;
1572 AudioClock zoom_range_clock;
1573 Gtk::Button zoom_in_button;
1574 Gtk::Button zoom_out_button;
1575 Gtk::Button zoom_out_full_button;
1576 Gtk::Button zoom_onetoone_button;
1578 Gtk::VBox toolbar_clock_vbox;
1579 Gtk::VBox toolbar_selection_clock_vbox;
1580 Gtk::Table toolbar_selection_clock_table;
1581 Gtk::Label toolbar_selection_cursor_label;
1583 Gtk::HBox mouse_mode_button_box;
1584 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1585 Gtk::ToggleButton mouse_select_button;
1586 Gtk::ToggleButton mouse_move_button;
1587 Gtk::ToggleButton mouse_gain_button;
1588 Gtk::ToggleButton mouse_zoom_button;
1589 Gtk::ToggleButton mouse_timefx_button;
1590 Gtk::ToggleButton mouse_audition_button;
1591 GroupedButtons *mouse_mode_button_set;
1592 void mouse_mode_toggled (Editing::MouseMode m);
1593 bool ignore_mouse_mode_toggle;
1595 gint mouse_select_button_release (GdkEventButton*);
1597 Gtk::VBox automation_box;
1598 Gtk::Button automation_mode_button;
1599 Gtk::ToggleButton global_automation_button;
1601 Gtk::ComboBoxText edit_mode_selector;
1602 Gtk::VBox edit_mode_box;
1604 void set_edit_mode (ARDOUR::EditMode);
1605 void cycle_edit_mode ();
1606 void edit_mode_selection_done ();
1608 Gtk::ComboBoxText snap_type_selector;
1609 Gtk::ComboBoxText snap_mode_selector;
1612 std::vector<std::string> snap_type_strings;
1613 std::vector<std::string> snap_mode_strings;
1615 void snap_type_selection_done ();
1616 void snap_mode_selection_done ();
1617 void snap_mode_chosen (Editing::SnapMode);
1618 void snap_type_chosen (Editing::SnapType);
1620 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1621 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1623 Gtk::ComboBoxText zoom_focus_selector;
1624 Gtk::VBox zoom_focus_box;
1626 std::vector<std::string> zoom_focus_strings;
1628 void zoom_focus_selection_done ();
1629 void zoom_focus_chosen (Editing::ZoomFocus);
1631 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1635 void zoom_adjustment_changed();
1637 void edit_point_clock_changed();
1639 void setup_toolbar ();
1641 Gtkmm2ext::TearOff* tools_tearoff;
1642 Gtk::HBox toolbar_hbox;
1643 Gtk::EventBox toolbar_base;
1644 Gtk::Frame toolbar_frame;
1646 /* selection process */
1648 Selection* selection;
1649 Selection* cut_buffer;
1651 void time_selection_changed ();
1652 void track_selection_changed ();
1653 void region_selection_changed ();
1654 void sensitize_the_right_region_actions (bool have_selected_regions);
1655 void point_selection_changed ();
1656 void marker_selection_changed ();
1665 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1666 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1667 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1668 void cancel_selection ();
1670 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1671 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1672 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1674 bool audio_region_selection_covers (nframes64_t where);
1676 /* transport range select process */
1677 enum RangeMarkerOp {
1679 CreateTransportMarker,
1683 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1684 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1685 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1687 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1688 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1689 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1690 ArdourCanvas::Line* marker_drag_line;
1691 ArdourCanvas::Points marker_drag_line_points;
1692 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1694 void update_marker_drag_item (ARDOUR::Location *);
1696 ArdourCanvas::SimpleRect *bogus_background_rect;
1698 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1699 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1700 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1701 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1702 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1703 ArdourCanvas::SimpleLine *transport_punchin_line;
1704 ArdourCanvas::SimpleLine *transport_punchout_line;
1705 ArdourCanvas::SimpleRect *transport_preroll_rect;
1706 ArdourCanvas::SimpleRect *transport_postroll_rect;
1708 ARDOUR::Location* transport_loop_location();
1709 ARDOUR::Location* transport_punch_location();
1711 ARDOUR::Location *temp_location;
1713 /* object rubberband select process */
1715 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1716 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1717 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1719 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1721 ArdourCanvas::SimpleRect *rubberband_rect;
1723 /* mouse zoom process */
1725 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1726 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1727 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1729 ArdourCanvas::SimpleRect *zoom_rect;
1730 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1732 /* diskstream/route display management */
1734 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1735 RouteDisplayModelColumns() {
1738 add (temporary_visible);
1742 Gtk::TreeModelColumn<Glib::ustring> text;
1743 Gtk::TreeModelColumn<bool> visible;
1744 Gtk::TreeModelColumn<bool> temporary_visible;
1745 Gtk::TreeModelColumn<TimeAxisView*> tv;
1746 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1749 RouteDisplayModelColumns route_display_columns;
1750 Glib::RefPtr<Gtk::ListStore> route_display_model;
1751 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1753 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1754 Gtk::ScrolledWindow route_list_scroller;
1755 Gtk::Menu* route_list_menu;
1757 void update_route_visibility ();
1759 void sync_order_keys (const char*);
1760 bool route_redisplay_does_not_sync_order_keys;
1761 bool route_redisplay_does_not_reset_order_keys;
1763 bool route_list_display_button_press (GdkEventButton*);
1764 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1767 const Gtk::SelectionData& data,
1771 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1773 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1774 void route_list_delete (const Gtk::TreeModel::Path&);
1775 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1777 void initial_route_list_display ();
1778 void redisplay_route_list();
1779 bool ignore_route_list_reorder;
1780 bool no_route_list_redisplay;
1781 bool sync_track_view_list_and_route_list ();
1783 void build_route_list_menu ();
1784 void show_route_list_menu ();
1786 void show_all_routes ();
1787 void hide_all_routes ();
1788 void show_all_audiotracks ();
1789 void hide_all_audiotracks ();
1790 void show_all_audiobus ();
1791 void hide_all_audiobus ();
1793 void set_all_tracks_visibility (bool yn);
1794 void set_all_audio_visibility (int type, bool yn);
1796 /* edit group management */
1798 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1799 GroupListModelColumns () {
1805 Gtk::TreeModelColumn<bool> is_active;
1806 Gtk::TreeModelColumn<bool> is_visible;
1807 Gtk::TreeModelColumn<std::string> text;
1808 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1811 GroupListModelColumns group_columns;
1812 Glib::RefPtr<Gtk::ListStore> group_model;
1813 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1815 Gtk::TreeView edit_group_display;
1816 Gtk::ScrolledWindow edit_group_display_scroller;
1817 Gtk::Menu* edit_group_list_menu;
1819 void build_edit_group_list_menu ();
1820 void activate_all_edit_groups ();
1821 void disable_all_edit_groups ();
1822 void show_all_edit_groups ();
1823 void hide_all_edit_groups ();
1825 bool in_edit_group_row_change;
1826 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1827 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1828 void new_edit_group ();
1829 void edit_group_list_button_clicked ();
1830 gint edit_group_list_button_press_event (GdkEventButton* ev);
1831 void add_edit_group (ARDOUR::RouteGroup* group);
1832 void remove_selected_edit_group ();
1833 void edit_groups_changed ();
1834 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1836 Gtk::VBox list_vpacker;
1840 bool autoscroll_active;
1841 int autoscroll_timeout_tag;
1844 int last_autoscroll_x;
1845 int last_autoscroll_y;
1846 uint32_t autoscroll_cnt;
1847 nframes64_t autoscroll_x_distance;
1848 double autoscroll_y_distance;
1850 static gint _autoscroll_canvas (void *);
1851 bool autoscroll_canvas ();
1852 void start_canvas_autoscroll (int x, int y);
1853 void stop_canvas_autoscroll ();
1854 void maybe_autoscroll (GdkEventMotion*);
1855 void maybe_autoscroll_horizontally (GdkEventMotion*);
1856 bool allow_vertical_scroll;
1865 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1866 void point_trim (GdkEvent*);
1867 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1868 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1869 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1870 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1872 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1873 void thaw_region_after_trim (RegionView& rv);
1875 void trim_region_front();
1876 void trim_region_back();
1877 void trim_region (bool front);
1879 void trim_region_to_edit_point ();
1880 void trim_region_from_edit_point ();
1881 void trim_region_to_loop ();
1882 void trim_region_to_punch ();
1883 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1885 bool show_gain_after_trim;
1889 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1890 const Glib::RefPtr<Gdk::DragContext>& context,
1893 const Gtk::SelectionData& data,
1897 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1900 const Gtk::SelectionData& data,
1904 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1907 const Gtk::SelectionData& data,
1911 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1914 const Gtk::SelectionData& data,
1918 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1921 const Gtk::SelectionData& data,
1927 ExportDialog *export_dialog;
1928 ExportDialog *export_range_markers_dialog;
1930 void export_range (nframes64_t start, nframes64_t end);
1931 void export_range_markers ();
1933 int write_region_selection(RegionSelection&);
1934 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1935 void export_region ();
1936 void bounce_region_selection ();
1937 void bounce_range_selection (bool replace, bool enable_processing = true);
1938 void external_edit_region ();
1940 int write_audio_selection (TimeSelection&);
1941 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1943 void write_selection ();
1947 UndoAction get_memento() const;
1949 XMLNode *before; /* used in *_reversible_command */
1950 void begin_reversible_command (string cmd_name);
1951 void commit_reversible_command ();
1953 void update_title ();
1954 void update_title_s (const string & snapshot_name);
1957 Selection* selection;
1958 double frames_per_unit;
1964 void store_state (State&) const;
1965 void restore_state (State *);
1967 void instant_save ();
1969 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1971 /* freeze operations */
1973 ARDOUR::InterThreadInfo freeze_status;
1974 gint freeze_progress_timeout (void *);
1975 static void* _freeze_thread (void*);
1976 void* freeze_thread ();
1978 void freeze_route ();
1979 void unfreeze_route ();
1981 /* edit-group solo + mute */
1983 void set_edit_group_solo (ARDOUR::Route&, bool);
1984 void set_edit_group_mute (ARDOUR::Route&, bool);
1988 void duplicate_dialog (bool with_dialog);
1990 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1992 /* returns false if mouse pointer is not in track or marker canvas
1994 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1996 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1997 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1998 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
2000 struct TimeFXDialog : public ArdourDialog {
2001 ARDOUR::TimeFXRequest request;
2004 Gtk::Adjustment pitch_octave_adjustment;
2005 Gtk::Adjustment pitch_semitone_adjustment;
2006 Gtk::Adjustment pitch_cent_adjustment;
2007 Gtk::SpinButton pitch_octave_spinner;
2008 Gtk::SpinButton pitch_semitone_spinner;
2009 Gtk::SpinButton pitch_cent_spinner;
2010 RegionSelection regions;
2011 Gtk::ProgressBar progress_bar;
2014 Gtk::ToggleButton quick_button;
2015 Gtk::ToggleButton antialias_button;
2016 Gtk::HBox upper_button_box;
2019 Gtk::ComboBoxText stretch_opts_selector;
2020 Gtk::Label stretch_opts_label;
2021 Gtk::ToggleButton precise_button;
2022 Gtk::ToggleButton preserve_formants_button;
2025 Gtk::Button* cancel_button;
2026 Gtk::Button* action_button;
2030 TimeFXDialog (Editor& e, bool for_pitch);
2032 gint update_progress ();
2033 sigc::connection first_cancel;
2034 sigc::connection first_delete;
2035 void cancel_in_progress ();
2036 gint delete_in_progress (GdkEventAny*);
2039 /* "whats mine is yours" */
2041 friend class TimeFXDialog;
2043 TimeFXDialog* current_timefx;
2045 static void* timefx_thread (void *arg);
2046 void do_timefx (TimeFXDialog&);
2048 int time_stretch (RegionSelection&, float fraction);
2049 int pitch_shift (RegionSelection&, float cents);
2050 void pitch_shift_regions ();
2051 int time_fx (RegionSelection&, float val, bool pitching);
2053 /* editor-mixer strip */
2055 MixerStrip *current_mixer_strip;
2056 bool show_editor_mixer_when_tracks_arrive;
2057 Gtk::VBox current_mixer_strip_vbox;
2058 void cms_deleted ();
2059 void current_mixer_strip_hidden ();
2060 void current_mixer_strip_removed ();
2062 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2063 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2065 void ensure_all_elements_drawn ();
2067 /* nudging tracks */
2069 void nudge_track (bool use_edit_point, bool forwards);
2073 bool _xfade_visibility;
2075 /* <CMT Additions> */
2076 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2077 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2079 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2080 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2082 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2083 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2084 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2086 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2087 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2088 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2089 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2091 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2092 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2093 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2094 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2096 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2097 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2098 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2099 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2100 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2101 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2103 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2104 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2105 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2106 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2107 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2108 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2110 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2111 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2113 ImageFrameSocketHandler* image_socket_listener ;
2114 /* </CMT Additions> */
2116 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2117 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2118 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2119 void xfade_edit_left_region ();
2120 void xfade_edit_right_region ();
2122 static const int32_t default_width = 995;
2123 static const int32_t default_height = 765;
2127 Gtk::Button nudge_forward_button;
2128 Gtk::Button nudge_backward_button;
2129 Gtk::HBox nudge_hbox;
2130 Gtk::VBox nudge_vbox;
2131 AudioClock nudge_clock;
2133 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2135 bool nudge_forward_release (GdkEventButton*);
2136 bool nudge_backward_release (GdkEventButton*);
2140 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2142 /* handling cleanup */
2144 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2146 vector<sigc::connection> session_connections;
2148 /* tracking step changes of track height */
2150 TimeAxisView* current_stepping_trackview;
2151 ARDOUR::microseconds_t last_track_height_step_timestamp;
2152 gint track_height_step_timeout();
2153 sigc::connection step_timeout;
2155 TimeAxisView* entered_track;
2156 RegionView* entered_regionview;
2159 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2160 bool clear_entered_track;
2161 bool left_track_canvas (GdkEventCrossing*);
2162 bool entered_track_canvas (GdkEventCrossing*);
2163 void set_entered_track (TimeAxisView*);
2164 void set_entered_regionview (RegionView*);
2165 void ensure_track_visible (TimeAxisView*);
2166 gint left_automation_track ();
2168 bool _new_regionviews_show_envelope;
2170 void reset_canvas_action_sensitivity (bool);
2171 void toggle_gain_envelope_visibility ();
2172 void toggle_gain_envelope_active ();
2173 void reset_region_gain_envelopes ();
2175 bool on_key_press_event (GdkEventKey*);
2176 bool on_key_release_event (GdkEventKey*);
2178 void session_state_saved (string);
2180 Glib::RefPtr<Gtk::Action> undo_action;
2181 Glib::RefPtr<Gtk::Action> redo_action;
2183 void history_changed ();
2184 void color_handler ();
2186 Gtk::HBox status_bar_hpacker;
2188 Editing::EditPoint _edit_point;
2190 Gtk::ComboBoxText edit_point_selector;
2192 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2193 void cycle_edit_point (bool with_marker);
2194 void set_edit_point ();
2195 void edit_point_selection_done ();
2196 void edit_point_chosen (Editing::EditPoint);
2197 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2198 std::vector<std::string> edit_point_strings;
2200 void selected_marker_moved (ARDOUR::Location*);
2201 sigc::connection edit_point_clock_connection_a;
2202 sigc::connection edit_point_clock_connection_b;
2204 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2206 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2207 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2209 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2211 sigc::connection fast_screen_update_connection;
2212 gint start_updating ();
2213 gint stop_updating ();
2214 void fast_update_strips ();
2215 bool meters_running;
2217 void select_next_route ();
2218 void select_prev_route ();
2220 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2222 RhythmFerret* rhythm_ferret;
2225 void set_track_height (uint32_t h);
2226 void set_track_height_largest ();
2227 void set_track_height_large ();
2228 void set_track_height_larger ();
2229 void set_track_height_normal ();
2230 void set_track_height_smaller ();
2231 void set_track_height_small ();
2233 void remove_tracks ();
2234 void toggle_tracks_active ();
2238 int32_t resize_idle_target;
2240 friend gboolean _idle_resize (gpointer);
2241 std::vector<TimeAxisView*> pending_resizes;
2244 #endif /* __ardour_editor_h__ */