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.
21 #ifndef __ardour_editor_h__
22 #define __ardour_editor_h__
30 #include <libgnomecanvasmm/canvas.h>
31 #include <libgnomecanvasmm/group.h>
32 #include <libgnomecanvasmm/line.h>
36 #include <gtkmm/layout.h>
37 #include <gtkmm/comboboxtext.h>
39 #include <gtkmm2ext/selector.h>
40 #include <gtkmm2ext/click_box.h>
41 #include <gtkmm2ext/dndtreeview.h>
43 #include <ardour/stateful.h>
44 #include <ardour/session.h>
45 #include <ardour/tempo.h>
46 #include <ardour/location.h>
47 #include <ardour/region.h>
48 #include <ardour/externalsource.h>
50 #include "audio_clock.h"
51 #include "gtk-custom-ruler.h"
52 #include "ardour_dialog.h"
53 #include "public_editor.h"
56 #include "region_selection.h"
64 namespace LinuxAudioSystems {
87 class AudioTimeAxisView;
88 class AutomationTimeAxisView;
89 class AudioRegionView;
92 class PlaylistSelector;
96 class UIExportSpecification;
100 class TrackSelection;
101 class AutomationSelection;
106 class AnalysisWindow;
109 /* <CMT Additions> */
110 class ImageFrameView;
111 class ImageFrameTimeAxisView;
112 class ImageFrameTimeAxis;
113 class MarkerTimeAxis ;
115 class ImageFrameSocketHandler ;
116 class TimeAxisViewItem ;
117 /* </CMT Additions> */
120 class Editor : public PublicEditor
123 Editor (ARDOUR::AudioEngine&);
126 void connect_to_session (ARDOUR::Session *);
127 ARDOUR::Session* current_session() const { return session; }
129 jack_nframes_t leftmost_position() const { return leftmost_frame; }
130 jack_nframes_t current_page_frames() const {
131 return (jack_nframes_t) floor (canvas_width * frames_per_unit);
134 void set_snap_to (Editing::SnapType);
135 void set_snap_mode (Editing::SnapMode);
136 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
138 void undo (uint32_t n = 1);
139 void redo (uint32_t n = 1);
141 XMLNode& get_state ();
142 int set_state (const XMLNode& );
144 void set_mouse_mode (Editing::MouseMode, bool force=true);
145 void step_mouse_mode (bool next);
146 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
148 void add_imageframe_time_axis(const string & track_name, void*) ;
149 void add_imageframe_marker_time_axis(const string & track_name, TimeAxisView* marked_track, void*) ;
150 void connect_to_image_compositor() ;
151 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
152 TimeAxisView* get_named_time_axis(const string & name) ;
153 /* </CMT Additions> */
155 void consider_auditioning (ARDOUR::Region&);
156 void hide_a_region (ARDOUR::Region&);
157 void remove_a_region (ARDOUR::Region&);
159 /* option editor-access */
161 void set_show_waveforms (bool yn);
162 bool show_waveforms() const { return _show_waveforms; }
164 void set_show_waveforms_recording (bool yn);
165 bool show_waveforms_recording() const { return _show_waveforms_recording; }
167 /* things that need to be public to be used in the main menubar */
169 void new_region_from_selection ();
170 void separate_region_from_selection ();
171 void separate_regions_using_location (ARDOUR::Location&);
172 void toggle_playback (bool with_abort);
176 void set_edit_menu (Gtk::Menu&);
178 jack_nframes_t unit_to_frame (double unit) {
179 return (jack_nframes_t) rint (unit * frames_per_unit);
182 double frame_to_unit (jack_nframes_t frame) {
183 return rint ((double) frame / (double) frames_per_unit);
186 double frame_to_unit (double frame) {
187 return rint (frame / frames_per_unit);
190 /* NOTE: these functions assume that the "pixel" coordinate is
191 the result of using the world->canvas affine transform on a
192 world coordinate. These coordinates already take into
193 account any scrolling carried out by adjusting the
197 jack_nframes_t pixel_to_frame (double pixel) {
199 /* pixel can be less than zero when motion events
200 are processed. since we've already run the world->canvas
201 affine, that means that the location *really* is "off
202 to the right" and thus really is "before the start".
206 return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
212 gulong frame_to_pixel (jack_nframes_t frame) {
213 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
218 Selection& get_selection() const { return *selection; }
219 Selection& get_cut_buffer() const { return *cut_buffer; }
221 void play_selection ();
222 void select_all_in_track (Selection::Operation op);
223 void select_all (Selection::Operation op);
224 void invert_selection_in_track ();
225 void invert_selection ();
229 void set_show_measures (bool yn);
230 bool show_measures () const { return _show_measures; }
233 /* analysis window */
234 void analyze_region_selection();
235 void analyze_range_selection();
240 /* these initiate export ... */
242 void export_session();
243 void export_selection();
245 /* this is what actually does it */
247 void export_audiofile (ARDOUR::AudioExportSpecification&);
251 void add_toplevel_controls (Gtk::Container&);
253 void set_zoom_focus (Editing::ZoomFocus);
254 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
255 gdouble get_current_zoom () { return frames_per_unit; }
257 void temporal_zoom_step (bool coarser);
259 /* stuff that AudioTimeAxisView and related classes use */
261 PlaylistSelector& playlist_selector() const;
262 void route_name_changed (TimeAxisView *);
263 gdouble frames_per_unit;
264 jack_nframes_t leftmost_frame;
265 void clear_playlist (ARDOUR::Playlist&);
267 void new_playlists ();
268 void copy_playlists ();
269 void clear_playlists ();
271 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
273 Width editor_mixer_strip_width;
274 void show_editor_mixer (bool yn);
275 void set_selected_mixer_strip (TimeAxisView&);
276 void hide_track_in_display (TimeAxisView& tv);
277 void show_track_in_display (TimeAxisView& tv);
279 /* nudge is initiated by transport controls owned by ARDOUR_UI */
281 void nudge_forward (bool next);
282 void nudge_backward (bool next);
284 /* nudge initiated from context menu */
286 void nudge_forward_capture_offset ();
287 void nudge_backward_capture_offset ();
289 /* playhead/screen stuff */
291 void set_follow_playhead (bool yn);
292 void toggle_follow_playhead ();
293 bool follow_playhead() const { return _follow_playhead; }
295 void toggle_waveform_visibility ();
296 void toggle_waveforms_while_recording ();
297 void toggle_measure_visibility ();
299 void set_meter_falloff (float);
300 void set_meter_hold (int32_t);
304 void toggle_auto_xfade ();
305 void toggle_xfades_active ();
306 void toggle_xfade_visibility ();
307 bool xfade_visibility() const { return _xfade_visibility; }
308 void update_crossfade_model ();
309 void set_crossfade_model (ARDOUR::CrossfadeModel);
313 void set_layer_model (ARDOUR::Session::LayerModel);
314 void update_layering_model ();
316 /* redirect shared ops menu. caller must free returned menu */
318 Gtk::Menu* redirect_menu ();
320 /* floating windows/transient */
322 void ensure_float (Gtk::Window&);
326 void scroll_tracks_down_line ();
327 void scroll_tracks_up_line ();
329 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
330 void prepare_for_cleanup ();
332 void reposition_x_origin (jack_nframes_t sample);
334 void maximise_editing_space();
335 void restore_editing_space();
338 void map_transport_state ();
339 void map_position_change (jack_nframes_t);
345 ARDOUR::Session *session;
346 ARDOUR::AudioEngine& engine;
349 PlaylistSelector* _playlist_selector;
359 TransportMarkerBarItem,
361 GainControlPointItem,
363 GainAutomationControlPointItem,
364 GainAutomationLineItem,
365 PanAutomationControlPointItem,
366 PanAutomationLineItem,
367 RedirectAutomationControlPointItem,
368 RedirectAutomationLineItem,
373 AudioRegionViewNameHighlight,
375 StartSelectionTrimItem,
376 EndSelectionTrimItem,
383 /* <CMT Additions> */
386 MarkerViewHandleStartItem,
387 MarkerViewHandleEndItem,
389 ImageFrameTimeAxisItem,
390 ImageFrameHandleStartItem,
391 ImageFrameHandleEndItem,
392 /* </CMT Additions> */
396 /* don't remove this */
401 void set_frames_per_unit (double);
402 void frames_per_unit_modified ();
404 Editing::MouseMode mouse_mode;
405 void mouse_insert (GdkEventButton *);
407 int pre_maximal_pane_position;
408 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
410 Gtk::Notebook the_notebook;
411 Gtk::HPaned edit_pane;
413 Gtk::EventBox meter_base;
415 Gtk::EventBox marker_base;
416 Gtk::HBox marker_box;
417 Gtk::VBox scrollers_rulers_markers_box;
419 void location_changed (ARDOUR::Location *);
420 void location_flags_changed (ARDOUR::Location *, void *);
421 void refresh_location_display ();
422 void refresh_location_display_s (ARDOUR::Change);
423 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
424 void add_new_location (ARDOUR::Location *);
425 void location_gone (ARDOUR::Location *);
426 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
427 gint really_remove_marker (ARDOUR::Location* loc);
429 uint32_t location_marker_color;
430 uint32_t location_range_color;
431 uint32_t location_loop_color;
432 uint32_t location_punch_color;
433 uint32_t location_cd_marker_color;
435 struct LocationMarkers {
443 void set_name (const string&);
444 void set_position (jack_nframes_t start, jack_nframes_t end = 0);
445 void set_color_rgba (uint32_t);
448 LocationMarkers *find_location_markers (ARDOUR::Location *);
449 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start);
451 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
452 LocationMarkerMap location_markers;
454 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
455 void clear_marker_display ();
456 void mouse_add_new_marker (jack_nframes_t where);
458 TimeAxisView* clicked_trackview;
459 AudioTimeAxisView* clicked_audio_trackview;
460 AudioRegionView* clicked_regionview;
461 AudioRegionView* latest_regionview;
462 uint32_t clicked_selection;
463 CrossfadeView* clicked_crossfadeview;
464 ControlPoint* clicked_control_point;
466 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl);
468 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
470 void mapped_set_selected_regionview_from_click (AudioTimeAxisView&, uint32_t, AudioRegionView*, vector<AudioRegionView*>*);
471 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t);
472 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t);
473 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
477 void catch_vanishing_audio_regionview (AudioRegionView *);
478 void set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
479 void set_selected_track_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
480 void set_selected_regionview_from_click (Selection::Operation op = Selection::Set, bool no_track_remove=false);
481 void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set);
482 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
483 void collect_new_region_view (AudioRegionView *);
485 Gtk::Menu track_context_menu;
486 Gtk::Menu track_region_context_menu;
487 Gtk::Menu track_selection_context_menu;
488 Gtk::Menu track_crossfade_context_menu;
490 Gtk::MenuItem* region_edit_menu_split_item;
491 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
492 Gtk::Menu * track_region_edit_playlist_menu;
493 Gtk::Menu * track_edit_playlist_submenu;
494 Gtk::Menu * track_selection_edit_playlist_submenu;
496 void popup_track_context_menu (int, int, ItemType, bool, jack_nframes_t);
497 Gtk::Menu* build_track_context_menu (jack_nframes_t);
498 Gtk::Menu* build_track_bus_context_menu (jack_nframes_t);
499 Gtk::Menu* build_track_region_context_menu (jack_nframes_t frame);
500 Gtk::Menu* build_track_crossfade_context_menu (jack_nframes_t);
501 Gtk::Menu* build_track_selection_context_menu (jack_nframes_t);
502 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
503 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
504 void add_region_context_items (StreamView*, ARDOUR::Region*, Gtk::Menu_Helpers::MenuList&);
505 void add_crossfade_context_items (StreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
506 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
508 void handle_new_route (ARDOUR::Route&);
509 void handle_new_route_p (ARDOUR::Route*);
510 void remove_route (TimeAxisView *);
513 Gtk::HBox global_hpacker;
514 Gtk::VBox global_vpacker;
517 Gdk::Cursor* current_canvas_cursor;
519 ArdourCanvas::CanvasAA track_canvas;
520 ArdourCanvas::CanvasAA time_canvas;
522 ArdourCanvas::Text* first_action_message;
523 ArdourCanvas::Text* verbose_canvas_cursor;
524 bool verbose_cursor_visible;
526 void session_control_changed (ARDOUR::Session::ControlType);
527 void queue_session_control_changed (ARDOUR::Session::ControlType);
530 bool track_canvas_motion (GdkEvent*);
532 void set_verbose_canvas_cursor (const string &, double x, double y);
533 void set_verbose_canvas_cursor_text (const string &);
534 void show_verbose_canvas_cursor();
535 void hide_verbose_canvas_cursor();
537 bool verbose_cursor_on; // so far unused
539 void flush_track_canvas ();
540 void flush_time_canvas ();
542 Gtk::EventBox time_canvas_event_box;
543 Gtk::EventBox track_canvas_event_box;
544 Gtk::EventBox time_button_event_box;
546 ArdourCanvas::Group *minsec_group;
547 ArdourCanvas::Group *bbt_group;
548 ArdourCanvas::Group *smpte_group;
549 ArdourCanvas::Group *frame_group;
550 ArdourCanvas::Group *tempo_group;
551 ArdourCanvas::Group *meter_group;
552 ArdourCanvas::Group *marker_group;
553 ArdourCanvas::Group *range_marker_group;
554 ArdourCanvas::Group *transport_marker_group;
557 ruler_metric_smpte = 0,
558 ruler_metric_bbt = 1,
559 ruler_metric_frames = 2,
560 ruler_metric_minsec = 3,
562 ruler_time_tempo = 4,
563 ruler_time_meter = 5,
564 ruler_time_marker = 6,
565 ruler_time_range_marker = 7,
566 ruler_time_transport_marker = 8,
569 static GtkCustomMetric ruler_metrics[4];
571 bool no_ruler_shown_update;
573 gint ruler_button_press (GdkEventButton*);
574 gint ruler_button_release (GdkEventButton*);
575 gint ruler_mouse_motion (GdkEventMotion*);
577 gint ruler_pressed_button;
578 Gtk::Widget * ruler_grabbed_widget;
580 void initialize_rulers ();
581 void update_just_smpte ();
582 void update_fixed_rulers ();
583 void update_tempo_based_rulers ();
584 void popup_ruler_menu (jack_nframes_t where = 0, ItemType type = RegionItem);
585 void update_ruler_visibility ();
586 void ruler_toggled (int);
587 gint ruler_label_button_release (GdkEventButton*);
588 void store_ruler_visibility ();
589 void restore_ruler_visibility ();
591 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
592 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
593 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
594 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
596 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
597 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
598 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
599 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
601 GtkWidget *_smpte_ruler;
602 GtkWidget *_bbt_ruler;
603 GtkWidget *_frames_ruler;
604 GtkWidget *_minsec_ruler;
605 Gtk::Widget *smpte_ruler;
606 Gtk::Widget *bbt_ruler;
607 Gtk::Widget *frames_ruler;
608 Gtk::Widget *minsec_ruler;
609 static Editor *ruler_editor;
611 static const double timebar_height;
612 guint32 visible_timebars;
613 Gtk::Menu *editor_ruler_menu;
615 ArdourCanvas::SimpleRect* tempo_bar;
616 ArdourCanvas::SimpleRect* meter_bar;
617 ArdourCanvas::SimpleRect* marker_bar;
618 ArdourCanvas::SimpleRect* range_marker_bar;
619 ArdourCanvas::SimpleRect* transport_marker_bar;
622 ArdourCanvas::SimpleLine* tempo_line;
623 ArdourCanvas::SimpleLine* meter_line;
624 ArdourCanvas::SimpleLine* marker_line;
625 ArdourCanvas::SimpleLine* range_marker_line;
626 ArdourCanvas::SimpleLine* transport_marker_line;
628 Gtk::Label minsec_label;
629 Gtk::Label bbt_label;
630 Gtk::Label smpte_label;
631 Gtk::Label frame_label;
632 Gtk::Label tempo_label;
633 Gtk::Label meter_label;
634 Gtk::Label mark_label;
635 Gtk::Label range_mark_label;
636 Gtk::Label transport_mark_label;
639 Gtk::VBox time_button_vbox;
640 Gtk::HBox time_button_hbox;
644 ArdourCanvas::Points points;
645 ArdourCanvas::Line canvas_item;
646 jack_nframes_t current_frame;
649 Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
652 void set_position (jack_nframes_t);
653 void set_length (double units);
654 void set_y_axis (double position);
657 friend struct Cursor; /* it needs access to several private
661 Cursor* playhead_cursor;
663 ArdourCanvas::Group* cursor_group;
665 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
666 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
667 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
668 void cursor_to_selection_start (Cursor *);
669 void cursor_to_selection_end (Cursor *);
670 void select_all_selectables_using_cursor (Cursor *, bool);
671 void select_all_selectables_between_cursors (Cursor *, Cursor *);
673 ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
675 vector<jack_nframes_t> region_boundary_cache;
676 void build_region_boundary_cache ();
678 Gtk::VBox trackview_vpacker;
681 Gtk::HBox bottom_hbox;
683 Gtk::Table edit_packer;
684 Gtk::VScrollbar edit_vscrollbar;
686 Gtk::Adjustment vertical_adjustment;
687 Gtk::Adjustment horizontal_adjustment;
689 Gtk::Layout controls_layout;
690 bool control_layout_scroll (GdkEventScroll* ev);
691 void controls_layout_size_request (Gtk::Requisition*);
693 Gtk::HScrollbar edit_hscrollbar;
694 bool edit_hscroll_dragging;
696 bool hscrollbar_button_press (GdkEventButton*);
697 bool hscrollbar_button_release (GdkEventButton*);
698 void hscrollbar_allocate (Gtk::Allocation &alloc);
701 double canvas_height;
703 bool track_canvas_map_handler (GdkEventAny*);
704 bool time_canvas_map_handler (GdkEventAny*);
706 gint edit_controls_button_release (GdkEventButton*);
707 Gtk::Menu *edit_controls_left_menu;
708 Gtk::Menu *edit_controls_right_menu;
710 void track_canvas_scroller_realized ();
711 void time_canvas_scroller_realized ();
713 Gtk::VBox track_canvas_vbox;
714 Gtk::VBox time_canvas_vbox;
715 Gtk::VBox edit_controls_vbox;
716 Gtk::HBox edit_controls_hbox;
718 void tie_vertical_scrolling ();
719 void canvas_horizontally_scrolled ();
720 void reposition_and_zoom (jack_nframes_t sample, double fpu);
721 gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
722 void end_location_changed (ARDOUR::Location*);
723 bool repos_zoom_queued;
724 bool no_zoom_repos_update;
725 bool no_tempo_map_update;
727 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
728 RegionListDisplayModelColumns() {
733 Gtk::TreeModelColumn<Glib::ustring> name;
734 Gtk::TreeModelColumn<ARDOUR::Region*> region;
735 Gtk::TreeModelColumn<Gdk::Color> color_;
738 RegionListDisplayModelColumns region_list_columns;
739 Gtkmm2ext::DnDTreeView region_list_display;
740 Glib::RefPtr<Gtk::TreeStore> region_list_model;
741 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
742 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
744 void region_list_selection_changed ();
745 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
747 Gtk::Menu *region_list_menu;
748 Gtk::ScrolledWindow region_list_scroller;
749 Gtk::Frame region_list_frame;
751 bool region_list_display_key_press (GdkEventKey *);
752 bool region_list_display_key_release (GdkEventKey *);
753 bool region_list_display_button_press (GdkEventButton *);
754 bool region_list_display_button_release (GdkEventButton *);
755 void region_list_clear ();
756 void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
757 void build_region_list_menu ();
758 void show_region_list_display_context_menu (int button, int time);
760 bool show_automatic_regions_in_region_list;
761 Editing::RegionListSortType region_list_sort_type;
763 void reset_region_list_sort_direction (bool);
764 void reset_region_list_sort_type (Editing::RegionListSortType);
766 void toggle_full_region_list ();
767 void toggle_show_auto_regions ();
769 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
773 Gtk::ScrolledWindow snapshot_display_scroller;
774 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
775 SnapshotDisplayModelColumns() {
779 Gtk::TreeModelColumn<Glib::ustring> visible_name;
780 Gtk::TreeModelColumn<Glib::ustring> real_name;
783 SnapshotDisplayModelColumns snapshot_display_columns;
784 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
785 Gtk::TreeView snapshot_display;
787 bool snapshot_display_button_press (GdkEventButton*);
788 void snapshot_display_selection_changed ();
789 void redisplay_snapshots();
791 /* named selections */
793 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
794 NamedSelectionDisplayModelColumns() {
798 Gtk::TreeModelColumn<Glib::ustring> text;
799 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
802 NamedSelectionDisplayModelColumns named_selection_columns;
803 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
805 Gtkmm2ext::DnDTreeView named_selection_display;
806 Gtk::ScrolledWindow named_selection_scroller;
808 void name_selection();
809 void named_selection_name_chosen ();
810 void create_named_selection (const string &);
811 void paste_named_selection (float times);
813 void handle_new_named_selection ();
814 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
815 void redisplay_named_selections ();
817 gint named_selection_display_button_press (GdkEventButton *ev);
818 void named_selection_display_selection_changed ();
822 TrackViewList track_views;
823 TimeAxisView *trackview_by_y_position (double ypos);
825 static Gdk::Cursor* cross_hair_cursor;
826 static Gdk::Cursor* trimmer_cursor;
827 static Gdk::Cursor* selector_cursor;
828 static Gdk::Cursor* grabber_cursor;
829 static Gdk::Cursor* zoom_cursor;
830 static Gdk::Cursor* time_fx_cursor;
831 static Gdk::Cursor* fader_cursor;
832 static Gdk::Cursor* speaker_cursor;
833 static Gdk::Cursor* wait_cursor;
834 static Gdk::Cursor* timebar_cursor;
836 static void build_cursors ();
838 sigc::connection scroll_connection;
839 jack_nframes_t last_update_frame;
840 void center_screen (jack_nframes_t);
841 void center_screen_internal (jack_nframes_t, float);
843 void update_current_screen ();
844 sigc::connection slower_update_connection;
845 void update_slower ();
847 gint show_track_context_menu (GdkEventButton *);
848 void hide_track_context_menu ();
850 void session_going_away ();
852 jack_nframes_t cut_buffer_start;
853 jack_nframes_t cut_buffer_length;
855 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
856 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
857 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
858 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
859 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
860 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
862 /* KEYMAP HANDLING */
864 void register_actions ();
866 int ensure_cursor (jack_nframes_t* pos);
868 void fake_handle_new_audio_region (ARDOUR::AudioRegion *);
869 void handle_new_audio_region (ARDOUR::AudioRegion *);
870 void fake_handle_audio_region_removed (ARDOUR::AudioRegion *);
871 void handle_audio_region_removed (ARDOUR::AudioRegion *);
872 void add_audio_region_to_region_display (ARDOUR::AudioRegion *);
873 void region_hidden (ARDOUR::Region*);
874 void redisplay_regions ();
875 void insert_into_tmp_audio_regionlist(ARDOUR::AudioRegion *);
877 list<ARDOUR::AudioRegion *> tmp_audio_region_list;
879 void cut_copy (Editing::CutCopyOp);
880 void cut_copy_points (Editing::CutCopyOp);
881 void cut_copy_regions (Editing::CutCopyOp);
882 void cut_copy_ranges (Editing::CutCopyOp);
885 void paste_internal (jack_nframes_t position, float times);
887 /* EDITING OPERATIONS */
889 void toggle_region_mute ();
890 void toggle_region_opaque ();
891 void raise_region ();
892 void raise_region_to_top ();
893 void lower_region ();
894 void lower_region_to_bottom ();
895 void split_region ();
896 void split_region_at (jack_nframes_t);
897 void split_regions_at (jack_nframes_t, AudioRegionSelection&);
898 void crop_region_to_selection ();
899 void set_a_regions_sync_position (ARDOUR::Region&, jack_nframes_t);
900 void set_region_sync_from_edit_cursor ();
901 void remove_region_sync();
902 void align_selection (ARDOUR::RegionPoint, jack_nframes_t position);
903 void align_selection_relative (ARDOUR::RegionPoint point, jack_nframes_t position);
904 void align_region (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
905 void align_region_internal (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
906 void remove_some_regions ();
907 void remove_clicked_region ();
908 void destroy_clicked_region ();
910 void duplicate_some_regions (AudioRegionSelection&, float times);
911 void duplicate_selection (float times);
912 void region_fill_selection ();
914 void region_fill_track ();
915 void audition_playlist_region_standalone (ARDOUR::AudioRegion&);
916 void audition_playlist_region_via_route (ARDOUR::AudioRegion&, ARDOUR::Route&);
917 void split_multichannel_region();
918 void reverse_region ();
919 void normalize_region ();
920 void denormalize_region ();
922 void audition_region_from_region_list ();
923 void hide_region_from_region_list ();
924 void remove_region_from_region_list ();
926 void align (ARDOUR::RegionPoint);
927 void align_relative (ARDOUR::RegionPoint);
932 void paste (float times);
934 int get_prefix (float&, bool&);
936 void keyboard_paste ();
937 void keyboard_duplicate_region ();
938 void keyboard_duplicate_selection ();
939 void keyboard_nudge ();
940 void keyboard_insert_region_list_selection ();
942 void region_from_selection ();
943 void create_region_from_selection (std::vector<ARDOUR::AudioRegion*>&);
946 void rename_region ();
947 void rename_region_finished (bool);
949 void play_from_start ();
950 void play_from_edit_cursor ();
951 void play_selected_region ();
952 void audition_selected_region ();
953 void toggle_loop_playback ();
954 void loop_selected_region ();
955 void play_location (ARDOUR::Location&);
956 void loop_location (ARDOUR::Location&);
958 Editing::ZoomFocus zoom_focus;
960 void temporal_zoom_selection ();
961 void temporal_zoom_session ();
962 void temporal_zoom (gdouble scale);
963 void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const string & op);
964 void temporal_zoom_to_frame (bool coarser, jack_nframes_t frame);
966 void amplitude_zoom (gdouble scale);
967 void amplitude_zoom_step (bool in);
969 void insert_region_list_drag (ARDOUR::AudioRegion&, int x, int y);
970 void insert_region_list_selection (float times);
972 void add_external_audio_action (Editing::ImportMode);
974 void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t& pos, bool prompt);
975 void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
976 void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, jack_nframes_t&, bool);
977 int import_sndfile (Glib::ustring path, Editing::ImportMode mode, ARDOUR::AudioTrack* track, jack_nframes_t& pos);
978 int embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
979 ARDOUR::AudioTrack* track, jack_nframes_t& pos, bool prompt);
980 int finish_bringing_in_audio (ARDOUR::AudioRegion& region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, jack_nframes_t& pos, Editing::ImportMode mode);
982 /* generic interthread progress window */
984 ArdourDialog* interthread_progress_window;
985 Gtk::Label interthread_progress_label;
986 Gtk::VBox interthread_progress_vbox;
987 Gtk::ProgressBar interthread_progress_bar;
988 Gtk::Button interthread_cancel_button;
989 Gtk::Label interthread_cancel_label;
990 sigc::connection interthread_progress_connection;
991 void interthread_cancel_clicked ();
992 void build_interthread_progress_window ();
993 ARDOUR::InterThreadInfo* current_interthread_info;
996 AnalysisWindow* analysis_window;
999 /* import specific info */
1001 ARDOUR::Session::import_status import_status;
1002 gint import_progress_timeout (void *);
1003 static void *_import_thread (void *);
1004 void* import_thread ();
1006 /* to support this ... */
1008 void import_audio (bool as_tracks);
1009 void do_import (vector<string> paths, bool split, bool as_tracks);
1011 void move_to_start ();
1012 void move_to_end ();
1014 void center_playhead ();
1015 void center_edit_cursor ();
1016 void edit_cursor_backward ();
1017 void edit_cursor_forward ();
1018 void playhead_backward ();
1019 void playhead_forward ();
1020 void scroll_backward (float pages=0.8f);
1021 void scroll_forward (float pages=0.8f);
1022 void scroll_tracks_down ();
1023 void scroll_tracks_up ();
1024 void delete_sample_forward ();
1025 void delete_sample_backward ();
1026 void delete_screen ();
1027 void search_backwards ();
1028 void search_forwards ();
1030 void clear_markers ();
1031 void clear_ranges ();
1032 void clear_locations ();
1033 void jump_forward_to_mark ();
1034 void jump_backward_to_mark ();
1035 void cursor_align (bool playhead_to_edit);
1037 void remove_last_capture ();
1038 void select_all_selectables_using_time_selection ();
1039 void select_all_selectables_using_loop();
1040 void select_all_selectables_using_punch();
1041 void set_selection_from_range (ARDOUR::Location&);
1042 void set_selection_from_punch ();
1043 void set_selection_from_loop ();
1044 void set_selection_from_audio_region ();
1046 void add_location_from_audio_region ();
1047 void add_location_from_selection ();
1048 void set_route_loop_selection ();
1050 void add_location_from_playhead_cursor ();
1052 void reverse_selection ();
1053 void edit_envelope ();
1055 void start_scrolling ();
1056 void stop_scrolling ();
1058 void keyboard_selection_begin ();
1059 void keyboard_selection_finish (bool add);
1060 bool have_pending_keyboard_selection;
1061 jack_nframes_t pending_keyboard_selection_start;
1063 ARDOUR::AudioRegion* select_region_for_operation (int dir, TimeAxisView **tv);
1064 void extend_selection_to_end_of_region (bool next);
1065 void extend_selection_to_start_of_region (bool previous);
1067 Editing::SnapType snap_type;
1068 Editing::SnapMode snap_mode;
1069 double snap_threshold;
1071 void soundfile_chosen_for_insert (const string & selection, bool split_channels);
1072 void soundfile_chosen_for_embed (const string & selection, bool split_channels);
1073 void soundfile_chosen_for_import (const string & selection, bool split_channels);
1075 void handle_gui_changes (const string &, void *);
1077 void hide_all_tracks (bool with_select);
1080 LineDragInfo current_line_drag_info;
1082 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1083 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1085 Gtk::Menu fade_context_menu;
1086 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1088 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1089 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1090 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1091 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1092 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1093 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1095 std::set<ARDOUR::Playlist*> motion_frozen_playlists;
1096 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1097 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1098 void region_copy_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1100 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1101 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1102 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1103 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1104 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1105 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1106 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1107 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1109 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1110 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1111 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1112 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1114 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1116 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1117 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1118 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1119 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1120 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1121 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1122 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1123 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1124 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1125 void start_line_grab (AutomationLine *, GdkEvent*);
1126 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1127 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1128 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1129 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1131 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1133 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1134 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1136 void mouse_brush_insert_region (AudioRegionView*, jack_nframes_t pos);
1137 void brush (jack_nframes_t);
1139 void show_verbose_time_cursor (jack_nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1140 void show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1142 /* Canvas event handlers */
1144 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1145 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1146 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1147 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1148 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1149 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1150 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1151 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1152 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1153 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1154 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1155 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1156 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1157 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioTimeAxisView*);
1158 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1159 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1160 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1161 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1162 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1164 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1165 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1166 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1167 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1168 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1170 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1171 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1172 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1173 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1174 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1175 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1176 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1177 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1179 /* non-public event handlers */
1181 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1182 bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1183 bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
1184 bool track_canvas_scroll (GdkEventScroll* event);
1186 bool track_canvas_button_press_event (GdkEventButton *);
1187 bool track_canvas_button_release_event (GdkEventButton *);
1189 void track_canvas_allocate (Gtk::Allocation alloc);
1190 void time_canvas_allocate (Gtk::Allocation alloc);
1192 void set_edit_cursor (GdkEvent* event);
1193 void set_playhead_cursor (GdkEvent* event);
1195 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1196 void kbd_set_playhead_cursor ();
1197 void kbd_set_edit_cursor ();
1198 void kbd_mute_unmute_region ();
1200 void kbd_set_sync_position ();
1201 void kbd_align (ARDOUR::RegionPoint);
1202 void kbd_align_relative (ARDOUR::RegionPoint);
1204 void kbd_audition ();
1206 void kbd_do_split (GdkEvent*);
1207 void kbd_do_set_sync_position (GdkEvent* ev);
1208 void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
1209 void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
1210 void kbd_do_brush (GdkEvent*);
1211 void kbd_do_audition (GdkEvent*);
1213 void fake_handle_new_duration ();
1214 void handle_new_duration ();
1215 void initialize_canvas ();
1216 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1217 void scroll_canvas ();
1219 /* display control */
1221 bool _show_measures;
1222 bool _show_waveforms;
1223 bool _follow_playhead;
1224 bool _show_waveforms_recording;
1226 void add_bbt_marks (ARDOUR::TempoMap::BBTPointList&);
1228 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1230 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1231 TimeLineList free_measure_lines;
1232 TimeLineList used_measure_lines;
1234 ArdourCanvas::Group* time_line_group;
1235 ArdourCanvas::SimpleLine* get_time_line ();
1236 void hide_measures ();
1237 void draw_measures ();
1238 void draw_time_bars ();
1240 void new_tempo_section ();
1242 void mouse_add_new_tempo_event (jack_nframes_t where);
1243 void mouse_add_new_meter_event (jack_nframes_t where);
1245 void remove_tempo_marker (ArdourCanvas::Item*);
1246 void remove_meter_marker (ArdourCanvas::Item*);
1247 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1248 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1250 void edit_tempo_section (ARDOUR::TempoSection*);
1251 void edit_meter_section (ARDOUR::MeterSection*);
1252 void edit_tempo_marker (ArdourCanvas::Item*);
1253 void edit_meter_marker (ArdourCanvas::Item*);
1255 void marker_menu_edit ();
1256 void marker_menu_remove ();
1257 void marker_menu_rename ();
1258 void marker_menu_hide ();
1259 void marker_menu_loop_range ();
1260 void marker_menu_select_all_selectables_using_range ();
1261 void marker_menu_separate_regions_using_location ();
1262 void marker_menu_play_from ();
1263 void marker_menu_set_playhead ();
1264 void marker_menu_set_from_playhead ();
1265 void marker_menu_set_from_selection ();
1266 void new_transport_marker_menu_set_loop ();
1267 void new_transport_marker_menu_set_punch ();
1268 void update_loop_range_view (bool visibility=false);
1269 void update_punch_range_view (bool visibility=false);
1270 gint new_transport_marker_menu_popdown (GdkEventAny*);
1271 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1272 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1273 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1274 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1275 void build_range_marker_menu ();
1276 void build_marker_menu ();
1277 void build_tm_marker_menu ();
1278 void build_transport_marker_menu ();
1279 void build_new_transport_marker_menu ();
1281 Gtk::Menu* tm_marker_menu;
1282 Gtk::Menu* marker_menu;
1283 Gtk::Menu* range_marker_menu;
1284 Gtk::Menu* transport_marker_menu;
1285 Gtk::Menu* new_transport_marker_menu;
1286 ArdourCanvas::Item* marker_menu_item;
1288 typedef list<Marker*> Marks;
1291 void remove_metric_marks ();
1292 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1294 void tempo_map_changed (ARDOUR::Change);
1295 void redisplay_tempo ();
1297 void snap_to (jack_nframes_t& first, int32_t direction = 0, bool for_mark = false);
1298 uint32_t bbt_beat_subdivision;
1302 Gtk::ToggleButton editor_mixer_button;
1304 void editor_mixer_button_toggled ();
1306 AudioClock selection_start_clock;
1307 Gtk::Label selection_start_clock_label;
1308 AudioClock selection_end_clock;
1309 Gtk::Label selection_end_clock_label;
1310 AudioClock edit_cursor_clock;
1311 Gtk::Label edit_cursor_clock_label;
1312 AudioClock zoom_range_clock;
1313 Gtk::Button zoom_in_button;
1314 Gtk::Button zoom_out_button;
1315 Gtk::Button zoom_out_full_button;
1316 Gtk::Button zoom_onetoone_button;
1318 Gtk::VBox toolbar_clock_vbox;
1319 Gtk::VBox toolbar_selection_clock_vbox;
1320 Gtk::Table toolbar_selection_clock_table;
1321 Gtk::Label toolbar_selection_cursor_label;
1323 Gtk::Table mouse_mode_button_table;
1324 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1325 Gtk::ToggleButton mouse_select_button;
1326 Gtk::ToggleButton mouse_move_button;
1327 Gtk::ToggleButton mouse_gain_button;
1328 Gtk::ToggleButton mouse_zoom_button;
1329 Gtk::ToggleButton mouse_timefx_button;
1330 Gtk::ToggleButton mouse_audition_button;
1331 GroupedButtons *mouse_mode_button_set;
1332 void mouse_mode_toggled (Editing::MouseMode m);
1333 bool ignore_mouse_mode_toggle;
1335 gint mouse_select_button_release (GdkEventButton*);
1337 Gtk::VBox automation_box;
1338 Gtk::Button automation_mode_button;
1339 Gtk::ToggleButton global_automation_button;
1341 Gtk::ComboBoxText edit_mode_selector;
1342 Gtk::Label edit_mode_label;
1343 Gtk::VBox edit_mode_box;
1345 void edit_mode_selection_done ();
1347 Gtk::ComboBoxText snap_type_selector;
1348 Gtk::Label snap_type_label;
1349 Gtk::VBox snap_type_box;
1351 void snap_type_selection_done ();
1353 Gtk::ComboBoxText snap_mode_selector;
1354 Gtk::Label snap_mode_label;
1355 Gtk::VBox snap_mode_box;
1357 void snap_mode_selection_done ();
1359 Gtk::ComboBoxText zoom_focus_selector;
1360 Gtk::Label zoom_focus_label;
1361 Gtk::VBox zoom_focus_box;
1363 void zoom_focus_selection_done ();
1365 Gtk::Label zoom_indicator_label;
1366 Gtk::HBox zoom_indicator_box;
1367 Gtk::VBox zoom_indicator_vbox;
1369 void update_zoom_indicator ();
1370 void zoom_adjustment_changed();
1372 void edit_cursor_clock_changed();
1374 void setup_toolbar ();
1376 Gtkmm2ext::TearOff* tools_tearoff;
1377 Gtk::HBox toolbar_hbox;
1378 Gtk::EventBox toolbar_base;
1379 Gtk::Frame toolbar_frame;
1381 /* selection process */
1383 Selection* selection;
1384 Selection* cut_buffer;
1386 void time_selection_changed ();
1387 void track_selection_changed ();
1388 void region_selection_changed ();
1389 void point_selection_changed ();
1390 void audio_track_selection_changed ();
1391 void line_selection_changed ();
1400 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1401 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1402 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1403 void cancel_selection ();
1405 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1406 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1407 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1409 bool audio_region_selection_covers (jack_nframes_t where);
1411 /* transport range select process */
1412 enum RangeMarkerOp {
1414 CreateTransportMarker
1417 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1418 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1419 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1421 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1422 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1423 ArdourCanvas::Line* marker_drag_line;
1424 ArdourCanvas::Points marker_drag_line_points;
1425 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1427 void update_marker_drag_item (ARDOUR::Location *);
1429 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1430 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1431 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1432 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1433 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1434 ArdourCanvas::SimpleLine *transport_punchin_line;
1435 ArdourCanvas::SimpleLine *transport_punchout_line;
1436 ArdourCanvas::SimpleRect *transport_preroll_rect;
1437 ArdourCanvas::SimpleRect *transport_postroll_rect;
1439 ARDOUR::Location* transport_loop_location();
1440 ARDOUR::Location* transport_punch_location();
1442 ARDOUR::Location *temp_location;
1444 /* object rubberband select process */
1446 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1447 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1448 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1450 bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
1452 ArdourCanvas::SimpleRect *rubberband_rect;
1454 /* mouse zoom process */
1456 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1457 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1458 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1460 ArdourCanvas::SimpleRect *zoom_rect;
1461 void reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end);
1463 /* diskstream/route display management */
1465 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1466 RouteDisplayModelColumns() {
1471 Gtk::TreeModelColumn<Glib::ustring> text;
1472 Gtk::TreeModelColumn<bool> visible;
1473 Gtk::TreeModelColumn<TimeAxisView*> tv;
1476 RouteDisplayModelColumns route_display_columns;
1477 Glib::RefPtr<Gtk::ListStore> route_display_model;
1478 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1480 gint route_list_compare_func (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1481 Gtkmm2ext::DnDTreeView route_list_display;
1482 Gtk::ScrolledWindow route_list_scroller;
1483 Gtk::Menu* route_list_menu;
1485 bool route_list_display_button_press (GdkEventButton*);
1486 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1488 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1489 void route_list_delete (const Gtk::TreeModel::Path&);
1490 void initial_route_list_display ();
1491 void redisplay_route_list();
1492 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1493 bool ignore_route_list_reorder;
1494 bool no_route_list_redisplay;
1495 void queue_route_list_reordered ();
1497 void build_route_list_menu ();
1498 void show_route_list_menu ();
1500 void show_all_routes ();
1501 void hide_all_routes ();
1502 void show_all_audiotracks ();
1503 void hide_all_audiotracks ();
1504 void show_all_audiobus ();
1505 void hide_all_audiobus ();
1507 void set_all_tracks_visibility (bool yn);
1508 void set_all_audio_visibility (int type, bool yn);
1510 /* edit group management */
1512 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1513 GroupListModelColumns () {
1519 Gtk::TreeModelColumn<bool> is_active;
1520 Gtk::TreeModelColumn<bool> is_visible;
1521 Gtk::TreeModelColumn<std::string> text;
1522 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1525 GroupListModelColumns group_columns;
1526 Glib::RefPtr<Gtk::ListStore> group_model;
1527 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1529 Gtk::TreeView edit_group_display;
1530 Gtk::ScrolledWindow edit_group_display_scroller;
1531 Gtk::Menu* edit_group_list_menu;
1533 void build_edit_group_list_menu ();
1534 void activate_all_edit_groups ();
1535 void disable_all_edit_groups ();
1537 bool in_edit_group_row_change;
1538 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1539 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1540 void new_edit_group ();
1541 void edit_group_list_button_clicked ();
1542 gint edit_group_list_button_press_event (GdkEventButton* ev);
1543 void edit_group_selection_changed ();
1544 void fake_add_edit_group (ARDOUR::RouteGroup* group);
1545 void fake_remove_edit_group (ARDOUR::RouteGroup* group);
1546 void add_edit_group (ARDOUR::RouteGroup* group);
1547 void remove_selected_edit_group ();
1548 void edit_groups_changed ();
1549 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1551 Gtk::VBox list_vpacker;
1555 int autoscroll_timeout_tag;
1556 int autoscroll_direction;
1557 uint32_t autoscroll_cnt;
1558 jack_nframes_t autoscroll_distance;
1560 static gint _autoscroll_canvas (void *);
1561 gint autoscroll_canvas ();
1562 void start_canvas_autoscroll (int direction);
1563 void stop_canvas_autoscroll ();
1564 void maybe_autoscroll (GdkEvent*);
1573 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1574 void point_trim (GdkEvent*);
1575 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1576 void single_contents_trim (AudioRegionView&, jack_nframes_t, bool, bool, bool);
1577 void single_start_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1578 void single_end_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1580 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1581 void thaw_region_after_trim (AudioRegionView& rv);
1583 void trim_region_to_edit_cursor ();
1584 void trim_region_from_edit_cursor ();
1586 bool show_gain_after_trim;
1590 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1591 const Glib::RefPtr<Gdk::DragContext>& context,
1594 const Gtk::SelectionData& data,
1598 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1601 const Gtk::SelectionData& data,
1605 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1608 const Gtk::SelectionData& data,
1613 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1616 const Gtk::SelectionData& data,
1620 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1623 const Gtk::SelectionData& data,
1629 ExportDialog *export_dialog;
1630 ExportDialog *export_range_markers_dialog;
1632 void export_range (jack_nframes_t start, jack_nframes_t end);
1633 void export_range_markers ();
1635 int write_region_selection(AudioRegionSelection&);
1636 bool write_region (string path, ARDOUR::AudioRegion&);
1637 void export_region ();
1638 void bounce_region_selection ();
1639 void bounce_range_selection ();
1640 void external_edit_region ();
1642 int write_audio_selection (TimeSelection&);
1643 bool write_audio_range (ARDOUR::Playlist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1645 void write_selection ();
1649 UndoAction get_memento() const;
1651 void begin_reversible_command (string cmd_name);
1652 void commit_reversible_command ();
1654 /* visual history */
1656 UndoHistory visual_history;
1657 UndoCommand current_visual_command;
1659 void begin_reversible_visual_command (const string & cmd_name);
1660 void commit_reversible_visual_command ();
1662 void update_title ();
1663 void update_title_s (const string & snapshot_name);
1666 Selection* selection;
1667 double frames_per_unit;
1673 void store_state (State&) const;
1674 void restore_state (State *);
1676 void instant_save ();
1678 ARDOUR::AudioRegion* last_audition_region;
1680 /* freeze operations */
1682 ARDOUR::InterThreadInfo freeze_status;
1683 gint freeze_progress_timeout (void *);
1684 static void* _freeze_thread (void*);
1685 void* freeze_thread ();
1687 void freeze_route ();
1688 void unfreeze_route ();
1690 /* edit-group solo + mute */
1692 void set_edit_group_solo (ARDOUR::Route&, bool);
1693 void set_edit_group_mute (ARDOUR::Route&, bool);
1697 void duplicate_dialog (bool for_region);
1701 Gtk::Menu* edit_menu;
1702 bool edit_menu_map_handler (GdkEventAny*);
1704 jack_nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
1706 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1707 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1708 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1710 struct TimeStretchDialog : public ArdourDialog {
1711 ARDOUR::Session::TimeStretchRequest request;
1713 AudioRegionSelection regions;
1714 Gtk::ProgressBar progress_bar;
1715 Gtk::ToggleButton quick_button;
1716 Gtk::ToggleButton antialias_button;
1717 Gtk::Button cancel_button;
1718 Gtk::Button action_button;
1719 Gtk::HBox lower_button_box;
1720 Gtk::HBox upper_button_box;
1724 TimeStretchDialog (Editor& e);
1726 gint update_progress ();
1727 sigc::connection first_cancel;
1728 sigc::connection first_delete;
1729 void cancel_timestretch_in_progress ();
1730 gint delete_timestretch_in_progress (GdkEventAny*);
1733 /* "whats mine is yours" */
1735 friend class TimeStretchDialog;
1737 TimeStretchDialog* current_timestretch;
1739 static void* timestretch_thread (void *arg);
1740 int run_timestretch (AudioRegionSelection&, float fraction);
1741 void do_timestretch (TimeStretchDialog&);
1743 /* editor-mixer strip */
1745 MixerStrip *current_mixer_strip;
1746 Gtk::VBox current_mixer_strip_vbox;
1747 void cms_deleted ();
1748 void current_mixer_strip_hidden ();
1749 void current_mixer_strip_removed ();
1751 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1752 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1754 /* nudging tracks */
1756 void nudge_track (bool use_edit_cursor, bool forwards);
1760 bool _xfade_visibility;
1762 /* <CMT Additions> */
1763 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1764 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
1766 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1767 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1769 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1770 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1771 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1773 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1774 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1775 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1776 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1778 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1779 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1780 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1781 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1783 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1784 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1785 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1786 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1787 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1788 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1790 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1791 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1792 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1793 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1794 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1795 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1797 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1798 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1800 ImageFrameSocketHandler* image_socket_listener ;
1801 /* </CMT Additions> */
1803 void toggle_xfade_active (ARDOUR::Crossfade*);
1804 void toggle_xfade_length (ARDOUR::Crossfade*);
1805 void edit_xfade (ARDOUR::Crossfade*);
1806 void remove_xfade ();
1807 void xfade_edit_left_region ();
1808 void xfade_edit_right_region ();
1810 static const int32_t default_width = 995;
1811 static const int32_t default_height = 765;
1815 Gtk::Button nudge_forward_button;
1816 Gtk::Button nudge_backward_button;
1817 Gtk::HBox nudge_hbox;
1818 Gtk::VBox nudge_vbox;
1819 Gtk::Label nudge_label;
1820 AudioClock nudge_clock;
1822 jack_nframes_t get_nudge_distance (jack_nframes_t pos, jack_nframes_t& next);
1826 void apply_filter (ARDOUR::AudioFilter&, string cmd);
1828 /* handling cleanup */
1830 int playlist_deletion_dialog (ARDOUR::Playlist*);
1832 vector<sigc::connection> session_connections;
1834 /* tracking step changes of track height */
1836 TimeAxisView* current_stepping_trackview;
1837 struct timeval last_track_height_step_timestamp;
1838 gint track_height_step_timeout();
1839 sigc::connection step_timeout;
1841 TimeAxisView* entered_track;
1842 AudioRegionView* entered_regionview;
1843 bool clear_entered_track;
1844 gint left_track_canvas (GdkEventCrossing*);
1845 void set_entered_track (TimeAxisView*);
1846 void set_entered_regionview (AudioRegionView*);
1847 gint left_automation_track ();
1849 bool _new_regionviews_show_envelope;
1851 void toggle_gain_envelope_visibility ();
1852 void toggle_gain_envelope_active ();
1854 bool on_key_press_event (GdkEventKey*);
1856 void session_state_saved (string);
1859 #endif /* __ardour_editor_h__ */