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>
38 #include <gtkmm/layout.h>
39 #include <gtkmm/comboboxtext.h>
41 #include <gtkmm2ext/selector.h>
42 #include <gtkmm2ext/click_box.h>
43 #include <gtkmm2ext/dndtreeview.h>
45 #include <ardour/stateful.h>
46 #include <ardour/session.h>
47 #include <ardour/tempo.h>
48 #include <ardour/location.h>
49 #include <ardour/region.h>
51 #include "audio_clock.h"
52 #include "gtk-custom-ruler.h"
53 #include "ardour_dialog.h"
54 #include "public_editor.h"
57 #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 /* <CMT Additions> */
107 class ImageFrameView;
108 class ImageFrameTimeAxisView;
109 class ImageFrameTimeAxis;
110 class MarkerTimeAxis ;
112 class ImageFrameSocketHandler ;
113 class TimeAxisViewItem ;
114 /* </CMT Additions> */
117 class Editor : public PublicEditor
120 Editor (ARDOUR::AudioEngine&);
123 void connect_to_session (ARDOUR::Session *);
124 ARDOUR::Session* current_session() const { return session; }
126 jack_nframes_t leftmost_position() const { return leftmost_frame; }
127 jack_nframes_t current_page_frames() const {
128 return (jack_nframes_t) floor (canvas_width * frames_per_unit);
131 void set_snap_to (Editing::SnapType);
132 void set_snap_mode (Editing::SnapMode);
133 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
135 void undo (uint32_t n = 1);
136 void redo (uint32_t n = 1);
138 XMLNode& get_state ();
139 int set_state (const XMLNode& );
141 void set_mouse_mode (Editing::MouseMode, bool force=true);
142 void step_mouse_mode (bool next);
143 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
145 void add_imageframe_time_axis(const string & track_name, void*) ;
146 void add_imageframe_marker_time_axis(const string & track_name, TimeAxisView* marked_track, void*) ;
147 void connect_to_image_compositor() ;
148 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
149 TimeAxisView* get_named_time_axis(const string & name) ;
150 /* </CMT Additions> */
152 void consider_auditioning (ARDOUR::Region&);
153 void hide_a_region (ARDOUR::Region&);
154 void remove_a_region (ARDOUR::Region&);
156 /* option editor-access */
158 void set_show_waveforms (bool yn);
159 bool show_waveforms() const { return _show_waveforms; }
161 void set_show_waveforms_recording (bool yn);
162 bool show_waveforms_recording() const { return _show_waveforms_recording; }
164 /* things that need to be public to be used in the main menubar */
166 void new_region_from_selection ();
167 void separate_region_from_selection ();
168 void toggle_playback (bool with_abort);
172 void set_edit_menu (Gtk::Menu&);
174 jack_nframes_t unit_to_frame (double unit) {
175 return (jack_nframes_t) rint (unit * frames_per_unit);
178 double frame_to_unit (jack_nframes_t frame) {
179 return rint ((double) frame / (double) frames_per_unit);
182 double frame_to_unit (double frame) {
183 return rint (frame / frames_per_unit);
186 /* NOTE: these functions assume that the "pixel" coordinate is
187 the result of using the world->canvas affine transform on a
188 world coordinate. These coordinates already take into
189 account any scrolling carried out by adjusting the
193 jack_nframes_t pixel_to_frame (double pixel) {
195 /* pixel can be less than zero when motion events
196 are processed. since we've already run the world->canvas
197 affine, that means that the location *really* is "off
198 to the right" and thus really is "before the start".
202 return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
208 gulong frame_to_pixel (jack_nframes_t frame) {
209 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
214 Selection& get_selection() const { return *selection; }
215 Selection& get_cut_buffer() const { return *cut_buffer; }
217 void play_selection ();
218 void select_all_in_track (Selection::Operation op);
219 void select_all (Selection::Operation op);
220 void invert_selection_in_track ();
221 void invert_selection ();
225 void set_show_measures (bool yn);
226 bool show_measures () const { return _show_measures; }
230 /* these initiate export ... */
232 void export_session();
233 void export_selection();
235 /* this is what actually does it */
237 void export_audiofile (ARDOUR::AudioExportSpecification&);
241 void add_toplevel_controls (Gtk::Container&);
243 void set_zoom_focus (Editing::ZoomFocus);
244 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
245 gdouble get_current_zoom () { return frames_per_unit; }
247 void temporal_zoom_step (bool coarser);
249 /* stuff that AudioTimeAxisView and related classes use */
251 PlaylistSelector& playlist_selector() const;
252 void route_name_changed (TimeAxisView *);
253 gdouble frames_per_unit;
254 jack_nframes_t leftmost_frame;
255 void clear_playlist (ARDOUR::Playlist&);
257 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
259 Width editor_mixer_strip_width;
260 void show_editor_mixer (bool yn);
261 void set_selected_mixer_strip (TimeAxisView&);
262 void hide_track_in_display (TimeAxisView& tv);
263 void show_track_in_display (TimeAxisView& tv);
265 /* nudge is initiated by transport controls owned by ARDOUR_UI */
267 void nudge_forward (bool next);
268 void nudge_backward (bool next);
270 /* nudge initiated from context menu */
272 void nudge_forward_capture_offset ();
273 void nudge_backward_capture_offset ();
275 /* playhead/screen stuff */
277 void set_follow_playhead (bool yn);
278 void toggle_follow_playhead ();
279 bool follow_playhead() const { return _follow_playhead; }
281 void toggle_waveform_visibility ();
282 void toggle_waveforms_while_recording ();
283 void toggle_measure_visibility ();
285 void set_meter_falloff (float);
286 void set_meter_hold (int32_t);
290 void toggle_xfades_active();
291 void toggle_xfade_visibility ();
292 void set_xfade_visibility (bool yn);
293 bool xfade_visibility() const { return _xfade_visibility; }
295 /* redirect shared ops menu. caller must free returned menu */
297 Gtk::Menu* redirect_menu ();
299 /* floating windows/transient */
301 void ensure_float (Gtk::Window&);
305 void scroll_tracks_down_line ();
306 void scroll_tracks_up_line ();
308 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
309 void prepare_for_cleanup ();
311 void reposition_x_origin (jack_nframes_t sample);
313 void maximise_editing_space();
314 void restore_editing_space();
317 void map_transport_state ();
318 void map_position_change (jack_nframes_t);
324 ARDOUR::Session *session;
325 ARDOUR::AudioEngine& engine;
328 PlaylistSelector* _playlist_selector;
338 TransportMarkerBarItem,
340 GainControlPointItem,
342 GainAutomationControlPointItem,
343 GainAutomationLineItem,
344 PanAutomationControlPointItem,
345 PanAutomationLineItem,
346 RedirectAutomationControlPointItem,
347 RedirectAutomationLineItem,
352 AudioRegionViewNameHighlight,
354 StartSelectionTrimItem,
355 EndSelectionTrimItem,
362 /* <CMT Additions> */
365 MarkerViewHandleStartItem,
366 MarkerViewHandleEndItem,
368 ImageFrameTimeAxisItem,
369 ImageFrameHandleStartItem,
370 ImageFrameHandleEndItem,
371 /* </CMT Additions> */
375 /* don't remove this */
380 void set_frames_per_unit (double);
381 void frames_per_unit_modified ();
383 Editing::MouseMode mouse_mode;
384 void mouse_insert (GdkEventButton *);
386 int pre_maximal_pane_position;
387 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
389 Gtk::Notebook the_notebook;
390 Gtk::HPaned edit_pane;
392 Gtk::EventBox meter_base;
394 Gtk::EventBox marker_base;
395 Gtk::HBox marker_box;
396 Gtk::VBox scrollers_rulers_markers_box;
398 void location_changed (ARDOUR::Location *);
399 void location_flags_changed (ARDOUR::Location *, void *);
400 void refresh_location_display ();
401 void refresh_location_display_s (ARDOUR::Change);
402 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
403 void add_new_location (ARDOUR::Location *);
404 void location_gone (ARDOUR::Location *);
405 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
406 gint really_remove_marker (ARDOUR::Location* loc);
408 uint32_t location_marker_color;
409 uint32_t location_range_color;
410 uint32_t location_loop_color;
411 uint32_t location_punch_color;
412 uint32_t location_cd_marker_color;
414 struct LocationMarkers {
422 void set_name (const string&);
423 void set_position (jack_nframes_t start, jack_nframes_t end = 0);
424 void set_color_rgba (uint32_t);
427 LocationMarkers *find_location_markers (ARDOUR::Location *);
428 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start);
430 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
431 LocationMarkerMap location_markers;
433 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
434 void clear_marker_display ();
435 void mouse_add_new_marker (jack_nframes_t where);
437 TimeAxisView* clicked_trackview;
438 AudioTimeAxisView* clicked_audio_trackview;
439 AudioRegionView* clicked_regionview;
440 AudioRegionView* latest_regionview;
441 uint32_t clicked_selection;
442 CrossfadeView* clicked_crossfadeview;
443 ControlPoint* clicked_control_point;
445 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&> sl);
447 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
449 void track_set_selected_regionview_from_click (AudioTimeAxisView&, AudioRegionView*, vector<AudioRegionView*>*);
453 void catch_vanishing_audio_regionview (AudioRegionView *);
454 void set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
455 void set_selected_track_from_click (Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
456 void set_selected_regionview_from_click (Selection::Operation op = Selection::Set, bool no_track_remove=false);
457 void set_selected_regionview_from_region_list (ARDOUR::Region& region, Selection::Operation op = Selection::Set);
458 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
459 void collect_new_region_view (AudioRegionView *);
461 Gtk::Menu track_context_menu;
462 Gtk::Menu track_region_context_menu;
463 Gtk::Menu track_selection_context_menu;
464 Gtk::Menu track_crossfade_context_menu;
466 Gtk::MenuItem* region_edit_menu_split_item;
467 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
468 Gtk::Menu * track_region_edit_playlist_menu;
469 Gtk::Menu * track_edit_playlist_submenu;
470 Gtk::Menu * track_selection_edit_playlist_submenu;
472 void popup_track_context_menu (int, int, ItemType, bool, jack_nframes_t);
473 Gtk::Menu* build_track_context_menu (jack_nframes_t);
474 Gtk::Menu* build_track_bus_context_menu (jack_nframes_t);
475 Gtk::Menu* build_track_region_context_menu (jack_nframes_t frame);
476 Gtk::Menu* build_track_crossfade_context_menu (jack_nframes_t);
477 Gtk::Menu* build_track_selection_context_menu (jack_nframes_t);
478 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
479 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
480 void add_region_context_items (StreamView*, ARDOUR::Region*, Gtk::Menu_Helpers::MenuList&);
481 void add_crossfade_context_items (StreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
482 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
484 void handle_new_route (ARDOUR::Route&);
485 void handle_new_route_p (ARDOUR::Route*);
486 void remove_route (TimeAxisView *);
489 Gtk::HBox global_hpacker;
490 Gtk::VBox global_vpacker;
493 Gdk::Cursor* current_canvas_cursor;
495 ArdourCanvas::CanvasAA track_canvas;
496 ArdourCanvas::CanvasAA time_canvas;
498 ArdourCanvas::Text* first_action_message;
499 ArdourCanvas::Text* verbose_canvas_cursor;
500 bool verbose_cursor_visible;
502 void session_control_changed (ARDOUR::Session::ControlType);
503 void queue_session_control_changed (ARDOUR::Session::ControlType);
506 bool track_canvas_motion (GdkEvent*);
508 void set_verbose_canvas_cursor (const string &, double x, double y);
509 void set_verbose_canvas_cursor_text (const string &);
510 void show_verbose_canvas_cursor();
511 void hide_verbose_canvas_cursor();
513 bool verbose_cursor_on; // so far unused
515 void flush_track_canvas ();
516 void flush_time_canvas ();
518 Gtk::EventBox time_canvas_event_box;
519 Gtk::EventBox track_canvas_event_box;
520 Gtk::EventBox time_button_event_box;
522 ArdourCanvas::Group *minsec_group;
523 ArdourCanvas::Group *bbt_group;
524 ArdourCanvas::Group *smpte_group;
525 ArdourCanvas::Group *frame_group;
526 ArdourCanvas::Group *tempo_group;
527 ArdourCanvas::Group *meter_group;
528 ArdourCanvas::Group *marker_group;
529 ArdourCanvas::Group *range_marker_group;
530 ArdourCanvas::Group *transport_marker_group;
533 ruler_metric_smpte = 0,
534 ruler_metric_bbt = 1,
535 ruler_metric_frames = 2,
536 ruler_metric_minsec = 3,
538 ruler_time_tempo = 4,
539 ruler_time_meter = 5,
540 ruler_time_marker = 6,
541 ruler_time_range_marker = 7,
542 ruler_time_transport_marker = 8,
545 static GtkCustomMetric ruler_metrics[4];
547 bool no_ruler_shown_update;
549 gint ruler_button_press (GdkEventButton*);
550 gint ruler_button_release (GdkEventButton*);
551 gint ruler_mouse_motion (GdkEventMotion*);
553 gint ruler_pressed_button;
554 Gtk::Widget * ruler_grabbed_widget;
556 void initialize_rulers ();
557 void update_just_smpte ();
558 void update_fixed_rulers ();
559 void update_tempo_based_rulers ();
560 void popup_ruler_menu (jack_nframes_t where = 0, ItemType type = RegionItem);
561 void update_ruler_visibility ();
562 void ruler_toggled (int);
563 gint ruler_label_button_release (GdkEventButton*);
564 void store_ruler_visibility ();
565 void restore_ruler_visibility ();
567 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
568 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
569 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
570 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
572 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
573 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
574 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
575 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
577 GtkWidget *_smpte_ruler;
578 GtkWidget *_bbt_ruler;
579 GtkWidget *_frames_ruler;
580 GtkWidget *_minsec_ruler;
581 Gtk::Widget *smpte_ruler;
582 Gtk::Widget *bbt_ruler;
583 Gtk::Widget *frames_ruler;
584 Gtk::Widget *minsec_ruler;
585 static Editor *ruler_editor;
587 static const double timebar_height;
588 guint32 visible_timebars;
589 Gtk::Menu *editor_ruler_menu;
591 ArdourCanvas::SimpleRect* tempo_bar;
592 ArdourCanvas::SimpleRect* meter_bar;
593 ArdourCanvas::SimpleRect* marker_bar;
594 ArdourCanvas::SimpleRect* range_marker_bar;
595 ArdourCanvas::SimpleRect* transport_marker_bar;
598 ArdourCanvas::SimpleLine* tempo_line;
599 ArdourCanvas::SimpleLine* meter_line;
600 ArdourCanvas::SimpleLine* marker_line;
601 ArdourCanvas::SimpleLine* range_marker_line;
602 ArdourCanvas::SimpleLine* transport_marker_line;
604 Gtk::Label minsec_label;
605 Gtk::Label bbt_label;
606 Gtk::Label smpte_label;
607 Gtk::Label frame_label;
608 Gtk::Label tempo_label;
609 Gtk::Label meter_label;
610 Gtk::Label mark_label;
611 Gtk::Label range_mark_label;
612 Gtk::Label transport_mark_label;
615 Gtk::VBox time_button_vbox;
616 Gtk::HBox time_button_hbox;
620 ArdourCanvas::Points points;
621 ArdourCanvas::Line canvas_item;
622 jack_nframes_t current_frame;
625 Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
628 void set_position (jack_nframes_t);
629 void set_length (double units);
630 void set_y_axis (double position);
633 friend struct Cursor; /* it needs access to several private
637 Cursor* playhead_cursor;
639 ArdourCanvas::Group* cursor_group;
641 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
642 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
643 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
644 void cursor_to_selection_start (Cursor *);
645 void cursor_to_selection_end (Cursor *);
646 void select_all_selectables_using_cursor (Cursor *, bool);
648 ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
650 vector<jack_nframes_t> region_boundary_cache;
651 void build_region_boundary_cache ();
653 Gtk::VBox trackview_vpacker;
656 Gtk::HBox bottom_hbox;
658 Gtk::Table edit_packer;
659 Gtk::Frame edit_frame;
660 Gtk::VScrollbar edit_vscrollbar;
662 Gtk::Adjustment vertical_adjustment;
663 Gtk::Adjustment horizontal_adjustment;
665 Gtk::Layout controls_layout;
666 bool control_layout_scroll (GdkEventScroll* ev);
667 void controls_layout_size_request (Gtk::Requisition*);
669 Gtk::HScrollbar edit_hscrollbar;
670 bool edit_hscroll_dragging;
672 bool hscrollbar_button_press (GdkEventButton*);
673 bool hscrollbar_button_release (GdkEventButton*);
674 void hscrollbar_allocate (Gtk::Allocation &alloc);
677 double canvas_height;
679 bool track_canvas_map_handler (GdkEventAny*);
680 bool time_canvas_map_handler (GdkEventAny*);
682 gint edit_controls_button_release (GdkEventButton*);
683 Gtk::Menu *edit_controls_left_menu;
684 Gtk::Menu *edit_controls_right_menu;
686 void track_canvas_scroller_realized ();
687 void time_canvas_scroller_realized ();
689 Gtk::VBox track_canvas_vbox;
690 Gtk::VBox time_canvas_vbox;
691 Gtk::VBox edit_controls_vbox;
692 Gtk::HBox edit_controls_hbox;
694 void tie_vertical_scrolling ();
695 void canvas_horizontally_scrolled ();
696 void reposition_and_zoom (jack_nframes_t sample, double fpu);
697 gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
698 void end_location_changed (ARDOUR::Location*);
699 bool repos_zoom_queued;
700 bool no_zoom_repos_update;
701 bool no_tempo_map_update;
703 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
704 RegionListDisplayModelColumns() {
709 Gtk::TreeModelColumn<Glib::ustring> name;
710 Gtk::TreeModelColumn<ARDOUR::Region*> region;
711 Gtk::TreeModelColumn<Gdk::Color> color_;
714 RegionListDisplayModelColumns region_list_columns;
715 Gtkmm2ext::DnDTreeView region_list_display;
716 Glib::RefPtr<Gtk::TreeStore> region_list_model;
717 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
718 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
720 void region_list_selection_changed ();
721 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
723 Gtk::Menu *region_list_menu;
724 Gtk::ScrolledWindow region_list_scroller;
725 Gtk::Frame region_list_frame;
727 bool region_list_display_key_press (GdkEventKey *);
728 bool region_list_display_key_release (GdkEventKey *);
729 bool region_list_display_button_press (GdkEventButton *);
730 bool region_list_display_button_release (GdkEventButton *);
731 void region_list_clear ();
732 void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
733 void build_region_list_menu ();
734 void show_region_list_display_context_menu (int button, int time);
736 bool show_automatic_regions_in_region_list;
737 Editing::RegionListSortType region_list_sort_type;
739 void reset_region_list_sort_direction (bool);
740 void reset_region_list_sort_type (Editing::RegionListSortType);
742 void toggle_full_region_list ();
743 void toggle_show_auto_regions ();
745 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
749 Gtk::ScrolledWindow snapshot_display_scroller;
750 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
751 SnapshotDisplayModelColumns() {
755 Gtk::TreeModelColumn<Glib::ustring> visible_name;
756 Gtk::TreeModelColumn<Glib::ustring> real_name;
759 SnapshotDisplayModelColumns snapshot_display_columns;
760 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
761 Gtk::TreeView snapshot_display;
763 bool snapshot_display_button_press (GdkEventButton*);
764 void snapshot_display_selection_changed ();
765 void redisplay_snapshots();
767 /* named selections */
769 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
770 NamedSelectionDisplayModelColumns() {
774 Gtk::TreeModelColumn<Glib::ustring> text;
775 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
778 NamedSelectionDisplayModelColumns named_selection_columns;
779 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
781 Gtkmm2ext::DnDTreeView named_selection_display;
782 Gtk::ScrolledWindow named_selection_scroller;
784 void name_selection();
785 void named_selection_name_chosen ();
786 void create_named_selection (const string &);
787 void paste_named_selection (float times);
789 void handle_new_named_selection ();
790 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
791 void redisplay_named_selections ();
793 gint named_selection_display_button_press (GdkEventButton *ev);
794 void named_selection_display_selection_changed ();
798 TrackViewList track_views;
799 TimeAxisView *trackview_by_y_position (double ypos);
801 static Gdk::Cursor* cross_hair_cursor;
802 static Gdk::Cursor* trimmer_cursor;
803 static Gdk::Cursor* selector_cursor;
804 static Gdk::Cursor* grabber_cursor;
805 static Gdk::Cursor* zoom_cursor;
806 static Gdk::Cursor* time_fx_cursor;
807 static Gdk::Cursor* fader_cursor;
808 static Gdk::Cursor* speaker_cursor;
809 static Gdk::Cursor* wait_cursor;
810 static Gdk::Cursor* timebar_cursor;
812 static void build_cursors ();
814 sigc::connection scroll_connection;
815 jack_nframes_t last_update_frame;
816 void center_screen (jack_nframes_t);
817 void center_screen_internal (jack_nframes_t, float);
819 void update_current_screen ();
820 sigc::connection slower_update_connection;
821 void update_slower ();
823 gint show_track_context_menu (GdkEventButton *);
824 void hide_track_context_menu ();
826 void session_going_away ();
828 jack_nframes_t cut_buffer_start;
829 jack_nframes_t cut_buffer_length;
831 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
832 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
833 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
834 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
835 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
836 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
838 /* KEYMAP HANDLING */
840 void register_actions ();
842 int ensure_cursor (jack_nframes_t* pos);
844 void fake_handle_new_audio_region (ARDOUR::AudioRegion *);
845 void handle_new_audio_region (ARDOUR::AudioRegion *);
846 void fake_handle_audio_region_removed (ARDOUR::AudioRegion *);
847 void handle_audio_region_removed (ARDOUR::AudioRegion *);
848 void add_audio_region_to_region_display (ARDOUR::AudioRegion *);
849 void region_hidden (ARDOUR::Region*);
850 void redisplay_regions ();
851 void insert_into_tmp_audio_regionlist(ARDOUR::AudioRegion *);
853 list<ARDOUR::AudioRegion *> tmp_audio_region_list;
855 void cut_copy (Editing::CutCopyOp);
856 void cut_copy_points (Editing::CutCopyOp);
857 void cut_copy_regions (Editing::CutCopyOp);
858 void cut_copy_ranges (Editing::CutCopyOp);
861 void paste_internal (jack_nframes_t position, float times);
863 /* EDITING OPERATIONS */
865 void toggle_region_mute ();
866 void toggle_region_opaque ();
867 void raise_region ();
868 void raise_region_to_top ();
869 void lower_region ();
870 void lower_region_to_bottom ();
871 void split_region ();
872 void split_region_at (jack_nframes_t);
873 void split_regions_at (jack_nframes_t, AudioRegionSelection&);
874 void crop_region_to_selection ();
875 void set_a_regions_sync_position (ARDOUR::Region&, jack_nframes_t);
876 void set_region_sync_from_edit_cursor ();
877 void remove_region_sync();
878 void align_selection (ARDOUR::RegionPoint, jack_nframes_t position);
879 void align_selection_relative (ARDOUR::RegionPoint point, jack_nframes_t position);
880 void align_region (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
881 void align_region_internal (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
882 void remove_some_regions ();
883 void remove_clicked_region ();
884 void destroy_clicked_region ();
886 void duplicate_some_regions (AudioRegionSelection&, float times);
887 void duplicate_selection (float times);
888 void region_fill_selection ();
890 void region_fill_track ();
891 void audition_playlist_region_standalone (ARDOUR::AudioRegion&);
892 void audition_playlist_region_via_route (ARDOUR::AudioRegion&, ARDOUR::Route&);
893 void split_multichannel_region();
894 void reverse_region ();
895 void normalize_region ();
896 void denormalize_region ();
898 void audition_region_from_region_list ();
899 void hide_region_from_region_list ();
900 void remove_region_from_region_list ();
902 void align (ARDOUR::RegionPoint);
903 void align_relative (ARDOUR::RegionPoint);
908 void paste (float times);
910 int get_prefix (float&, bool&);
912 void keyboard_paste ();
913 void keyboard_duplicate_region ();
914 void keyboard_duplicate_selection ();
915 void keyboard_nudge ();
916 void keyboard_insert_region_list_selection ();
918 void region_from_selection ();
919 void create_region_from_selection (std::vector<ARDOUR::AudioRegion*>&);
922 void rename_region ();
923 void rename_region_finished (bool);
925 void play_from_start ();
926 void play_from_edit_cursor ();
927 void play_selected_region ();
928 void audition_selected_region ();
929 void toggle_loop_playback ();
930 void loop_selected_region ();
931 void play_location (ARDOUR::Location&);
932 void loop_location (ARDOUR::Location&);
934 Editing::ZoomFocus zoom_focus;
936 void temporal_zoom_selection ();
937 void temporal_zoom_session ();
938 void temporal_zoom (gdouble scale);
939 void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const string & op);
940 void temporal_zoom_to_frame (bool coarser, jack_nframes_t frame);
942 void amplitude_zoom (gdouble scale);
943 void amplitude_zoom_step (bool in);
945 void insert_region_list_drag (ARDOUR::AudioRegion&, int x, int y);
946 void insert_region_list_selection (float times);
948 void insert_sndfile (bool as_tracks);
949 void embed_audio (); // inserts into region list
950 int reject_because_rate_differs (const string & path, SF_INFO& finfo, const string & action, bool multiple_pending);
952 void do_embed_sndfiles (vector<string> paths, bool split);
953 void embed_sndfile (string path, bool split, bool multiple_files, bool& check_sr);
955 void do_insert_sndfile (vector<string> path, bool multi, jack_nframes_t frame);
956 void insert_paths_as_new_tracks (std::vector<std::string> paths, bool multi); // inserts files as new tracks
957 void insert_sndfile_into (const string & path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
958 static void* _insert_sndfile_thread (void*);
959 void* insert_sndfile_thread (void*);
961 /* generic interthread progress window */
963 ArdourDialog* interthread_progress_window;
964 Gtk::Label interthread_progress_label;
965 Gtk::VBox interthread_progress_vbox;
966 Gtk::ProgressBar interthread_progress_bar;
967 Gtk::Button interthread_cancel_button;
968 Gtk::Label interthread_cancel_label;
969 sigc::connection interthread_progress_connection;
970 void interthread_cancel_clicked ();
971 void build_interthread_progress_window ();
972 ARDOUR::InterThreadInfo* current_interthread_info;
974 /* import specific info */
976 ARDOUR::Session::import_status import_status;
977 gint import_progress_timeout (void *);
978 static void *_import_thread (void *);
979 void* import_thread ();
980 void catch_new_audio_region (ARDOUR::AudioRegion*);
981 ARDOUR::AudioRegion* last_audio_region;
983 /* to support this ... */
985 void import_audio (bool as_tracks);
986 void do_import (vector<string> paths, bool split, bool as_tracks);
988 void move_to_start ();
991 void center_playhead ();
992 void center_edit_cursor ();
993 void edit_cursor_backward ();
994 void edit_cursor_forward ();
995 void playhead_backward ();
996 void playhead_forward ();
997 void scroll_backward (float pages=0.8f);
998 void scroll_forward (float pages=0.8f);
999 void scroll_tracks_down ();
1000 void scroll_tracks_up ();
1001 void delete_sample_forward ();
1002 void delete_sample_backward ();
1003 void delete_screen ();
1004 void search_backwards ();
1005 void search_forwards ();
1007 void clear_markers ();
1008 void clear_ranges ();
1009 void clear_locations ();
1010 void jump_forward_to_mark ();
1011 void jump_backward_to_mark ();
1012 void cursor_align (bool playhead_to_edit);
1014 void remove_last_capture ();
1015 void select_all_selectables_using_time_selection ();
1016 void select_all_selectables_using_loop();
1017 void select_all_selectables_using_punch();
1018 void set_selection_from_range (ARDOUR::Location&);
1019 void set_selection_from_punch ();
1020 void set_selection_from_loop ();
1022 void add_location_from_selection ();
1023 void set_route_loop_selection ();
1025 void add_location_from_playhead_cursor ();
1027 void reverse_selection ();
1028 void edit_envelope ();
1030 void start_scrolling ();
1031 void stop_scrolling ();
1033 void keyboard_selection_begin ();
1034 void keyboard_selection_finish (bool add);
1035 bool have_pending_keyboard_selection;
1036 jack_nframes_t pending_keyboard_selection_start;
1038 ARDOUR::AudioRegion* select_region_for_operation (int dir, TimeAxisView **tv);
1039 void extend_selection_to_end_of_region (bool next);
1040 void extend_selection_to_start_of_region (bool previous);
1042 Editing::SnapType snap_type;
1043 Editing::SnapMode snap_mode;
1044 double snap_threshold;
1046 void soundfile_chosen_for_insert (const string & selection, bool split_channels);
1047 void soundfile_chosen_for_embed (const string & selection, bool split_channels);
1048 void soundfile_chosen_for_import (const string & selection, bool split_channels);
1050 void handle_gui_changes (const string &, void *);
1052 void hide_all_tracks (bool with_select);
1055 ArdourCanvas::Item* item;
1057 jack_nframes_t last_frame_position;
1058 int32_t pointer_frame_offset;
1059 jack_nframes_t grab_frame;
1060 jack_nframes_t last_pointer_frame;
1061 jack_nframes_t current_pointer_frame;
1062 double grab_x, grab_y;
1063 double cumulative_x_drag;
1064 double cumulative_y_drag;
1065 double current_pointer_x;
1066 double current_pointer_y;
1067 void (Editor::*motion_callback)(ArdourCanvas::Item*, GdkEvent*);
1068 void (Editor::*finished_callback)(ArdourCanvas::Item*, GdkEvent*);
1069 TimeAxisView* last_trackview;
1074 bool move_threshold_passsed;
1075 bool want_move_threshold;
1077 ARDOUR::Location* copied_location;
1080 struct LineDragInfo {
1085 LineDragInfo current_line_drag_info;
1087 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1088 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1090 Gtk::Menu fade_context_menu;
1091 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1093 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1094 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1095 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1096 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1097 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1098 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1100 std::set<ARDOUR::Playlist*> motion_frozen_playlists;
1101 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1102 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1103 void region_copy_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1105 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1106 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1107 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1108 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1109 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1110 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1111 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1112 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1114 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1115 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1116 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1117 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1119 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1121 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1122 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1123 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1124 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1125 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1126 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1127 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1128 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1129 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1130 void start_line_grab (AutomationLine *, GdkEvent*);
1131 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1132 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1133 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1134 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1136 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1138 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1139 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1141 void mouse_brush_insert_region (AudioRegionView*, jack_nframes_t pos);
1142 void brush (jack_nframes_t);
1144 void show_verbose_time_cursor (jack_nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1145 void show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1147 /* Canvas event handlers */
1149 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1150 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1151 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1152 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1153 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1154 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1155 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1156 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1157 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1158 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1159 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1160 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1161 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1162 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioTimeAxisView*);
1163 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1164 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1165 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1166 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1167 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1169 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1170 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1171 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1172 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1173 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1175 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1176 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1177 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1178 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1179 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1180 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1181 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1182 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1184 /* non-public event handlers */
1186 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1187 bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1188 bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
1189 bool track_canvas_scroll (GdkEventScroll* event);
1191 bool track_canvas_button_press_event (GdkEventButton *);
1192 bool track_canvas_button_release_event (GdkEventButton *);
1194 void track_canvas_allocate (Gtk::Allocation alloc);
1195 void time_canvas_allocate (Gtk::Allocation alloc);
1197 void set_edit_cursor (GdkEvent* event);
1198 void set_playhead_cursor (GdkEvent* event);
1200 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1201 void kbd_set_playhead_cursor ();
1202 void kbd_set_edit_cursor ();
1203 void kbd_mute_unmute_region ();
1205 void kbd_set_sync_position ();
1206 void kbd_align (ARDOUR::RegionPoint);
1207 void kbd_align_relative (ARDOUR::RegionPoint);
1209 void kbd_audition ();
1211 void kbd_do_split (GdkEvent*);
1212 void kbd_do_set_sync_position (GdkEvent* ev);
1213 void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
1214 void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
1215 void kbd_do_brush (GdkEvent*);
1216 void kbd_do_audition (GdkEvent*);
1218 void fake_handle_new_duration ();
1219 void handle_new_duration ();
1220 void initialize_canvas ();
1221 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1222 void scroll_canvas ();
1224 /* display control */
1226 bool _show_measures;
1227 bool _show_waveforms;
1228 bool _follow_playhead;
1229 bool _show_waveforms_recording;
1231 void add_bbt_marks (ARDOUR::TempoMap::BBTPointList&);
1233 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1235 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1236 TimeLineList free_measure_lines;
1237 TimeLineList used_measure_lines;
1239 ArdourCanvas::Group* time_line_group;
1240 ArdourCanvas::SimpleLine* get_time_line ();
1241 void hide_measures ();
1242 void draw_measures ();
1243 void draw_time_bars ();
1245 void new_tempo_section ();
1247 void mouse_add_new_tempo_event (jack_nframes_t where);
1248 void mouse_add_new_meter_event (jack_nframes_t where);
1250 void remove_tempo_marker (ArdourCanvas::Item*);
1251 void remove_meter_marker (ArdourCanvas::Item*);
1252 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1253 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1255 void edit_tempo_section (ARDOUR::TempoSection*);
1256 void edit_meter_section (ARDOUR::MeterSection*);
1257 void edit_tempo_marker (ArdourCanvas::Item*);
1258 void edit_meter_marker (ArdourCanvas::Item*);
1260 void marker_menu_edit ();
1261 void marker_menu_remove ();
1262 void marker_menu_rename ();
1263 void marker_menu_hide ();
1264 void marker_menu_loop_range ();
1265 void marker_menu_select_all_selectables_using_range ();
1266 void marker_menu_play_from ();
1267 void marker_menu_set_playhead ();
1268 void marker_menu_set_from_playhead ();
1269 void marker_menu_set_from_selection ();
1270 void new_transport_marker_menu_set_loop ();
1271 void new_transport_marker_menu_set_punch ();
1272 void update_loop_range_view (bool visibility=false);
1273 void update_punch_range_view (bool visibility=false);
1274 gint new_transport_marker_menu_popdown (GdkEventAny*);
1275 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1276 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1277 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1278 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1279 void build_range_marker_menu ();
1280 void build_marker_menu ();
1281 void build_tm_marker_menu ();
1282 void build_transport_marker_menu ();
1283 void build_new_transport_marker_menu ();
1285 Gtk::Menu* tm_marker_menu;
1286 Gtk::Menu* marker_menu;
1287 Gtk::Menu* transport_marker_menu;
1288 Gtk::Menu* new_transport_marker_menu;
1289 ArdourCanvas::Item* marker_menu_item;
1291 typedef list<Marker*> Marks;
1294 void remove_metric_marks ();
1295 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1297 void tempo_map_changed (ARDOUR::Change);
1298 void redisplay_tempo ();
1300 void snap_to (jack_nframes_t& first, int32_t direction = 0, bool for_mark = false);
1301 uint32_t bbt_beat_subdivision;
1305 Gtk::ToggleButton editor_mixer_button;
1307 void editor_mixer_button_toggled ();
1309 AudioClock selection_start_clock;
1310 Gtk::Label selection_start_clock_label;
1311 AudioClock selection_end_clock;
1312 Gtk::Label selection_end_clock_label;
1313 AudioClock edit_cursor_clock;
1314 Gtk::Label edit_cursor_clock_label;
1315 AudioClock zoom_range_clock;
1316 Gtk::Button zoom_in_button;
1317 Gtk::Button zoom_out_button;
1318 Gtk::Button zoom_out_full_button;
1319 Gtk::Button zoom_onetoone_button;
1321 Gtk::VBox toolbar_clock_vbox;
1322 Gtk::VBox toolbar_selection_clock_vbox;
1323 Gtk::Table toolbar_selection_clock_table;
1324 Gtk::Label toolbar_selection_cursor_label;
1326 Gtk::Table mouse_mode_button_table;
1327 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1328 Gtk::ToggleButton mouse_select_button;
1329 Gtk::ToggleButton mouse_move_button;
1330 Gtk::ToggleButton mouse_gain_button;
1331 Gtk::ToggleButton mouse_zoom_button;
1332 Gtk::ToggleButton mouse_timefx_button;
1333 Gtk::ToggleButton mouse_audition_button;
1334 GroupedButtons *mouse_mode_button_set;
1335 void mouse_mode_toggled (Editing::MouseMode m);
1336 bool ignore_mouse_mode_toggle;
1338 gint mouse_select_button_release (GdkEventButton*);
1340 Gtk::VBox automation_box;
1341 Gtk::Button automation_mode_button;
1342 Gtk::ToggleButton global_automation_button;
1344 Gtk::ComboBoxText edit_mode_selector;
1345 Gtk::Label edit_mode_label;
1346 Gtk::VBox edit_mode_box;
1348 void edit_mode_selection_done ();
1350 Gtk::ComboBoxText snap_type_selector;
1351 Gtk::Label snap_type_label;
1352 Gtk::VBox snap_type_box;
1354 void snap_type_selection_done ();
1356 Gtk::ComboBoxText snap_mode_selector;
1357 Gtk::Label snap_mode_label;
1358 Gtk::VBox snap_mode_box;
1360 void snap_mode_selection_done ();
1362 Gtk::ComboBoxText zoom_focus_selector;
1363 Gtk::Label zoom_focus_label;
1364 Gtk::VBox zoom_focus_box;
1366 void zoom_focus_selection_done ();
1368 Gtk::Label zoom_indicator_label;
1369 Gtk::HBox zoom_indicator_box;
1370 Gtk::VBox zoom_indicator_vbox;
1372 void update_zoom_indicator ();
1373 void zoom_adjustment_changed();
1375 void edit_cursor_clock_changed();
1377 void setup_toolbar ();
1379 Gtkmm2ext::TearOff* tools_tearoff;
1380 Gtk::HBox toolbar_hbox;
1381 Gtk::EventBox toolbar_base;
1382 Gtk::Frame toolbar_frame;
1384 /* selection process */
1386 Selection* selection;
1387 Selection* cut_buffer;
1389 void time_selection_changed ();
1390 void track_selection_changed ();
1391 void region_selection_changed ();
1392 void point_selection_changed ();
1393 void audio_track_selection_changed ();
1394 void line_selection_changed ();
1403 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1404 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1405 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1406 void cancel_selection ();
1408 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1409 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1410 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1412 bool audio_region_selection_covers (jack_nframes_t where);
1414 /* transport range select process */
1415 enum RangeMarkerOp {
1417 CreateTransportMarker
1420 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1421 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1422 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1424 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1425 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1426 ArdourCanvas::Line* marker_drag_line;
1427 ArdourCanvas::Points marker_drag_line_points;
1428 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1430 void update_marker_drag_item (ARDOUR::Location *);
1432 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1433 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1434 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1435 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1436 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1437 ArdourCanvas::SimpleLine *transport_punchin_line;
1438 ArdourCanvas::SimpleLine *transport_punchout_line;
1439 ArdourCanvas::SimpleRect *transport_preroll_rect;
1440 ArdourCanvas::SimpleRect *transport_postroll_rect;
1442 ARDOUR::Location* transport_loop_location();
1443 ARDOUR::Location* transport_punch_location();
1445 ARDOUR::Location *temp_location;
1447 /* object rubberband select process */
1449 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1450 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1451 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1453 bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
1455 ArdourCanvas::SimpleRect *rubberband_rect;
1457 /* mouse zoom process */
1459 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1460 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1461 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1463 ArdourCanvas::SimpleRect *zoom_rect;
1464 void reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end);
1466 /* diskstream/route display management */
1468 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1469 RouteDisplayModelColumns() {
1474 Gtk::TreeModelColumn<Glib::ustring> text;
1475 Gtk::TreeModelColumn<bool> visible;
1476 Gtk::TreeModelColumn<TimeAxisView*> tv;
1479 RouteDisplayModelColumns route_display_columns;
1480 Glib::RefPtr<Gtk::ListStore> route_display_model;
1481 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1483 gint route_list_compare_func (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1484 Gtkmm2ext::DnDTreeView route_list_display;
1485 Gtk::ScrolledWindow route_list_scroller;
1486 Gtk::Menu* route_list_menu;
1488 bool route_list_display_button_press (GdkEventButton*);
1489 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1491 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1492 void route_list_delete (const Gtk::TreeModel::Path&);
1493 void initial_route_list_display ();
1494 void redisplay_route_list();
1495 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1496 bool ignore_route_list_reorder;
1497 bool no_route_list_redisplay;
1498 void queue_route_list_reordered ();
1500 void build_route_list_menu ();
1501 void show_route_list_menu ();
1503 void show_all_routes ();
1504 void hide_all_routes ();
1505 void show_all_audiotracks ();
1506 void hide_all_audiotracks ();
1507 void show_all_audiobus ();
1508 void hide_all_audiobus ();
1510 void set_all_tracks_visibility (bool yn);
1511 void set_all_audio_visibility (int type, bool yn);
1513 /* edit group management */
1515 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1516 GroupListModelColumns () {
1522 Gtk::TreeModelColumn<bool> is_active;
1523 Gtk::TreeModelColumn<bool> is_visible;
1524 Gtk::TreeModelColumn<std::string> text;
1525 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1528 GroupListModelColumns group_columns;
1529 Glib::RefPtr<Gtk::ListStore> group_model;
1530 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1532 Gtk::TreeView edit_group_display;
1533 Gtk::ScrolledWindow edit_group_display_scroller;
1534 Gtk::Menu* edit_group_list_menu;
1536 void build_edit_group_list_menu ();
1537 void activate_all_edit_groups ();
1538 void disable_all_edit_groups ();
1540 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1542 void new_edit_group ();
1543 void edit_group_list_button_clicked ();
1544 gint edit_group_list_button_press_event (GdkEventButton* ev);
1545 void edit_group_selection_changed ();
1546 void fake_add_edit_group (ARDOUR::RouteGroup* group);
1547 void add_edit_group (ARDOUR::RouteGroup* group);
1548 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1550 Gtk::VBox list_vpacker;
1554 int autoscroll_timeout_tag;
1555 int autoscroll_direction;
1556 uint32_t autoscroll_cnt;
1557 jack_nframes_t autoscroll_distance;
1559 static gint _autoscroll_canvas (void *);
1560 gint autoscroll_canvas ();
1561 void start_canvas_autoscroll (int direction);
1562 void stop_canvas_autoscroll ();
1563 void maybe_autoscroll (GdkEvent*);
1572 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1573 void point_trim (GdkEvent*);
1574 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1575 void single_contents_trim (AudioRegionView&, jack_nframes_t, bool, bool, bool);
1576 void single_start_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1577 void single_end_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1579 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1580 void thaw_region_after_trim (AudioRegionView& rv);
1582 void trim_region_to_edit_cursor ();
1583 void trim_region_from_edit_cursor ();
1585 bool show_gain_after_trim;
1589 int convert_drop_to_paths (std::vector<std::string>& paths,
1590 const Glib::RefPtr<Gdk::DragContext>& context,
1593 const Gtk::SelectionData& data,
1597 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1600 const Gtk::SelectionData& data,
1604 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1607 const Gtk::SelectionData& data,
1612 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1615 const Gtk::SelectionData& data,
1619 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1622 const Gtk::SelectionData& data,
1628 ExportDialog *export_dialog;
1629 ExportDialog *export_range_markers_dialog;
1631 void export_range (jack_nframes_t start, jack_nframes_t end);
1632 void export_range_markers ();
1634 int write_region_selection(AudioRegionSelection&);
1635 bool write_region (string path, ARDOUR::AudioRegion&);
1636 void export_region ();
1637 void bounce_region_selection ();
1638 void bounce_range_selection ();
1639 void external_edit_region ();
1641 int write_audio_selection (TimeSelection&);
1642 bool write_audio_range (ARDOUR::Playlist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1644 void write_selection ();
1648 UndoAction get_memento() const;
1650 void begin_reversible_command (string cmd_name);
1651 void commit_reversible_command ();
1653 /* visual history */
1655 UndoHistory visual_history;
1656 UndoCommand current_visual_command;
1658 void begin_reversible_visual_command (const string & cmd_name);
1659 void commit_reversible_visual_command ();
1661 void update_title ();
1662 void update_title_s (const string & snapshot_name);
1665 Selection* selection;
1666 double frames_per_unit;
1672 void store_state (State&) const;
1673 void restore_state (State *);
1675 void instant_save ();
1677 ARDOUR::AudioRegion* last_audition_region;
1679 /* freeze operations */
1681 ARDOUR::InterThreadInfo freeze_status;
1682 gint freeze_progress_timeout (void *);
1683 static void* _freeze_thread (void*);
1684 void* freeze_thread ();
1686 void freeze_route ();
1687 void unfreeze_route ();
1689 /* edit-group solo + mute */
1691 void set_edit_group_solo (ARDOUR::Route&, bool);
1692 void set_edit_group_mute (ARDOUR::Route&, bool);
1696 void duplicate_dialog (bool for_region);
1700 Gtk::Menu* edit_menu;
1701 bool edit_menu_map_handler (GdkEventAny*);
1703 jack_nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
1705 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1706 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1707 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1709 struct TimeStretchDialog : public ArdourDialog {
1710 ARDOUR::Session::TimeStretchRequest request;
1712 AudioRegionSelection regions;
1713 Gtk::ProgressBar progress_bar;
1714 Gtk::ToggleButton quick_button;
1715 Gtk::ToggleButton antialias_button;
1716 Gtk::Button cancel_button;
1717 Gtk::Button action_button;
1718 Gtk::HBox lower_button_box;
1719 Gtk::HBox upper_button_box;
1723 TimeStretchDialog (Editor& e);
1725 gint update_progress ();
1726 sigc::connection first_cancel;
1727 sigc::connection first_delete;
1728 void cancel_timestretch_in_progress ();
1729 gint delete_timestretch_in_progress (GdkEventAny*);
1732 /* "whats mine is yours" */
1734 friend class TimeStretchDialog;
1736 TimeStretchDialog* current_timestretch;
1738 static void* timestretch_thread (void *arg);
1739 int run_timestretch (AudioRegionSelection&, float fraction);
1740 void do_timestretch (TimeStretchDialog&);
1742 /* editor-mixer strip */
1744 MixerStrip *current_mixer_strip;
1745 Gtk::VBox current_mixer_strip_vbox;
1746 void cms_deleted ();
1747 void current_mixer_strip_hidden ();
1748 void current_mixer_strip_removed ();
1750 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1751 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1753 /* nudging tracks */
1755 void nudge_track (bool use_edit_cursor, bool forwards);
1759 bool _xfade_visibility;
1761 /* <CMT Additions> */
1762 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1763 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
1765 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1766 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1768 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1769 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1770 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1772 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1773 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1774 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1775 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1777 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1778 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1779 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1780 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1782 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1783 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1784 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1785 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1786 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1787 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1789 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1790 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1791 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1792 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1793 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1794 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1796 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1797 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1799 ImageFrameSocketHandler* image_socket_listener ;
1800 /* </CMT Additions> */
1802 void toggle_xfade_active (ARDOUR::Crossfade*);
1803 void toggle_xfade_length (ARDOUR::Crossfade*);
1804 void edit_xfade (ARDOUR::Crossfade*);
1805 void remove_xfade ();
1806 void xfade_edit_left_region ();
1807 void xfade_edit_right_region ();
1809 static const int32_t default_width = 995;
1810 static const int32_t default_height = 765;
1814 Gtk::Button nudge_forward_button;
1815 Gtk::Button nudge_backward_button;
1816 Gtk::HBox nudge_hbox;
1817 Gtk::VBox nudge_vbox;
1818 Gtk::Label nudge_label;
1819 AudioClock nudge_clock;
1821 jack_nframes_t get_nudge_distance (jack_nframes_t pos, jack_nframes_t& next);
1825 void apply_filter (ARDOUR::AudioFilter&, string cmd);
1827 /* handling cleanup */
1829 int playlist_deletion_dialog (ARDOUR::Playlist*);
1831 vector<sigc::connection> session_connections;
1833 /* tracking step changes of track height */
1835 TimeAxisView* current_stepping_trackview;
1836 struct timeval last_track_height_step_timestamp;
1837 gint track_height_step_timeout();
1838 sigc::connection step_timeout;
1840 TimeAxisView* entered_track;
1841 AudioRegionView* entered_regionview;
1842 bool clear_entered_track;
1843 gint left_track_canvas (GdkEventCrossing*);
1844 void set_entered_track (TimeAxisView*);
1845 void set_entered_regionview (AudioRegionView*);
1846 gint left_automation_track ();
1848 bool _new_regionviews_show_envelope;
1850 void toggle_gain_envelope_visibility ();
1851 void toggle_gain_envelope_active ();
1853 bool on_key_press_event (GdkEventKey*);
1855 void session_state_saved (string);
1858 #endif /* __ardour_editor_h__ */