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 /* option editor-access */
176 void set_show_waveforms (bool yn);
177 bool show_waveforms() const { return _show_waveforms; }
179 void set_waveform_scale (Editing::WaveformScale);
181 void set_show_waveforms_recording (bool yn);
182 bool show_waveforms_recording() const { return _show_waveforms_recording; }
184 /* things that need to be public to be used in the main menubar */
186 void new_region_from_selection ();
187 void separate_regions_between (const TimeSelection&);
188 void separate_region_from_selection ();
189 void separate_region_from_punch ();
190 void separate_region_from_loop ();
191 void separate_regions_using_location (ARDOUR::Location&);
192 void toggle_playback (bool with_abort);
193 void transition_to_rolling (bool forward);
197 nframes64_t unit_to_frame (double unit) const {
198 return (nframes64_t) rint (unit * frames_per_unit);
201 double frame_to_unit (nframes64_t frame) const {
202 return rint ((double) frame / (double) frames_per_unit);
205 double frame_to_unit (double frame) const {
206 return rint (frame / frames_per_unit);
209 /* NOTE: these functions assume that the "pixel" coordinate is
210 the result of using the world->canvas affine transform on a
211 world coordinate. These coordinates already take into
212 account any scrolling carried out by adjusting the
216 nframes64_t pixel_to_frame (double pixel) const {
218 /* pixel can be less than zero when motion events
219 are processed. since we've already run the world->canvas
220 affine, that means that the location *really* is "off
221 to the right" and thus really is "before the start".
225 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
231 gulong frame_to_pixel (nframes64_t frame) const {
232 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
235 void flush_canvas ();
239 Selection& get_selection() const { return *selection; }
240 Selection& get_cut_buffer() const { return *cut_buffer; }
242 bool extend_selection_to_track (TimeAxisView&);
244 void play_selection ();
245 void select_all_in_track (Selection::Operation op);
246 void select_all (Selection::Operation op);
247 void invert_selection_in_track ();
248 void invert_selection ();
249 void deselect_all ();
253 void set_show_measures (bool yn);
254 bool show_measures () const { return _show_measures; }
257 /* analysis window */
258 void analyze_region_selection();
259 void analyze_range_selection();
264 /* these initiate export ... */
266 void export_session();
267 void export_selection();
269 void add_toplevel_controls (Gtk::Container&);
270 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
272 void set_zoom_focus (Editing::ZoomFocus);
273 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
274 double get_current_zoom () const { return frames_per_unit; }
276 void temporal_zoom_step (bool coarser);
278 /* stuff that AudioTimeAxisView and related classes use */
280 PlaylistSelector& playlist_selector() const;
281 void route_name_changed (TimeAxisView *);
282 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
284 void new_playlists (TimeAxisView*);
285 void copy_playlists (TimeAxisView*);
286 void clear_playlists (TimeAxisView*);
288 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
290 Width editor_mixer_strip_width;
291 void maybe_add_mixer_strip_width (XMLNode&);
292 void show_editor_mixer (bool yn);
293 void set_selected_mixer_strip (TimeAxisView&);
294 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
295 void show_track_in_display (TimeAxisView& tv);
297 /* nudge is initiated by transport controls owned by ARDOUR_UI */
299 void nudge_forward (bool next, bool force_playhead);
300 void nudge_backward (bool next, bool force_playhead);
302 /* nudge initiated from context menu */
304 void nudge_forward_capture_offset ();
305 void nudge_backward_capture_offset ();
307 /* playhead/screen stuff */
309 void set_follow_playhead (bool yn);
310 void toggle_follow_playhead ();
311 bool follow_playhead() const { return _follow_playhead; }
312 bool dragging_playhead () const { return _dragging_playhead; }
314 void toggle_waveform_visibility ();
315 void toggle_waveforms_while_recording ();
316 void toggle_measure_visibility ();
317 void toggle_logo_visibility ();
319 double physical_screen_width;
320 double physical_screen_height;
322 /* SMPTE timecode & video sync */
324 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
325 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
326 void subframes_per_frame_chosen (uint32_t);
328 void update_smpte_mode();
329 void update_video_pullup();
330 void update_subframes_per_frame ();
334 void toggle_region_fades ();
335 void toggle_region_fades_visible ();
336 void toggle_selected_region_fades (int dir);
337 void update_region_fade_visibility ();
339 void toggle_auto_xfade ();
340 void toggle_xfades_active ();
341 void toggle_xfade_visibility ();
342 bool xfade_visibility() const { return _xfade_visibility; }
343 void update_xfade_visibility ();
344 void update_crossfade_model ();
345 void set_crossfade_model (ARDOUR::CrossfadeModel);
348 void set_layer_model (ARDOUR::LayerModel);
349 void update_layering_model ();
351 void toggle_link_region_and_track_selection ();
353 /* redirect shared ops menu. caller must free returned menu */
355 Gtk::Menu* redirect_menu ();
357 /* floating windows/transient */
359 void ensure_float (Gtk::Window&);
363 void scroll_tracks_down_line ();
364 void scroll_tracks_up_line ();
366 void move_selected_tracks (bool up);
368 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
369 void prepare_for_cleanup ();
370 void finish_cleanup ();
372 void maximise_editing_space();
373 void restore_editing_space();
375 void reset_x_origin (nframes64_t);
376 void reset_zoom (double);
377 void reposition_and_zoom (nframes64_t, double);
379 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
381 bool update_mouse_speed ();
382 bool decelerate_mouse_speed ();
384 void toggle_meter_updating();
386 void show_rhythm_ferret();
388 void goto_visual_state (uint32_t);
389 void save_visual_state (uint32_t);
391 void queue_draw_resize_line (int at);
392 void start_resize_line_ops ();
393 void end_resize_line_ops ();
396 void map_transport_state ();
397 void map_position_change (nframes64_t);
400 bool on_expose_event (GdkEventExpose*);
404 ARDOUR::Session *session;
407 // to keep track of the playhead position for control_scroll
408 boost::optional<nframes64_t> _control_scroll_target;
410 PlaylistSelector* _playlist_selector;
412 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
416 double frames_per_unit;
417 nframes64_t leftmost_frame;
418 Editing::ZoomFocus zoom_focus;
419 bool zoomed_to_region;
420 std::list<TAVState> track_states;
423 std::list<VisualState*> undo_visual_stack;
424 std::list<VisualState*> redo_visual_stack;
425 VisualState* current_visual_state (bool with_tracks = true);
426 void undo_visual_state ();
427 void redo_visual_state ();
428 void use_visual_state (VisualState&);
430 void swap_visual_state ();
432 std::vector<VisualState*> visual_states;
433 sigc::connection visual_state_op_connection;
434 void start_visual_state_op (uint32_t n);
435 void cancel_visual_state_op (uint32_t n);
436 bool end_visual_state_op (uint32_t n);
438 nframes64_t leftmost_frame;
439 double frames_per_unit;
440 Editing::ZoomFocus zoom_focus;
442 void set_frames_per_unit (double);
445 Editing::MouseMode mouse_mode;
447 int post_maximal_editor_width;
448 int post_maximal_pane_position;
449 int pre_maximal_pane_position;
450 int pre_maximal_editor_width;
451 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
453 Gtk::Notebook the_notebook;
454 Gtk::HPaned edit_pane;
456 Gtk::EventBox meter_base;
458 Gtk::EventBox marker_base;
459 Gtk::HBox marker_box;
460 Gtk::VBox scrollers_rulers_markers_box;
462 void location_changed (ARDOUR::Location *);
463 void location_flags_changed (ARDOUR::Location *, void *);
464 void refresh_location_display ();
465 void refresh_location_display_s (ARDOUR::Change);
466 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
467 void add_new_location (ARDOUR::Location *);
468 void location_gone (ARDOUR::Location *);
469 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
470 gint really_remove_marker (ARDOUR::Location* loc);
471 void goto_nth_marker (int nth);
473 uint32_t location_marker_color;
474 uint32_t location_range_color;
475 uint32_t location_loop_color;
476 uint32_t location_punch_color;
477 uint32_t location_cd_marker_color;
479 struct LocationMarkers {
484 LocationMarkers () : start(0), end(0), valid (true) {}
490 void set_name (const string&);
491 void set_position (nframes64_t start, nframes64_t end = 0);
492 void set_color_rgba (uint32_t);
495 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
496 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
497 Marker* entered_marker;
499 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
500 LocationMarkerMap location_markers;
502 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
503 void clear_marker_display ();
504 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
505 bool choose_new_marker_name(string &name);
506 void update_cd_marker_display ();
507 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
509 TimeAxisView* clicked_trackview;
510 AudioTimeAxisView* clicked_audio_trackview;
511 RegionView* clicked_regionview;
512 RegionSelection latest_regionviews;
513 uint32_t clicked_selection;
514 CrossfadeView* clicked_crossfadeview;
515 ControlPoint* clicked_control_point;
517 void sort_track_selection (TrackSelection* sel = 0);
519 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
520 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
521 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
523 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
525 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
526 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
527 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
528 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
532 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
533 bool button_release_can_deselect;
535 void catch_vanishing_regionview (RegionView *);
537 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
538 void select_all_tracks ();
540 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
541 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
542 void set_selected_track_as_side_effect (bool force = false);
543 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
545 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
546 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
547 void collect_new_region_view (RegionView *);
549 Gtk::Menu track_context_menu;
550 Gtk::Menu track_region_context_menu;
551 Gtk::Menu track_selection_context_menu;
552 Gtk::Menu track_crossfade_context_menu;
554 Gtk::MenuItem* region_edit_menu_split_item;
555 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
556 Gtk::Menu * track_region_edit_playlist_menu;
557 Gtk::Menu * track_edit_playlist_submenu;
558 Gtk::Menu * track_selection_edit_playlist_submenu;
560 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
561 Gtk::Menu* build_track_context_menu (nframes64_t);
562 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
563 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
564 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
565 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
566 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
567 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
568 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
569 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
570 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
572 void handle_new_route (ARDOUR::Session::RouteList&);
573 void remove_route (TimeAxisView *);
576 Gtk::HBox global_hpacker;
577 Gtk::VBox global_vpacker;
580 bool need_resize_line;
582 int old_resize_line_y;
584 Gdk::Cursor* current_canvas_cursor;
585 void set_canvas_cursor ();
586 Gdk::Cursor* which_grabber_cursor ();
588 ArdourCanvas::Canvas* track_canvas;
590 ArdourCanvas::Text* first_action_message;
591 ArdourCanvas::Text* verbose_canvas_cursor;
592 bool verbose_cursor_visible;
594 void parameter_changed (const char *);
596 bool track_canvas_motion (GdkEvent*);
598 void set_verbose_canvas_cursor (const string &, double x, double y);
599 void set_verbose_canvas_cursor_text (const string &);
600 void show_verbose_canvas_cursor();
601 void hide_verbose_canvas_cursor();
603 bool verbose_cursor_on; // so far unused
605 Gtk::EventBox time_canvas_event_box;
606 Gtk::EventBox track_canvas_event_box;
607 Gtk::EventBox time_button_event_box;
608 Gtk::EventBox ruler_label_event_box;
610 ArdourCanvas::Pixbuf* logo_item;
611 ArdourCanvas::Group* minsec_group;
612 ArdourCanvas::Group* bbt_group;
613 ArdourCanvas::Group* smpte_group;
614 ArdourCanvas::Group* frame_group;
615 ArdourCanvas::Group* tempo_group;
616 ArdourCanvas::Group* meter_group;
617 ArdourCanvas::Group* marker_group;
618 ArdourCanvas::Group* range_marker_group;
619 ArdourCanvas::Group* transport_marker_group;
620 ArdourCanvas::Group* cd_marker_group;
622 ArdourCanvas::Group* timebar_group;
624 /* These bars never need to be scrolled */
625 ArdourCanvas::Group* meter_bar_group;
626 ArdourCanvas::Group* tempo_bar_group;
627 ArdourCanvas::Group* marker_bar_group;
628 ArdourCanvas::Group* range_marker_bar_group;
629 ArdourCanvas::Group* transport_marker_bar_group;
630 ArdourCanvas::Group* cd_marker_bar_group;
633 The _master_group is the group containing all items
634 that require horizontal scrolling..
635 It is primarily used to separate canvas items
636 that require horizontal scrolling from those that do not.
638 ArdourCanvas::Group* _master_group;
640 The _trackview_group is the group containing all trackviews.
641 It is only scrolled vertically.
643 ArdourCanvas::Group* _trackview_group;
645 This canvas group is used for region motion.
646 It sits on top of the _trackview_group
648 ArdourCanvas::Group* _region_motion_group;
651 ruler_metric_smpte = 0,
652 ruler_metric_bbt = 1,
653 ruler_metric_frames = 2,
654 ruler_metric_minsec = 3,
656 ruler_time_tempo = 4,
657 ruler_time_meter = 5,
658 ruler_time_marker = 6,
659 ruler_time_range_marker = 7,
660 ruler_time_transport_marker = 8,
661 ruler_time_cd_marker = 9,
664 static GtkCustomMetric ruler_metrics[4];
665 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
666 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
667 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
668 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
669 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
670 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
671 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
672 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
673 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
674 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
675 bool no_ruler_shown_update;
677 gint ruler_button_press (GdkEventButton*);
678 gint ruler_button_release (GdkEventButton*);
679 gint ruler_mouse_motion (GdkEventMotion*);
680 bool ruler_scroll (GdkEventScroll* event);
682 gint ruler_pressed_button;
683 Gtk::Widget * ruler_grabbed_widget;
685 void initialize_rulers ();
686 void update_just_smpte ();
687 void update_fixed_rulers ();
688 void update_tempo_based_rulers ();
689 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
690 void update_ruler_visibility ();
691 void set_ruler_visible (RulerType, bool);
692 void toggle_ruler_visibility (RulerType rt);
693 void ruler_toggled (int);
694 gint ruler_label_button_release (GdkEventButton*);
695 void store_ruler_visibility ();
696 void restore_ruler_visibility ();
698 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
699 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
700 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
701 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
703 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
704 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
705 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
706 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
708 Gtk::Widget *_ruler_separator;
709 GtkWidget *_smpte_ruler;
710 GtkWidget *_bbt_ruler;
711 GtkWidget *_frames_ruler;
712 GtkWidget *_minsec_ruler;
713 Gtk::Widget *smpte_ruler;
714 Gtk::Widget *bbt_ruler;
715 Gtk::Widget *frames_ruler;
716 Gtk::Widget *minsec_ruler;
717 static Editor *ruler_editor;
719 static const double timebar_height;
720 guint32 visible_timebars;
721 gdouble canvas_timebars_vsize;
722 Gtk::Menu *editor_ruler_menu;
724 ArdourCanvas::SimpleRect* tempo_bar;
725 ArdourCanvas::SimpleRect* meter_bar;
726 ArdourCanvas::SimpleRect* marker_bar;
727 ArdourCanvas::SimpleRect* range_marker_bar;
728 ArdourCanvas::SimpleRect* transport_marker_bar;
729 ArdourCanvas::SimpleRect* cd_marker_bar;
732 ArdourCanvas::SimpleLine* tempo_line;
733 ArdourCanvas::SimpleLine* meter_line;
734 ArdourCanvas::SimpleLine* marker_line;
735 ArdourCanvas::SimpleLine* range_marker_line;
736 ArdourCanvas::SimpleLine* transport_marker_line;
737 ArdourCanvas::SimpleLine* cd_marker_line;
739 Gtk::Label minsec_label;
740 Gtk::Label bbt_label;
741 Gtk::Label smpte_label;
742 Gtk::Label frame_label;
743 Gtk::Label tempo_label;
744 Gtk::Label meter_label;
745 Gtk::Label mark_label;
746 Gtk::Label range_mark_label;
747 Gtk::Label transport_mark_label;
748 Gtk::Label cd_mark_label;
751 Gtk::VBox time_button_vbox;
752 Gtk::HBox time_button_hbox;
756 ArdourCanvas::Points points;
757 ArdourCanvas::Line canvas_item;
758 nframes64_t current_frame;
761 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
764 void set_position (nframes64_t);
765 void set_length (double units);
766 void set_y_axis (double position);
769 friend struct Cursor; /* it needs access to several private
773 Cursor* playhead_cursor;
774 ArdourCanvas::Group* cursor_group;
776 void cursor_to_region_boundary (Cursor*, int32_t dir);
777 void cursor_to_next_region_boundary (Cursor*);
778 void cursor_to_previous_region_boundary (Cursor*);
779 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
780 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
781 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
782 void cursor_to_selection_start (Cursor *);
783 void cursor_to_selection_end (Cursor *);
785 void selected_marker_to_region_boundary (int32_t dir);
786 void selected_marker_to_next_region_boundary ();
787 void selected_marker_to_previous_region_boundary ();
788 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
789 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
790 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
791 void selected_marker_to_selection_start ();
792 void selected_marker_to_selection_end ();
794 void select_all_selectables_using_cursor (Cursor *, bool);
795 void select_all_selectables_using_edit (bool);
796 void select_all_selectables_between (bool within);
797 void select_range_between ();
799 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
800 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
802 vector<nframes64_t> region_boundary_cache;
803 void build_region_boundary_cache ();
806 Gtk::HBox bottom_hbox;
808 Gtk::Table edit_packer;
809 Gtk::VScrollbar edit_vscrollbar;
811 Gtk::Adjustment vertical_adjustment;
812 Gtk::Adjustment horizontal_adjustment;
814 Gtk::Layout controls_layout;
815 bool control_layout_scroll (GdkEventScroll* ev);
816 void controls_layout_size_request (Gtk::Requisition*);
817 sigc::connection controls_layout_size_request_connection;
819 Gtk::HScrollbar edit_hscrollbar;
820 bool _dragging_hscrollbar;
822 void reset_hscrollbar_stepping ();
824 bool hscrollbar_button_press (GdkEventButton*);
825 bool hscrollbar_button_release (GdkEventButton*);
826 void hscrollbar_allocate (Gtk::Allocation &alloc);
829 double canvas_height;
830 double full_canvas_height;
831 nframes64_t last_canvas_frame;
833 bool track_canvas_map_handler (GdkEventAny*);
835 gint edit_controls_button_release (GdkEventButton*);
836 Gtk::Menu *edit_controls_left_menu;
837 Gtk::Menu *edit_controls_right_menu;
839 Gtk::VBox ruler_label_vbox;
840 Gtk::VBox track_canvas_vbox;
841 Gtk::VBox time_canvas_vbox;
842 Gtk::VBox edit_controls_vbox;
843 Gtk::HBox edit_controls_hbox;
845 void control_scroll (float);
846 void access_action (std::string,std::string);
847 bool deferred_control_scroll (nframes64_t);
848 sigc::connection control_scroll_connection;
850 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
851 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
852 double last_trackview_group_vertical_offset;
853 void tie_vertical_scrolling ();
854 void scroll_canvas_horizontally ();
855 void scroll_canvas_vertically ();
856 void canvas_horizontally_scrolled ();
857 void canvas_scroll_to (nframes64_t);
859 struct VisualChange {
866 nframes64_t time_origin;
867 double frames_per_unit;
871 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
875 VisualChange pending_visual_change;
877 static int _idle_visual_changer (void *arg);
878 int idle_visual_changer ();
880 void queue_visual_change (nframes64_t);
881 void queue_visual_change (double);
883 void end_location_changed (ARDOUR::Location*);
885 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
886 RegionListDisplayModelColumns() {
891 Gtk::TreeModelColumn<Glib::ustring> name;
892 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
893 Gtk::TreeModelColumn<Gdk::Color> color_;
896 RegionListDisplayModelColumns region_list_columns;
897 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
899 Glib::RefPtr<Gtk::TreeStore> region_list_model;
900 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
901 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
903 void region_list_selection_changed ();
904 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
905 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
906 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
908 Gtk::Menu *region_list_menu;
909 Gtk::ScrolledWindow region_list_scroller;
910 Gtk::Frame region_list_frame;
912 bool region_list_display_key_press (GdkEventKey *);
913 bool region_list_display_key_release (GdkEventKey *);
914 bool region_list_display_button_press (GdkEventButton *);
915 bool region_list_display_button_release (GdkEventButton *);
916 void region_list_clear ();
917 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
918 void build_region_list_menu ();
919 void show_region_list_display_context_menu (int button, int time);
921 bool show_automatic_regions_in_region_list;
922 Editing::RegionListSortType region_list_sort_type;
924 void reset_region_list_sort_direction (bool);
925 void reset_region_list_sort_type (Editing::RegionListSortType);
927 void toggle_full_region_list ();
928 void toggle_show_auto_regions ();
930 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
934 Gtk::ScrolledWindow snapshot_display_scroller;
935 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
936 SnapshotDisplayModelColumns() {
940 Gtk::TreeModelColumn<Glib::ustring> visible_name;
941 Gtk::TreeModelColumn<Glib::ustring> real_name;
944 SnapshotDisplayModelColumns snapshot_display_columns;
945 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
946 Gtk::TreeView snapshot_display;
947 Gtk::Menu snapshot_context_menu;
949 bool snapshot_display_button_press (GdkEventButton*);
950 void snapshot_display_selection_changed ();
951 void redisplay_snapshots();
952 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
954 /* named selections */
956 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
957 NamedSelectionDisplayModelColumns() {
961 Gtk::TreeModelColumn<Glib::ustring> text;
962 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
965 NamedSelectionDisplayModelColumns named_selection_columns;
966 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
968 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
969 Gtk::ScrolledWindow named_selection_scroller;
971 void create_named_selection ();
972 void paste_named_selection (float times);
973 void remove_selected_named_selections ();
974 void remove_snapshot (Glib::ustring);
975 void rename_snapshot (Glib::ustring);
977 void handle_new_named_selection ();
978 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
979 void redisplay_named_selections ();
981 bool named_selection_display_button_release (GdkEventButton *ev);
982 bool named_selection_display_key_release (GdkEventKey *ev);
983 void named_selection_display_selection_changed ();
986 TrackViewList track_views;
987 TimeAxisView *trackview_by_y_position (double ypos);
989 static Gdk::Cursor* cross_hair_cursor;
990 static Gdk::Cursor* trimmer_cursor;
991 static Gdk::Cursor* selector_cursor;
992 static Gdk::Cursor* grabber_cursor;
993 static Gdk::Cursor* grabber_edit_point_cursor;
994 static Gdk::Cursor* zoom_cursor;
995 static Gdk::Cursor* time_fx_cursor;
996 static Gdk::Cursor* fader_cursor;
997 static Gdk::Cursor* speaker_cursor;
998 static Gdk::Cursor* wait_cursor;
999 static Gdk::Cursor* timebar_cursor;
1000 static Gdk::Cursor* transparent_cursor;
1002 static void build_cursors ();
1004 sigc::connection scroll_connection;
1005 nframes64_t last_update_frame;
1006 void center_screen (nframes64_t);
1007 void center_screen_internal (nframes64_t, float);
1009 void update_current_screen ();
1011 void session_going_away ();
1013 nframes64_t cut_buffer_start;
1014 nframes64_t cut_buffer_length;
1016 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1017 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1018 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1019 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1020 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1021 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1023 /* KEYMAP HANDLING */
1025 void register_actions ();
1027 int ensure_cursor (nframes64_t* pos);
1029 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
1030 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
1031 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
1032 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
1033 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
1034 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1035 void redisplay_regions ();
1036 bool no_region_list_redisplay;
1037 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
1039 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
1041 void cut_copy (Editing::CutCopyOp);
1042 void cut_copy_points (Editing::CutCopyOp);
1043 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1044 void cut_copy_ranges (Editing::CutCopyOp);
1046 void mouse_paste ();
1047 void paste_internal (nframes64_t position, float times);
1049 /* EDITING OPERATIONS */
1051 void reset_point_selection ();
1052 void toggle_region_mute ();
1053 void toggle_region_lock ();
1054 void toggle_region_opaque ();
1055 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1056 void raise_region ();
1057 void raise_region_to_top ();
1058 void lower_region ();
1059 void lower_region_to_bottom ();
1060 void split_region ();
1061 void split_region_at (nframes64_t);
1062 void split_regions_at (nframes64_t, RegionSelection&);
1063 void split_region_at_transients ();
1064 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1065 void crop_region_to_selection ();
1066 void crop_region_to (nframes64_t start, nframes64_t end);
1067 void set_sync_point (nframes64_t, const RegionSelection&);
1068 void set_region_sync_from_edit_point ();
1069 void remove_region_sync();
1070 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1071 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1072 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1073 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1074 void remove_region ();
1075 void remove_clicked_region ();
1076 void edit_region ();
1077 void rename_region ();
1078 void duplicate_some_regions (RegionSelection&, float times);
1079 void duplicate_selection (float times);
1080 void region_fill_selection ();
1082 void region_fill_track ();
1083 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1084 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1085 void split_multichannel_region();
1086 void reverse_region ();
1087 void normalize_region ();
1088 void denormalize_region ();
1089 void adjust_region_scale_amplitude (bool up);
1091 void do_insert_time ();
1092 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1094 void tab_to_transient (bool forward);
1096 void use_region_as_bar ();
1097 void use_range_as_bar ();
1099 void define_one_bar (nframes64_t start, nframes64_t end);
1101 void audition_region_from_region_list ();
1102 void hide_region_from_region_list ();
1103 void remove_region_from_region_list ();
1105 void align (ARDOUR::RegionPoint);
1106 void align_relative (ARDOUR::RegionPoint);
1109 void reset_focus ();
1115 void paste (float times);
1117 int get_prefix (float&, bool&);
1119 void keyboard_paste ();
1120 void keyboard_insert_region_list_selection ();
1122 void region_from_selection ();
1123 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1125 void play_from_start ();
1126 void play_from_edit_point ();
1127 void play_from_edit_point_and_return ();
1128 void play_selected_region ();
1129 void play_edit_range ();
1130 void loop_selected_region ();
1131 void play_location (ARDOUR::Location&);
1132 void loop_location (ARDOUR::Location&);
1134 void temporal_zoom_selection ();
1135 void temporal_zoom_region (bool both_axes);
1136 void toggle_zoom_region (bool both_axes);
1137 bool zoomed_to_region;
1138 void temporal_zoom_session ();
1139 void temporal_zoom (gdouble scale);
1140 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1141 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1143 void amplitude_zoom (gdouble scale);
1144 void amplitude_zoom_step (bool in);
1146 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1147 void insert_region_list_selection (float times);
1149 void add_external_audio_action (Editing::ImportMode);
1150 void external_audio_dialog ();
1152 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1153 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1155 SoundFileOmega* sfbrowser;
1157 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1159 void _do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1160 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1161 bool idle_do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1163 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1164 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1165 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1167 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1168 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool);
1169 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1170 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1172 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1173 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1174 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1175 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1177 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1179 /* generic interthread progress window */
1181 ArdourDialog* interthread_progress_window;
1182 Gtk::Label interthread_progress_label;
1183 Gtk::VBox interthread_progress_vbox;
1184 Gtk::ProgressBar interthread_progress_bar;
1185 Gtk::Button interthread_cancel_button;
1186 Gtk::Label interthread_cancel_label;
1187 sigc::connection interthread_progress_connection;
1188 void interthread_cancel_clicked ();
1189 void build_interthread_progress_window ();
1190 ARDOUR::InterThreadInfo* current_interthread_info;
1193 AnalysisWindow* analysis_window;
1196 /* import specific info */
1198 ARDOUR::Session::import_status import_status;
1199 gint import_progress_timeout (void *);
1200 static void *_import_thread (void *);
1201 void* import_thread ();
1203 /* to support this ... */
1205 void import_audio (bool as_tracks);
1206 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1208 void move_to_start ();
1209 void move_to_end ();
1211 void center_playhead ();
1212 void center_edit_point ();
1213 void edit_cursor_backward ();
1214 void edit_cursor_forward ();
1215 void playhead_forward_to_grid ();
1216 void playhead_backward_to_grid ();
1217 void playhead_backward ();
1218 void playhead_forward ();
1219 void scroll_playhead (bool forward);
1220 void scroll_backward (float pages=0.8f);
1221 void scroll_forward (float pages=0.8f);
1222 void scroll_tracks_down ();
1223 void scroll_tracks_up ();
1224 void delete_sample_forward ();
1225 void delete_sample_backward ();
1226 void delete_screen ();
1227 void search_backwards ();
1228 void search_forwards ();
1230 void clear_markers ();
1231 void clear_ranges ();
1232 void clear_locations ();
1233 void unhide_markers ();
1234 void unhide_ranges ();
1235 void jump_forward_to_mark ();
1236 void jump_backward_to_mark ();
1237 void cursor_align (bool playhead_to_edit);
1239 void remove_last_capture ();
1240 void select_all_selectables_using_time_selection ();
1241 void select_all_selectables_using_loop();
1242 void select_all_selectables_using_punch();
1243 void set_selection_from_range (ARDOUR::Location&);
1244 void set_selection_from_punch ();
1245 void set_selection_from_loop ();
1246 void set_selection_from_audio_region ();
1248 void add_location_mark (nframes64_t where);
1249 void add_location_from_audio_region ();
1250 void add_location_from_selection ();
1251 void set_loop_from_selection (bool play);
1252 void set_punch_from_selection ();
1253 void set_punch_from_region ();
1255 void set_loop_from_edit_range (bool play);
1256 void set_loop_from_region (bool play);
1257 void set_punch_from_edit_range ();
1259 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1260 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1262 void add_location_from_playhead_cursor ();
1263 bool select_new_marker;
1265 void reverse_selection ();
1266 void edit_envelope ();
1268 void start_scrolling ();
1269 void stop_scrolling ();
1272 double last_scrub_x;
1273 int scrubbing_direction;
1274 int scrub_reversals;
1275 int scrub_reverse_distance;
1278 void keyboard_selection_begin ();
1279 void keyboard_selection_finish (bool add);
1280 bool have_pending_keyboard_selection;
1281 nframes64_t pending_keyboard_selection_start;
1283 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1284 void extend_selection_to_end_of_region (bool next);
1285 void extend_selection_to_start_of_region (bool previous);
1287 Editing::SnapType snap_type;
1288 Editing::SnapMode snap_mode;
1289 double snap_threshold;
1291 void handle_gui_changes (const string &, void *);
1293 void hide_all_tracks (bool with_select);
1296 LineDragInfo current_line_drag_info;
1298 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1299 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1300 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1302 void finalize_drag ();
1304 Gtk::Menu fade_context_menu;
1305 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1307 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1308 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1309 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1310 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1311 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1312 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1314 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1315 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1317 void set_fade_length (bool in);
1318 void toggle_fade_active (bool in);
1319 void set_fade_in_active (bool);
1320 void set_fade_out_active (bool);
1322 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1323 RegionSelection pre_drag_region_selection;
1324 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1325 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1326 bool check_region_drag_possible (AudioTimeAxisView**);
1327 void possibly_copy_regions_during_grab (GdkEvent*);
1328 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1329 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1331 bool _dragging_playhead;
1332 bool _dragging_edit_point;
1334 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1335 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1336 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1337 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1338 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1339 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1340 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1341 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1343 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1344 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1345 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1346 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1348 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1350 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1351 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1352 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1353 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1354 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1355 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1356 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1357 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1358 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1359 void start_line_grab (AutomationLine *, GdkEvent*);
1360 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1361 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1362 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1363 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1365 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1367 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1368 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1370 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1371 void brush (nframes64_t);
1373 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1374 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1375 double clamp_verbose_cursor_x (double);
1376 double clamp_verbose_cursor_y (double);
1378 /* Canvas event handlers */
1380 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1381 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1382 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1383 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1384 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1385 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1386 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1387 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1388 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1389 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1392 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1394 ArdourCanvas::Item *last_item_entered;
1395 int last_item_entered_n;
1398 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1399 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1400 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1401 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1402 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1403 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1404 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1405 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1406 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1408 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1409 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1410 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1411 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1412 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1413 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1415 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1416 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1417 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1418 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1419 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1420 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1421 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1422 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1424 /* non-public event handlers */
1426 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1427 bool track_canvas_scroll (GdkEventScroll* event);
1429 bool track_canvas_scroll_event (GdkEventScroll* event);
1430 bool track_canvas_button_press_event (GdkEventButton* event);
1431 bool track_canvas_button_release_event (GdkEventButton* event);
1432 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1434 Gtk::Allocation canvas_allocation;
1435 void track_canvas_allocate (Gtk::Allocation alloc);
1436 bool track_canvas_size_allocated ();
1438 void set_playhead_cursor ();
1440 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1441 void kbd_mute_unmute_region ();
1444 void kbd_do_brush (GdkEvent*);
1445 void kbd_do_audition (GdkEvent*);
1447 void handle_new_duration ();
1448 void initialize_canvas ();
1450 /* display control */
1452 bool _show_measures;
1453 bool _show_waveforms;
1454 bool _follow_playhead;
1455 bool _show_waveforms_recording;
1457 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1459 TempoLines* tempo_lines;
1461 ArdourCanvas::Group* time_line_group;
1462 ArdourCanvas::SimpleLine* get_time_line ();
1463 void hide_measures ();
1464 void draw_measures ();
1465 bool redraw_measures ();
1467 void new_tempo_section ();
1469 void mouse_add_new_tempo_event (nframes64_t where);
1470 void mouse_add_new_meter_event (nframes64_t where);
1472 void remove_tempo_marker (ArdourCanvas::Item*);
1473 void remove_meter_marker (ArdourCanvas::Item*);
1474 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1475 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1477 void edit_tempo_section (ARDOUR::TempoSection*);
1478 void edit_meter_section (ARDOUR::MeterSection*);
1479 void edit_tempo_marker (ArdourCanvas::Item*);
1480 void edit_meter_marker (ArdourCanvas::Item*);
1482 void marker_menu_edit ();
1483 void marker_menu_remove ();
1484 void marker_menu_rename ();
1485 void marker_menu_lock (bool yn);
1486 void marker_menu_hide ();
1487 void marker_menu_loop_range ();
1488 void marker_menu_select_all_selectables_using_range ();
1489 void marker_menu_select_using_range ();
1490 void marker_menu_separate_regions_using_location ();
1491 void marker_menu_play_from ();
1492 void marker_menu_play_range ();
1493 void marker_menu_set_playhead ();
1494 void marker_menu_set_from_playhead ();
1495 void marker_menu_set_from_selection ();
1496 void marker_menu_range_to_next ();
1497 void marker_menu_export_range ();
1498 void new_transport_marker_menu_set_loop ();
1499 void new_transport_marker_menu_set_punch ();
1500 void update_loop_range_view (bool visibility=false);
1501 void update_punch_range_view (bool visibility=false);
1502 gint new_transport_marker_menu_popdown (GdkEventAny*);
1503 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1504 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1505 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1506 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1507 void build_range_marker_menu (bool loop_or_punch);
1508 void build_marker_menu (bool start_or_end);
1509 void build_tm_marker_menu ();
1510 void build_new_transport_marker_menu ();
1512 Gtk::Menu* tm_marker_menu;
1513 Gtk::Menu* marker_menu;
1514 Gtk::Menu* start_end_marker_menu;
1515 Gtk::Menu* range_marker_menu;
1516 Gtk::Menu* transport_marker_menu;
1517 Gtk::Menu* new_transport_marker_menu;
1518 Gtk::Menu* cd_marker_menu;
1519 ArdourCanvas::Item* marker_menu_item;
1521 typedef list<Marker*> Marks;
1524 void remove_metric_marks ();
1525 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1527 void compute_current_bbt_points (nframes_t left, nframes_t right);
1528 void tempo_map_changed (ARDOUR::Change);
1529 void redisplay_tempo (bool immediate_redraw);
1531 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1533 uint32_t bbt_beat_subdivision;
1537 void editor_mixer_button_toggled ();
1539 AudioClock edit_point_clock;
1540 AudioClock zoom_range_clock;
1541 Gtk::Button zoom_in_button;
1542 Gtk::Button zoom_out_button;
1543 Gtk::Button zoom_out_full_button;
1544 Gtk::Button zoom_onetoone_button;
1546 Gtk::VBox toolbar_clock_vbox;
1547 Gtk::VBox toolbar_selection_clock_vbox;
1548 Gtk::Table toolbar_selection_clock_table;
1549 Gtk::Label toolbar_selection_cursor_label;
1551 Gtk::HBox mouse_mode_button_box;
1552 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1553 Gtk::ToggleButton mouse_select_button;
1554 Gtk::ToggleButton mouse_move_button;
1555 Gtk::ToggleButton mouse_gain_button;
1556 Gtk::ToggleButton mouse_zoom_button;
1557 Gtk::ToggleButton mouse_timefx_button;
1558 Gtk::ToggleButton mouse_audition_button;
1559 GroupedButtons *mouse_mode_button_set;
1560 void mouse_mode_toggled (Editing::MouseMode m);
1561 bool ignore_mouse_mode_toggle;
1563 gint mouse_select_button_release (GdkEventButton*);
1565 Gtk::VBox automation_box;
1566 Gtk::Button automation_mode_button;
1567 Gtk::ToggleButton global_automation_button;
1569 Gtk::ComboBoxText edit_mode_selector;
1570 Gtk::VBox edit_mode_box;
1572 void set_edit_mode (ARDOUR::EditMode);
1573 void cycle_edit_mode ();
1574 void edit_mode_selection_done ();
1576 Gtk::ComboBoxText snap_type_selector;
1577 Gtk::ComboBoxText snap_mode_selector;
1580 std::vector<std::string> snap_type_strings;
1581 std::vector<std::string> snap_mode_strings;
1583 void snap_type_selection_done ();
1584 void snap_mode_selection_done ();
1585 void snap_mode_chosen (Editing::SnapMode);
1586 void snap_type_chosen (Editing::SnapType);
1588 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1589 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1591 Gtk::ComboBoxText zoom_focus_selector;
1592 Gtk::VBox zoom_focus_box;
1594 std::vector<std::string> zoom_focus_strings;
1596 void zoom_focus_selection_done ();
1597 void zoom_focus_chosen (Editing::ZoomFocus);
1599 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1603 void zoom_adjustment_changed();
1605 void edit_point_clock_changed();
1607 void setup_toolbar ();
1609 Gtkmm2ext::TearOff* tools_tearoff;
1610 Gtk::HBox toolbar_hbox;
1611 Gtk::EventBox toolbar_base;
1612 Gtk::Frame toolbar_frame;
1614 /* selection process */
1616 Selection* selection;
1617 Selection* cut_buffer;
1619 void time_selection_changed ();
1620 void track_selection_changed ();
1621 void region_selection_changed ();
1622 void sensitize_the_right_region_actions (bool have_selected_regions);
1623 void point_selection_changed ();
1624 void marker_selection_changed ();
1633 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1634 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1635 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1636 void cancel_selection ();
1638 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1639 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1640 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1642 bool audio_region_selection_covers (nframes64_t where);
1644 /* transport range select process */
1645 enum RangeMarkerOp {
1647 CreateTransportMarker,
1651 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1652 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1653 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1655 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1656 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1657 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1658 ArdourCanvas::Line* marker_drag_line;
1659 ArdourCanvas::Points marker_drag_line_points;
1660 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1662 void update_marker_drag_item (ARDOUR::Location *);
1664 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1665 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1666 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1667 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1668 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1669 ArdourCanvas::SimpleLine *transport_punchin_line;
1670 ArdourCanvas::SimpleLine *transport_punchout_line;
1671 ArdourCanvas::SimpleRect *transport_preroll_rect;
1672 ArdourCanvas::SimpleRect *transport_postroll_rect;
1674 ARDOUR::Location* transport_loop_location();
1675 ARDOUR::Location* transport_punch_location();
1677 ARDOUR::Location *temp_location;
1679 /* object rubberband select process */
1681 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1682 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1683 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1685 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1687 ArdourCanvas::SimpleRect *rubberband_rect;
1689 /* mouse zoom process */
1691 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1692 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1693 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1695 ArdourCanvas::SimpleRect *zoom_rect;
1696 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1698 /* diskstream/route display management */
1700 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1701 RouteDisplayModelColumns() {
1704 add (temporary_visible);
1708 Gtk::TreeModelColumn<Glib::ustring> text;
1709 Gtk::TreeModelColumn<bool> visible;
1710 Gtk::TreeModelColumn<bool> temporary_visible;
1711 Gtk::TreeModelColumn<TimeAxisView*> tv;
1712 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1715 RouteDisplayModelColumns route_display_columns;
1716 Glib::RefPtr<Gtk::ListStore> route_display_model;
1717 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1719 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1720 Gtk::ScrolledWindow route_list_scroller;
1721 Gtk::Menu* route_list_menu;
1723 void update_route_visibility ();
1725 void sync_order_keys (const char*);
1726 bool route_redisplay_does_not_sync_order_keys;
1727 bool route_redisplay_does_not_reset_order_keys;
1729 bool route_list_display_button_press (GdkEventButton*);
1730 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1733 const Gtk::SelectionData& data,
1737 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1739 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1740 void route_list_delete (const Gtk::TreeModel::Path&);
1741 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1743 void initial_route_list_display ();
1744 void redisplay_route_list();
1745 bool ignore_route_list_reorder;
1746 bool no_route_list_redisplay;
1748 void build_route_list_menu ();
1749 void show_route_list_menu ();
1751 void show_all_routes ();
1752 void hide_all_routes ();
1753 void show_all_audiotracks ();
1754 void hide_all_audiotracks ();
1755 void show_all_audiobus ();
1756 void hide_all_audiobus ();
1758 void set_all_tracks_visibility (bool yn);
1759 void set_all_audio_visibility (int type, bool yn);
1761 /* edit group management */
1763 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1764 GroupListModelColumns () {
1770 Gtk::TreeModelColumn<bool> is_active;
1771 Gtk::TreeModelColumn<bool> is_visible;
1772 Gtk::TreeModelColumn<std::string> text;
1773 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1776 GroupListModelColumns group_columns;
1777 Glib::RefPtr<Gtk::ListStore> group_model;
1778 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1780 Gtk::TreeView edit_group_display;
1781 Gtk::ScrolledWindow edit_group_display_scroller;
1782 Gtk::Menu* edit_group_list_menu;
1784 void build_edit_group_list_menu ();
1785 void activate_all_edit_groups ();
1786 void disable_all_edit_groups ();
1788 bool in_edit_group_row_change;
1789 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1790 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1791 void new_edit_group ();
1792 void edit_group_list_button_clicked ();
1793 gint edit_group_list_button_press_event (GdkEventButton* ev);
1794 void add_edit_group (ARDOUR::RouteGroup* group);
1795 void remove_selected_edit_group ();
1796 void edit_groups_changed ();
1797 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1799 Gtk::VBox list_vpacker;
1803 bool autoscroll_active;
1804 int autoscroll_timeout_tag;
1807 int last_autoscroll_x;
1808 int last_autoscroll_y;
1809 uint32_t autoscroll_cnt;
1810 nframes64_t autoscroll_x_distance;
1811 double autoscroll_y_distance;
1813 static gint _autoscroll_canvas (void *);
1814 bool autoscroll_canvas ();
1815 void start_canvas_autoscroll (int x, int y);
1816 void stop_canvas_autoscroll ();
1817 void maybe_autoscroll (GdkEventMotion*);
1818 void maybe_autoscroll_horizontally (GdkEventMotion*);
1819 bool allow_vertical_scroll;
1828 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1829 void point_trim (GdkEvent*);
1830 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1831 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1832 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1833 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1835 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1836 void thaw_region_after_trim (RegionView& rv);
1838 void trim_region_front();
1839 void trim_region_back();
1840 void trim_region (bool front);
1842 void trim_region_to_edit_point ();
1843 void trim_region_from_edit_point ();
1844 void trim_region_to_loop ();
1845 void trim_region_to_punch ();
1846 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1848 bool show_gain_after_trim;
1852 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1853 const Glib::RefPtr<Gdk::DragContext>& context,
1856 const Gtk::SelectionData& data,
1860 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1863 const Gtk::SelectionData& data,
1867 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1870 const Gtk::SelectionData& data,
1875 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1878 const Gtk::SelectionData& data,
1882 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1885 const Gtk::SelectionData& data,
1891 ExportDialog *export_dialog;
1892 ExportDialog *export_range_markers_dialog;
1894 void export_range (nframes64_t start, nframes64_t end);
1895 void export_range_markers ();
1897 int write_region_selection(RegionSelection&);
1898 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1899 void export_region ();
1900 void bounce_region_selection ();
1901 void bounce_range_selection (bool replace);
1902 void external_edit_region ();
1904 int write_audio_selection (TimeSelection&);
1905 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1907 void write_selection ();
1911 UndoAction get_memento() const;
1913 XMLNode *before; /* used in *_reversible_command */
1914 void begin_reversible_command (string cmd_name);
1915 void commit_reversible_command ();
1917 void update_title ();
1918 void update_title_s (const string & snapshot_name);
1921 Selection* selection;
1922 double frames_per_unit;
1928 void store_state (State&) const;
1929 void restore_state (State *);
1931 void instant_save ();
1933 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1935 /* freeze operations */
1937 ARDOUR::InterThreadInfo freeze_status;
1938 gint freeze_progress_timeout (void *);
1939 static void* _freeze_thread (void*);
1940 void* freeze_thread ();
1942 void freeze_route ();
1943 void unfreeze_route ();
1945 /* edit-group solo + mute */
1947 void set_edit_group_solo (ARDOUR::Route&, bool);
1948 void set_edit_group_mute (ARDOUR::Route&, bool);
1952 void duplicate_dialog (bool with_dialog);
1954 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1956 /* returns false if mouse pointer is not in track or marker canvas
1958 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1960 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1961 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1962 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1964 struct TimeFXDialog : public ArdourDialog {
1965 ARDOUR::TimeFXRequest request;
1968 Gtk::Adjustment pitch_octave_adjustment;
1969 Gtk::Adjustment pitch_semitone_adjustment;
1970 Gtk::Adjustment pitch_cent_adjustment;
1971 Gtk::SpinButton pitch_octave_spinner;
1972 Gtk::SpinButton pitch_semitone_spinner;
1973 Gtk::SpinButton pitch_cent_spinner;
1974 RegionSelection regions;
1975 Gtk::ProgressBar progress_bar;
1978 Gtk::ToggleButton quick_button;
1979 Gtk::ToggleButton antialias_button;
1980 Gtk::HBox upper_button_box;
1983 Gtk::ComboBoxText stretch_opts_selector;
1984 Gtk::Label stretch_opts_label;
1985 Gtk::ToggleButton precise_button;
1988 Gtk::Button* cancel_button;
1989 Gtk::Button* action_button;
1993 TimeFXDialog (Editor& e, bool for_pitch);
1995 gint update_progress ();
1996 sigc::connection first_cancel;
1997 sigc::connection first_delete;
1998 void cancel_in_progress ();
1999 gint delete_in_progress (GdkEventAny*);
2002 /* "whats mine is yours" */
2004 friend class TimeFXDialog;
2006 TimeFXDialog* current_timefx;
2008 static void* timefx_thread (void *arg);
2009 void do_timefx (TimeFXDialog&);
2011 int time_stretch (RegionSelection&, float fraction);
2012 int pitch_shift (RegionSelection&, float cents);
2013 void pitch_shift_regions ();
2014 int time_fx (RegionSelection&, float val, bool pitching);
2016 /* editor-mixer strip */
2018 MixerStrip *current_mixer_strip;
2019 bool show_editor_mixer_when_tracks_arrive;
2020 Gtk::VBox current_mixer_strip_vbox;
2021 void cms_deleted ();
2022 void current_mixer_strip_hidden ();
2023 void current_mixer_strip_removed ();
2025 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2026 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2028 /* nudging tracks */
2030 void nudge_track (bool use_edit_point, bool forwards);
2034 bool _xfade_visibility;
2036 /* <CMT Additions> */
2037 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2038 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2040 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2041 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2043 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2044 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2045 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2047 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2048 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2049 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2050 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2052 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2053 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2054 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2055 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2057 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2058 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2059 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2060 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2061 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2062 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2064 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2065 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2066 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2067 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2068 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2069 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2071 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2072 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2074 ImageFrameSocketHandler* image_socket_listener ;
2075 /* </CMT Additions> */
2077 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2078 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2079 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2080 void xfade_edit_left_region ();
2081 void xfade_edit_right_region ();
2083 static const int32_t default_width = 995;
2084 static const int32_t default_height = 765;
2088 Gtk::Button nudge_forward_button;
2089 Gtk::Button nudge_backward_button;
2090 Gtk::HBox nudge_hbox;
2091 Gtk::VBox nudge_vbox;
2092 AudioClock nudge_clock;
2094 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2096 bool nudge_forward_release (GdkEventButton*);
2097 bool nudge_backward_release (GdkEventButton*);
2101 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2103 /* handling cleanup */
2105 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2107 vector<sigc::connection> session_connections;
2109 /* tracking step changes of track height */
2111 TimeAxisView* current_stepping_trackview;
2112 ARDOUR::microseconds_t last_track_height_step_timestamp;
2113 gint track_height_step_timeout();
2114 sigc::connection step_timeout;
2116 TimeAxisView* entered_track;
2117 RegionView* entered_regionview;
2120 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2121 bool clear_entered_track;
2122 bool left_track_canvas (GdkEventCrossing*);
2123 bool entered_track_canvas (GdkEventCrossing*);
2124 void set_entered_track (TimeAxisView*);
2125 void set_entered_regionview (RegionView*);
2126 gint left_automation_track ();
2128 bool _new_regionviews_show_envelope;
2130 void reset_canvas_action_sensitivity (bool);
2131 void toggle_gain_envelope_visibility ();
2132 void toggle_gain_envelope_active ();
2133 void reset_region_gain_envelopes ();
2135 bool on_key_press_event (GdkEventKey*);
2136 bool on_key_release_event (GdkEventKey*);
2138 void session_state_saved (string);
2140 Glib::RefPtr<Gtk::Action> undo_action;
2141 Glib::RefPtr<Gtk::Action> redo_action;
2143 void history_changed ();
2144 void color_handler ();
2146 Gtk::HBox status_bar_hpacker;
2148 Editing::EditPoint _edit_point;
2150 Gtk::ComboBoxText edit_point_selector;
2152 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2153 void cycle_edit_point (bool with_marker);
2154 void set_edit_point ();
2155 void edit_point_selection_done ();
2156 void edit_point_chosen (Editing::EditPoint);
2157 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2158 std::vector<std::string> edit_point_strings;
2160 void selected_marker_moved (ARDOUR::Location*);
2161 sigc::connection edit_point_clock_connection_a;
2162 sigc::connection edit_point_clock_connection_b;
2164 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2166 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2167 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2169 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2171 sigc::connection fast_screen_update_connection;
2172 gint start_updating ();
2173 gint stop_updating ();
2174 void fast_update_strips ();
2175 bool meters_running;
2177 void select_next_route ();
2178 void select_prev_route ();
2180 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2182 RhythmFerret* rhythm_ferret;
2185 void set_track_height (uint32_t h);
2186 void set_track_height_largest ();
2187 void set_track_height_large ();
2188 void set_track_height_larger ();
2189 void set_track_height_normal ();
2190 void set_track_height_smaller ();
2191 void set_track_height_small ();
2193 void remove_tracks ();
2194 void toggle_tracks_active ();
2195 void waveform_scale_chosen (Editing::WaveformScale);
2199 int32_t resize_idle_target;
2201 friend gboolean _idle_resize (gpointer);
2202 std::vector<TimeAxisView*> pending_resizes;
2205 #endif /* __ardour_editor_h__ */