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 toggle_playback (bool with_abort);
175 void set_edit_menu (Gtk::Menu&);
177 jack_nframes_t unit_to_frame (double unit) {
178 return (jack_nframes_t) rint (unit * frames_per_unit);
181 double frame_to_unit (jack_nframes_t frame) {
182 return rint ((double) frame / (double) frames_per_unit);
185 double frame_to_unit (double frame) {
186 return rint (frame / frames_per_unit);
189 /* NOTE: these functions assume that the "pixel" coordinate is
190 the result of using the world->canvas affine transform on a
191 world coordinate. These coordinates already take into
192 account any scrolling carried out by adjusting the
196 jack_nframes_t pixel_to_frame (double pixel) {
198 /* pixel can be less than zero when motion events
199 are processed. since we've already run the world->canvas
200 affine, that means that the location *really* is "off
201 to the right" and thus really is "before the start".
205 return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
211 gulong frame_to_pixel (jack_nframes_t frame) {
212 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
217 Selection& get_selection() const { return *selection; }
218 Selection& get_cut_buffer() const { return *cut_buffer; }
220 void play_selection ();
221 void select_all_in_track (Selection::Operation op);
222 void select_all (Selection::Operation op);
223 void invert_selection_in_track ();
224 void invert_selection ();
228 void set_show_measures (bool yn);
229 bool show_measures () const { return _show_measures; }
232 /* analysis window */
233 void analyze_region_selection();
234 void analyze_range_selection();
239 /* these initiate export ... */
241 void export_session();
242 void export_selection();
244 /* this is what actually does it */
246 void export_audiofile (ARDOUR::AudioExportSpecification&);
250 void add_toplevel_controls (Gtk::Container&);
252 void set_zoom_focus (Editing::ZoomFocus);
253 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
254 gdouble get_current_zoom () { return frames_per_unit; }
256 void temporal_zoom_step (bool coarser);
258 /* stuff that AudioTimeAxisView and related classes use */
260 PlaylistSelector& playlist_selector() const;
261 void route_name_changed (TimeAxisView *);
262 gdouble frames_per_unit;
263 jack_nframes_t leftmost_frame;
264 void clear_playlist (ARDOUR::Playlist&);
266 void new_playlists ();
267 void copy_playlists ();
268 void clear_playlists ();
270 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
272 Width editor_mixer_strip_width;
273 void show_editor_mixer (bool yn);
274 void set_selected_mixer_strip (TimeAxisView&);
275 void hide_track_in_display (TimeAxisView& tv);
276 void show_track_in_display (TimeAxisView& tv);
278 /* nudge is initiated by transport controls owned by ARDOUR_UI */
280 void nudge_forward (bool next);
281 void nudge_backward (bool next);
283 /* nudge initiated from context menu */
285 void nudge_forward_capture_offset ();
286 void nudge_backward_capture_offset ();
288 /* playhead/screen stuff */
290 void set_follow_playhead (bool yn);
291 void toggle_follow_playhead ();
292 bool follow_playhead() const { return _follow_playhead; }
294 void toggle_waveform_visibility ();
295 void toggle_waveforms_while_recording ();
296 void toggle_measure_visibility ();
298 void set_meter_falloff (float);
299 void set_meter_hold (int32_t);
303 void toggle_xfades_active();
304 void toggle_xfade_visibility ();
305 void set_xfade_visibility (bool yn);
306 bool xfade_visibility() const { return _xfade_visibility; }
308 /* redirect shared ops menu. caller must free returned menu */
310 Gtk::Menu* redirect_menu ();
312 /* floating windows/transient */
314 void ensure_float (Gtk::Window&);
318 void scroll_tracks_down_line ();
319 void scroll_tracks_up_line ();
321 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
322 void prepare_for_cleanup ();
324 void reposition_x_origin (jack_nframes_t sample);
326 void maximise_editing_space();
327 void restore_editing_space();
330 void map_transport_state ();
331 void map_position_change (jack_nframes_t);
337 ARDOUR::Session *session;
338 ARDOUR::AudioEngine& engine;
341 PlaylistSelector* _playlist_selector;
351 TransportMarkerBarItem,
353 GainControlPointItem,
355 GainAutomationControlPointItem,
356 GainAutomationLineItem,
357 PanAutomationControlPointItem,
358 PanAutomationLineItem,
359 RedirectAutomationControlPointItem,
360 RedirectAutomationLineItem,
365 AudioRegionViewNameHighlight,
367 StartSelectionTrimItem,
368 EndSelectionTrimItem,
375 /* <CMT Additions> */
378 MarkerViewHandleStartItem,
379 MarkerViewHandleEndItem,
381 ImageFrameTimeAxisItem,
382 ImageFrameHandleStartItem,
383 ImageFrameHandleEndItem,
384 /* </CMT Additions> */
388 /* don't remove this */
393 void set_frames_per_unit (double);
394 void frames_per_unit_modified ();
396 Editing::MouseMode mouse_mode;
397 void mouse_insert (GdkEventButton *);
399 int pre_maximal_pane_position;
400 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
402 Gtk::Notebook the_notebook;
403 Gtk::HPaned edit_pane;
405 Gtk::EventBox meter_base;
407 Gtk::EventBox marker_base;
408 Gtk::HBox marker_box;
409 Gtk::VBox scrollers_rulers_markers_box;
411 void location_changed (ARDOUR::Location *);
412 void location_flags_changed (ARDOUR::Location *, void *);
413 void refresh_location_display ();
414 void refresh_location_display_s (ARDOUR::Change);
415 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
416 void add_new_location (ARDOUR::Location *);
417 void location_gone (ARDOUR::Location *);
418 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
419 gint really_remove_marker (ARDOUR::Location* loc);
421 uint32_t location_marker_color;
422 uint32_t location_range_color;
423 uint32_t location_loop_color;
424 uint32_t location_punch_color;
425 uint32_t location_cd_marker_color;
427 struct LocationMarkers {
435 void set_name (const string&);
436 void set_position (jack_nframes_t start, jack_nframes_t end = 0);
437 void set_color_rgba (uint32_t);
440 LocationMarkers *find_location_markers (ARDOUR::Location *);
441 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start);
443 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
444 LocationMarkerMap location_markers;
446 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
447 void clear_marker_display ();
448 void mouse_add_new_marker (jack_nframes_t where);
450 TimeAxisView* clicked_trackview;
451 AudioTimeAxisView* clicked_audio_trackview;
452 AudioRegionView* clicked_regionview;
453 AudioRegionView* latest_regionview;
454 uint32_t clicked_selection;
455 CrossfadeView* clicked_crossfadeview;
456 ControlPoint* clicked_control_point;
458 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl);
460 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
462 void mapped_set_selected_regionview_from_click (AudioTimeAxisView&, uint32_t, AudioRegionView*, vector<AudioRegionView*>*);
463 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t);
464 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t);
465 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
469 void catch_vanishing_audio_regionview (AudioRegionView *);
470 void set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
471 void set_selected_track_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
472 void set_selected_regionview_from_click (Selection::Operation op = Selection::Set, bool no_track_remove=false);
473 void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set);
474 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
475 void collect_new_region_view (AudioRegionView *);
477 Gtk::Menu track_context_menu;
478 Gtk::Menu track_region_context_menu;
479 Gtk::Menu track_selection_context_menu;
480 Gtk::Menu track_crossfade_context_menu;
482 Gtk::MenuItem* region_edit_menu_split_item;
483 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
484 Gtk::Menu * track_region_edit_playlist_menu;
485 Gtk::Menu * track_edit_playlist_submenu;
486 Gtk::Menu * track_selection_edit_playlist_submenu;
488 void popup_track_context_menu (int, int, ItemType, bool, jack_nframes_t);
489 Gtk::Menu* build_track_context_menu (jack_nframes_t);
490 Gtk::Menu* build_track_bus_context_menu (jack_nframes_t);
491 Gtk::Menu* build_track_region_context_menu (jack_nframes_t frame);
492 Gtk::Menu* build_track_crossfade_context_menu (jack_nframes_t);
493 Gtk::Menu* build_track_selection_context_menu (jack_nframes_t);
494 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
495 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
496 void add_region_context_items (StreamView*, ARDOUR::Region*, Gtk::Menu_Helpers::MenuList&);
497 void add_crossfade_context_items (StreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
498 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
500 void handle_new_route (ARDOUR::Route&);
501 void handle_new_route_p (ARDOUR::Route*);
502 void remove_route (TimeAxisView *);
505 Gtk::HBox global_hpacker;
506 Gtk::VBox global_vpacker;
509 Gdk::Cursor* current_canvas_cursor;
511 ArdourCanvas::CanvasAA track_canvas;
512 ArdourCanvas::CanvasAA time_canvas;
514 ArdourCanvas::Text* first_action_message;
515 ArdourCanvas::Text* verbose_canvas_cursor;
516 bool verbose_cursor_visible;
518 void session_control_changed (ARDOUR::Session::ControlType);
519 void queue_session_control_changed (ARDOUR::Session::ControlType);
522 bool track_canvas_motion (GdkEvent*);
524 void set_verbose_canvas_cursor (const string &, double x, double y);
525 void set_verbose_canvas_cursor_text (const string &);
526 void show_verbose_canvas_cursor();
527 void hide_verbose_canvas_cursor();
529 bool verbose_cursor_on; // so far unused
531 void flush_track_canvas ();
532 void flush_time_canvas ();
534 Gtk::EventBox time_canvas_event_box;
535 Gtk::EventBox track_canvas_event_box;
536 Gtk::EventBox time_button_event_box;
538 ArdourCanvas::Group *minsec_group;
539 ArdourCanvas::Group *bbt_group;
540 ArdourCanvas::Group *smpte_group;
541 ArdourCanvas::Group *frame_group;
542 ArdourCanvas::Group *tempo_group;
543 ArdourCanvas::Group *meter_group;
544 ArdourCanvas::Group *marker_group;
545 ArdourCanvas::Group *range_marker_group;
546 ArdourCanvas::Group *transport_marker_group;
549 ruler_metric_smpte = 0,
550 ruler_metric_bbt = 1,
551 ruler_metric_frames = 2,
552 ruler_metric_minsec = 3,
554 ruler_time_tempo = 4,
555 ruler_time_meter = 5,
556 ruler_time_marker = 6,
557 ruler_time_range_marker = 7,
558 ruler_time_transport_marker = 8,
561 static GtkCustomMetric ruler_metrics[4];
563 bool no_ruler_shown_update;
565 gint ruler_button_press (GdkEventButton*);
566 gint ruler_button_release (GdkEventButton*);
567 gint ruler_mouse_motion (GdkEventMotion*);
569 gint ruler_pressed_button;
570 Gtk::Widget * ruler_grabbed_widget;
572 void initialize_rulers ();
573 void update_just_smpte ();
574 void update_fixed_rulers ();
575 void update_tempo_based_rulers ();
576 void popup_ruler_menu (jack_nframes_t where = 0, ItemType type = RegionItem);
577 void update_ruler_visibility ();
578 void ruler_toggled (int);
579 gint ruler_label_button_release (GdkEventButton*);
580 void store_ruler_visibility ();
581 void restore_ruler_visibility ();
583 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
584 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
585 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
586 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
588 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
589 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
590 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
591 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
593 GtkWidget *_smpte_ruler;
594 GtkWidget *_bbt_ruler;
595 GtkWidget *_frames_ruler;
596 GtkWidget *_minsec_ruler;
597 Gtk::Widget *smpte_ruler;
598 Gtk::Widget *bbt_ruler;
599 Gtk::Widget *frames_ruler;
600 Gtk::Widget *minsec_ruler;
601 static Editor *ruler_editor;
603 static const double timebar_height;
604 guint32 visible_timebars;
605 Gtk::Menu *editor_ruler_menu;
607 ArdourCanvas::SimpleRect* tempo_bar;
608 ArdourCanvas::SimpleRect* meter_bar;
609 ArdourCanvas::SimpleRect* marker_bar;
610 ArdourCanvas::SimpleRect* range_marker_bar;
611 ArdourCanvas::SimpleRect* transport_marker_bar;
614 ArdourCanvas::SimpleLine* tempo_line;
615 ArdourCanvas::SimpleLine* meter_line;
616 ArdourCanvas::SimpleLine* marker_line;
617 ArdourCanvas::SimpleLine* range_marker_line;
618 ArdourCanvas::SimpleLine* transport_marker_line;
620 Gtk::Label minsec_label;
621 Gtk::Label bbt_label;
622 Gtk::Label smpte_label;
623 Gtk::Label frame_label;
624 Gtk::Label tempo_label;
625 Gtk::Label meter_label;
626 Gtk::Label mark_label;
627 Gtk::Label range_mark_label;
628 Gtk::Label transport_mark_label;
631 Gtk::VBox time_button_vbox;
632 Gtk::HBox time_button_hbox;
636 ArdourCanvas::Points points;
637 ArdourCanvas::Line canvas_item;
638 jack_nframes_t current_frame;
641 Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
644 void set_position (jack_nframes_t);
645 void set_length (double units);
646 void set_y_axis (double position);
649 friend struct Cursor; /* it needs access to several private
653 Cursor* playhead_cursor;
655 ArdourCanvas::Group* cursor_group;
657 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
658 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
659 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
660 void cursor_to_selection_start (Cursor *);
661 void cursor_to_selection_end (Cursor *);
662 void select_all_selectables_using_cursor (Cursor *, bool);
664 ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
666 vector<jack_nframes_t> region_boundary_cache;
667 void build_region_boundary_cache ();
669 Gtk::VBox trackview_vpacker;
672 Gtk::HBox bottom_hbox;
674 Gtk::Table edit_packer;
675 Gtk::Frame edit_frame;
676 Gtk::VScrollbar edit_vscrollbar;
678 Gtk::Adjustment vertical_adjustment;
679 Gtk::Adjustment horizontal_adjustment;
681 Gtk::Layout controls_layout;
682 bool control_layout_scroll (GdkEventScroll* ev);
683 void controls_layout_size_request (Gtk::Requisition*);
685 Gtk::HScrollbar edit_hscrollbar;
686 bool edit_hscroll_dragging;
688 bool hscrollbar_button_press (GdkEventButton*);
689 bool hscrollbar_button_release (GdkEventButton*);
690 void hscrollbar_allocate (Gtk::Allocation &alloc);
693 double canvas_height;
695 bool track_canvas_map_handler (GdkEventAny*);
696 bool time_canvas_map_handler (GdkEventAny*);
698 gint edit_controls_button_release (GdkEventButton*);
699 Gtk::Menu *edit_controls_left_menu;
700 Gtk::Menu *edit_controls_right_menu;
702 void track_canvas_scroller_realized ();
703 void time_canvas_scroller_realized ();
705 Gtk::VBox track_canvas_vbox;
706 Gtk::VBox time_canvas_vbox;
707 Gtk::VBox edit_controls_vbox;
708 Gtk::HBox edit_controls_hbox;
710 void tie_vertical_scrolling ();
711 void canvas_horizontally_scrolled ();
712 void reposition_and_zoom (jack_nframes_t sample, double fpu);
713 gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
714 void end_location_changed (ARDOUR::Location*);
715 bool repos_zoom_queued;
716 bool no_zoom_repos_update;
717 bool no_tempo_map_update;
719 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
720 RegionListDisplayModelColumns() {
725 Gtk::TreeModelColumn<Glib::ustring> name;
726 Gtk::TreeModelColumn<ARDOUR::Region*> region;
727 Gtk::TreeModelColumn<Gdk::Color> color_;
730 RegionListDisplayModelColumns region_list_columns;
731 Gtkmm2ext::DnDTreeView region_list_display;
732 Glib::RefPtr<Gtk::TreeStore> region_list_model;
733 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
734 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
736 void region_list_selection_changed ();
737 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
739 Gtk::Menu *region_list_menu;
740 Gtk::ScrolledWindow region_list_scroller;
741 Gtk::Frame region_list_frame;
743 bool region_list_display_key_press (GdkEventKey *);
744 bool region_list_display_key_release (GdkEventKey *);
745 bool region_list_display_button_press (GdkEventButton *);
746 bool region_list_display_button_release (GdkEventButton *);
747 void region_list_clear ();
748 void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
749 void build_region_list_menu ();
750 void show_region_list_display_context_menu (int button, int time);
752 bool show_automatic_regions_in_region_list;
753 Editing::RegionListSortType region_list_sort_type;
755 void reset_region_list_sort_direction (bool);
756 void reset_region_list_sort_type (Editing::RegionListSortType);
758 void toggle_full_region_list ();
759 void toggle_show_auto_regions ();
761 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
765 Gtk::ScrolledWindow snapshot_display_scroller;
766 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
767 SnapshotDisplayModelColumns() {
771 Gtk::TreeModelColumn<Glib::ustring> visible_name;
772 Gtk::TreeModelColumn<Glib::ustring> real_name;
775 SnapshotDisplayModelColumns snapshot_display_columns;
776 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
777 Gtk::TreeView snapshot_display;
779 bool snapshot_display_button_press (GdkEventButton*);
780 void snapshot_display_selection_changed ();
781 void redisplay_snapshots();
783 /* named selections */
785 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
786 NamedSelectionDisplayModelColumns() {
790 Gtk::TreeModelColumn<Glib::ustring> text;
791 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
794 NamedSelectionDisplayModelColumns named_selection_columns;
795 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
797 Gtkmm2ext::DnDTreeView named_selection_display;
798 Gtk::ScrolledWindow named_selection_scroller;
800 void name_selection();
801 void named_selection_name_chosen ();
802 void create_named_selection (const string &);
803 void paste_named_selection (float times);
805 void handle_new_named_selection ();
806 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
807 void redisplay_named_selections ();
809 gint named_selection_display_button_press (GdkEventButton *ev);
810 void named_selection_display_selection_changed ();
814 TrackViewList track_views;
815 TimeAxisView *trackview_by_y_position (double ypos);
817 static Gdk::Cursor* cross_hair_cursor;
818 static Gdk::Cursor* trimmer_cursor;
819 static Gdk::Cursor* selector_cursor;
820 static Gdk::Cursor* grabber_cursor;
821 static Gdk::Cursor* zoom_cursor;
822 static Gdk::Cursor* time_fx_cursor;
823 static Gdk::Cursor* fader_cursor;
824 static Gdk::Cursor* speaker_cursor;
825 static Gdk::Cursor* wait_cursor;
826 static Gdk::Cursor* timebar_cursor;
828 static void build_cursors ();
830 sigc::connection scroll_connection;
831 jack_nframes_t last_update_frame;
832 void center_screen (jack_nframes_t);
833 void center_screen_internal (jack_nframes_t, float);
835 void update_current_screen ();
836 sigc::connection slower_update_connection;
837 void update_slower ();
839 gint show_track_context_menu (GdkEventButton *);
840 void hide_track_context_menu ();
842 void session_going_away ();
844 jack_nframes_t cut_buffer_start;
845 jack_nframes_t cut_buffer_length;
847 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
848 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
849 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
850 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
851 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
852 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
854 /* KEYMAP HANDLING */
856 void register_actions ();
858 int ensure_cursor (jack_nframes_t* pos);
860 void fake_handle_new_audio_region (ARDOUR::AudioRegion *);
861 void handle_new_audio_region (ARDOUR::AudioRegion *);
862 void fake_handle_audio_region_removed (ARDOUR::AudioRegion *);
863 void handle_audio_region_removed (ARDOUR::AudioRegion *);
864 void add_audio_region_to_region_display (ARDOUR::AudioRegion *);
865 void region_hidden (ARDOUR::Region*);
866 void redisplay_regions ();
867 void insert_into_tmp_audio_regionlist(ARDOUR::AudioRegion *);
869 list<ARDOUR::AudioRegion *> tmp_audio_region_list;
871 void cut_copy (Editing::CutCopyOp);
872 void cut_copy_points (Editing::CutCopyOp);
873 void cut_copy_regions (Editing::CutCopyOp);
874 void cut_copy_ranges (Editing::CutCopyOp);
877 void paste_internal (jack_nframes_t position, float times);
879 /* EDITING OPERATIONS */
881 void toggle_region_mute ();
882 void toggle_region_opaque ();
883 void raise_region ();
884 void raise_region_to_top ();
885 void lower_region ();
886 void lower_region_to_bottom ();
887 void split_region ();
888 void split_region_at (jack_nframes_t);
889 void split_regions_at (jack_nframes_t, AudioRegionSelection&);
890 void crop_region_to_selection ();
891 void set_a_regions_sync_position (ARDOUR::Region&, jack_nframes_t);
892 void set_region_sync_from_edit_cursor ();
893 void remove_region_sync();
894 void align_selection (ARDOUR::RegionPoint, jack_nframes_t position);
895 void align_selection_relative (ARDOUR::RegionPoint point, jack_nframes_t position);
896 void align_region (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
897 void align_region_internal (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
898 void remove_some_regions ();
899 void remove_clicked_region ();
900 void destroy_clicked_region ();
902 void duplicate_some_regions (AudioRegionSelection&, float times);
903 void duplicate_selection (float times);
904 void region_fill_selection ();
906 void region_fill_track ();
907 void audition_playlist_region_standalone (ARDOUR::AudioRegion&);
908 void audition_playlist_region_via_route (ARDOUR::AudioRegion&, ARDOUR::Route&);
909 void split_multichannel_region();
910 void reverse_region ();
911 void normalize_region ();
912 void denormalize_region ();
914 void audition_region_from_region_list ();
915 void hide_region_from_region_list ();
916 void remove_region_from_region_list ();
918 void align (ARDOUR::RegionPoint);
919 void align_relative (ARDOUR::RegionPoint);
924 void paste (float times);
926 int get_prefix (float&, bool&);
928 void keyboard_paste ();
929 void keyboard_duplicate_region ();
930 void keyboard_duplicate_selection ();
931 void keyboard_nudge ();
932 void keyboard_insert_region_list_selection ();
934 void region_from_selection ();
935 void create_region_from_selection (std::vector<ARDOUR::AudioRegion*>&);
938 void rename_region ();
939 void rename_region_finished (bool);
941 void play_from_start ();
942 void play_from_edit_cursor ();
943 void play_selected_region ();
944 void audition_selected_region ();
945 void toggle_loop_playback ();
946 void loop_selected_region ();
947 void play_location (ARDOUR::Location&);
948 void loop_location (ARDOUR::Location&);
950 Editing::ZoomFocus zoom_focus;
952 void temporal_zoom_selection ();
953 void temporal_zoom_session ();
954 void temporal_zoom (gdouble scale);
955 void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const string & op);
956 void temporal_zoom_to_frame (bool coarser, jack_nframes_t frame);
958 void amplitude_zoom (gdouble scale);
959 void amplitude_zoom_step (bool in);
961 void insert_region_list_drag (ARDOUR::AudioRegion&, int x, int y);
962 void insert_region_list_selection (float times);
964 void insert_sndfile (bool as_tracks);
965 void embed_audio (); // inserts into region list
966 int reject_because_rate_differs (const string & path, ARDOUR::SoundFileInfo& finfo, const string & action, bool multiple_pending);
968 void do_embed_sndfiles (vector<string> paths, bool split);
969 void embed_sndfile (string path, bool split, bool multiple_files, bool& check_sr);
971 void do_insert_sndfile (vector<string> path, bool multi, jack_nframes_t frame);
972 void insert_paths_as_new_tracks (std::vector<std::string> paths, bool multi); // inserts files as new tracks
973 void insert_sndfile_into (const string & path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
974 static void* _insert_sndfile_thread (void*);
975 void* insert_sndfile_thread (void*);
977 /* generic interthread progress window */
979 ArdourDialog* interthread_progress_window;
980 Gtk::Label interthread_progress_label;
981 Gtk::VBox interthread_progress_vbox;
982 Gtk::ProgressBar interthread_progress_bar;
983 Gtk::Button interthread_cancel_button;
984 Gtk::Label interthread_cancel_label;
985 sigc::connection interthread_progress_connection;
986 void interthread_cancel_clicked ();
987 void build_interthread_progress_window ();
988 ARDOUR::InterThreadInfo* current_interthread_info;
991 AnalysisWindow* analysis_window;
994 /* import specific info */
996 ARDOUR::Session::import_status import_status;
997 gint import_progress_timeout (void *);
998 static void *_import_thread (void *);
999 void* import_thread ();
1000 void catch_new_audio_region (ARDOUR::AudioRegion*);
1001 ARDOUR::AudioRegion* last_audio_region;
1003 /* to support this ... */
1005 void import_audio (bool as_tracks);
1006 void do_import (vector<string> paths, bool split, bool as_tracks);
1008 void move_to_start ();
1009 void move_to_end ();
1011 void center_playhead ();
1012 void center_edit_cursor ();
1013 void edit_cursor_backward ();
1014 void edit_cursor_forward ();
1015 void playhead_backward ();
1016 void playhead_forward ();
1017 void scroll_backward (float pages=0.8f);
1018 void scroll_forward (float pages=0.8f);
1019 void scroll_tracks_down ();
1020 void scroll_tracks_up ();
1021 void delete_sample_forward ();
1022 void delete_sample_backward ();
1023 void delete_screen ();
1024 void search_backwards ();
1025 void search_forwards ();
1027 void clear_markers ();
1028 void clear_ranges ();
1029 void clear_locations ();
1030 void jump_forward_to_mark ();
1031 void jump_backward_to_mark ();
1032 void cursor_align (bool playhead_to_edit);
1034 void remove_last_capture ();
1035 void select_all_selectables_using_time_selection ();
1036 void select_all_selectables_using_loop();
1037 void select_all_selectables_using_punch();
1038 void set_selection_from_range (ARDOUR::Location&);
1039 void set_selection_from_punch ();
1040 void set_selection_from_loop ();
1042 void add_location_from_selection ();
1043 void set_route_loop_selection ();
1045 void add_location_from_playhead_cursor ();
1047 void reverse_selection ();
1048 void edit_envelope ();
1050 void start_scrolling ();
1051 void stop_scrolling ();
1053 void keyboard_selection_begin ();
1054 void keyboard_selection_finish (bool add);
1055 bool have_pending_keyboard_selection;
1056 jack_nframes_t pending_keyboard_selection_start;
1058 ARDOUR::AudioRegion* select_region_for_operation (int dir, TimeAxisView **tv);
1059 void extend_selection_to_end_of_region (bool next);
1060 void extend_selection_to_start_of_region (bool previous);
1062 Editing::SnapType snap_type;
1063 Editing::SnapMode snap_mode;
1064 double snap_threshold;
1066 void soundfile_chosen_for_insert (const string & selection, bool split_channels);
1067 void soundfile_chosen_for_embed (const string & selection, bool split_channels);
1068 void soundfile_chosen_for_import (const string & selection, bool split_channels);
1070 void handle_gui_changes (const string &, void *);
1072 void hide_all_tracks (bool with_select);
1075 LineDragInfo current_line_drag_info;
1077 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1078 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1080 Gtk::Menu fade_context_menu;
1081 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1083 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1084 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1085 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1086 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1087 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1088 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1090 std::set<ARDOUR::Playlist*> motion_frozen_playlists;
1091 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1092 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1093 void region_copy_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1095 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1096 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1097 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1098 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1099 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1100 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1101 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1102 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1104 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1105 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1106 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1107 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1109 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1111 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1112 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1113 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1114 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1115 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1116 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1117 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1118 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1119 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1120 void start_line_grab (AutomationLine *, GdkEvent*);
1121 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1122 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1123 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1124 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1126 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1128 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1129 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1131 void mouse_brush_insert_region (AudioRegionView*, jack_nframes_t pos);
1132 void brush (jack_nframes_t);
1134 void show_verbose_time_cursor (jack_nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1135 void show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1137 /* Canvas event handlers */
1139 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1140 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1141 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1142 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1143 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1144 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1145 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1146 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1147 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1148 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1149 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1150 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1151 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1152 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioTimeAxisView*);
1153 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1154 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1155 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1156 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1157 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1159 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1160 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1161 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1162 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1163 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1165 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1166 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1167 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1168 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1169 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1170 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1171 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1172 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1174 /* non-public event handlers */
1176 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1177 bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1178 bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
1179 bool track_canvas_scroll (GdkEventScroll* event);
1181 bool track_canvas_button_press_event (GdkEventButton *);
1182 bool track_canvas_button_release_event (GdkEventButton *);
1184 void track_canvas_allocate (Gtk::Allocation alloc);
1185 void time_canvas_allocate (Gtk::Allocation alloc);
1187 void set_edit_cursor (GdkEvent* event);
1188 void set_playhead_cursor (GdkEvent* event);
1190 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1191 void kbd_set_playhead_cursor ();
1192 void kbd_set_edit_cursor ();
1193 void kbd_mute_unmute_region ();
1195 void kbd_set_sync_position ();
1196 void kbd_align (ARDOUR::RegionPoint);
1197 void kbd_align_relative (ARDOUR::RegionPoint);
1199 void kbd_audition ();
1201 void kbd_do_split (GdkEvent*);
1202 void kbd_do_set_sync_position (GdkEvent* ev);
1203 void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
1204 void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
1205 void kbd_do_brush (GdkEvent*);
1206 void kbd_do_audition (GdkEvent*);
1208 void fake_handle_new_duration ();
1209 void handle_new_duration ();
1210 void initialize_canvas ();
1211 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1212 void scroll_canvas ();
1214 /* display control */
1216 bool _show_measures;
1217 bool _show_waveforms;
1218 bool _follow_playhead;
1219 bool _show_waveforms_recording;
1221 void add_bbt_marks (ARDOUR::TempoMap::BBTPointList&);
1223 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1225 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1226 TimeLineList free_measure_lines;
1227 TimeLineList used_measure_lines;
1229 ArdourCanvas::Group* time_line_group;
1230 ArdourCanvas::SimpleLine* get_time_line ();
1231 void hide_measures ();
1232 void draw_measures ();
1233 void draw_time_bars ();
1235 void new_tempo_section ();
1237 void mouse_add_new_tempo_event (jack_nframes_t where);
1238 void mouse_add_new_meter_event (jack_nframes_t where);
1240 void remove_tempo_marker (ArdourCanvas::Item*);
1241 void remove_meter_marker (ArdourCanvas::Item*);
1242 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1243 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1245 void edit_tempo_section (ARDOUR::TempoSection*);
1246 void edit_meter_section (ARDOUR::MeterSection*);
1247 void edit_tempo_marker (ArdourCanvas::Item*);
1248 void edit_meter_marker (ArdourCanvas::Item*);
1250 void marker_menu_edit ();
1251 void marker_menu_remove ();
1252 void marker_menu_rename ();
1253 void marker_menu_hide ();
1254 void marker_menu_loop_range ();
1255 void marker_menu_select_all_selectables_using_range ();
1256 void marker_menu_play_from ();
1257 void marker_menu_set_playhead ();
1258 void marker_menu_set_from_playhead ();
1259 void marker_menu_set_from_selection ();
1260 void new_transport_marker_menu_set_loop ();
1261 void new_transport_marker_menu_set_punch ();
1262 void update_loop_range_view (bool visibility=false);
1263 void update_punch_range_view (bool visibility=false);
1264 gint new_transport_marker_menu_popdown (GdkEventAny*);
1265 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1266 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1267 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1268 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1269 void build_range_marker_menu ();
1270 void build_marker_menu ();
1271 void build_tm_marker_menu ();
1272 void build_transport_marker_menu ();
1273 void build_new_transport_marker_menu ();
1275 Gtk::Menu* tm_marker_menu;
1276 Gtk::Menu* marker_menu;
1277 Gtk::Menu* transport_marker_menu;
1278 Gtk::Menu* new_transport_marker_menu;
1279 ArdourCanvas::Item* marker_menu_item;
1281 typedef list<Marker*> Marks;
1284 void remove_metric_marks ();
1285 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1287 void tempo_map_changed (ARDOUR::Change);
1288 void redisplay_tempo ();
1290 void snap_to (jack_nframes_t& first, int32_t direction = 0, bool for_mark = false);
1291 uint32_t bbt_beat_subdivision;
1295 Gtk::ToggleButton editor_mixer_button;
1297 void editor_mixer_button_toggled ();
1299 AudioClock selection_start_clock;
1300 Gtk::Label selection_start_clock_label;
1301 AudioClock selection_end_clock;
1302 Gtk::Label selection_end_clock_label;
1303 AudioClock edit_cursor_clock;
1304 Gtk::Label edit_cursor_clock_label;
1305 AudioClock zoom_range_clock;
1306 Gtk::Button zoom_in_button;
1307 Gtk::Button zoom_out_button;
1308 Gtk::Button zoom_out_full_button;
1309 Gtk::Button zoom_onetoone_button;
1311 Gtk::VBox toolbar_clock_vbox;
1312 Gtk::VBox toolbar_selection_clock_vbox;
1313 Gtk::Table toolbar_selection_clock_table;
1314 Gtk::Label toolbar_selection_cursor_label;
1316 Gtk::Table mouse_mode_button_table;
1317 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1318 Gtk::ToggleButton mouse_select_button;
1319 Gtk::ToggleButton mouse_move_button;
1320 Gtk::ToggleButton mouse_gain_button;
1321 Gtk::ToggleButton mouse_zoom_button;
1322 Gtk::ToggleButton mouse_timefx_button;
1323 Gtk::ToggleButton mouse_audition_button;
1324 GroupedButtons *mouse_mode_button_set;
1325 void mouse_mode_toggled (Editing::MouseMode m);
1326 bool ignore_mouse_mode_toggle;
1328 gint mouse_select_button_release (GdkEventButton*);
1330 Gtk::VBox automation_box;
1331 Gtk::Button automation_mode_button;
1332 Gtk::ToggleButton global_automation_button;
1334 Gtk::ComboBoxText edit_mode_selector;
1335 Gtk::Label edit_mode_label;
1336 Gtk::VBox edit_mode_box;
1338 void edit_mode_selection_done ();
1340 Gtk::ComboBoxText snap_type_selector;
1341 Gtk::Label snap_type_label;
1342 Gtk::VBox snap_type_box;
1344 void snap_type_selection_done ();
1346 Gtk::ComboBoxText snap_mode_selector;
1347 Gtk::Label snap_mode_label;
1348 Gtk::VBox snap_mode_box;
1350 void snap_mode_selection_done ();
1352 Gtk::ComboBoxText zoom_focus_selector;
1353 Gtk::Label zoom_focus_label;
1354 Gtk::VBox zoom_focus_box;
1356 void zoom_focus_selection_done ();
1358 Gtk::Label zoom_indicator_label;
1359 Gtk::HBox zoom_indicator_box;
1360 Gtk::VBox zoom_indicator_vbox;
1362 void update_zoom_indicator ();
1363 void zoom_adjustment_changed();
1365 void edit_cursor_clock_changed();
1367 void setup_toolbar ();
1369 Gtkmm2ext::TearOff* tools_tearoff;
1370 Gtk::HBox toolbar_hbox;
1371 Gtk::EventBox toolbar_base;
1372 Gtk::Frame toolbar_frame;
1374 /* selection process */
1376 Selection* selection;
1377 Selection* cut_buffer;
1379 void time_selection_changed ();
1380 void track_selection_changed ();
1381 void region_selection_changed ();
1382 void point_selection_changed ();
1383 void audio_track_selection_changed ();
1384 void line_selection_changed ();
1393 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1394 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1395 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1396 void cancel_selection ();
1398 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1399 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1400 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1402 bool audio_region_selection_covers (jack_nframes_t where);
1404 /* transport range select process */
1405 enum RangeMarkerOp {
1407 CreateTransportMarker
1410 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1411 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1412 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1414 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1415 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1416 ArdourCanvas::Line* marker_drag_line;
1417 ArdourCanvas::Points marker_drag_line_points;
1418 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1420 void update_marker_drag_item (ARDOUR::Location *);
1422 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1423 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1424 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1425 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1426 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1427 ArdourCanvas::SimpleLine *transport_punchin_line;
1428 ArdourCanvas::SimpleLine *transport_punchout_line;
1429 ArdourCanvas::SimpleRect *transport_preroll_rect;
1430 ArdourCanvas::SimpleRect *transport_postroll_rect;
1432 ARDOUR::Location* transport_loop_location();
1433 ARDOUR::Location* transport_punch_location();
1435 ARDOUR::Location *temp_location;
1437 /* object rubberband select process */
1439 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1440 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1441 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1443 bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
1445 ArdourCanvas::SimpleRect *rubberband_rect;
1447 /* mouse zoom process */
1449 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1450 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1451 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1453 ArdourCanvas::SimpleRect *zoom_rect;
1454 void reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end);
1456 /* diskstream/route display management */
1458 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1459 RouteDisplayModelColumns() {
1464 Gtk::TreeModelColumn<Glib::ustring> text;
1465 Gtk::TreeModelColumn<bool> visible;
1466 Gtk::TreeModelColumn<TimeAxisView*> tv;
1469 RouteDisplayModelColumns route_display_columns;
1470 Glib::RefPtr<Gtk::ListStore> route_display_model;
1471 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1473 gint route_list_compare_func (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1474 Gtkmm2ext::DnDTreeView route_list_display;
1475 Gtk::ScrolledWindow route_list_scroller;
1476 Gtk::Menu* route_list_menu;
1478 bool route_list_display_button_press (GdkEventButton*);
1479 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1481 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1482 void route_list_delete (const Gtk::TreeModel::Path&);
1483 void initial_route_list_display ();
1484 void redisplay_route_list();
1485 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1486 bool ignore_route_list_reorder;
1487 bool no_route_list_redisplay;
1488 void queue_route_list_reordered ();
1490 void build_route_list_menu ();
1491 void show_route_list_menu ();
1493 void show_all_routes ();
1494 void hide_all_routes ();
1495 void show_all_audiotracks ();
1496 void hide_all_audiotracks ();
1497 void show_all_audiobus ();
1498 void hide_all_audiobus ();
1500 void set_all_tracks_visibility (bool yn);
1501 void set_all_audio_visibility (int type, bool yn);
1503 /* edit group management */
1505 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1506 GroupListModelColumns () {
1512 Gtk::TreeModelColumn<bool> is_active;
1513 Gtk::TreeModelColumn<bool> is_visible;
1514 Gtk::TreeModelColumn<std::string> text;
1515 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1518 GroupListModelColumns group_columns;
1519 Glib::RefPtr<Gtk::ListStore> group_model;
1520 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1522 Gtk::TreeView edit_group_display;
1523 Gtk::ScrolledWindow edit_group_display_scroller;
1524 Gtk::Menu* edit_group_list_menu;
1526 void build_edit_group_list_menu ();
1527 void activate_all_edit_groups ();
1528 void disable_all_edit_groups ();
1530 bool in_edit_group_row_change;
1531 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1532 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1533 void new_edit_group ();
1534 void edit_group_list_button_clicked ();
1535 gint edit_group_list_button_press_event (GdkEventButton* ev);
1536 void edit_group_selection_changed ();
1537 void fake_add_edit_group (ARDOUR::RouteGroup* group);
1538 void fake_remove_edit_group (ARDOUR::RouteGroup* group);
1539 void add_edit_group (ARDOUR::RouteGroup* group);
1540 void remove_selected_edit_group ();
1541 void edit_groups_changed ();
1542 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1544 Gtk::VBox list_vpacker;
1548 int autoscroll_timeout_tag;
1549 int autoscroll_direction;
1550 uint32_t autoscroll_cnt;
1551 jack_nframes_t autoscroll_distance;
1553 static gint _autoscroll_canvas (void *);
1554 gint autoscroll_canvas ();
1555 void start_canvas_autoscroll (int direction);
1556 void stop_canvas_autoscroll ();
1557 void maybe_autoscroll (GdkEvent*);
1566 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1567 void point_trim (GdkEvent*);
1568 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1569 void single_contents_trim (AudioRegionView&, jack_nframes_t, bool, bool, bool);
1570 void single_start_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1571 void single_end_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1573 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1574 void thaw_region_after_trim (AudioRegionView& rv);
1576 void trim_region_to_edit_cursor ();
1577 void trim_region_from_edit_cursor ();
1579 bool show_gain_after_trim;
1583 int convert_drop_to_paths (std::vector<std::string>& paths,
1584 const Glib::RefPtr<Gdk::DragContext>& context,
1587 const Gtk::SelectionData& data,
1591 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1594 const Gtk::SelectionData& data,
1598 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1601 const Gtk::SelectionData& data,
1606 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1609 const Gtk::SelectionData& data,
1613 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1616 const Gtk::SelectionData& data,
1622 ExportDialog *export_dialog;
1623 ExportDialog *export_range_markers_dialog;
1625 void export_range (jack_nframes_t start, jack_nframes_t end);
1626 void export_range_markers ();
1628 int write_region_selection(AudioRegionSelection&);
1629 bool write_region (string path, ARDOUR::AudioRegion&);
1630 void export_region ();
1631 void bounce_region_selection ();
1632 void bounce_range_selection ();
1633 void external_edit_region ();
1635 int write_audio_selection (TimeSelection&);
1636 bool write_audio_range (ARDOUR::Playlist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1638 void write_selection ();
1642 UndoAction get_memento() const;
1644 void begin_reversible_command (string cmd_name);
1645 void commit_reversible_command ();
1647 /* visual history */
1649 UndoHistory visual_history;
1650 UndoCommand current_visual_command;
1652 void begin_reversible_visual_command (const string & cmd_name);
1653 void commit_reversible_visual_command ();
1655 void update_title ();
1656 void update_title_s (const string & snapshot_name);
1659 Selection* selection;
1660 double frames_per_unit;
1666 void store_state (State&) const;
1667 void restore_state (State *);
1669 void instant_save ();
1671 ARDOUR::AudioRegion* last_audition_region;
1673 /* freeze operations */
1675 ARDOUR::InterThreadInfo freeze_status;
1676 gint freeze_progress_timeout (void *);
1677 static void* _freeze_thread (void*);
1678 void* freeze_thread ();
1680 void freeze_route ();
1681 void unfreeze_route ();
1683 /* edit-group solo + mute */
1685 void set_edit_group_solo (ARDOUR::Route&, bool);
1686 void set_edit_group_mute (ARDOUR::Route&, bool);
1690 void duplicate_dialog (bool for_region);
1694 Gtk::Menu* edit_menu;
1695 bool edit_menu_map_handler (GdkEventAny*);
1697 jack_nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
1699 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1700 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1701 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1703 struct TimeStretchDialog : public ArdourDialog {
1704 ARDOUR::Session::TimeStretchRequest request;
1706 AudioRegionSelection regions;
1707 Gtk::ProgressBar progress_bar;
1708 Gtk::ToggleButton quick_button;
1709 Gtk::ToggleButton antialias_button;
1710 Gtk::Button cancel_button;
1711 Gtk::Button action_button;
1712 Gtk::HBox lower_button_box;
1713 Gtk::HBox upper_button_box;
1717 TimeStretchDialog (Editor& e);
1719 gint update_progress ();
1720 sigc::connection first_cancel;
1721 sigc::connection first_delete;
1722 void cancel_timestretch_in_progress ();
1723 gint delete_timestretch_in_progress (GdkEventAny*);
1726 /* "whats mine is yours" */
1728 friend class TimeStretchDialog;
1730 TimeStretchDialog* current_timestretch;
1732 static void* timestretch_thread (void *arg);
1733 int run_timestretch (AudioRegionSelection&, float fraction);
1734 void do_timestretch (TimeStretchDialog&);
1736 /* editor-mixer strip */
1738 MixerStrip *current_mixer_strip;
1739 Gtk::VBox current_mixer_strip_vbox;
1740 void cms_deleted ();
1741 void current_mixer_strip_hidden ();
1742 void current_mixer_strip_removed ();
1744 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1745 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1747 /* nudging tracks */
1749 void nudge_track (bool use_edit_cursor, bool forwards);
1753 bool _xfade_visibility;
1755 /* <CMT Additions> */
1756 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1757 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
1759 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1760 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1762 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1763 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1764 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1766 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1767 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1768 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1769 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1771 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1772 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1773 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1774 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1776 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1777 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1778 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1779 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1780 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1781 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1783 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1784 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1785 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1786 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1787 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1788 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1790 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1791 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1793 ImageFrameSocketHandler* image_socket_listener ;
1794 /* </CMT Additions> */
1796 void toggle_xfade_active (ARDOUR::Crossfade*);
1797 void toggle_xfade_length (ARDOUR::Crossfade*);
1798 void edit_xfade (ARDOUR::Crossfade*);
1799 void remove_xfade ();
1800 void xfade_edit_left_region ();
1801 void xfade_edit_right_region ();
1803 static const int32_t default_width = 995;
1804 static const int32_t default_height = 765;
1808 Gtk::Button nudge_forward_button;
1809 Gtk::Button nudge_backward_button;
1810 Gtk::HBox nudge_hbox;
1811 Gtk::VBox nudge_vbox;
1812 Gtk::Label nudge_label;
1813 AudioClock nudge_clock;
1815 jack_nframes_t get_nudge_distance (jack_nframes_t pos, jack_nframes_t& next);
1819 void apply_filter (ARDOUR::AudioFilter&, string cmd);
1821 /* handling cleanup */
1823 int playlist_deletion_dialog (ARDOUR::Playlist*);
1825 vector<sigc::connection> session_connections;
1827 /* tracking step changes of track height */
1829 TimeAxisView* current_stepping_trackview;
1830 struct timeval last_track_height_step_timestamp;
1831 gint track_height_step_timeout();
1832 sigc::connection step_timeout;
1834 TimeAxisView* entered_track;
1835 AudioRegionView* entered_regionview;
1836 bool clear_entered_track;
1837 gint left_track_canvas (GdkEventCrossing*);
1838 void set_entered_track (TimeAxisView*);
1839 void set_entered_regionview (AudioRegionView*);
1840 gint left_automation_track ();
1842 bool _new_regionviews_show_envelope;
1844 void toggle_gain_envelope_visibility ();
1845 void toggle_gain_envelope_active ();
1847 bool on_key_press_event (GdkEventKey*);
1849 void session_state_saved (string);
1852 #endif /* __ardour_editor_h__ */