2 Copyright (C) 2000-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_editor_h__
21 #define __ardour_editor_h__
28 #include <glibmm/ustring.h>
30 #include <boost/optional.hpp>
32 #include <libgnomecanvasmm/canvas.h>
33 #include <libgnomecanvasmm/group.h>
34 #include <libgnomecanvasmm/line.h>
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 <pbd/stateful.h>
46 #include <ardour/session.h>
47 #include <ardour/tempo.h>
48 #include <ardour/location.h>
49 #include <ardour/audioregion.h>
51 #include "audio_clock.h"
52 #include "gtk-custom-ruler.h"
53 #include "ardour_dialog.h"
54 #include "public_editor.h"
57 #include "editor_items.h"
58 #include "region_selection.h"
67 class AudioDiskstream;
85 class RouteTimeAxisView;
86 class AudioTimeAxisView;
87 class AutomationTimeAxisView;
88 class AudioRegionView;
91 class PlaylistSelector;
95 class UIExportSpecification;
100 class AutomationSelection;
103 class AudioStreamView;
105 class SoundFileBrowser;
107 class AnalysisWindow;
110 /* <CMT Additions> */
111 class ImageFrameView;
112 class ImageFrameTimeAxisView;
113 class ImageFrameTimeAxis;
114 class MarkerTimeAxis ;
116 class ImageFrameSocketHandler ;
117 class TimeAxisViewItem ;
118 /* </CMT Additions> */
121 class Editor : public PublicEditor
127 void connect_to_session (ARDOUR::Session *);
128 ARDOUR::Session* current_session() const { return session; }
130 nframes_t leftmost_position() const { return leftmost_frame; }
131 nframes_t current_page_frames() const {
132 return (nframes_t) floor (canvas_width * frames_per_unit);
135 void set_snap_to (Editing::SnapType);
136 void set_snap_mode (Editing::SnapMode);
137 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
139 void undo (uint32_t n = 1);
140 void redo (uint32_t n = 1);
142 XMLNode& get_state ();
143 int set_state (const XMLNode& );
145 void set_mouse_mode (Editing::MouseMode, bool force=true);
146 void step_mouse_mode (bool next);
147 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
149 void add_imageframe_time_axis(const std::string & track_name, void*) ;
150 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
151 void connect_to_image_compositor() ;
152 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
153 TimeAxisView* get_named_time_axis(const std::string & name) ;
155 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
156 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
157 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
159 /* option editor-access */
161 void set_show_waveforms (bool yn);
162 bool show_waveforms() const { return _show_waveforms; }
164 void set_show_waveforms_recording (bool yn);
165 bool show_waveforms_recording() const { return _show_waveforms_recording; }
167 /* things that need to be public to be used in the main menubar */
169 void new_region_from_selection ();
170 void separate_region_from_selection ();
171 void separate_regions_using_location (ARDOUR::Location&);
172 void toggle_playback (bool with_abort);
173 void transition_to_rolling (bool forward);
177 nframes_t unit_to_frame (double unit) {
178 return (nframes_t) rint (unit * frames_per_unit);
181 double frame_to_unit (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 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 (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
211 gulong frame_to_pixel (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 bool extend_selection_to_track (TimeAxisView&);
222 void play_selection ();
223 void select_all_in_track (Selection::Operation op);
224 void select_all (Selection::Operation op);
225 void invert_selection_in_track ();
226 void invert_selection ();
230 void set_show_measures (bool yn);
231 bool show_measures () const { return _show_measures; }
232 bool initial_ruler_update_required;
235 /* analysis window */
236 void analyze_region_selection();
237 void analyze_range_selection();
242 /* these initiate export ... */
244 void export_session();
245 void export_selection();
248 void add_toplevel_controls (Gtk::Container&);
250 void set_zoom_focus (Editing::ZoomFocus);
251 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
252 gdouble get_current_zoom () { return frames_per_unit; }
254 void temporal_zoom_step (bool coarser);
256 /* stuff that AudioTimeAxisView and related classes use */
258 PlaylistSelector& playlist_selector() const;
259 void route_name_changed (TimeAxisView *);
260 gdouble frames_per_unit;
261 nframes_t leftmost_frame;
262 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
264 void new_playlists ();
265 void copy_playlists ();
266 void clear_playlists ();
268 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
270 Width editor_mixer_strip_width;
271 void maybe_add_mixer_strip_width (XMLNode&);
272 void show_editor_mixer (bool yn);
273 void set_selected_mixer_strip (TimeAxisView&);
274 void hide_track_in_display (TimeAxisView& tv);
275 void show_track_in_display (TimeAxisView& tv);
277 /* nudge is initiated by transport controls owned by ARDOUR_UI */
279 void nudge_forward (bool next);
280 void nudge_backward (bool next);
282 /* nudge initiated from context menu */
284 void nudge_forward_capture_offset ();
285 void nudge_backward_capture_offset ();
287 /* playhead/screen stuff */
289 void set_follow_playhead (bool yn);
290 void toggle_follow_playhead ();
291 bool follow_playhead() const { return _follow_playhead; }
292 bool dragging_playhead () const { return _dragging_playhead; }
294 void toggle_waveform_visibility ();
295 void toggle_waveforms_while_recording ();
296 void toggle_measure_visibility ();
298 /* SMPTE timecode & video sync */
300 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
301 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
302 void subframes_per_frame_chosen (uint32_t);
304 void update_smpte_mode();
305 void update_video_pullup();
306 void update_subframes_per_frame ();
309 void toggle_auto_xfade ();
310 void toggle_xfades_active ();
311 void toggle_xfade_visibility ();
312 bool xfade_visibility() const { return _xfade_visibility; }
313 void update_xfade_visibility ();
314 void update_crossfade_model ();
315 void set_crossfade_model (ARDOUR::CrossfadeModel);
318 void set_layer_model (ARDOUR::LayerModel);
319 void update_layering_model ();
321 /* redirect shared ops menu. caller must free returned menu */
323 Gtk::Menu* redirect_menu ();
325 /* floating windows/transient */
327 void ensure_float (Gtk::Window&);
331 void scroll_tracks_down_line ();
332 void scroll_tracks_up_line ();
334 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
335 void prepare_for_cleanup ();
337 void maximise_editing_space();
338 void restore_editing_space();
340 void reset_x_origin (nframes_t);
341 void reset_zoom (double);
342 void reposition_and_zoom (nframes_t, double);
344 nframes_t edit_cursor_position(bool);
347 void map_transport_state ();
348 void map_position_change (nframes_t);
354 ARDOUR::Session *session;
357 // to keep track of the playhead position for control_scroll
358 boost::optional<nframes_t> _control_scroll_target;
360 PlaylistSelector* _playlist_selector;
362 void set_frames_per_unit (double);
364 Editing::MouseMode mouse_mode;
366 int post_maximal_editor_width;
367 int post_maximal_pane_position;
368 int pre_maximal_pane_position;
369 int pre_maximal_editor_width;
370 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
372 Gtk::Notebook the_notebook;
373 Gtk::HPaned edit_pane;
375 Gtk::EventBox meter_base;
377 Gtk::EventBox marker_base;
378 Gtk::HBox marker_box;
379 Gtk::VBox scrollers_rulers_markers_box;
381 void location_changed (ARDOUR::Location *);
382 void location_flags_changed (ARDOUR::Location *, void *);
383 void refresh_location_display ();
384 void refresh_location_display_s (ARDOUR::Change);
385 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
386 void add_new_location (ARDOUR::Location *);
387 void location_gone (ARDOUR::Location *);
388 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
389 gint really_remove_marker (ARDOUR::Location* loc);
391 uint32_t location_marker_color;
392 uint32_t location_range_color;
393 uint32_t location_loop_color;
394 uint32_t location_punch_color;
395 uint32_t location_cd_marker_color;
397 struct LocationMarkers {
405 void set_name (const string&);
406 void set_position (nframes_t start, nframes_t end = 0);
407 void set_color_rgba (uint32_t);
410 LocationMarkers *find_location_markers (ARDOUR::Location *);
411 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start);
413 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
414 LocationMarkerMap location_markers;
416 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
417 void clear_marker_display ();
418 void mouse_add_new_marker (nframes_t where);
420 TimeAxisView* clicked_trackview;
421 AudioTimeAxisView* clicked_audio_trackview;
422 RegionView* clicked_regionview;
423 RegionView* latest_regionview;
424 uint32_t clicked_selection;
425 CrossfadeView* clicked_crossfadeview;
426 ControlPoint* clicked_control_point;
428 void sort_track_selection ();
430 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
431 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
432 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl);
434 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
436 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
437 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t);
438 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t);
439 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
443 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
444 bool button_release_can_deselect;
446 void catch_vanishing_regionview (RegionView *);
448 bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
449 void select_all_tracks ();
451 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
452 bool set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
453 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
455 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
456 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
457 void collect_new_region_view (RegionView *);
459 Gtk::Menu track_context_menu;
460 Gtk::Menu track_region_context_menu;
461 Gtk::Menu track_selection_context_menu;
462 Gtk::Menu track_crossfade_context_menu;
464 Gtk::MenuItem* region_edit_menu_split_item;
465 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
466 Gtk::Menu * track_region_edit_playlist_menu;
467 Gtk::Menu * track_edit_playlist_submenu;
468 Gtk::Menu * track_selection_edit_playlist_submenu;
470 void popup_track_context_menu (int, int, ItemType, bool, nframes_t);
471 Gtk::Menu* build_track_context_menu (nframes_t);
472 Gtk::Menu* build_track_bus_context_menu (nframes_t);
473 Gtk::Menu* build_track_region_context_menu (nframes_t frame);
474 Gtk::Menu* build_track_crossfade_context_menu (nframes_t);
475 Gtk::Menu* build_track_selection_context_menu (nframes_t);
476 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
477 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
478 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
479 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
480 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
482 void handle_new_route (ARDOUR::Session::RouteList&);
483 void remove_route (TimeAxisView *);
486 Gtk::HBox global_hpacker;
487 Gtk::VBox global_vpacker;
490 Gdk::Cursor* current_canvas_cursor;
492 ArdourCanvas::CanvasAA track_canvas;
493 ArdourCanvas::CanvasAA time_canvas;
495 ArdourCanvas::Text* first_action_message;
496 ArdourCanvas::Text* verbose_canvas_cursor;
497 bool verbose_cursor_visible;
499 void parameter_changed (const char *);
501 bool track_canvas_motion (GdkEvent*);
503 void set_verbose_canvas_cursor (const string &, double x, double y);
504 void set_verbose_canvas_cursor_text (const string &);
505 void show_verbose_canvas_cursor();
506 void hide_verbose_canvas_cursor();
508 bool verbose_cursor_on; // so far unused
510 Gtk::EventBox time_canvas_event_box;
511 Gtk::EventBox track_canvas_event_box;
512 Gtk::EventBox time_button_event_box;
513 Gtk::Frame time_button_frame;
515 ArdourCanvas::Group *minsec_group;
516 ArdourCanvas::Group *bbt_group;
517 ArdourCanvas::Group *smpte_group;
518 ArdourCanvas::Group *frame_group;
519 ArdourCanvas::Group *tempo_group;
520 ArdourCanvas::Group *meter_group;
521 ArdourCanvas::Group *marker_group;
522 ArdourCanvas::Group *range_marker_group;
523 ArdourCanvas::Group *transport_marker_group;
526 ruler_metric_smpte = 0,
527 ruler_metric_bbt = 1,
528 ruler_metric_frames = 2,
529 ruler_metric_minsec = 3,
531 ruler_time_tempo = 4,
532 ruler_time_meter = 5,
533 ruler_time_marker = 6,
534 ruler_time_range_marker = 7,
535 ruler_time_transport_marker = 8,
538 static GtkCustomMetric ruler_metrics[4];
540 bool no_ruler_shown_update;
542 gint ruler_button_press (GdkEventButton*);
543 gint ruler_button_release (GdkEventButton*);
544 gint ruler_mouse_motion (GdkEventMotion*);
546 gint ruler_pressed_button;
547 Gtk::Widget * ruler_grabbed_widget;
549 void initialize_rulers ();
550 void update_just_smpte ();
551 void update_fixed_rulers ();
552 void update_tempo_based_rulers ();
553 void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem);
554 void update_ruler_visibility ();
555 void ruler_toggled (int);
556 gint ruler_label_button_release (GdkEventButton*);
557 void store_ruler_visibility ();
558 void restore_ruler_visibility ();
560 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
561 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
562 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
563 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
565 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
566 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
567 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
568 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
570 Gtk::Widget *_ruler_separator;
571 GtkWidget *_smpte_ruler;
572 GtkWidget *_bbt_ruler;
573 GtkWidget *_frames_ruler;
574 GtkWidget *_minsec_ruler;
575 Gtk::Widget *smpte_ruler;
576 Gtk::Widget *bbt_ruler;
577 Gtk::Widget *frames_ruler;
578 Gtk::Widget *minsec_ruler;
579 static Editor *ruler_editor;
581 static const double timebar_height;
582 guint32 visible_timebars;
583 Gtk::Menu *editor_ruler_menu;
585 ArdourCanvas::SimpleRect* tempo_bar;
586 ArdourCanvas::SimpleRect* meter_bar;
587 ArdourCanvas::SimpleRect* marker_bar;
588 ArdourCanvas::SimpleRect* range_marker_bar;
589 ArdourCanvas::SimpleRect* transport_marker_bar;
592 ArdourCanvas::SimpleLine* tempo_line;
593 ArdourCanvas::SimpleLine* meter_line;
594 ArdourCanvas::SimpleLine* marker_line;
595 ArdourCanvas::SimpleLine* range_marker_line;
596 ArdourCanvas::SimpleLine* transport_marker_line;
598 Gtk::Label minsec_label;
599 Gtk::Label bbt_label;
600 Gtk::Label smpte_label;
601 Gtk::Label frame_label;
602 Gtk::Label tempo_label;
603 Gtk::Label meter_label;
604 Gtk::Label mark_label;
605 Gtk::Label range_mark_label;
606 Gtk::Label transport_mark_label;
609 Gtk::VBox time_button_vbox;
610 Gtk::HBox time_button_hbox;
614 ArdourCanvas::Points points;
615 ArdourCanvas::Line canvas_item;
616 nframes_t current_frame;
619 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
622 void set_position (nframes_t);
623 void set_length (double units);
624 void set_y_axis (double position);
627 friend struct Cursor; /* it needs access to several private
631 Cursor* playhead_cursor;
633 ArdourCanvas::Group* cursor_group;
635 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
636 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
637 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
638 void cursor_to_selection_start (Cursor *);
639 void cursor_to_selection_end (Cursor *);
640 void select_all_selectables_using_cursor (Cursor *, bool);
641 void select_all_selectables_between_cursors (Cursor *, Cursor *);
643 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
645 vector<nframes_t> region_boundary_cache;
646 void build_region_boundary_cache ();
648 Gtk::VBox trackview_vpacker;
651 Gtk::HBox bottom_hbox;
653 Gtk::Table edit_packer;
654 Gtk::VScrollbar edit_vscrollbar;
656 Gtk::Adjustment vertical_adjustment;
657 Gtk::Adjustment horizontal_adjustment;
659 Gtk::Layout controls_layout;
660 bool control_layout_scroll (GdkEventScroll* ev);
661 void controls_layout_size_request (Gtk::Requisition*);
663 Gtk::HScrollbar edit_hscrollbar;
664 bool _dragging_hscrollbar;
666 void reset_hscrollbar_stepping ();
668 bool hscrollbar_button_press (GdkEventButton*);
669 bool hscrollbar_button_release (GdkEventButton*);
670 void hscrollbar_allocate (Gtk::Allocation &alloc);
673 double canvas_height;
674 double full_canvas_height;
675 nframes_t last_canvas_frame;
677 bool track_canvas_map_handler (GdkEventAny*);
678 bool time_canvas_map_handler (GdkEventAny*);
680 gint edit_controls_button_release (GdkEventButton*);
681 Gtk::Menu *edit_controls_left_menu;
682 Gtk::Menu *edit_controls_right_menu;
684 Gtk::VBox track_canvas_vbox;
685 Gtk::VBox time_canvas_vbox;
686 Gtk::VBox edit_controls_vbox;
687 Gtk::HBox edit_controls_hbox;
689 void control_scroll (float);
690 bool deferred_control_scroll (nframes_t);
691 sigc::connection control_scroll_connection;
693 void tie_vertical_scrolling ();
694 void canvas_horizontally_scrolled ();
696 struct VisualChange {
703 nframes_t time_origin;
704 double frames_per_unit;
708 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
712 VisualChange pending_visual_change;
714 static int _idle_visual_changer (void *arg);
715 int idle_visual_changer ();
717 void queue_visual_change (nframes_t);
718 void queue_visual_change (double);
720 void end_location_changed (ARDOUR::Location*);
722 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
723 RegionListDisplayModelColumns() {
728 Gtk::TreeModelColumn<Glib::ustring> name;
729 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
730 Gtk::TreeModelColumn<Gdk::Color> color_;
733 RegionListDisplayModelColumns region_list_columns;
734 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
736 Glib::RefPtr<Gtk::TreeStore> region_list_model;
737 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
738 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
740 void region_list_selection_changed ();
741 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
743 Gtk::Menu *region_list_menu;
744 Gtk::ScrolledWindow region_list_scroller;
745 Gtk::Frame region_list_frame;
747 bool region_list_display_key_press (GdkEventKey *);
748 bool region_list_display_key_release (GdkEventKey *);
749 bool region_list_display_button_press (GdkEventButton *);
750 bool region_list_display_button_release (GdkEventButton *);
751 void region_list_clear ();
752 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
753 void build_region_list_menu ();
754 void show_region_list_display_context_menu (int button, int time);
756 bool show_automatic_regions_in_region_list;
757 Editing::RegionListSortType region_list_sort_type;
759 void reset_region_list_sort_direction (bool);
760 void reset_region_list_sort_type (Editing::RegionListSortType);
762 void toggle_full_region_list ();
763 void toggle_show_auto_regions ();
765 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
769 Gtk::ScrolledWindow snapshot_display_scroller;
770 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
771 SnapshotDisplayModelColumns() {
775 Gtk::TreeModelColumn<Glib::ustring> visible_name;
776 Gtk::TreeModelColumn<Glib::ustring> real_name;
779 SnapshotDisplayModelColumns snapshot_display_columns;
780 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
781 Gtk::TreeView snapshot_display;
782 Gtk::Menu snapshot_context_menu;
784 bool snapshot_display_button_press (GdkEventButton*);
785 void snapshot_display_selection_changed ();
786 void redisplay_snapshots();
787 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
789 /* named selections */
791 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
792 NamedSelectionDisplayModelColumns() {
796 Gtk::TreeModelColumn<Glib::ustring> text;
797 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
800 NamedSelectionDisplayModelColumns named_selection_columns;
801 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
803 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
804 Gtk::ScrolledWindow named_selection_scroller;
806 void create_named_selection ();
807 void paste_named_selection (float times);
808 void remove_selected_named_selections ();
809 void remove_snapshot (Glib::ustring);
810 void rename_snapshot (Glib::ustring);
812 void handle_new_named_selection ();
813 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
814 void redisplay_named_selections ();
816 bool named_selection_display_button_release (GdkEventButton *ev);
817 bool named_selection_display_key_release (GdkEventKey *ev);
818 void named_selection_display_selection_changed ();
821 TrackViewList track_views;
822 TimeAxisView *trackview_by_y_position (double ypos);
824 static Gdk::Cursor* cross_hair_cursor;
825 static Gdk::Cursor* trimmer_cursor;
826 static Gdk::Cursor* selector_cursor;
827 static Gdk::Cursor* grabber_cursor;
828 static Gdk::Cursor* zoom_cursor;
829 static Gdk::Cursor* time_fx_cursor;
830 static Gdk::Cursor* fader_cursor;
831 static Gdk::Cursor* speaker_cursor;
832 static Gdk::Cursor* wait_cursor;
833 static Gdk::Cursor* timebar_cursor;
835 static void build_cursors ();
837 sigc::connection scroll_connection;
838 nframes_t last_update_frame;
839 void center_screen (nframes_t);
840 void center_screen_internal (nframes_t, float);
842 void update_current_screen ();
844 void session_going_away ();
846 nframes_t cut_buffer_start;
847 nframes_t cut_buffer_length;
849 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
850 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
851 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
852 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
853 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
854 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
856 /* KEYMAP HANDLING */
858 void register_actions ();
860 int ensure_cursor (nframes_t* pos);
862 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
863 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
864 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
865 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
866 void redisplay_regions ();
867 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
869 list<boost::shared_ptr<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 (nframes_t position, float times);
879 /* EDITING OPERATIONS */
881 void reset_point_selection ();
882 void toggle_region_mute ();
883 void toggle_region_lock ();
884 void toggle_region_opaque ();
885 void raise_region ();
886 void raise_region_to_top ();
887 void lower_region ();
888 void lower_region_to_bottom ();
889 void split_region ();
890 void split_region_at (nframes_t);
891 void split_regions_at (nframes_t, RegionSelection&);
892 void crop_region_to_selection ();
893 void set_a_regions_sync_position (boost::shared_ptr<ARDOUR::Region>, nframes_t);
894 void set_region_sync_from_edit_cursor ();
895 void remove_region_sync();
896 void align_selection (ARDOUR::RegionPoint, nframes_t position);
897 void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position);
898 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
899 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
900 void remove_clicked_region ();
901 void destroy_clicked_region ();
903 void duplicate_some_regions (RegionSelection&, float times);
904 void duplicate_selection (float times);
905 void region_fill_selection ();
907 void region_fill_track ();
908 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
909 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
910 void split_multichannel_region();
911 void reverse_region ();
912 void normalize_region ();
913 void denormalize_region ();
915 void audition_region_from_region_list ();
916 void hide_region_from_region_list ();
917 void remove_region_from_region_list ();
919 void align (ARDOUR::RegionPoint);
920 void align_relative (ARDOUR::RegionPoint);
927 void paste (float times);
929 int get_prefix (float&, bool&);
931 void keyboard_paste ();
932 void keyboard_duplicate_region ();
933 void keyboard_duplicate_selection ();
934 void keyboard_insert_region_list_selection ();
936 void region_from_selection ();
937 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
940 void rename_region ();
941 void rename_region_finished (bool);
943 void play_from_start ();
944 void play_from_edit_cursor ();
945 void play_selected_region ();
946 void audition_selected_region ();
947 void loop_selected_region ();
948 void play_location (ARDOUR::Location&);
949 void loop_location (ARDOUR::Location&);
951 Editing::ZoomFocus zoom_focus;
953 void temporal_zoom_selection ();
954 void temporal_zoom_session ();
955 void temporal_zoom (gdouble scale);
956 void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
957 void temporal_zoom_to_frame (bool coarser, nframes_t frame);
959 void amplitude_zoom (gdouble scale);
960 void amplitude_zoom_step (bool in);
962 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
963 void insert_region_list_selection (float times);
965 void add_external_audio_action (Editing::ImportMode);
966 void external_audio_dialog ();
967 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
969 SoundFileBrowser* sfbrowser;
971 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
972 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
974 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
975 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
976 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
978 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, nframes64_t& pos,
979 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
980 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
981 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
983 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
984 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
985 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
986 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track, int nth);
988 /* generic interthread progress window */
990 ArdourDialog* interthread_progress_window;
991 Gtk::Label interthread_progress_label;
992 Gtk::VBox interthread_progress_vbox;
993 Gtk::ProgressBar interthread_progress_bar;
994 Gtk::Button interthread_cancel_button;
995 Gtk::Label interthread_cancel_label;
996 sigc::connection interthread_progress_connection;
997 void interthread_cancel_clicked ();
998 void build_interthread_progress_window ();
999 ARDOUR::InterThreadInfo* current_interthread_info;
1002 AnalysisWindow* analysis_window;
1005 /* import specific info */
1007 ARDOUR::Session::import_status import_status;
1008 gint import_progress_timeout (void *);
1009 static void *_import_thread (void *);
1010 void* import_thread ();
1012 /* to support this ... */
1014 void import_audio (bool as_tracks);
1015 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1017 void move_to_start ();
1018 void move_to_end ();
1020 void center_playhead ();
1021 void center_edit_cursor ();
1022 void edit_cursor_backward ();
1023 void edit_cursor_forward ();
1024 void playhead_backward ();
1025 void playhead_forward ();
1026 void scroll_playhead (bool forward);
1027 void scroll_backward (float pages=0.8f);
1028 void scroll_forward (float pages=0.8f);
1029 void scroll_tracks_down ();
1030 void scroll_tracks_up ();
1031 void delete_sample_forward ();
1032 void delete_sample_backward ();
1033 void delete_screen ();
1034 void search_backwards ();
1035 void search_forwards ();
1037 void clear_markers ();
1038 void clear_ranges ();
1039 void clear_locations ();
1040 void unhide_markers ();
1041 void unhide_ranges ();
1042 void jump_forward_to_mark ();
1043 void jump_backward_to_mark ();
1044 void cursor_align (bool playhead_to_edit);
1046 void remove_last_capture ();
1047 void select_all_selectables_using_time_selection ();
1048 void select_all_selectables_using_loop();
1049 void select_all_selectables_using_punch();
1050 void set_selection_from_range (ARDOUR::Location&);
1051 void set_selection_from_punch ();
1052 void set_selection_from_loop ();
1053 void set_selection_from_audio_region ();
1055 void add_location_from_audio_region ();
1056 void add_location_from_selection ();
1057 void set_loop_from_selection (bool play);
1058 void set_punch_from_selection ();
1060 void set_loop_range (nframes_t start, nframes_t end, std::string cmd);
1061 void set_punch_range (nframes_t start, nframes_t end, std::string cmd);
1063 void add_location_from_playhead_cursor ();
1065 void reverse_selection ();
1066 void edit_envelope ();
1068 void start_scrolling ();
1069 void stop_scrolling ();
1072 nframes64_t last_scrub_frame;
1073 uint32_t last_scrub_time;
1075 void keyboard_selection_begin ();
1076 void keyboard_selection_finish (bool add);
1077 bool have_pending_keyboard_selection;
1078 nframes_t pending_keyboard_selection_start;
1080 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1081 void extend_selection_to_end_of_region (bool next);
1082 void extend_selection_to_start_of_region (bool previous);
1084 Editing::SnapType snap_type;
1085 Editing::SnapMode snap_mode;
1086 double snap_threshold;
1088 void handle_gui_changes (const string &, void *);
1090 void hide_all_tracks (bool with_select);
1093 LineDragInfo current_line_drag_info;
1095 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1096 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1097 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1099 Gtk::Menu fade_context_menu;
1100 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1102 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1103 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1104 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1105 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1106 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1107 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1109 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1110 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1112 void set_fade_in_active (bool);
1113 void set_fade_out_active (bool);
1115 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1116 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1117 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1119 bool _dragging_playhead;
1121 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1122 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1123 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1124 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1125 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1126 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1127 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1128 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1130 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1131 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1132 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1133 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1135 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1137 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1138 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1139 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1140 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1141 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1142 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1143 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1144 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1145 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1146 void start_line_grab (AutomationLine *, GdkEvent*);
1147 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1148 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1149 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1150 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1152 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1154 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1155 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1157 void mouse_brush_insert_region (RegionView*, nframes_t pos);
1158 void brush (nframes_t);
1160 void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1161 void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1163 /* Canvas event handlers */
1165 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1166 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1167 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1168 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1169 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1170 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1171 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1172 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1173 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1174 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1175 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1176 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1177 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1178 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1179 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1180 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1181 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1182 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1183 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1185 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1186 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1187 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1188 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1189 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1191 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1192 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1193 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1194 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1195 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1196 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1197 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1198 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1200 /* non-public event handlers */
1202 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1203 bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1204 bool track_canvas_scroll (GdkEventScroll* event);
1206 bool track_canvas_scroll_event (GdkEventScroll* event);
1207 bool track_canvas_button_press_event (GdkEventButton* event);
1208 bool track_canvas_button_release_event (GdkEventButton* event);
1209 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1211 Gtk::Allocation canvas_allocation;
1212 bool canvas_idle_queued;
1213 void track_canvas_allocate (Gtk::Allocation alloc);
1214 bool track_canvas_size_allocated ();
1216 void set_edit_cursor (GdkEvent* event);
1217 void set_playhead_cursor (GdkEvent* event);
1219 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1220 void kbd_set_playhead_cursor ();
1221 void kbd_set_edit_cursor ();
1222 void kbd_mute_unmute_region ();
1224 void kbd_set_sync_position ();
1225 void kbd_align (ARDOUR::RegionPoint);
1226 void kbd_align_relative (ARDOUR::RegionPoint);
1228 void kbd_audition ();
1230 void kbd_do_split (GdkEvent*);
1231 void kbd_do_set_sync_position (GdkEvent* ev);
1232 void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
1233 void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
1234 void kbd_do_brush (GdkEvent*);
1235 void kbd_do_audition (GdkEvent*);
1237 void handle_new_duration ();
1238 void initialize_canvas ();
1239 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1241 /* display control */
1243 bool _show_measures;
1244 bool _show_waveforms;
1245 bool _follow_playhead;
1246 bool _show_waveforms_recording;
1248 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1250 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1251 TimeLineList free_measure_lines;
1252 TimeLineList used_measure_lines;
1254 ArdourCanvas::Group* time_line_group;
1255 ArdourCanvas::SimpleLine* get_time_line ();
1256 void hide_measures ();
1257 void draw_measures ();
1258 bool lazy_hide_and_draw_measures ();
1260 void new_tempo_section ();
1262 void mouse_add_new_tempo_event (nframes_t where);
1263 void mouse_add_new_meter_event (nframes_t where);
1265 void remove_tempo_marker (ArdourCanvas::Item*);
1266 void remove_meter_marker (ArdourCanvas::Item*);
1267 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1268 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1270 void edit_tempo_section (ARDOUR::TempoSection*);
1271 void edit_meter_section (ARDOUR::MeterSection*);
1272 void edit_tempo_marker (ArdourCanvas::Item*);
1273 void edit_meter_marker (ArdourCanvas::Item*);
1275 void marker_menu_edit ();
1276 void marker_menu_remove ();
1277 void marker_menu_rename ();
1278 void marker_menu_hide ();
1279 void marker_menu_loop_range ();
1280 void marker_menu_select_all_selectables_using_range ();
1281 void marker_menu_select_using_range ();
1282 void marker_menu_separate_regions_using_location ();
1283 void marker_menu_play_from ();
1284 void marker_menu_play_range ();
1285 void marker_menu_set_playhead ();
1286 void marker_menu_set_from_playhead ();
1287 void marker_menu_set_from_selection ();
1288 void new_transport_marker_menu_set_loop ();
1289 void new_transport_marker_menu_set_punch ();
1290 void update_loop_range_view (bool visibility=false);
1291 void update_punch_range_view (bool visibility=false);
1292 gint new_transport_marker_menu_popdown (GdkEventAny*);
1293 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1294 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1295 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1296 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1297 void build_range_marker_menu (bool loop_or_punch);
1298 void build_marker_menu (bool start_or_end);
1299 void build_tm_marker_menu ();
1300 void build_new_transport_marker_menu ();
1302 Gtk::Menu* tm_marker_menu;
1303 Gtk::Menu* marker_menu;
1304 Gtk::Menu* start_end_marker_menu;
1305 Gtk::Menu* range_marker_menu;
1306 Gtk::Menu* transport_marker_menu;
1307 Gtk::Menu* new_transport_marker_menu;
1308 ArdourCanvas::Item* marker_menu_item;
1310 typedef list<Marker*> Marks;
1313 void remove_metric_marks ();
1314 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1316 void tempo_map_changed (ARDOUR::Change);
1317 void redisplay_tempo (bool immediate_redraw);
1319 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1320 void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) {
1321 /* XXX remove this function when everything moves to 64 bit frame counts */
1322 nframes64_t first64 = first;
1323 snap_to (first64, direction, for_mark);
1324 first = (nframes_t) first64;
1327 uint32_t bbt_beat_subdivision;
1331 Gtk::ToggleButton editor_mixer_button;
1333 void editor_mixer_button_toggled ();
1335 AudioClock edit_cursor_clock;
1336 AudioClock zoom_range_clock;
1337 Gtk::Button zoom_in_button;
1338 Gtk::Button zoom_out_button;
1339 Gtk::Button zoom_out_full_button;
1340 Gtk::Button zoom_onetoone_button;
1342 Gtk::VBox toolbar_clock_vbox;
1343 Gtk::VBox toolbar_selection_clock_vbox;
1344 Gtk::Table toolbar_selection_clock_table;
1345 Gtk::Label toolbar_selection_cursor_label;
1347 Gtk::HBox mouse_mode_button_box;
1348 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1349 Gtk::ToggleButton mouse_select_button;
1350 Gtk::ToggleButton mouse_move_button;
1351 Gtk::ToggleButton mouse_gain_button;
1352 Gtk::ToggleButton mouse_zoom_button;
1353 Gtk::ToggleButton mouse_timefx_button;
1354 Gtk::ToggleButton mouse_audition_button;
1355 GroupedButtons *mouse_mode_button_set;
1356 void mouse_mode_toggled (Editing::MouseMode m);
1357 bool ignore_mouse_mode_toggle;
1359 gint mouse_select_button_release (GdkEventButton*);
1361 Gtk::VBox automation_box;
1362 Gtk::Button automation_mode_button;
1363 Gtk::ToggleButton global_automation_button;
1365 Gtk::ComboBoxText edit_mode_selector;
1366 Gtk::VBox edit_mode_box;
1368 void edit_mode_selection_done ();
1370 Gtk::ComboBoxText snap_type_selector;
1371 Gtk::ComboBoxText snap_mode_selector;
1374 std::vector<std::string> snap_type_strings;
1375 std::vector<std::string> snap_mode_strings;
1377 void snap_type_selection_done ();
1378 void snap_mode_selection_done ();
1379 void snap_mode_chosen (Editing::SnapMode);
1380 void snap_type_chosen (Editing::SnapType);
1382 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1383 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1385 Gtk::ComboBoxText zoom_focus_selector;
1386 Gtk::VBox zoom_focus_box;
1388 std::vector<std::string> zoom_focus_strings;
1390 void zoom_focus_selection_done ();
1391 void zoom_focus_chosen (Editing::ZoomFocus);
1393 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1397 void zoom_adjustment_changed();
1399 void edit_cursor_clock_changed();
1401 void setup_toolbar ();
1403 Gtkmm2ext::TearOff* tools_tearoff;
1404 Gtk::HBox toolbar_hbox;
1405 Gtk::EventBox toolbar_base;
1406 Gtk::Frame toolbar_frame;
1408 /* selection process */
1410 Selection* selection;
1411 Selection* cut_buffer;
1413 void time_selection_changed ();
1414 void track_selection_changed ();
1415 void region_selection_changed ();
1416 void point_selection_changed ();
1425 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1426 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1427 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1428 void cancel_selection ();
1430 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1431 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1432 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1434 bool audio_region_selection_covers (nframes_t where);
1436 /* transport range select process */
1437 enum RangeMarkerOp {
1439 CreateTransportMarker
1442 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1443 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1444 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1446 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1447 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1448 ArdourCanvas::Line* marker_drag_line;
1449 ArdourCanvas::Points marker_drag_line_points;
1450 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1452 void update_marker_drag_item (ARDOUR::Location *);
1454 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1455 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1456 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1457 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1458 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1459 ArdourCanvas::SimpleLine *transport_punchin_line;
1460 ArdourCanvas::SimpleLine *transport_punchout_line;
1461 ArdourCanvas::SimpleRect *transport_preroll_rect;
1462 ArdourCanvas::SimpleRect *transport_postroll_rect;
1464 ARDOUR::Location* transport_loop_location();
1465 ARDOUR::Location* transport_punch_location();
1467 ARDOUR::Location *temp_location;
1469 /* object rubberband select process */
1471 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1472 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1473 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1475 bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1477 ArdourCanvas::SimpleRect *rubberband_rect;
1479 /* mouse zoom process */
1481 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1482 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1483 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1485 ArdourCanvas::SimpleRect *zoom_rect;
1486 void reposition_zoom_rect (nframes_t start, nframes_t end);
1488 /* diskstream/route display management */
1490 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1491 RouteDisplayModelColumns() {
1496 Gtk::TreeModelColumn<Glib::ustring> text;
1497 Gtk::TreeModelColumn<bool> visible;
1498 Gtk::TreeModelColumn<TimeAxisView*> tv;
1501 RouteDisplayModelColumns route_display_columns;
1502 Glib::RefPtr<Gtk::ListStore> route_display_model;
1503 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1505 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1506 Gtk::ScrolledWindow route_list_scroller;
1507 Gtk::Menu* route_list_menu;
1509 bool route_list_display_button_press (GdkEventButton*);
1510 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1512 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1513 void route_list_delete (const Gtk::TreeModel::Path&);
1514 void initial_route_list_display ();
1515 void redisplay_route_list();
1516 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1517 bool ignore_route_list_reorder;
1518 bool no_route_list_redisplay;
1520 void build_route_list_menu ();
1521 void show_route_list_menu ();
1523 void show_all_routes ();
1524 void hide_all_routes ();
1525 void show_all_audiotracks ();
1526 void hide_all_audiotracks ();
1527 void show_all_audiobus ();
1528 void hide_all_audiobus ();
1530 void set_all_tracks_visibility (bool yn);
1531 void set_all_audio_visibility (int type, bool yn);
1533 /* edit group management */
1535 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1536 GroupListModelColumns () {
1542 Gtk::TreeModelColumn<bool> is_active;
1543 Gtk::TreeModelColumn<bool> is_visible;
1544 Gtk::TreeModelColumn<std::string> text;
1545 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1548 GroupListModelColumns group_columns;
1549 Glib::RefPtr<Gtk::ListStore> group_model;
1550 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1552 Gtk::TreeView edit_group_display;
1553 Gtk::ScrolledWindow edit_group_display_scroller;
1554 Gtk::Menu* edit_group_list_menu;
1556 void build_edit_group_list_menu ();
1557 void activate_all_edit_groups ();
1558 void disable_all_edit_groups ();
1560 bool in_edit_group_row_change;
1561 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1562 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1563 void new_edit_group ();
1564 void edit_group_list_button_clicked ();
1565 gint edit_group_list_button_press_event (GdkEventButton* ev);
1566 void add_edit_group (ARDOUR::RouteGroup* group);
1567 void remove_selected_edit_group ();
1568 void edit_groups_changed ();
1569 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1571 Gtk::VBox list_vpacker;
1575 bool autoscroll_active;
1576 int autoscroll_timeout_tag;
1577 int autoscroll_direction;
1578 uint32_t autoscroll_cnt;
1579 nframes_t autoscroll_distance;
1581 static gint _autoscroll_canvas (void *);
1582 bool autoscroll_canvas ();
1583 void start_canvas_autoscroll (int direction);
1584 void stop_canvas_autoscroll ();
1585 void maybe_autoscroll (GdkEvent*);
1594 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1595 void point_trim (GdkEvent*);
1596 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1597 void single_contents_trim (RegionView&, nframes_t, bool, bool, bool);
1598 void single_start_trim (RegionView&, nframes_t, bool, bool);
1599 void single_end_trim (RegionView&, nframes_t, bool, bool);
1601 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1602 void thaw_region_after_trim (RegionView& rv);
1604 void trim_region_to_edit_cursor ();
1605 void trim_region_from_edit_cursor ();
1607 bool show_gain_after_trim;
1611 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1612 const Glib::RefPtr<Gdk::DragContext>& context,
1615 const Gtk::SelectionData& data,
1619 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1622 const Gtk::SelectionData& data,
1626 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1629 const Gtk::SelectionData& data,
1634 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1637 const Gtk::SelectionData& data,
1641 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1644 const Gtk::SelectionData& data,
1650 ExportDialog *export_dialog;
1651 ExportDialog *export_range_markers_dialog;
1653 void export_range (nframes_t start, nframes_t end);
1654 void export_range_markers ();
1656 int write_region_selection(RegionSelection&);
1657 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1658 void export_region ();
1659 void bounce_region_selection ();
1660 void bounce_range_selection ();
1661 void external_edit_region ();
1663 int write_audio_selection (TimeSelection&);
1664 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1666 void write_selection ();
1670 UndoAction get_memento() const;
1672 XMLNode *before; /* used in *_reversible_command */
1673 void begin_reversible_command (string cmd_name);
1674 void commit_reversible_command ();
1676 /* visual history */
1678 UndoHistory visual_history;
1679 UndoTransaction current_visual_command;
1682 void update_title ();
1683 void update_title_s (const string & snapshot_name);
1686 Selection* selection;
1687 double frames_per_unit;
1693 void store_state (State&) const;
1694 void restore_state (State *);
1696 void instant_save ();
1698 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1700 /* freeze operations */
1702 ARDOUR::InterThreadInfo freeze_status;
1703 gint freeze_progress_timeout (void *);
1704 static void* _freeze_thread (void*);
1705 void* freeze_thread ();
1707 void freeze_route ();
1708 void unfreeze_route ();
1710 /* edit-group solo + mute */
1712 void set_edit_group_solo (ARDOUR::Route&, bool);
1713 void set_edit_group_mute (ARDOUR::Route&, bool);
1717 void duplicate_dialog (bool for_region);
1719 nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
1721 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1722 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1723 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1725 struct TimeStretchDialog : public ArdourDialog {
1726 ARDOUR::Session::TimeStretchRequest request;
1728 RegionSelection regions;
1729 Gtk::ProgressBar progress_bar;
1730 Gtk::ToggleButton quick_button;
1731 Gtk::ToggleButton antialias_button;
1732 Gtk::Button* cancel_button;
1733 Gtk::Button* action_button;
1734 Gtk::HBox upper_button_box;
1738 TimeStretchDialog (Editor& e);
1740 gint update_progress ();
1741 sigc::connection first_cancel;
1742 sigc::connection first_delete;
1743 void cancel_timestretch_in_progress ();
1744 gint delete_timestretch_in_progress (GdkEventAny*);
1747 /* "whats mine is yours" */
1749 friend class TimeStretchDialog;
1751 TimeStretchDialog* current_timestretch;
1753 static void* timestretch_thread (void *arg);
1754 int run_timestretch (RegionSelection&, float fraction);
1755 void do_timestretch (TimeStretchDialog&);
1757 /* editor-mixer strip */
1759 MixerStrip *current_mixer_strip;
1760 bool show_editor_mixer_when_tracks_arrive;
1761 Gtk::VBox current_mixer_strip_vbox;
1762 void cms_deleted ();
1763 void current_mixer_strip_hidden ();
1764 void current_mixer_strip_removed ();
1766 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1767 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1769 /* nudging tracks */
1771 void nudge_track (bool use_edit_cursor, bool forwards);
1775 bool _xfade_visibility;
1777 /* <CMT Additions> */
1778 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1779 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
1781 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1782 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1784 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1785 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1786 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1788 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1789 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1790 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1791 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1793 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1794 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1795 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1796 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1798 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1799 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1800 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1801 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1802 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1803 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1805 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1806 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1807 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1808 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1809 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1810 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1812 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1813 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1815 ImageFrameSocketHandler* image_socket_listener ;
1816 /* </CMT Additions> */
1818 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
1819 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
1820 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
1821 void xfade_edit_left_region ();
1822 void xfade_edit_right_region ();
1824 static const int32_t default_width = 995;
1825 static const int32_t default_height = 765;
1829 Gtk::Button nudge_forward_button;
1830 Gtk::Button nudge_backward_button;
1831 Gtk::HBox nudge_hbox;
1832 Gtk::VBox nudge_vbox;
1833 AudioClock nudge_clock;
1835 nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
1839 void apply_filter (ARDOUR::AudioFilter&, string cmd);
1841 /* handling cleanup */
1843 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
1845 vector<sigc::connection> session_connections;
1847 /* tracking step changes of track height */
1849 TimeAxisView* current_stepping_trackview;
1850 struct timeval last_track_height_step_timestamp;
1851 gint track_height_step_timeout();
1852 sigc::connection step_timeout;
1854 TimeAxisView* entered_track;
1855 RegionView* entered_regionview;
1856 bool clear_entered_track;
1857 gint left_track_canvas (GdkEventCrossing*);
1858 void set_entered_track (TimeAxisView*);
1859 void set_entered_regionview (RegionView*);
1860 gint left_automation_track ();
1862 bool _new_regionviews_show_envelope;
1864 void toggle_gain_envelope_visibility ();
1865 void toggle_gain_envelope_active ();
1866 void reset_region_gain_envelopes ();
1868 Gtk::CheckMenuItem* region_envelope_visible_item;
1869 Gtk::CheckMenuItem* region_envelope_active_item;
1870 Gtk::CheckMenuItem* region_mute_item;
1871 Gtk::CheckMenuItem* region_lock_item;
1872 Gtk::CheckMenuItem* region_opaque_item;
1874 bool on_key_press_event (GdkEventKey*);
1876 void session_state_saved (string);
1878 Glib::RefPtr<Gtk::Action> undo_action;
1879 Glib::RefPtr<Gtk::Action> redo_action;
1881 void history_changed ();
1882 void color_handler ();
1885 #endif /* __ardour_editor_h__ */