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__
29 #include <glibmm/ustring.h>
31 #include <boost/optional.hpp>
33 #include <libgnomecanvasmm/canvas.h>
34 #include <libgnomecanvasmm/group.h>
35 #include <libgnomecanvasmm/line.h>
36 #include <libgnomecanvasmm/pixbuf.h>
40 #include <gtkmm/layout.h>
41 #include <gtkmm/comboboxtext.h>
43 #include <gtkmm2ext/selector.h>
44 #include <gtkmm2ext/click_box.h>
45 #include <gtkmm2ext/dndtreeview.h>
47 #include <pbd/stateful.h>
48 #include <ardour/session.h>
49 #include <ardour/tempo.h>
50 #include <ardour/stretch.h>
51 #include <ardour/location.h>
52 #include <ardour/audioregion.h>
54 #include "audio_clock.h"
55 #include "gtk-custom-ruler.h"
56 #include "ardour_dialog.h"
57 #include "public_editor.h"
60 #include "editor_items.h"
61 #include "region_selection.h"
64 #include "tempo_lines.h"
71 class AudioDiskstream;
90 class AudioTimeAxisView;
91 class AutomationTimeAxisView;
92 class AudioRegionView;
95 class PlaylistSelector;
99 class UIExportSpecification;
103 class TrackSelection;
104 class AutomationSelection;
107 class AudioStreamView;
109 class SoundFileOmega;
112 class AnalysisWindow;
115 /* <CMT Additions> */
116 class ImageFrameView;
117 class ImageFrameTimeAxisView;
118 class ImageFrameTimeAxis;
119 class MarkerTimeAxis ;
121 class ImageFrameSocketHandler ;
122 class TimeAxisViewItem ;
123 /* </CMT Additions> */
126 class Editor : public PublicEditor
132 void connect_to_session (ARDOUR::Session *);
133 ARDOUR::Session* current_session() const { return session; }
135 nframes_t leftmost_position() const { return leftmost_frame; }
136 nframes_t current_page_frames() const {
137 return (nframes_t) floor (canvas_width * frames_per_unit);
140 void cycle_snap_mode ();
141 void cycle_snap_choice ();
142 void set_snap_to (Editing::SnapType);
143 void set_snap_mode (Editing::SnapMode);
144 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
146 void undo (uint32_t n = 1);
147 void redo (uint32_t n = 1);
149 XMLNode& get_state ();
150 int set_state (const XMLNode& );
152 void set_mouse_mode (Editing::MouseMode, bool force=true);
153 void step_mouse_mode (bool next);
154 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
156 void set_midi_edit_cursor (Editing::MidiEditMode);
157 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
158 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
161 void add_imageframe_time_axis(const std::string & track_name, void*) ;
162 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
163 void connect_to_image_compositor() ;
164 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
165 TimeAxisView* get_named_time_axis(const std::string & name) ;
168 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
170 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
171 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
172 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
174 #ifdef USE_RUBBERBAND
175 std::vector<std::string> rb_opt_strings;
178 /* option editor-access */
180 void set_show_waveforms (bool yn);
181 bool show_waveforms() const { return _show_waveforms; }
183 void set_show_waveforms_recording (bool yn);
184 bool show_waveforms_recording() const { return _show_waveforms_recording; }
186 /* things that need to be public to be used in the main menubar */
188 void new_region_from_selection ();
189 void separate_regions_between (const TimeSelection&);
190 void separate_region_from_selection ();
191 void separate_regions_using_location (ARDOUR::Location&);
192 void toggle_playback (bool with_abort);
193 void transition_to_rolling (bool forward);
197 nframes_t unit_to_frame (double unit) const {
198 return (nframes_t) rint (unit * frames_per_unit);
201 double frame_to_unit (nframes_t frame) const {
202 return rint ((double) frame / (double) frames_per_unit);
205 double frame_to_unit (double frame) const {
206 return rint (frame / frames_per_unit);
209 /* NOTE: these functions assume that the "pixel" coordinate is
210 the result of using the world->canvas affine transform on a
211 world coordinate. These coordinates already take into
212 account any scrolling carried out by adjusting the
216 nframes64_t pixel_to_frame (double pixel) const {
218 /* pixel can be less than zero when motion events
219 are processed. since we've already run the world->canvas
220 affine, that means that the location *really* is "off
221 to the right" and thus really is "before the start".
225 return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
231 gulong frame_to_pixel (nframes64_t frame) const {
232 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
235 void flush_canvas ();
239 Selection& get_selection() const { return *selection; }
240 Selection& get_cut_buffer() const { return *cut_buffer; }
242 bool extend_selection_to_track (TimeAxisView&);
244 void play_selection ();
245 void select_all_in_track (Selection::Operation op);
246 void select_all (Selection::Operation op);
247 void invert_selection_in_track ();
248 void invert_selection ();
249 void deselect_all ();
253 void set_show_measures (bool yn);
254 bool show_measures () const { return _show_measures; }
255 bool initial_ruler_update_required;
258 /* analysis window */
259 void analyze_region_selection();
260 void analyze_range_selection();
265 /* these initiate export ... */
267 void export_session();
268 void export_selection();
271 void add_toplevel_controls (Gtk::Container&);
272 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
274 void set_zoom_focus (Editing::ZoomFocus);
275 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
276 double get_current_zoom () const { return frames_per_unit; }
278 void temporal_zoom_step (bool coarser);
280 /* stuff that AudioTimeAxisView and related classes use */
282 PlaylistSelector& playlist_selector() const;
283 void route_name_changed (TimeAxisView *);
284 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
286 void new_playlists (TimeAxisView* v);
287 void copy_playlists (TimeAxisView* v);
288 void clear_playlists (TimeAxisView* v);
290 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
292 Width editor_mixer_strip_width;
293 void maybe_add_mixer_strip_width (XMLNode&);
294 void show_editor_mixer (bool yn);
295 void show_editor_list (bool yn);
296 void set_selected_mixer_strip (TimeAxisView&);
297 void hide_track_in_display (TimeAxisView& tv);
298 void show_track_in_display (TimeAxisView& tv);
300 /* nudge is initiated by transport controls owned by ARDOUR_UI */
302 void nudge_forward (bool next, bool force_playhead);
303 void nudge_backward (bool next, bool force_playhead);
305 /* nudge initiated from context menu */
307 void nudge_forward_capture_offset ();
308 void nudge_backward_capture_offset ();
310 /* playhead/screen stuff */
312 void set_follow_playhead (bool yn);
313 void toggle_follow_playhead ();
314 bool follow_playhead() const { return _follow_playhead; }
315 bool dragging_playhead () const { return _dragging_playhead; }
317 void toggle_waveform_visibility ();
318 void toggle_zero_line_visibility ();
319 void toggle_waveforms_while_recording ();
320 void toggle_measure_visibility ();
321 void toggle_logo_visibility ();
323 /* SMPTE timecode & video sync */
325 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
326 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
327 void subframes_per_frame_chosen (uint32_t);
329 void update_smpte_mode();
330 void update_video_pullup();
331 void update_subframes_per_frame ();
334 void toggle_auto_xfade ();
335 void toggle_xfades_active ();
336 void toggle_xfade_visibility ();
337 bool xfade_visibility() const { return _xfade_visibility; }
338 void update_xfade_visibility ();
339 void update_crossfade_model ();
340 void set_crossfade_model (ARDOUR::CrossfadeModel);
343 void set_layer_model (ARDOUR::LayerModel);
344 void update_layering_model ();
346 void toggle_link_region_and_track_selection ();
348 /* redirect shared ops menu. caller must free returned menu */
350 Gtk::Menu* redirect_menu ();
352 /* floating windows/transient */
354 void ensure_float (Gtk::Window&);
358 void scroll_tracks_down_line ();
359 void scroll_tracks_up_line ();
361 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
362 void prepare_for_cleanup ();
364 void maximise_editing_space();
365 void restore_editing_space();
367 void reset_x_origin (nframes_t);
368 void reset_zoom (double);
369 void reposition_and_zoom (nframes_t, double);
371 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
373 bool update_mouse_speed ();
374 bool decelerate_mouse_speed ();
376 void toggle_meter_updating();
378 void show_rhythm_ferret();
381 void map_transport_state ();
382 void map_position_change (nframes_t);
388 /// The session that we are editing, or 0
389 void color_handler ();
390 ARDOUR::Session *session;
393 // to keep track of the playhead position for control_scroll
394 boost::optional<nframes_t> _control_scroll_target;
396 PlaylistSelector* _playlist_selector;
399 double frames_per_unit;
400 nframes_t leftmost_frame;
401 Editing::ZoomFocus zoom_focus;
404 VisualState last_visual_state;
406 nframes_t leftmost_frame;
407 double frames_per_unit;
408 Editing::ZoomFocus zoom_focus;
410 void use_visual_state (const VisualState&);
411 void set_frames_per_unit (double);
412 void swap_visual_state ();
415 Editing::MouseMode mouse_mode;
416 Editing::MidiEditMode midi_edit_mode;
418 int post_maximal_editor_width;
419 int post_maximal_pane_position;
420 int pre_maximal_pane_position;
421 int pre_maximal_editor_width;
422 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
424 Gtk::Notebook the_notebook;
425 Gtk::HPaned edit_pane;
427 Gtk::EventBox meter_base;
429 Gtk::EventBox marker_base;
430 Gtk::HBox marker_box;
431 Gtk::VBox scrollers_rulers_markers_box;
433 void location_changed (ARDOUR::Location *);
434 void location_flags_changed (ARDOUR::Location *, void *);
435 void refresh_location_display ();
436 void refresh_location_display_s (ARDOUR::Change);
437 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
438 void add_new_location (ARDOUR::Location *);
439 void location_gone (ARDOUR::Location *);
440 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
441 gint really_remove_marker (ARDOUR::Location* loc);
442 void goto_nth_marker (int nth);
444 uint32_t location_marker_color;
445 uint32_t location_range_color;
446 uint32_t location_loop_color;
447 uint32_t location_punch_color;
448 uint32_t location_cd_marker_color;
450 struct LocationMarkers {
455 LocationMarkers () : start(0), end(0), valid (true) {}
461 void set_name (const string&);
462 void set_position (nframes_t start, nframes_t end = 0);
463 void set_color_rgba (uint32_t);
466 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
467 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
468 Marker* entered_marker;
470 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
471 LocationMarkerMap location_markers;
473 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
474 void clear_marker_display ();
475 void mouse_add_new_marker (nframes_t where, bool is_cd=false, bool is_xrun=false);
476 void update_cd_marker_display ();
477 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
479 TimeAxisView* clicked_axisview;
480 RouteTimeAxisView* clicked_routeview;
481 /** The last RegionView that was clicked on, or 0 if the last click was not
482 * on a RegionView. This is set up by the canvas event handlers in
483 * editor_canvas_events.cc
485 RegionView* clicked_regionview;
486 RegionSelection latest_regionviews;
487 uint32_t clicked_selection;
488 CrossfadeView* clicked_crossfadeview;
489 ControlPoint* clicked_control_point;
491 void sort_track_selection (TrackSelection* sel = 0);
493 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
494 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
495 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
497 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
499 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
500 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
501 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
502 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
506 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
507 bool button_release_can_deselect;
509 void catch_vanishing_regionview (RegionView *);
511 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
512 void select_all_tracks ();
514 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
515 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
516 void set_selected_track_as_side_effect (bool force = false);
517 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
519 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
520 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
521 void collect_new_region_view (RegionView *);
522 void collect_and_select_new_region_view (RegionView *);
524 Gtk::Menu track_context_menu;
525 Gtk::Menu track_region_context_menu;
526 Gtk::Menu track_selection_context_menu;
527 Gtk::Menu track_crossfade_context_menu;
529 Gtk::MenuItem* region_edit_menu_split_item;
530 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
531 Gtk::Menu * track_region_edit_playlist_menu;
532 Gtk::Menu * track_edit_playlist_submenu;
533 Gtk::Menu * track_selection_edit_playlist_submenu;
535 void popup_track_context_menu (int, int, ItemType, bool, nframes_t);
536 Gtk::Menu* build_track_context_menu (nframes_t);
537 Gtk::Menu* build_track_bus_context_menu (nframes_t);
538 Gtk::Menu* build_track_region_context_menu (nframes_t frame);
539 Gtk::Menu* build_track_crossfade_context_menu (nframes_t);
540 Gtk::Menu* build_track_selection_context_menu (nframes_t);
541 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
542 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
543 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
544 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
545 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
547 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
549 void handle_new_route (ARDOUR::Session::RouteList&);
550 void remove_route (TimeAxisView *);
553 Gtk::HBox global_hpacker;
554 Gtk::VBox global_vpacker;
557 Gdk::Cursor* current_canvas_cursor;
558 void set_canvas_cursor ();
559 Gdk::Cursor* which_grabber_cursor ();
561 ArdourCanvas::CanvasAA track_canvas;
562 ArdourCanvas::CanvasAA time_canvas;
564 ArdourCanvas::Text* first_action_message;
565 ArdourCanvas::Text* verbose_canvas_cursor;
566 bool verbose_cursor_visible;
568 void parameter_changed (const char *);
570 bool track_canvas_motion (GdkEvent*);
572 void set_verbose_canvas_cursor (const string &, double x, double y);
573 void set_verbose_canvas_cursor_text (const string &);
574 void show_verbose_canvas_cursor();
575 void hide_verbose_canvas_cursor();
577 bool verbose_cursor_on; // so far unused
579 Gtk::EventBox time_canvas_event_box;
580 Gtk::EventBox track_canvas_event_box;
581 Gtk::EventBox time_button_event_box;
582 Gtk::Frame time_button_frame;
584 ArdourCanvas::Group *minsec_group;
585 ArdourCanvas::Pixbuf *logo_item;
586 ArdourCanvas::Group *bbt_group;
587 ArdourCanvas::Group *smpte_group;
588 ArdourCanvas::Group *frame_group;
589 ArdourCanvas::Group *tempo_group;
590 ArdourCanvas::Group *meter_group;
591 ArdourCanvas::Group *marker_group;
592 ArdourCanvas::Group *range_marker_group;
593 ArdourCanvas::Group *transport_marker_group;
594 ArdourCanvas::Group* cd_marker_group;
597 ruler_metric_smpte = 0,
598 ruler_metric_bbt = 1,
599 ruler_metric_frames = 2,
600 ruler_metric_minsec = 3,
602 ruler_time_tempo = 4,
603 ruler_time_meter = 5,
604 ruler_time_marker = 6,
605 ruler_time_range_marker = 7,
606 ruler_time_transport_marker = 8,
607 ruler_time_cd_marker = 9,
610 static GtkCustomMetric ruler_metrics[4];
611 bool ruler_shown[10];
612 bool no_ruler_shown_update;
614 gint ruler_button_press (GdkEventButton*);
615 gint ruler_button_release (GdkEventButton*);
616 gint ruler_mouse_motion (GdkEventMotion*);
617 bool ruler_scroll (GdkEventScroll* event);
619 gint ruler_pressed_button;
620 Gtk::Widget * ruler_grabbed_widget;
622 void initialize_rulers ();
623 void update_just_smpte ();
624 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
625 void update_fixed_rulers ();
626 void update_tempo_based_rulers ();
627 void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem);
628 void update_ruler_visibility ();
629 void ruler_toggled (int);
630 gint ruler_label_button_release (GdkEventButton*);
631 void store_ruler_visibility ();
632 void restore_ruler_visibility ();
634 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
635 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
636 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
637 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
639 enum MinsecRulerScale {
646 MinsecRulerScale minsec_ruler_scale;
648 nframes_t minsec_mark_interval;
649 gint minsec_mark_modulo;
651 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
653 enum SMPTERulerScale {
661 SMPTERulerScale smpte_ruler_scale;
663 nframes_t smpte_mark_interval;
664 gint smpte_mark_modulo;
666 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
676 bbt_show_ticks_detail,
677 bbt_show_ticks_super_detail
680 BBTRulerScale bbt_ruler_scale;
684 uint32_t bbt_bar_helper_on;
685 uint32_t bbt_accent_modulo;
686 void compute_bbt_ruler_scale (nframes_t lower, nframes_t upper);
688 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
689 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
690 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
691 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
693 Gtk::Widget *_ruler_separator;
694 GtkWidget *_smpte_ruler;
695 GtkWidget *_bbt_ruler;
696 GtkWidget *_frames_ruler;
697 GtkWidget *_minsec_ruler;
698 Gtk::Widget *smpte_ruler;
699 Gtk::Widget *bbt_ruler;
700 Gtk::Widget *frames_ruler;
701 Gtk::Widget *minsec_ruler;
702 static Editor *ruler_editor;
704 static const double timebar_height;
705 guint32 visible_timebars;
706 Gtk::Menu *editor_ruler_menu;
708 ArdourCanvas::SimpleRect* tempo_bar;
709 ArdourCanvas::SimpleRect* meter_bar;
710 ArdourCanvas::SimpleRect* marker_bar;
711 ArdourCanvas::SimpleRect* range_marker_bar;
712 ArdourCanvas::SimpleRect* transport_marker_bar;
713 ArdourCanvas::SimpleRect* cd_marker_bar;
715 Gtk::Label minsec_label;
716 Gtk::Label bbt_label;
717 Gtk::Label smpte_label;
718 Gtk::Label frame_label;
719 Gtk::Label tempo_label;
720 Gtk::Label meter_label;
721 Gtk::Label mark_label;
722 Gtk::Label range_mark_label;
723 Gtk::Label transport_mark_label;
724 Gtk::Label cd_mark_label;
727 Gtk::VBox time_button_vbox;
728 Gtk::HBox time_button_hbox;
732 ArdourCanvas::Points points;
733 ArdourCanvas::Line canvas_item;
734 nframes_t current_frame;
737 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
740 void set_position (nframes_t);
741 void set_length (double units);
742 void set_y_axis (double position);
745 friend struct Cursor; /* it needs access to several private
749 Cursor* playhead_cursor;
750 ArdourCanvas::Group* cursor_group;
752 void cursor_to_region_boundary (Cursor*, int32_t dir);
753 void cursor_to_next_region_boundary (Cursor*);
754 void cursor_to_previous_region_boundary (Cursor*);
755 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
756 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
757 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
758 void cursor_to_selection_start (Cursor *);
759 void cursor_to_selection_end (Cursor *);
761 void selected_marker_to_region_boundary (int32_t dir);
762 void selected_marker_to_next_region_boundary ();
763 void selected_marker_to_previous_region_boundary ();
764 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
765 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
766 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
767 void selected_marker_to_selection_start ();
768 void selected_marker_to_selection_end ();
770 void select_all_selectables_using_cursor (Cursor *, bool);
771 void select_all_selectables_using_edit (bool);
772 void select_all_selectables_between (bool within);
773 void select_range_between ();
775 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
776 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
778 vector<nframes_t> region_boundary_cache;
779 void build_region_boundary_cache ();
781 Gtk::VBox trackview_vpacker;
784 Gtk::HBox bottom_hbox;
786 Gtk::Table edit_packer;
787 Gtk::VScrollbar edit_vscrollbar;
789 Gtk::Adjustment vertical_adjustment;
790 Gtk::Adjustment horizontal_adjustment;
792 Gtk::Layout controls_layout;
793 bool control_layout_scroll (GdkEventScroll* ev);
794 void controls_layout_size_request (Gtk::Requisition*);
796 Gtk::HScrollbar edit_hscrollbar;
797 bool _dragging_hscrollbar;
799 void reset_hscrollbar_stepping ();
801 bool hscrollbar_button_press (GdkEventButton*);
802 bool hscrollbar_button_release (GdkEventButton*);
803 void hscrollbar_allocate (Gtk::Allocation &alloc);
806 double canvas_height;
807 double full_canvas_height;
808 nframes_t last_canvas_frame;
810 bool track_canvas_map_handler (GdkEventAny*);
811 bool time_canvas_map_handler (GdkEventAny*);
813 gint edit_controls_button_release (GdkEventButton*);
814 Gtk::Menu *edit_controls_left_menu;
815 Gtk::Menu *edit_controls_right_menu;
817 Gtk::VBox track_canvas_vbox;
818 Gtk::VBox time_canvas_vbox;
819 Gtk::VBox edit_controls_vbox;
820 Gtk::HBox edit_controls_hbox;
822 void control_scroll (float);
823 bool deferred_control_scroll (nframes_t);
824 sigc::connection control_scroll_connection;
826 void tie_vertical_scrolling ();
827 void canvas_horizontally_scrolled ();
828 void canvas_scroll_to (nframes64_t);
830 struct VisualChange {
837 nframes_t time_origin;
838 double frames_per_unit;
842 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
846 VisualChange pending_visual_change;
848 static int _idle_visual_changer (void *arg);
849 int idle_visual_changer ();
851 void queue_visual_change (nframes_t);
852 void queue_visual_change (double);
854 void end_location_changed (ARDOUR::Location*);
856 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
857 RegionListDisplayModelColumns() {
862 Gtk::TreeModelColumn<Glib::ustring> name;
863 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
864 Gtk::TreeModelColumn<Gdk::Color> color_;
867 RegionListDisplayModelColumns region_list_columns;
868 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
870 Glib::RefPtr<Gtk::TreeStore> region_list_model;
871 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
872 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
874 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
875 void region_list_selection_changed ();
876 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
877 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
878 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
880 Gtk::Menu *region_list_menu;
881 Gtk::ScrolledWindow region_list_scroller;
882 Gtk::Frame region_list_frame;
884 bool region_list_display_key_press (GdkEventKey *);
885 bool region_list_display_key_release (GdkEventKey *);
886 bool region_list_display_button_press (GdkEventButton *);
887 bool region_list_display_button_release (GdkEventButton *);
888 void region_list_clear ();
889 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
890 void build_region_list_menu ();
891 void show_region_list_display_context_menu (int button, int time);
893 bool show_automatic_regions_in_region_list;
894 Editing::RegionListSortType region_list_sort_type;
896 void reset_region_list_sort_direction (bool);
897 void reset_region_list_sort_type (Editing::RegionListSortType);
899 void toggle_full_region_list ();
900 void toggle_show_auto_regions ();
902 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
906 Gtk::ScrolledWindow snapshot_display_scroller;
907 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
908 SnapshotDisplayModelColumns() {
912 Gtk::TreeModelColumn<Glib::ustring> visible_name;
913 Gtk::TreeModelColumn<Glib::ustring> real_name;
916 SnapshotDisplayModelColumns snapshot_display_columns;
917 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
918 Gtk::TreeView snapshot_display;
919 Gtk::Menu snapshot_context_menu;
921 bool snapshot_display_button_press (GdkEventButton*);
922 void snapshot_display_selection_changed ();
923 void redisplay_snapshots();
924 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
926 /* named selections */
928 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
929 NamedSelectionDisplayModelColumns() {
933 Gtk::TreeModelColumn<Glib::ustring> text;
934 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
937 NamedSelectionDisplayModelColumns named_selection_columns;
938 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
940 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
941 Gtk::ScrolledWindow named_selection_scroller;
943 void create_named_selection ();
944 void paste_named_selection (float times);
945 void remove_selected_named_selections ();
946 void remove_snapshot (Glib::ustring);
947 void rename_snapshot (Glib::ustring);
949 void handle_new_named_selection ();
950 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
951 void redisplay_named_selections ();
953 bool named_selection_display_button_release (GdkEventButton *ev);
954 bool named_selection_display_key_release (GdkEventKey *ev);
955 void named_selection_display_selection_changed ();
958 TrackViewList track_views;
959 TimeAxisView *trackview_by_y_position (double ypos);
961 static Gdk::Cursor* cross_hair_cursor;
962 static Gdk::Cursor* trimmer_cursor;
963 static Gdk::Cursor* selector_cursor;
964 static Gdk::Cursor* grabber_cursor;
965 static Gdk::Cursor* grabber_edit_point_cursor;
966 static Gdk::Cursor* zoom_cursor;
967 static Gdk::Cursor* time_fx_cursor;
968 static Gdk::Cursor* fader_cursor;
969 static Gdk::Cursor* speaker_cursor;
970 static Gdk::Cursor* midi_pencil_cursor;
971 static Gdk::Cursor* midi_select_cursor;
972 static Gdk::Cursor* midi_erase_cursor;
973 static Gdk::Cursor* wait_cursor;
974 static Gdk::Cursor* timebar_cursor;
975 static Gdk::Cursor* transparent_cursor;
977 static void build_cursors ();
979 sigc::connection scroll_connection;
980 nframes_t last_update_frame;
981 void center_screen (nframes_t);
982 void center_screen_internal (nframes_t, float);
984 void update_current_screen ();
986 void session_going_away ();
988 nframes_t cut_buffer_start;
989 nframes_t cut_buffer_length;
991 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
992 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
993 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
994 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
995 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
996 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
998 /* KEYMAP HANDLING */
1000 void register_actions ();
1002 int ensure_cursor (nframes_t* pos);
1004 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1005 void handle_new_regions (vector<boost::weak_ptr<ARDOUR::Region> >& );
1006 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1007 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1008 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1009 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1010 void redisplay_regions ();
1011 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1013 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1015 void cut_copy (Editing::CutCopyOp);
1016 bool can_cut_copy () const;
1017 void cut_copy_points (Editing::CutCopyOp);
1018 void cut_copy_regions (Editing::CutCopyOp);
1019 void cut_copy_ranges (Editing::CutCopyOp);
1021 void mouse_paste ();
1022 void paste_internal (nframes_t position, float times);
1024 /* EDITING OPERATIONS */
1026 void reset_point_selection ();
1027 void toggle_region_mute ();
1028 void toggle_region_lock ();
1029 void toggle_region_opaque ();
1030 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1031 void raise_region ();
1032 void raise_region_to_top ();
1033 void lower_region ();
1034 void lower_region_to_bottom ();
1035 void split_region ();
1036 void split_region_at (nframes_t);
1037 void split_regions_at (nframes_t, RegionSelection&);
1038 void split_region_at_transients ();
1039 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1040 void crop_region_to_selection ();
1041 void crop_region_to (nframes_t start, nframes_t end);
1042 void set_sync_point (nframes64_t, const RegionSelection&);
1043 void set_region_sync_from_edit_point ();
1044 void remove_region_sync();
1045 void align_selection (ARDOUR::RegionPoint, nframes_t position, const RegionSelection&);
1046 void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position, const RegionSelection&);
1047 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
1048 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
1049 void remove_selected_regions ();
1050 void remove_clicked_region ();
1051 void edit_region ();
1052 void rename_region ();
1053 void duplicate_some_regions (RegionSelection&, float times);
1054 void duplicate_selection (float times);
1055 void region_fill_selection ();
1057 void region_fill_track ();
1058 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1059 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1060 void split_multichannel_region();
1061 void reverse_region ();
1062 void normalize_region ();
1063 void denormalize_region ();
1064 void adjust_region_scale_amplitude (bool up);
1065 void quantize_region ();
1067 void tab_to_transient (bool forward);
1069 void use_region_as_bar ();
1070 void use_range_as_bar ();
1072 void define_one_bar (nframes64_t start, nframes64_t end);
1074 void audition_region_from_region_list ();
1075 void hide_region_from_region_list ();
1076 void remove_region_from_region_list ();
1078 void align (ARDOUR::RegionPoint);
1079 void align_relative (ARDOUR::RegionPoint);
1082 void reset_focus ();
1088 void paste (float times);
1090 int get_prefix (float&, bool&);
1092 void keyboard_paste ();
1093 void keyboard_insert_region_list_selection ();
1095 void region_from_selection ();
1096 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1098 void play_from_start ();
1099 void play_from_edit_point ();
1100 void play_from_edit_point_and_return ();
1101 void play_selected_region ();
1102 void play_edit_range ();
1103 void loop_selected_region ();
1104 void play_location (ARDOUR::Location&);
1105 void loop_location (ARDOUR::Location&);
1107 void temporal_zoom_selection ();
1108 void temporal_zoom_region ();
1109 void toggle_zoom_region ();
1110 bool zoomed_to_region;
1111 void temporal_zoom_session ();
1112 void temporal_zoom (gdouble scale);
1113 void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
1114 void temporal_zoom_to_frame (bool coarser, nframes_t frame);
1116 void amplitude_zoom (gdouble scale);
1117 void amplitude_zoom_step (bool in);
1119 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1120 void insert_region_list_selection (float times);
1122 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1124 /* import & embed */
1126 void add_external_audio_action (Editing::ImportMode);
1127 void external_audio_dialog ();
1129 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1130 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1132 SoundFileOmega* sfbrowser;
1134 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1135 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1137 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1138 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1139 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1141 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1142 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool);
1143 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1144 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1146 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1147 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1148 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1149 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1151 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1153 /* generic interthread progress window */
1155 ArdourDialog* interthread_progress_window;
1156 Gtk::Label interthread_progress_label;
1157 Gtk::VBox interthread_progress_vbox;
1158 Gtk::ProgressBar interthread_progress_bar;
1159 Gtk::Button interthread_cancel_button;
1160 Gtk::Label interthread_cancel_label;
1161 sigc::connection interthread_progress_connection;
1162 void interthread_cancel_clicked ();
1163 void build_interthread_progress_window ();
1164 ARDOUR::InterThreadInfo* current_interthread_info;
1167 AnalysisWindow* analysis_window;
1170 /* import specific info */
1172 ARDOUR::Session::import_status import_status;
1173 gint import_progress_timeout (void *);
1174 static void *_import_thread (void *);
1175 void* import_thread ();
1177 /* to support this ... */
1179 void import_audio (bool as_tracks);
1180 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1182 void move_to_start ();
1183 void move_to_end ();
1185 void center_playhead ();
1186 void center_edit_point ();
1187 void edit_cursor_backward ();
1188 void edit_cursor_forward ();
1189 void playhead_backward ();
1190 void playhead_forward ();
1191 void scroll_playhead (bool forward);
1192 void scroll_backward (float pages=0.8f);
1193 void scroll_forward (float pages=0.8f);
1194 void scroll_tracks_down ();
1195 void scroll_tracks_up ();
1196 void delete_sample_forward ();
1197 void delete_sample_backward ();
1198 void delete_screen ();
1199 void search_backwards ();
1200 void search_forwards ();
1202 void clear_markers ();
1203 void clear_ranges ();
1204 void clear_locations ();
1205 void unhide_markers ();
1206 void unhide_ranges ();
1207 void jump_forward_to_mark ();
1208 void jump_backward_to_mark ();
1209 void cursor_align (bool playhead_to_edit);
1211 void remove_last_capture ();
1212 void select_all_selectables_using_time_selection ();
1213 void select_all_selectables_using_loop();
1214 void select_all_selectables_using_punch();
1215 void set_selection_from_range (ARDOUR::Location&);
1216 void set_selection_from_punch ();
1217 void set_selection_from_loop ();
1218 void set_selection_from_region ();
1220 void add_location_mark (nframes64_t where);
1221 void add_location_from_audio_region ();
1222 void add_location_from_selection ();
1223 void set_loop_from_selection (bool play);
1224 void set_punch_from_selection ();
1225 void set_punch_from_region ();
1227 void set_loop_from_edit_range (bool play);
1228 void set_loop_from_region (bool play);
1229 void set_punch_from_edit_range ();
1231 void set_loop_range (nframes_t start, nframes_t end, std::string cmd);
1232 void set_punch_range (nframes_t start, nframes_t end, std::string cmd);
1234 void add_location_from_playhead_cursor ();
1235 bool select_new_marker;
1237 void reverse_selection ();
1238 void edit_envelope ();
1240 void start_scrolling ();
1241 void stop_scrolling ();
1244 double last_scrub_x;
1245 int scrubbing_direction;
1246 int scrub_reversals;
1247 int scrub_reverse_distance;
1249 void keyboard_selection_begin ();
1250 void keyboard_selection_finish (bool add);
1251 bool have_pending_keyboard_selection;
1252 nframes_t pending_keyboard_selection_start;
1254 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1255 void extend_selection_to_end_of_region (bool next);
1256 void extend_selection_to_start_of_region (bool previous);
1258 Editing::SnapType snap_type;
1259 Editing::SnapMode snap_mode;
1261 /// Snap threshold in pixels
1262 double snap_threshold;
1264 void handle_gui_changes (const string &, void *);
1266 void hide_all_tracks (bool with_select);
1269 LineDragInfo current_line_drag_info;
1271 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1272 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1273 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1275 Gtk::Menu fade_context_menu;
1276 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1278 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1279 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1280 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1281 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1282 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1283 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1285 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1286 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1288 void set_fade_length (bool in);
1289 void toggle_fade_active (bool in);
1290 void set_fade_in_active (bool);
1291 void set_fade_out_active (bool);
1293 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1294 RegionSelection pre_drag_region_selection;
1295 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1296 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1297 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1298 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1299 bool check_region_drag_possible (RouteTimeAxisView**);
1300 void possibly_copy_regions_during_grab (GdkEvent*);
1301 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1302 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1304 bool _dragging_playhead;
1305 bool _dragging_edit_point;
1307 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1308 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1309 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1310 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1311 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1312 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1313 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1314 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1316 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1317 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1318 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1319 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1321 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1323 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1324 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1325 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1326 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1327 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1328 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1329 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1330 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1331 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1332 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1333 void start_line_grab (AutomationLine *, GdkEvent*);
1334 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1335 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1336 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1337 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1339 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1341 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1342 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1344 void mouse_brush_insert_region (RegionView*, nframes_t pos);
1345 void brush (nframes_t);
1347 void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1348 void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1349 double clamp_verbose_cursor_x (double);
1350 double clamp_verbose_cursor_y (double);
1352 /* Canvas event handlers */
1354 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1355 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1356 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1357 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1358 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1359 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1360 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1361 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1362 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1363 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1366 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1368 ArdourCanvas::Item *last_item_entered;
1369 int last_item_entered_n;
1372 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1373 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1374 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1375 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1376 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1377 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1378 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1379 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1380 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1382 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1383 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1384 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1385 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1386 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1387 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1389 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1390 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1391 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1392 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1393 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1394 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1395 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1396 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1398 /* non-public event handlers */
1400 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1401 bool track_canvas_scroll (GdkEventScroll* event);
1402 bool time_canvas_scroll (GdkEventScroll* event);
1404 bool track_canvas_scroll_event (GdkEventScroll* event);
1405 bool track_canvas_button_press_event (GdkEventButton* event);
1406 bool track_canvas_button_release_event (GdkEventButton* event);
1407 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1409 bool time_canvas_scroll_event (GdkEventScroll* event);
1411 Gtk::Allocation canvas_allocation;
1412 bool canvas_idle_queued;
1413 void track_canvas_allocate (Gtk::Allocation alloc);
1414 bool track_canvas_size_allocated ();
1416 void set_playhead_cursor ();
1418 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1419 void kbd_mute_unmute_region ();
1422 void kbd_do_brush (GdkEvent*);
1423 void kbd_do_audition (GdkEvent*);
1425 void handle_new_duration ();
1426 void initialize_canvas ();
1427 int canvas_hroizontally_scrolled_handler_id;
1428 void reset_horizontally_scrolling_region (Gtk::Allocation* alloc = 0);
1429 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1431 /* display control */
1433 bool _show_measures;
1434 /// true to show waveforms, otherwise false
1435 bool _show_waveforms;
1436 /// true if the editor should follow the playhead, otherwise false
1437 bool _follow_playhead;
1438 /// true if waveforms should be shown while recording audio tracks, otherwise false
1439 bool _show_waveforms_recording;
1441 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1443 ArdourCanvas::Group* time_line_group;
1444 ArdourCanvas::Group* marker_time_line_group;
1446 TempoLines* tempo_lines;
1447 TempoLines* marker_tempo_lines;
1449 void hide_measures ();
1450 void draw_measures ();
1451 bool redraw_measures ();
1453 void new_tempo_section ();
1455 void mouse_add_new_tempo_event (nframes_t where);
1456 void mouse_add_new_meter_event (nframes_t where);
1458 void remove_tempo_marker (ArdourCanvas::Item*);
1459 void remove_meter_marker (ArdourCanvas::Item*);
1460 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1461 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1463 void edit_tempo_section (ARDOUR::TempoSection*);
1464 void edit_meter_section (ARDOUR::MeterSection*);
1465 void edit_tempo_marker (ArdourCanvas::Item*);
1466 void edit_meter_marker (ArdourCanvas::Item*);
1468 void marker_menu_edit ();
1469 void marker_menu_remove ();
1470 void marker_menu_rename ();
1471 void marker_menu_lock (bool yn);
1472 void marker_menu_hide ();
1473 void marker_menu_loop_range ();
1474 void marker_menu_select_all_selectables_using_range ();
1475 void marker_menu_select_using_range ();
1476 void marker_menu_separate_regions_using_location ();
1477 void marker_menu_play_from ();
1478 void marker_menu_play_range ();
1479 void marker_menu_set_playhead ();
1480 void marker_menu_set_from_playhead ();
1481 void marker_menu_set_from_selection ();
1482 void new_transport_marker_menu_set_loop ();
1483 void new_transport_marker_menu_set_punch ();
1484 void update_loop_range_view (bool visibility=false);
1485 void update_punch_range_view (bool visibility=false);
1486 gint new_transport_marker_menu_popdown (GdkEventAny*);
1487 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1488 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1489 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1490 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1491 void build_range_marker_menu (bool loop_or_punch);
1492 void build_marker_menu (bool start_or_end);
1493 void build_tm_marker_menu ();
1494 void build_new_transport_marker_menu ();
1496 Gtk::Menu* tm_marker_menu;
1497 Gtk::Menu* marker_menu;
1498 Gtk::Menu* start_end_marker_menu;
1499 Gtk::Menu* range_marker_menu;
1500 Gtk::Menu* transport_marker_menu;
1501 Gtk::Menu* new_transport_marker_menu;
1502 Gtk::Menu* cd_marker_menu;
1503 ArdourCanvas::Item* marker_menu_item;
1505 typedef list<Marker*> Marks;
1508 void remove_metric_marks ();
1509 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1511 void compute_current_bbt_points (nframes_t left, nframes_t right);
1512 int tempo_map_change_idle_handler_id;
1513 void tempo_map_changed (ARDOUR::Change);
1514 void redisplay_tempo (bool immediate_redraw);
1516 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1517 void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) {
1518 /* XXX remove this function when everything moves to 64 bit frame counts */
1519 nframes64_t first64 = first;
1520 snap_to (first64, direction, for_mark);
1521 first = (nframes_t) first64;
1524 double snap_length_beats (nframes_t start);
1526 uint32_t bbt_beat_subdivision;
1530 Gtk::ToggleButton editor_mixer_button;
1531 Gtk::ToggleButton editor_list_button;
1533 void editor_mixer_button_toggled ();
1534 void editor_list_button_toggled ();
1536 AudioClock edit_point_clock;
1537 AudioClock zoom_range_clock;
1538 Gtk::Button zoom_in_button;
1539 Gtk::Button zoom_out_button;
1540 Gtk::Button zoom_out_full_button;
1541 Gtk::Button zoom_onetoone_button;
1543 Gtk::VBox toolbar_clock_vbox;
1544 Gtk::VBox toolbar_selection_clock_vbox;
1545 Gtk::Table toolbar_selection_clock_table;
1546 Gtk::Label toolbar_selection_cursor_label;
1548 Gtk::HBox mouse_mode_button_box;
1549 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1550 Gtk::ToggleButton mouse_select_button;
1551 Gtk::ToggleButton mouse_move_button;
1552 Gtk::ToggleButton mouse_gain_button;
1553 Gtk::ToggleButton mouse_zoom_button;
1554 Gtk::ToggleButton mouse_timefx_button;
1555 Gtk::ToggleButton mouse_audition_button;
1556 Gtk::ToggleButton mouse_note_button;
1557 GroupedButtons *mouse_mode_button_set;
1558 void mouse_mode_toggled (Editing::MouseMode m);
1559 bool ignore_mouse_mode_toggle;
1561 gint mouse_select_button_release (GdkEventButton*);
1563 Gtk::VBox automation_box;
1564 Gtk::Button automation_mode_button;
1565 Gtk::ToggleButton global_automation_button;
1567 Gtk::ComboBoxText edit_mode_selector;
1568 Gtk::VBox edit_mode_box;
1570 void set_edit_mode (ARDOUR::EditMode);
1571 void cycle_edit_mode ();
1572 void edit_mode_selection_done ();
1574 Gtk::ComboBoxText snap_type_selector;
1575 Gtk::ComboBoxText snap_mode_selector;
1578 std::vector<std::string> snap_type_strings;
1579 std::vector<std::string> snap_mode_strings;
1581 void snap_type_selection_done ();
1582 void snap_mode_selection_done ();
1583 void snap_mode_chosen (Editing::SnapMode);
1584 void snap_type_chosen (Editing::SnapType);
1586 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1587 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1589 Gtk::ComboBoxText zoom_focus_selector;
1590 Gtk::VBox zoom_focus_box;
1592 std::vector<std::string> zoom_focus_strings;
1594 void zoom_focus_selection_done ();
1595 void zoom_focus_chosen (Editing::ZoomFocus);
1597 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1601 void zoom_adjustment_changed();
1603 void edit_point_clock_changed();
1605 void setup_toolbar ();
1607 Gtkmm2ext::TearOff* tools_tearoff;
1608 Gtk::HBox toolbar_hbox;
1609 Gtk::EventBox toolbar_base;
1610 Gtk::Frame toolbar_frame;
1614 Gtk::HBox midi_tool_button_box;
1615 Gtkmm2ext::TearOff* midi_tool_tearoff;
1616 Gtk::ToggleButton midi_tool_pencil_button;
1617 Gtk::ToggleButton midi_tool_select_button;
1618 Gtk::ToggleButton midi_tool_erase_button;
1619 GroupedButtons *midi_tool_button_set;
1620 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1621 bool ignore_midi_edit_mode_toggle;
1623 Gtkmm2ext::TearOff* midi_tools_tearoff;
1624 Gtk::HBox midi_toolbar_hbox;
1625 Gtk::EventBox midi_toolbar_base;
1626 Gtk::Frame midi_toolbar_frame;
1628 void setup_midi_toolbar ();
1630 /* selection process */
1632 Selection* selection;
1633 Selection* cut_buffer;
1635 void time_selection_changed ();
1636 void track_selection_changed ();
1637 void region_selection_changed ();
1638 void point_selection_changed ();
1639 void marker_selection_changed ();
1648 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1649 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1650 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1651 void cancel_selection ();
1653 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1654 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1655 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1657 bool audio_region_selection_covers (nframes_t where);
1659 /* transport range select process */
1660 enum RangeMarkerOp {
1662 CreateTransportMarker,
1666 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1667 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1668 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1670 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1671 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1672 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1673 ArdourCanvas::Line* marker_drag_line;
1674 ArdourCanvas::Points marker_drag_line_points;
1675 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1677 void update_marker_drag_item (ARDOUR::Location *);
1679 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1680 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1681 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1682 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1683 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1684 ArdourCanvas::SimpleLine *transport_punchin_line;
1685 ArdourCanvas::SimpleLine *transport_punchout_line;
1686 ArdourCanvas::SimpleRect *transport_preroll_rect;
1687 ArdourCanvas::SimpleRect *transport_postroll_rect;
1689 ARDOUR::Location* transport_loop_location();
1690 ARDOUR::Location* transport_punch_location();
1692 ARDOUR::Location *temp_location;
1694 /* object rubberband select process */
1696 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1697 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1698 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1700 bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1702 ArdourCanvas::SimpleRect *rubberband_rect;
1704 /* mouse zoom process */
1706 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1707 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1708 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1710 ArdourCanvas::SimpleRect *zoom_rect;
1711 void reposition_zoom_rect (nframes_t start, nframes_t end);
1713 /* diskstream/route display management */
1715 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1716 RouteDisplayModelColumns() {
1722 Gtk::TreeModelColumn<Glib::ustring> text;
1723 Gtk::TreeModelColumn<bool> visible;
1724 Gtk::TreeModelColumn<TimeAxisView*> tv;
1725 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1728 RouteDisplayModelColumns route_display_columns;
1729 Glib::RefPtr<Gtk::ListStore> route_display_model;
1730 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1732 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1733 Gtk::ScrolledWindow route_list_scroller;
1734 Gtk::Menu* route_list_menu;
1736 void sync_order_keys ();
1737 bool ignore_route_order_sync;
1739 bool route_list_display_button_press (GdkEventButton*);
1740 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1743 const Gtk::SelectionData& data,
1747 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1749 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1750 void route_list_delete (const Gtk::TreeModel::Path&);
1751 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1753 void initial_route_list_display ();
1754 void redisplay_route_list();
1755 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1756 bool ignore_route_list_reorder;
1757 bool no_route_list_redisplay;
1759 void build_route_list_menu ();
1760 void show_route_list_menu ();
1762 void show_all_routes ();
1763 void hide_all_routes ();
1764 void show_all_audiotracks ();
1765 void hide_all_audiotracks ();
1766 void show_all_audiobus ();
1767 void hide_all_audiobus ();
1769 void set_all_tracks_visibility (bool yn);
1770 void set_all_audio_visibility (int type, bool yn);
1772 /* edit group management */
1774 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1775 GroupListModelColumns () {
1781 Gtk::TreeModelColumn<bool> is_active;
1782 Gtk::TreeModelColumn<bool> is_visible;
1783 Gtk::TreeModelColumn<std::string> text;
1784 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1787 GroupListModelColumns group_columns;
1788 Glib::RefPtr<Gtk::ListStore> group_model;
1789 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1791 Gtk::TreeView edit_group_display;
1792 Gtk::ScrolledWindow edit_group_display_scroller;
1793 Gtk::Menu* edit_group_list_menu;
1795 void build_edit_group_list_menu ();
1796 void activate_all_edit_groups ();
1797 void disable_all_edit_groups ();
1799 bool in_edit_group_row_change;
1800 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1801 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1802 void new_edit_group ();
1803 void edit_group_list_button_clicked ();
1804 gint edit_group_list_button_press_event (GdkEventButton* ev);
1805 void add_edit_group (ARDOUR::RouteGroup* group);
1806 void remove_selected_edit_group ();
1807 void edit_groups_changed ();
1808 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1810 Gtk::VBox list_vpacker;
1814 bool autoscroll_active;
1815 int autoscroll_timeout_tag;
1816 int autoscroll_direction;
1817 uint32_t autoscroll_cnt;
1818 nframes_t autoscroll_distance;
1820 static gint _autoscroll_canvas (void *);
1821 bool autoscroll_canvas ();
1822 void start_canvas_autoscroll (int direction);
1823 void stop_canvas_autoscroll ();
1824 void maybe_autoscroll (GdkEvent*);
1833 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1834 void point_trim (GdkEvent*);
1835 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1836 void single_contents_trim (RegionView&, nframes_t, bool, bool, bool);
1837 void single_start_trim (RegionView&, nframes_t, bool, bool);
1838 void single_end_trim (RegionView&, nframes_t, bool, bool);
1840 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1841 void thaw_region_after_trim (RegionView& rv);
1843 void trim_region_front();
1844 void trim_region_back();
1845 void trim_region (bool front);
1847 void trim_region_to_edit_point ();
1848 void trim_region_from_edit_point ();
1849 void trim_region_to_loop ();
1850 void trim_region_to_punch ();
1851 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1853 bool show_gain_after_trim;
1857 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1858 const Glib::RefPtr<Gdk::DragContext>& context,
1861 const Gtk::SelectionData& data,
1865 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1868 const Gtk::SelectionData& data,
1872 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1875 const Gtk::SelectionData& data,
1880 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1883 const Gtk::SelectionData& data,
1887 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1890 const Gtk::SelectionData& data,
1894 void drop_routes (const Glib::RefPtr<Gdk::DragContext>& context,
1897 const Gtk::SelectionData& data,
1903 ExportDialog *export_dialog;
1904 ExportDialog *export_range_markers_dialog;
1906 void export_range (nframes_t start, nframes_t end);
1907 void export_range_markers ();
1909 int write_region_selection(RegionSelection&);
1910 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1911 void export_region ();
1912 void bounce_region_selection ();
1913 void bounce_range_selection ();
1914 void external_edit_region ();
1916 int write_audio_selection (TimeSelection&);
1917 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
1919 void write_selection ();
1923 UndoAction get_memento() const;
1925 XMLNode *before; /* used in *_reversible_command */
1927 void begin_reversible_command (string cmd_name);
1928 void commit_reversible_command ();
1930 /* visual history */
1932 UndoHistory visual_history;
1933 UndoTransaction current_visual_command;
1936 void update_title ();
1937 void update_title_s (const string & snapshot_name);
1940 Selection* selection;
1941 double frames_per_unit;
1943 State (PublicEditor const * e);
1947 void store_state (State&) const;
1948 void restore_state (State *);
1950 void instant_save ();
1952 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1954 /* freeze operations */
1956 ARDOUR::InterThreadInfo freeze_status;
1957 gint freeze_progress_timeout (void *);
1958 static void* _freeze_thread (void*);
1959 void* freeze_thread ();
1961 void freeze_route ();
1962 void unfreeze_route ();
1964 /* edit-group solo + mute */
1966 void set_edit_group_solo (ARDOUR::Route&, bool);
1967 void set_edit_group_mute (ARDOUR::Route&, bool);
1971 void duplicate_dialog (bool with_dialog);
1973 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1975 /* returns false if mouse pointer is not in track or marker canvas
1977 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1979 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1980 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1981 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1983 struct TimeFXDialog : public ArdourDialog {
1984 ARDOUR::TimeFXRequest request;
1987 Gtk::Adjustment pitch_octave_adjustment;
1988 Gtk::Adjustment pitch_semitone_adjustment;
1989 Gtk::Adjustment pitch_cent_adjustment;
1990 Gtk::SpinButton pitch_octave_spinner;
1991 Gtk::SpinButton pitch_semitone_spinner;
1992 Gtk::SpinButton pitch_cent_spinner;
1993 RegionSelection regions;
1994 Gtk::ProgressBar progress_bar;
1997 Gtk::ToggleButton quick_button;
1998 Gtk::ToggleButton antialias_button;
1999 Gtk::HBox upper_button_box;
2002 Gtk::ComboBoxText stretch_opts_selector;
2003 Gtk::Label stretch_opts_label;
2004 Gtk::ToggleButton precise_button;
2007 Gtk::Button* cancel_button;
2008 Gtk::Button* action_button;
2012 TimeFXDialog (Editor& e, bool for_pitch);
2014 gint update_progress ();
2015 sigc::connection first_cancel;
2016 sigc::connection first_delete;
2017 void cancel_in_progress ();
2018 gint delete_in_progress (GdkEventAny*);
2021 /* "whats mine is yours" */
2023 friend class TimeFXDialog;
2025 TimeFXDialog* current_timefx;
2027 static void* timefx_thread (void *arg);
2028 void do_timefx (TimeFXDialog&);
2030 int time_stretch (RegionSelection&, float fraction);
2031 int pitch_shift (RegionSelection&, float cents);
2032 void pitch_shift_regions ();
2033 int time_fx (RegionSelection&, float val, bool pitching);
2035 /* editor-mixer strip */
2037 MixerStrip *current_mixer_strip;
2038 bool show_editor_mixer_when_tracks_arrive;
2039 Gtk::VBox current_mixer_strip_vbox;
2040 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2041 void cms_deleted ();
2042 void current_mixer_strip_hidden ();
2043 void current_mixer_strip_removed ();
2045 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2046 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2048 /* nudging tracks */
2050 void nudge_track (bool use_edit_point, bool forwards);
2054 bool _xfade_visibility;
2057 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2058 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2060 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2061 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2063 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2064 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2065 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2067 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2068 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2069 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2070 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2072 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2073 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2074 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2075 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2077 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2078 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2079 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2080 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2081 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2082 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2084 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2085 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2086 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2087 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2088 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2089 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2091 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2092 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2094 ImageFrameSocketHandler* image_socket_listener ;
2097 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2098 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2099 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2100 void xfade_edit_left_region ();
2101 void xfade_edit_right_region ();
2103 static const int32_t default_width = 995;
2104 static const int32_t default_height = 765;
2108 Gtk::Button nudge_forward_button;
2109 Gtk::Button nudge_backward_button;
2110 Gtk::HBox nudge_hbox;
2111 Gtk::VBox nudge_vbox;
2112 AudioClock nudge_clock;
2114 nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
2116 bool nudge_forward_release (GdkEventButton*);
2117 bool nudge_backward_release (GdkEventButton*);
2121 void apply_filter (ARDOUR::Filter&, string cmd);
2123 /* handling cleanup */
2125 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2127 vector<sigc::connection> session_connections;
2129 /* tracking step changes of track height */
2131 TimeAxisView* current_stepping_trackview;
2132 struct timeval last_track_height_step_timestamp;
2133 gint track_height_step_timeout();
2134 sigc::connection step_timeout;
2136 TimeAxisView* entered_track;
2137 RegionView* entered_regionview;
2140 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2141 bool clear_entered_track;
2142 gint left_track_canvas (GdkEventCrossing*);
2143 void set_entered_track (TimeAxisView*);
2144 void set_entered_regionview (RegionView*);
2145 gint left_automation_track ();
2147 bool _new_regionviews_show_envelope;
2149 void toggle_gain_envelope_visibility ();
2150 void toggle_gain_envelope_active ();
2151 void reset_region_gain_envelopes ();
2153 bool on_key_press_event (GdkEventKey*);
2154 bool on_key_release_event (GdkEventKey*);
2156 void session_state_saved (string);
2158 Glib::RefPtr<Gtk::Action> undo_action;
2159 Glib::RefPtr<Gtk::Action> redo_action;
2161 void history_changed ();
2163 Gtk::HBox status_bar_hpacker;
2165 Editing::EditPoint _edit_point;
2167 Gtk::ComboBoxText edit_point_selector;
2169 void set_edit_point_preference (Editing::EditPoint ep);
2170 void cycle_edit_point (bool with_marker);
2171 void set_edit_point ();
2172 void edit_point_selection_done ();
2173 void edit_point_chosen (Editing::EditPoint);
2174 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2175 std::vector<std::string> edit_point_strings;
2177 void selected_marker_moved (ARDOUR::Location*);
2178 sigc::connection edit_point_clock_connection_a;
2179 sigc::connection edit_point_clock_connection_b;
2181 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2183 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2184 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2186 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2188 sigc::connection fast_screen_update_connection;
2189 gint start_updating ();
2190 gint stop_updating ();
2191 void fast_update_strips ();
2192 bool meters_running;
2194 void select_next_route ();
2195 void select_prev_route ();
2197 RhythmFerret* rhythm_ferret;
2200 #endif /* __ardour_editor_h__ */