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 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
169 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
170 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
172 #ifdef USE_RUBBERBAND
173 std::vector<std::string> rb_opt_strings;
176 /* option editor-access */
178 void set_show_waveforms (bool yn);
179 bool show_waveforms() const { return _show_waveforms; }
181 void set_show_waveforms_recording (bool yn);
182 bool show_waveforms_recording() const { return _show_waveforms_recording; }
184 /* things that need to be public to be used in the main menubar */
186 void new_region_from_selection ();
187 void separate_regions_between (const TimeSelection&);
188 void separate_region_from_selection ();
189 void separate_regions_using_location (ARDOUR::Location&);
190 void toggle_playback (bool with_abort);
191 void transition_to_rolling (bool forward);
195 nframes_t unit_to_frame (double unit) const {
196 return (nframes_t) rint (unit * frames_per_unit);
199 double frame_to_unit (nframes_t frame) const {
200 return rint ((double) frame / (double) frames_per_unit);
203 double frame_to_unit (double frame) const {
204 return rint (frame / frames_per_unit);
207 /* NOTE: these functions assume that the "pixel" coordinate is
208 the result of using the world->canvas affine transform on a
209 world coordinate. These coordinates already take into
210 account any scrolling carried out by adjusting the
214 nframes64_t pixel_to_frame (double pixel) const {
216 /* pixel can be less than zero when motion events
217 are processed. since we've already run the world->canvas
218 affine, that means that the location *really* is "off
219 to the right" and thus really is "before the start".
223 return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
229 gulong frame_to_pixel (nframes64_t frame) const {
230 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
233 void flush_canvas ();
237 Selection& get_selection() const { return *selection; }
238 Selection& get_cut_buffer() const { return *cut_buffer; }
240 bool extend_selection_to_track (TimeAxisView&);
242 void play_selection ();
243 void select_all_in_track (Selection::Operation op);
244 void select_all (Selection::Operation op);
245 void invert_selection_in_track ();
246 void invert_selection ();
247 void deselect_all ();
251 void set_show_measures (bool yn);
252 bool show_measures () const { return _show_measures; }
253 bool initial_ruler_update_required;
256 /* analysis window */
257 void analyze_region_selection();
258 void analyze_range_selection();
263 /* these initiate export ... */
265 void export_session();
266 void export_selection();
269 void add_toplevel_controls (Gtk::Container&);
270 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
272 void set_zoom_focus (Editing::ZoomFocus);
273 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
274 double get_current_zoom () const { return frames_per_unit; }
276 void temporal_zoom_step (bool coarser);
278 /* stuff that AudioTimeAxisView and related classes use */
280 PlaylistSelector& playlist_selector() const;
281 void route_name_changed (TimeAxisView *);
282 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
284 void new_playlists (TimeAxisView* v);
285 void copy_playlists (TimeAxisView* v);
286 void clear_playlists (TimeAxisView* v);
288 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
290 Width editor_mixer_strip_width;
291 void maybe_add_mixer_strip_width (XMLNode&);
292 void show_editor_mixer (bool yn);
293 void show_editor_list (bool yn);
294 void set_selected_mixer_strip (TimeAxisView&);
295 void hide_track_in_display (TimeAxisView& tv);
296 void show_track_in_display (TimeAxisView& tv);
298 /* nudge is initiated by transport controls owned by ARDOUR_UI */
300 void nudge_forward (bool next, bool force_playhead);
301 void nudge_backward (bool next, bool force_playhead);
303 /* nudge initiated from context menu */
305 void nudge_forward_capture_offset ();
306 void nudge_backward_capture_offset ();
308 /* playhead/screen stuff */
310 void set_follow_playhead (bool yn);
311 void toggle_follow_playhead ();
312 bool follow_playhead() const { return _follow_playhead; }
313 bool dragging_playhead () const { return _dragging_playhead; }
315 void toggle_waveform_visibility ();
316 void toggle_waveforms_while_recording ();
317 void toggle_measure_visibility ();
318 void toggle_logo_visibility ();
320 /* SMPTE timecode & video sync */
322 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
323 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
324 void subframes_per_frame_chosen (uint32_t);
326 void update_smpte_mode();
327 void update_video_pullup();
328 void update_subframes_per_frame ();
331 void toggle_auto_xfade ();
332 void toggle_xfades_active ();
333 void toggle_xfade_visibility ();
334 bool xfade_visibility() const { return _xfade_visibility; }
335 void update_xfade_visibility ();
336 void update_crossfade_model ();
337 void set_crossfade_model (ARDOUR::CrossfadeModel);
340 void set_layer_model (ARDOUR::LayerModel);
341 void update_layering_model ();
343 void toggle_link_region_and_track_selection ();
345 /* redirect shared ops menu. caller must free returned menu */
347 Gtk::Menu* redirect_menu ();
349 /* floating windows/transient */
351 void ensure_float (Gtk::Window&);
355 void scroll_tracks_down_line ();
356 void scroll_tracks_up_line ();
358 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
359 void prepare_for_cleanup ();
361 void maximise_editing_space();
362 void restore_editing_space();
364 void reset_x_origin (nframes_t);
365 void reset_zoom (double);
366 void reposition_and_zoom (nframes_t, double);
368 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
370 bool update_mouse_speed ();
371 bool decelerate_mouse_speed ();
373 void toggle_meter_updating();
375 void show_rhythm_ferret();
378 void map_transport_state ();
379 void map_position_change (nframes_t);
385 /// The session that we are editing, or 0
386 void color_handler ();
387 ARDOUR::Session *session;
390 // to keep track of the playhead position for control_scroll
391 boost::optional<nframes_t> _control_scroll_target;
393 PlaylistSelector* _playlist_selector;
396 double frames_per_unit;
397 nframes_t leftmost_frame;
398 Editing::ZoomFocus zoom_focus;
401 VisualState last_visual_state;
403 nframes_t leftmost_frame;
404 double frames_per_unit;
405 Editing::ZoomFocus zoom_focus;
407 void use_visual_state (const VisualState&);
408 void set_frames_per_unit (double);
409 void swap_visual_state ();
412 Editing::MouseMode mouse_mode;
413 Editing::MidiEditMode midi_edit_mode;
415 int post_maximal_editor_width;
416 int post_maximal_pane_position;
417 int pre_maximal_pane_position;
418 int pre_maximal_editor_width;
419 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
421 Gtk::Notebook the_notebook;
422 Gtk::HPaned edit_pane;
424 Gtk::EventBox meter_base;
426 Gtk::EventBox marker_base;
427 Gtk::HBox marker_box;
428 Gtk::VBox scrollers_rulers_markers_box;
430 void location_changed (ARDOUR::Location *);
431 void location_flags_changed (ARDOUR::Location *, void *);
432 void refresh_location_display ();
433 void refresh_location_display_s (ARDOUR::Change);
434 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
435 void add_new_location (ARDOUR::Location *);
436 void location_gone (ARDOUR::Location *);
437 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
438 gint really_remove_marker (ARDOUR::Location* loc);
439 void goto_nth_marker (int nth);
441 uint32_t location_marker_color;
442 uint32_t location_range_color;
443 uint32_t location_loop_color;
444 uint32_t location_punch_color;
445 uint32_t location_cd_marker_color;
447 struct LocationMarkers {
452 LocationMarkers () : start(0), end(0), valid (true) {}
458 void set_name (const string&);
459 void set_position (nframes_t start, nframes_t end = 0);
460 void set_color_rgba (uint32_t);
463 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
464 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
465 Marker* entered_marker;
467 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
468 LocationMarkerMap location_markers;
470 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
471 void clear_marker_display ();
472 void mouse_add_new_marker (nframes_t where, bool is_cd=false);
473 void update_cd_marker_display ();
474 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
476 TimeAxisView* clicked_axisview;
477 RouteTimeAxisView* clicked_routeview;
478 /** The last RegionView that was clicked on, or 0 if the last click was not
479 * on a RegionView. This is set up by the canvas event handlers in
480 * editor_canvas_events.cc
482 RegionView* clicked_regionview;
483 RegionSelection latest_regionviews;
484 uint32_t clicked_selection;
485 CrossfadeView* clicked_crossfadeview;
486 ControlPoint* clicked_control_point;
488 void sort_track_selection (TrackSelection* sel = 0);
490 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
491 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
492 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
494 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
496 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
497 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
498 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
499 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
503 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
504 bool button_release_can_deselect;
506 void catch_vanishing_regionview (RegionView *);
508 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
509 void select_all_tracks ();
511 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
512 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
513 void set_selected_track_as_side_effect (bool force = false);
514 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
516 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
517 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
518 void collect_new_region_view (RegionView *);
519 void collect_and_select_new_region_view (RegionView *);
521 Gtk::Menu track_context_menu;
522 Gtk::Menu track_region_context_menu;
523 Gtk::Menu track_selection_context_menu;
524 Gtk::Menu track_crossfade_context_menu;
526 Gtk::MenuItem* region_edit_menu_split_item;
527 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
528 Gtk::Menu * track_region_edit_playlist_menu;
529 Gtk::Menu * track_edit_playlist_submenu;
530 Gtk::Menu * track_selection_edit_playlist_submenu;
532 void popup_track_context_menu (int, int, ItemType, bool, nframes_t);
533 Gtk::Menu* build_track_context_menu (nframes_t);
534 Gtk::Menu* build_track_bus_context_menu (nframes_t);
535 Gtk::Menu* build_track_region_context_menu (nframes_t frame);
536 Gtk::Menu* build_track_crossfade_context_menu (nframes_t);
537 Gtk::Menu* build_track_selection_context_menu (nframes_t);
538 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
539 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
540 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
541 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
542 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
544 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
546 void handle_new_route (ARDOUR::Session::RouteList&);
547 void remove_route (TimeAxisView *);
550 Gtk::HBox global_hpacker;
551 Gtk::VBox global_vpacker;
554 Gdk::Cursor* current_canvas_cursor;
556 ArdourCanvas::CanvasAA track_canvas;
557 ArdourCanvas::CanvasAA time_canvas;
559 ArdourCanvas::Text* first_action_message;
560 ArdourCanvas::Text* verbose_canvas_cursor;
561 bool verbose_cursor_visible;
563 void parameter_changed (const char *);
565 bool track_canvas_motion (GdkEvent*);
567 void set_verbose_canvas_cursor (const string &, double x, double y);
568 void set_verbose_canvas_cursor_text (const string &);
569 void show_verbose_canvas_cursor();
570 void hide_verbose_canvas_cursor();
572 bool verbose_cursor_on; // so far unused
574 Gtk::EventBox time_canvas_event_box;
575 Gtk::EventBox track_canvas_event_box;
576 Gtk::EventBox time_button_event_box;
577 Gtk::Frame time_button_frame;
579 ArdourCanvas::Group *minsec_group;
580 ArdourCanvas::Pixbuf *logo_item;
581 ArdourCanvas::Group *bbt_group;
582 ArdourCanvas::Group *smpte_group;
583 ArdourCanvas::Group *frame_group;
584 ArdourCanvas::Group *tempo_group;
585 ArdourCanvas::Group *meter_group;
586 ArdourCanvas::Group *marker_group;
587 ArdourCanvas::Group *range_marker_group;
588 ArdourCanvas::Group *transport_marker_group;
589 ArdourCanvas::Group* cd_marker_group;
592 ruler_metric_smpte = 0,
593 ruler_metric_bbt = 1,
594 ruler_metric_frames = 2,
595 ruler_metric_minsec = 3,
597 ruler_time_tempo = 4,
598 ruler_time_meter = 5,
599 ruler_time_marker = 6,
600 ruler_time_range_marker = 7,
601 ruler_time_transport_marker = 8,
602 ruler_time_cd_marker = 9,
605 static GtkCustomMetric ruler_metrics[4];
606 bool ruler_shown[10];
607 bool no_ruler_shown_update;
609 gint ruler_button_press (GdkEventButton*);
610 gint ruler_button_release (GdkEventButton*);
611 gint ruler_mouse_motion (GdkEventMotion*);
612 bool ruler_scroll (GdkEventScroll* event);
614 gint ruler_pressed_button;
615 Gtk::Widget * ruler_grabbed_widget;
617 void initialize_rulers ();
618 void update_just_smpte ();
619 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
620 void update_fixed_rulers ();
621 void update_tempo_based_rulers ();
622 void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem);
623 void update_ruler_visibility ();
624 void ruler_toggled (int);
625 gint ruler_label_button_release (GdkEventButton*);
626 void store_ruler_visibility ();
627 void restore_ruler_visibility ();
629 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
630 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
631 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
632 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
634 enum MinsecRulerScale {
641 MinsecRulerScale minsec_ruler_scale;
643 nframes_t minsec_mark_interval;
644 gint minsec_mark_modulo;
646 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
648 enum SMPTERulerScale {
656 SMPTERulerScale smpte_ruler_scale;
658 nframes_t smpte_mark_interval;
659 gint smpte_mark_modulo;
661 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
671 bbt_show_ticks_detail,
672 bbt_show_ticks_super_detail
675 BBTRulerScale bbt_ruler_scale;
679 uint32_t bbt_bar_helper_on;
680 uint32_t bbt_accent_modulo;
681 void compute_bbt_ruler_scale (nframes_t lower, nframes_t upper);
683 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
684 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
685 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
686 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
688 Gtk::Widget *_ruler_separator;
689 GtkWidget *_smpte_ruler;
690 GtkWidget *_bbt_ruler;
691 GtkWidget *_frames_ruler;
692 GtkWidget *_minsec_ruler;
693 Gtk::Widget *smpte_ruler;
694 Gtk::Widget *bbt_ruler;
695 Gtk::Widget *frames_ruler;
696 Gtk::Widget *minsec_ruler;
697 static Editor *ruler_editor;
699 static const double timebar_height;
700 guint32 visible_timebars;
701 Gtk::Menu *editor_ruler_menu;
703 ArdourCanvas::SimpleRect* tempo_bar;
704 ArdourCanvas::SimpleRect* meter_bar;
705 ArdourCanvas::SimpleRect* marker_bar;
706 ArdourCanvas::SimpleRect* range_marker_bar;
707 ArdourCanvas::SimpleRect* transport_marker_bar;
708 ArdourCanvas::SimpleRect* cd_marker_bar;
710 Gtk::Label minsec_label;
711 Gtk::Label bbt_label;
712 Gtk::Label smpte_label;
713 Gtk::Label frame_label;
714 Gtk::Label tempo_label;
715 Gtk::Label meter_label;
716 Gtk::Label mark_label;
717 Gtk::Label range_mark_label;
718 Gtk::Label transport_mark_label;
719 Gtk::Label cd_mark_label;
722 Gtk::VBox time_button_vbox;
723 Gtk::HBox time_button_hbox;
727 ArdourCanvas::Points points;
728 ArdourCanvas::Line canvas_item;
729 nframes_t current_frame;
732 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
735 void set_position (nframes_t);
736 void set_length (double units);
737 void set_y_axis (double position);
740 friend struct Cursor; /* it needs access to several private
744 Cursor* playhead_cursor;
745 ArdourCanvas::Group* cursor_group;
747 void cursor_to_region_boundary (Cursor*, int32_t dir);
748 void cursor_to_next_region_boundary (Cursor*);
749 void cursor_to_previous_region_boundary (Cursor*);
750 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
751 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
752 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
753 void cursor_to_selection_start (Cursor *);
754 void cursor_to_selection_end (Cursor *);
756 void selected_marker_to_region_boundary (int32_t dir);
757 void selected_marker_to_next_region_boundary ();
758 void selected_marker_to_previous_region_boundary ();
759 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
760 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
761 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
762 void selected_marker_to_selection_start ();
763 void selected_marker_to_selection_end ();
765 void select_all_selectables_using_cursor (Cursor *, bool);
766 void select_all_selectables_using_edit (bool);
767 void select_all_selectables_between (bool within);
768 void select_range_between ();
770 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
771 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
773 vector<nframes_t> region_boundary_cache;
774 void build_region_boundary_cache ();
776 Gtk::VBox trackview_vpacker;
779 Gtk::HBox bottom_hbox;
781 Gtk::Table edit_packer;
782 Gtk::VScrollbar edit_vscrollbar;
784 Gtk::Adjustment vertical_adjustment;
785 Gtk::Adjustment horizontal_adjustment;
787 Gtk::Layout controls_layout;
788 bool control_layout_scroll (GdkEventScroll* ev);
789 void controls_layout_size_request (Gtk::Requisition*);
791 Gtk::HScrollbar edit_hscrollbar;
792 bool _dragging_hscrollbar;
794 void reset_hscrollbar_stepping ();
796 bool hscrollbar_button_press (GdkEventButton*);
797 bool hscrollbar_button_release (GdkEventButton*);
798 void hscrollbar_allocate (Gtk::Allocation &alloc);
801 double canvas_height;
802 double full_canvas_height;
803 nframes_t last_canvas_frame;
805 bool track_canvas_map_handler (GdkEventAny*);
806 bool time_canvas_map_handler (GdkEventAny*);
808 gint edit_controls_button_release (GdkEventButton*);
809 Gtk::Menu *edit_controls_left_menu;
810 Gtk::Menu *edit_controls_right_menu;
812 Gtk::VBox track_canvas_vbox;
813 Gtk::VBox time_canvas_vbox;
814 Gtk::VBox edit_controls_vbox;
815 Gtk::HBox edit_controls_hbox;
817 void control_scroll (float);
818 bool deferred_control_scroll (nframes_t);
819 sigc::connection control_scroll_connection;
821 void tie_vertical_scrolling ();
822 void canvas_horizontally_scrolled ();
823 void canvas_scroll_to (nframes64_t);
825 struct VisualChange {
832 nframes_t time_origin;
833 double frames_per_unit;
837 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
841 VisualChange pending_visual_change;
843 static int _idle_visual_changer (void *arg);
844 int idle_visual_changer ();
846 void queue_visual_change (nframes_t);
847 void queue_visual_change (double);
849 void end_location_changed (ARDOUR::Location*);
851 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
852 RegionListDisplayModelColumns() {
857 Gtk::TreeModelColumn<Glib::ustring> name;
858 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
859 Gtk::TreeModelColumn<Gdk::Color> color_;
862 RegionListDisplayModelColumns region_list_columns;
863 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
865 Glib::RefPtr<Gtk::TreeStore> region_list_model;
866 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
867 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
869 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
870 void region_list_selection_changed ();
871 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
872 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
873 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
875 Gtk::Menu *region_list_menu;
876 Gtk::ScrolledWindow region_list_scroller;
877 Gtk::Frame region_list_frame;
879 bool region_list_display_key_press (GdkEventKey *);
880 bool region_list_display_key_release (GdkEventKey *);
881 bool region_list_display_button_press (GdkEventButton *);
882 bool region_list_display_button_release (GdkEventButton *);
883 void region_list_clear ();
884 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
885 void build_region_list_menu ();
886 void show_region_list_display_context_menu (int button, int time);
888 bool show_automatic_regions_in_region_list;
889 Editing::RegionListSortType region_list_sort_type;
891 void reset_region_list_sort_direction (bool);
892 void reset_region_list_sort_type (Editing::RegionListSortType);
894 void toggle_full_region_list ();
895 void toggle_show_auto_regions ();
897 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
901 Gtk::ScrolledWindow snapshot_display_scroller;
902 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
903 SnapshotDisplayModelColumns() {
907 Gtk::TreeModelColumn<Glib::ustring> visible_name;
908 Gtk::TreeModelColumn<Glib::ustring> real_name;
911 SnapshotDisplayModelColumns snapshot_display_columns;
912 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
913 Gtk::TreeView snapshot_display;
914 Gtk::Menu snapshot_context_menu;
916 bool snapshot_display_button_press (GdkEventButton*);
917 void snapshot_display_selection_changed ();
918 void redisplay_snapshots();
919 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
921 /* named selections */
923 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
924 NamedSelectionDisplayModelColumns() {
928 Gtk::TreeModelColumn<Glib::ustring> text;
929 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
932 NamedSelectionDisplayModelColumns named_selection_columns;
933 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
935 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
936 Gtk::ScrolledWindow named_selection_scroller;
938 void create_named_selection ();
939 void paste_named_selection (float times);
940 void remove_selected_named_selections ();
941 void remove_snapshot (Glib::ustring);
942 void rename_snapshot (Glib::ustring);
944 void handle_new_named_selection ();
945 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
946 void redisplay_named_selections ();
948 bool named_selection_display_button_release (GdkEventButton *ev);
949 bool named_selection_display_key_release (GdkEventKey *ev);
950 void named_selection_display_selection_changed ();
953 TrackViewList track_views;
954 TimeAxisView *trackview_by_y_position (double ypos);
956 static Gdk::Cursor* cross_hair_cursor;
957 static Gdk::Cursor* trimmer_cursor;
958 static Gdk::Cursor* selector_cursor;
959 static Gdk::Cursor* grabber_cursor;
960 static Gdk::Cursor* zoom_cursor;
961 static Gdk::Cursor* time_fx_cursor;
962 static Gdk::Cursor* fader_cursor;
963 static Gdk::Cursor* speaker_cursor;
964 static Gdk::Cursor* midi_pencil_cursor;
965 static Gdk::Cursor* midi_select_cursor;
966 static Gdk::Cursor* midi_erase_cursor;
967 static Gdk::Cursor* wait_cursor;
968 static Gdk::Cursor* timebar_cursor;
969 static Gdk::Cursor* transparent_cursor;
971 static void build_cursors ();
973 sigc::connection scroll_connection;
974 nframes_t last_update_frame;
975 void center_screen (nframes_t);
976 void center_screen_internal (nframes_t, float);
978 void update_current_screen ();
980 void session_going_away ();
982 nframes_t cut_buffer_start;
983 nframes_t cut_buffer_length;
985 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
986 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
987 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
988 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
989 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
990 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
992 /* KEYMAP HANDLING */
994 void register_actions ();
996 int ensure_cursor (nframes_t* pos);
998 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
999 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1000 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1001 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1002 void redisplay_regions ();
1003 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1005 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1007 void cut_copy (Editing::CutCopyOp);
1008 bool can_cut_copy () const;
1009 void cut_copy_points (Editing::CutCopyOp);
1010 void cut_copy_regions (Editing::CutCopyOp);
1011 void cut_copy_ranges (Editing::CutCopyOp);
1013 void mouse_paste ();
1014 void paste_internal (nframes_t position, float times);
1016 /* EDITING OPERATIONS */
1018 void reset_point_selection ();
1019 void toggle_region_mute ();
1020 void toggle_region_lock ();
1021 void toggle_region_opaque ();
1022 void toggle_region_position_lock ();
1023 void raise_region ();
1024 void raise_region_to_top ();
1025 void lower_region ();
1026 void lower_region_to_bottom ();
1027 void split_region ();
1028 void split_region_at (nframes_t);
1029 void split_regions_at (nframes_t, RegionSelection&);
1030 void split_region_at_transients ();
1031 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, std::vector<nframes64_t>&);
1032 void crop_region_to_selection ();
1033 void crop_region_to (nframes_t start, nframes_t end);
1034 void set_sync_point (nframes64_t, const RegionSelection&);
1035 void set_region_sync_from_edit_point ();
1036 void remove_region_sync();
1037 void align_selection (ARDOUR::RegionPoint, nframes_t position, const RegionSelection&);
1038 void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position, const RegionSelection&);
1039 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
1040 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
1041 void remove_selected_regions ();
1042 void remove_clicked_region ();
1043 void edit_region ();
1044 void rename_region ();
1045 void duplicate_some_regions (RegionSelection&, float times);
1046 void duplicate_selection (float times);
1047 void region_fill_selection ();
1049 void region_fill_track ();
1050 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1051 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1052 void split_multichannel_region();
1053 void reverse_region ();
1054 void normalize_region ();
1055 void denormalize_region ();
1056 void adjust_region_scale_amplitude (bool up);
1057 void quantize_region ();
1059 void tab_to_transient (bool forward);
1061 void use_region_as_bar ();
1062 void use_range_as_bar ();
1064 void define_one_bar (nframes64_t start, nframes64_t end);
1066 void audition_region_from_region_list ();
1067 void hide_region_from_region_list ();
1068 void remove_region_from_region_list ();
1070 void align (ARDOUR::RegionPoint);
1071 void align_relative (ARDOUR::RegionPoint);
1074 void reset_focus ();
1080 void paste (float times);
1082 int get_prefix (float&, bool&);
1084 void keyboard_paste ();
1085 void keyboard_insert_region_list_selection ();
1087 void region_from_selection ();
1088 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1090 void play_from_start ();
1091 void play_from_edit_point ();
1092 void play_from_edit_point_and_return ();
1093 void play_selected_region ();
1094 void play_edit_range ();
1095 void loop_selected_region ();
1096 void play_location (ARDOUR::Location&);
1097 void loop_location (ARDOUR::Location&);
1099 void temporal_zoom_selection ();
1100 void temporal_zoom_region ();
1101 void toggle_zoom_region ();
1102 bool zoomed_to_region;
1103 void temporal_zoom_session ();
1104 void temporal_zoom (gdouble scale);
1105 void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
1106 void temporal_zoom_to_frame (bool coarser, nframes_t frame);
1108 void amplitude_zoom (gdouble scale);
1109 void amplitude_zoom_step (bool in);
1111 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1112 void insert_region_list_selection (float times);
1114 /* import & embed */
1116 void add_external_audio_action (Editing::ImportMode);
1117 void external_audio_dialog ();
1118 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1120 SoundFileOmega* sfbrowser;
1122 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1123 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1125 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1126 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1127 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1129 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1130 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1131 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1132 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1134 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1135 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1136 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1137 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1139 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1141 /* generic interthread progress window */
1143 ArdourDialog* interthread_progress_window;
1144 Gtk::Label interthread_progress_label;
1145 Gtk::VBox interthread_progress_vbox;
1146 Gtk::ProgressBar interthread_progress_bar;
1147 Gtk::Button interthread_cancel_button;
1148 Gtk::Label interthread_cancel_label;
1149 sigc::connection interthread_progress_connection;
1150 void interthread_cancel_clicked ();
1151 void build_interthread_progress_window ();
1152 ARDOUR::InterThreadInfo* current_interthread_info;
1155 AnalysisWindow* analysis_window;
1158 /* import specific info */
1160 ARDOUR::Session::import_status import_status;
1161 gint import_progress_timeout (void *);
1162 static void *_import_thread (void *);
1163 void* import_thread ();
1165 /* to support this ... */
1167 void import_audio (bool as_tracks);
1168 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1170 void move_to_start ();
1171 void move_to_end ();
1173 void center_playhead ();
1174 void center_edit_point ();
1175 void edit_cursor_backward ();
1176 void edit_cursor_forward ();
1177 void playhead_backward ();
1178 void playhead_forward ();
1179 void scroll_playhead (bool forward);
1180 void scroll_backward (float pages=0.8f);
1181 void scroll_forward (float pages=0.8f);
1182 void scroll_tracks_down ();
1183 void scroll_tracks_up ();
1184 void delete_sample_forward ();
1185 void delete_sample_backward ();
1186 void delete_screen ();
1187 void search_backwards ();
1188 void search_forwards ();
1190 void clear_markers ();
1191 void clear_ranges ();
1192 void clear_locations ();
1193 void unhide_markers ();
1194 void unhide_ranges ();
1195 void jump_forward_to_mark ();
1196 void jump_backward_to_mark ();
1197 void cursor_align (bool playhead_to_edit);
1199 void remove_last_capture ();
1200 void select_all_selectables_using_time_selection ();
1201 void select_all_selectables_using_loop();
1202 void select_all_selectables_using_punch();
1203 void set_selection_from_range (ARDOUR::Location&);
1204 void set_selection_from_punch ();
1205 void set_selection_from_loop ();
1206 void set_selection_from_region ();
1208 void add_location_mark (nframes64_t where);
1209 void add_location_from_audio_region ();
1210 void add_location_from_selection ();
1211 void set_loop_from_selection (bool play);
1212 void set_punch_from_selection ();
1213 void set_punch_from_region ();
1215 void set_loop_from_edit_range (bool play);
1216 void set_loop_from_region (bool play);
1217 void set_punch_from_edit_range ();
1219 void set_loop_range (nframes_t start, nframes_t end, std::string cmd);
1220 void set_punch_range (nframes_t start, nframes_t end, std::string cmd);
1222 void add_location_from_playhead_cursor ();
1223 bool select_new_marker;
1225 void reverse_selection ();
1226 void edit_envelope ();
1228 void start_scrolling ();
1229 void stop_scrolling ();
1232 double last_scrub_x;
1233 int scrubbing_direction;
1234 int scrub_reversals;
1235 int scrub_reverse_distance;
1237 void keyboard_selection_begin ();
1238 void keyboard_selection_finish (bool add);
1239 bool have_pending_keyboard_selection;
1240 nframes_t pending_keyboard_selection_start;
1242 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1243 void extend_selection_to_end_of_region (bool next);
1244 void extend_selection_to_start_of_region (bool previous);
1246 Editing::SnapType snap_type;
1247 Editing::SnapMode snap_mode;
1249 /// Snap threshold in pixels
1250 double snap_threshold;
1252 void handle_gui_changes (const string &, void *);
1254 void hide_all_tracks (bool with_select);
1257 LineDragInfo current_line_drag_info;
1259 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1260 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1261 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1263 Gtk::Menu fade_context_menu;
1264 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1266 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1267 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1268 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1269 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1270 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1271 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1273 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1274 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1276 void set_fade_length (bool in);
1277 void toggle_fade_active (bool in);
1278 void set_fade_in_active (bool);
1279 void set_fade_out_active (bool);
1281 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1282 RegionSelection pre_drag_region_selection;
1283 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1284 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1285 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1286 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1287 bool check_region_drag_possible (RouteTimeAxisView**);
1288 void possibly_copy_regions_during_grab (GdkEvent*);
1289 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1290 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1292 bool _dragging_playhead;
1293 bool _dragging_edit_point;
1295 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1296 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1297 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1298 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1299 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1300 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1301 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1302 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1304 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1305 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1306 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1307 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1309 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1311 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1312 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1313 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1314 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1315 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1316 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1317 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1318 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1319 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1320 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1321 void start_line_grab (AutomationLine *, GdkEvent*);
1322 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1323 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1324 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1325 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1327 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1329 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1330 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1332 void mouse_brush_insert_region (RegionView*, nframes_t pos);
1333 void brush (nframes_t);
1335 void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1336 void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1338 /* Canvas event handlers */
1340 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1341 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1342 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1343 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1344 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1345 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1346 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1347 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1348 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1349 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1350 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1351 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1352 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1353 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1354 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1355 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1356 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1357 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1358 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1360 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1361 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1362 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1363 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1364 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1365 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1367 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1368 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1369 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1370 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1371 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1372 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1373 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1374 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1376 /* non-public event handlers */
1378 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1379 bool track_canvas_scroll (GdkEventScroll* event);
1380 bool time_canvas_scroll (GdkEventScroll* event);
1382 bool track_canvas_scroll_event (GdkEventScroll* event);
1383 bool track_canvas_button_press_event (GdkEventButton* event);
1384 bool track_canvas_button_release_event (GdkEventButton* event);
1385 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1387 bool time_canvas_scroll_event (GdkEventScroll* event);
1389 Gtk::Allocation canvas_allocation;
1390 bool canvas_idle_queued;
1391 void track_canvas_allocate (Gtk::Allocation alloc);
1392 bool track_canvas_size_allocated ();
1394 void set_playhead_cursor ();
1396 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1397 void kbd_mute_unmute_region ();
1400 void kbd_do_brush (GdkEvent*);
1401 void kbd_do_audition (GdkEvent*);
1403 void handle_new_duration ();
1404 void initialize_canvas ();
1405 int canvas_hroizontally_scrolled_handler_id;
1406 void reset_horizontally_scrolling_region (Gtk::Allocation* alloc = 0);
1407 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1409 /* display control */
1411 bool _show_measures;
1412 /// true to show waveforms, otherwise false
1413 bool _show_waveforms;
1414 /// true if the editor should follow the playhead, otherwise false
1415 bool _follow_playhead;
1416 /// true if waveforms should be shown while recording audio tracks, otherwise false
1417 bool _show_waveforms_recording;
1419 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1421 ArdourCanvas::Group* time_line_group;
1422 ArdourCanvas::Group* marker_time_line_group;
1424 TempoLines* tempo_lines;
1425 TempoLines* marker_tempo_lines;
1427 void hide_measures ();
1428 void draw_measures ();
1429 bool redraw_measures ();
1431 void new_tempo_section ();
1433 void mouse_add_new_tempo_event (nframes_t where);
1434 void mouse_add_new_meter_event (nframes_t where);
1436 void remove_tempo_marker (ArdourCanvas::Item*);
1437 void remove_meter_marker (ArdourCanvas::Item*);
1438 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1439 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1441 void edit_tempo_section (ARDOUR::TempoSection*);
1442 void edit_meter_section (ARDOUR::MeterSection*);
1443 void edit_tempo_marker (ArdourCanvas::Item*);
1444 void edit_meter_marker (ArdourCanvas::Item*);
1446 void marker_menu_edit ();
1447 void marker_menu_remove ();
1448 void marker_menu_rename ();
1449 void marker_menu_lock (bool yn);
1450 void marker_menu_hide ();
1451 void marker_menu_loop_range ();
1452 void marker_menu_select_all_selectables_using_range ();
1453 void marker_menu_select_using_range ();
1454 void marker_menu_separate_regions_using_location ();
1455 void marker_menu_play_from ();
1456 void marker_menu_play_range ();
1457 void marker_menu_set_playhead ();
1458 void marker_menu_set_from_playhead ();
1459 void marker_menu_set_from_selection ();
1460 void new_transport_marker_menu_set_loop ();
1461 void new_transport_marker_menu_set_punch ();
1462 void update_loop_range_view (bool visibility=false);
1463 void update_punch_range_view (bool visibility=false);
1464 gint new_transport_marker_menu_popdown (GdkEventAny*);
1465 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1466 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1467 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1468 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1469 void build_range_marker_menu (bool loop_or_punch);
1470 void build_marker_menu (bool start_or_end);
1471 void build_tm_marker_menu ();
1472 void build_new_transport_marker_menu ();
1474 Gtk::Menu* tm_marker_menu;
1475 Gtk::Menu* marker_menu;
1476 Gtk::Menu* start_end_marker_menu;
1477 Gtk::Menu* range_marker_menu;
1478 Gtk::Menu* transport_marker_menu;
1479 Gtk::Menu* new_transport_marker_menu;
1480 Gtk::Menu* cd_marker_menu;
1481 ArdourCanvas::Item* marker_menu_item;
1483 typedef list<Marker*> Marks;
1486 void remove_metric_marks ();
1487 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1489 void compute_current_bbt_points (nframes_t left, nframes_t right);
1490 int tempo_map_change_idle_handler_id;
1491 void tempo_map_changed (ARDOUR::Change);
1492 void redisplay_tempo (bool immediate_redraw);
1494 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1495 void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) {
1496 /* XXX remove this function when everything moves to 64 bit frame counts */
1497 nframes64_t first64 = first;
1498 snap_to (first64, direction, for_mark);
1499 first = (nframes_t) first64;
1502 double snap_length_beats (nframes_t start);
1504 uint32_t bbt_beat_subdivision;
1508 Gtk::ToggleButton editor_mixer_button;
1509 Gtk::ToggleButton editor_list_button;
1511 void editor_mixer_button_toggled ();
1512 void editor_list_button_toggled ();
1514 AudioClock edit_point_clock;
1515 AudioClock zoom_range_clock;
1516 Gtk::Button zoom_in_button;
1517 Gtk::Button zoom_out_button;
1518 Gtk::Button zoom_out_full_button;
1519 Gtk::Button zoom_onetoone_button;
1521 Gtk::VBox toolbar_clock_vbox;
1522 Gtk::VBox toolbar_selection_clock_vbox;
1523 Gtk::Table toolbar_selection_clock_table;
1524 Gtk::Label toolbar_selection_cursor_label;
1526 Gtk::HBox mouse_mode_button_box;
1527 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1528 Gtk::ToggleButton mouse_select_button;
1529 Gtk::ToggleButton mouse_move_button;
1530 Gtk::ToggleButton mouse_gain_button;
1531 Gtk::ToggleButton mouse_zoom_button;
1532 Gtk::ToggleButton mouse_timefx_button;
1533 Gtk::ToggleButton mouse_audition_button;
1534 Gtk::ToggleButton mouse_note_button;
1535 GroupedButtons *mouse_mode_button_set;
1536 void mouse_mode_toggled (Editing::MouseMode m);
1537 bool ignore_mouse_mode_toggle;
1539 gint mouse_select_button_release (GdkEventButton*);
1541 Gtk::VBox automation_box;
1542 Gtk::Button automation_mode_button;
1543 Gtk::ToggleButton global_automation_button;
1545 Gtk::ComboBoxText edit_mode_selector;
1546 Gtk::VBox edit_mode_box;
1548 void set_edit_mode (ARDOUR::EditMode);
1549 void cycle_edit_mode ();
1550 void edit_mode_selection_done ();
1552 Gtk::ComboBoxText snap_type_selector;
1553 Gtk::ComboBoxText snap_mode_selector;
1556 std::vector<std::string> snap_type_strings;
1557 std::vector<std::string> snap_mode_strings;
1559 void snap_type_selection_done ();
1560 void snap_mode_selection_done ();
1561 void snap_mode_chosen (Editing::SnapMode);
1562 void snap_type_chosen (Editing::SnapType);
1564 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1565 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1567 Gtk::ComboBoxText zoom_focus_selector;
1568 Gtk::VBox zoom_focus_box;
1570 std::vector<std::string> zoom_focus_strings;
1572 void zoom_focus_selection_done ();
1573 void zoom_focus_chosen (Editing::ZoomFocus);
1575 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1579 void zoom_adjustment_changed();
1581 void edit_point_clock_changed();
1583 void setup_toolbar ();
1585 Gtkmm2ext::TearOff* tools_tearoff;
1586 Gtk::HBox toolbar_hbox;
1587 Gtk::EventBox toolbar_base;
1588 Gtk::Frame toolbar_frame;
1592 Gtk::HBox midi_tool_button_box;
1593 Gtkmm2ext::TearOff* midi_tool_tearoff;
1594 Gtk::ToggleButton midi_tool_pencil_button;
1595 Gtk::ToggleButton midi_tool_select_button;
1596 Gtk::ToggleButton midi_tool_erase_button;
1597 GroupedButtons *midi_tool_button_set;
1598 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1599 bool ignore_midi_edit_mode_toggle;
1601 Gtkmm2ext::TearOff* midi_tools_tearoff;
1602 Gtk::HBox midi_toolbar_hbox;
1603 Gtk::EventBox midi_toolbar_base;
1604 Gtk::Frame midi_toolbar_frame;
1606 void setup_midi_toolbar ();
1608 /* selection process */
1610 Selection* selection;
1611 Selection* cut_buffer;
1613 void time_selection_changed ();
1614 void track_selection_changed ();
1615 void region_selection_changed ();
1616 void point_selection_changed ();
1617 void marker_selection_changed ();
1626 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1627 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1628 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1629 void cancel_selection ();
1631 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1632 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1633 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1635 bool audio_region_selection_covers (nframes_t where);
1637 /* transport range select process */
1638 enum RangeMarkerOp {
1640 CreateTransportMarker,
1644 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1645 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1646 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1648 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1649 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1650 ArdourCanvas::Line* marker_drag_line;
1651 ArdourCanvas::Points marker_drag_line_points;
1652 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1654 void update_marker_drag_item (ARDOUR::Location *);
1656 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1657 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1658 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1659 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1660 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1661 ArdourCanvas::SimpleLine *transport_punchin_line;
1662 ArdourCanvas::SimpleLine *transport_punchout_line;
1663 ArdourCanvas::SimpleRect *transport_preroll_rect;
1664 ArdourCanvas::SimpleRect *transport_postroll_rect;
1666 ARDOUR::Location* transport_loop_location();
1667 ARDOUR::Location* transport_punch_location();
1669 ARDOUR::Location *temp_location;
1671 /* object rubberband select process */
1673 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1674 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1675 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1677 bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1679 ArdourCanvas::SimpleRect *rubberband_rect;
1681 /* mouse zoom process */
1683 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1684 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1685 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1687 ArdourCanvas::SimpleRect *zoom_rect;
1688 void reposition_zoom_rect (nframes_t start, nframes_t end);
1690 /* diskstream/route display management */
1692 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1693 RouteDisplayModelColumns() {
1699 Gtk::TreeModelColumn<Glib::ustring> text;
1700 Gtk::TreeModelColumn<bool> visible;
1701 Gtk::TreeModelColumn<TimeAxisView*> tv;
1702 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1705 RouteDisplayModelColumns route_display_columns;
1706 Glib::RefPtr<Gtk::ListStore> route_display_model;
1707 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1709 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1710 Gtk::ScrolledWindow route_list_scroller;
1711 Gtk::Menu* route_list_menu;
1713 void sync_order_keys ();
1714 bool ignore_route_order_sync;
1716 bool route_list_display_button_press (GdkEventButton*);
1717 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1720 const Gtk::SelectionData& data,
1724 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1726 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1727 void route_list_delete (const Gtk::TreeModel::Path&);
1728 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1730 void initial_route_list_display ();
1731 void redisplay_route_list();
1732 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1733 bool ignore_route_list_reorder;
1734 bool no_route_list_redisplay;
1736 void build_route_list_menu ();
1737 void show_route_list_menu ();
1739 void show_all_routes ();
1740 void hide_all_routes ();
1741 void show_all_audiotracks ();
1742 void hide_all_audiotracks ();
1743 void show_all_audiobus ();
1744 void hide_all_audiobus ();
1746 void set_all_tracks_visibility (bool yn);
1747 void set_all_audio_visibility (int type, bool yn);
1749 /* edit group management */
1751 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1752 GroupListModelColumns () {
1758 Gtk::TreeModelColumn<bool> is_active;
1759 Gtk::TreeModelColumn<bool> is_visible;
1760 Gtk::TreeModelColumn<std::string> text;
1761 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1764 GroupListModelColumns group_columns;
1765 Glib::RefPtr<Gtk::ListStore> group_model;
1766 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1768 Gtk::TreeView edit_group_display;
1769 Gtk::ScrolledWindow edit_group_display_scroller;
1770 Gtk::Menu* edit_group_list_menu;
1772 void build_edit_group_list_menu ();
1773 void activate_all_edit_groups ();
1774 void disable_all_edit_groups ();
1776 bool in_edit_group_row_change;
1777 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1778 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1779 void new_edit_group ();
1780 void edit_group_list_button_clicked ();
1781 gint edit_group_list_button_press_event (GdkEventButton* ev);
1782 void add_edit_group (ARDOUR::RouteGroup* group);
1783 void remove_selected_edit_group ();
1784 void edit_groups_changed ();
1785 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1787 Gtk::VBox list_vpacker;
1791 bool autoscroll_active;
1792 int autoscroll_timeout_tag;
1793 int autoscroll_direction;
1794 uint32_t autoscroll_cnt;
1795 nframes_t autoscroll_distance;
1797 static gint _autoscroll_canvas (void *);
1798 bool autoscroll_canvas ();
1799 void start_canvas_autoscroll (int direction);
1800 void stop_canvas_autoscroll ();
1801 void maybe_autoscroll (GdkEvent*);
1810 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1811 void point_trim (GdkEvent*);
1812 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1813 void single_contents_trim (RegionView&, nframes_t, bool, bool, bool);
1814 void single_start_trim (RegionView&, nframes_t, bool, bool);
1815 void single_end_trim (RegionView&, nframes_t, bool, bool);
1817 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1818 void thaw_region_after_trim (RegionView& rv);
1820 void trim_region_front();
1821 void trim_region_back();
1822 void trim_region (bool front);
1824 void trim_region_to_edit_point ();
1825 void trim_region_from_edit_point ();
1826 void trim_region_to_loop ();
1827 void trim_region_to_punch ();
1828 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1830 bool show_gain_after_trim;
1834 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1835 const Glib::RefPtr<Gdk::DragContext>& context,
1838 const Gtk::SelectionData& data,
1842 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1845 const Gtk::SelectionData& data,
1849 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1852 const Gtk::SelectionData& data,
1857 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1860 const Gtk::SelectionData& data,
1864 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1867 const Gtk::SelectionData& data,
1873 ExportDialog *export_dialog;
1874 ExportDialog *export_range_markers_dialog;
1876 void export_range (nframes_t start, nframes_t end);
1877 void export_range_markers ();
1879 int write_region_selection(RegionSelection&);
1880 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1881 void export_region ();
1882 void bounce_region_selection ();
1883 void bounce_range_selection ();
1884 void external_edit_region ();
1886 int write_audio_selection (TimeSelection&);
1887 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
1889 void write_selection ();
1893 UndoAction get_memento() const;
1895 XMLNode *before; /* used in *_reversible_command */
1897 void begin_reversible_command (string cmd_name);
1898 void commit_reversible_command ();
1900 /* visual history */
1902 UndoHistory visual_history;
1903 UndoTransaction current_visual_command;
1906 void update_title ();
1907 void update_title_s (const string & snapshot_name);
1910 Selection* selection;
1911 double frames_per_unit;
1913 State (PublicEditor const * e);
1917 void store_state (State&) const;
1918 void restore_state (State *);
1920 void instant_save ();
1922 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1924 /* freeze operations */
1926 ARDOUR::InterThreadInfo freeze_status;
1927 gint freeze_progress_timeout (void *);
1928 static void* _freeze_thread (void*);
1929 void* freeze_thread ();
1931 void freeze_route ();
1932 void unfreeze_route ();
1934 /* edit-group solo + mute */
1936 void set_edit_group_solo (ARDOUR::Route&, bool);
1937 void set_edit_group_mute (ARDOUR::Route&, bool);
1941 void duplicate_dialog (bool with_dialog);
1943 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1945 /* returns false if mouse pointer is not in track or marker canvas
1947 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1949 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1950 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1951 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1953 struct TimeFXDialog : public ArdourDialog {
1954 ARDOUR::TimeFXRequest request;
1957 Gtk::Adjustment pitch_octave_adjustment;
1958 Gtk::Adjustment pitch_semitone_adjustment;
1959 Gtk::Adjustment pitch_cent_adjustment;
1960 Gtk::SpinButton pitch_octave_spinner;
1961 Gtk::SpinButton pitch_semitone_spinner;
1962 Gtk::SpinButton pitch_cent_spinner;
1963 RegionSelection regions;
1964 Gtk::ProgressBar progress_bar;
1967 Gtk::ToggleButton quick_button;
1968 Gtk::ToggleButton antialias_button;
1969 Gtk::HBox upper_button_box;
1972 Gtk::ComboBoxText stretch_opts_selector;
1973 Gtk::Label stretch_opts_label;
1974 Gtk::ToggleButton precise_button;
1977 Gtk::Button* cancel_button;
1978 Gtk::Button* action_button;
1982 TimeFXDialog (Editor& e, bool for_pitch);
1984 gint update_progress ();
1985 sigc::connection first_cancel;
1986 sigc::connection first_delete;
1987 void cancel_in_progress ();
1988 gint delete_in_progress (GdkEventAny*);
1991 /* "whats mine is yours" */
1993 friend class TimeFXDialog;
1995 TimeFXDialog* current_timefx;
1997 static void* timefx_thread (void *arg);
1998 void do_timefx (TimeFXDialog&);
2000 int time_stretch (RegionSelection&, float fraction);
2001 int pitch_shift (RegionSelection&, float cents);
2002 void pitch_shift_regions ();
2003 int time_fx (RegionSelection&, float val, bool pitching);
2005 /* editor-mixer strip */
2007 MixerStrip *current_mixer_strip;
2008 bool show_editor_mixer_when_tracks_arrive;
2009 Gtk::VBox current_mixer_strip_vbox;
2010 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2011 void cms_deleted ();
2012 void current_mixer_strip_hidden ();
2013 void current_mixer_strip_removed ();
2015 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2016 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2018 /* nudging tracks */
2020 void nudge_track (bool use_edit_point, bool forwards);
2024 bool _xfade_visibility;
2027 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2028 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2030 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2031 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2033 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2034 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2035 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2037 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2038 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2039 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2040 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2042 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2043 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2044 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2045 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2047 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2048 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2049 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2050 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2051 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2052 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2054 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2055 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2056 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2057 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2058 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2059 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2061 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2062 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2064 ImageFrameSocketHandler* image_socket_listener ;
2067 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2068 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2069 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2070 void xfade_edit_left_region ();
2071 void xfade_edit_right_region ();
2073 static const int32_t default_width = 995;
2074 static const int32_t default_height = 765;
2078 Gtk::Button nudge_forward_button;
2079 Gtk::Button nudge_backward_button;
2080 Gtk::HBox nudge_hbox;
2081 Gtk::VBox nudge_vbox;
2082 AudioClock nudge_clock;
2084 nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
2086 bool nudge_forward_release (GdkEventButton*);
2087 bool nudge_backward_release (GdkEventButton*);
2091 void apply_filter (ARDOUR::Filter&, string cmd);
2093 /* handling cleanup */
2095 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2097 vector<sigc::connection> session_connections;
2099 /* tracking step changes of track height */
2101 TimeAxisView* current_stepping_trackview;
2102 struct timeval last_track_height_step_timestamp;
2103 gint track_height_step_timeout();
2104 sigc::connection step_timeout;
2106 TimeAxisView* entered_track;
2107 RegionView* entered_regionview;
2109 class ExclusiveRegionSelection {
2111 ExclusiveRegionSelection (Editor&, RegionView*);
2112 ~ExclusiveRegionSelection ();
2116 RegionView* regionview;
2120 void ensure_entered_region_selected (bool op_acts_on_objects = false);
2121 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2122 bool clear_entered_track;
2123 gint left_track_canvas (GdkEventCrossing*);
2124 void set_entered_track (TimeAxisView*);
2125 void set_entered_regionview (RegionView*);
2126 gint left_automation_track ();
2128 bool _new_regionviews_show_envelope;
2130 void toggle_gain_envelope_visibility ();
2131 void toggle_gain_envelope_active ();
2132 void reset_region_gain_envelopes ();
2134 bool on_key_press_event (GdkEventKey*);
2135 bool on_key_release_event (GdkEventKey*);
2137 void session_state_saved (string);
2139 Glib::RefPtr<Gtk::Action> undo_action;
2140 Glib::RefPtr<Gtk::Action> redo_action;
2142 void history_changed ();
2144 Gtk::HBox status_bar_hpacker;
2146 Editing::EditPoint _edit_point;
2148 Gtk::ComboBoxText edit_point_selector;
2150 void set_edit_point_preference (Editing::EditPoint ep);
2151 void cycle_edit_point (bool with_marker);
2152 void set_edit_point ();
2153 void edit_point_selection_done ();
2154 void edit_point_chosen (Editing::EditPoint);
2155 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2156 std::vector<std::string> edit_point_strings;
2158 void selected_marker_moved (ARDOUR::Location*);
2159 sigc::connection edit_point_clock_connection_a;
2160 sigc::connection edit_point_clock_connection_b;
2162 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2164 RegionSelection get_regions_at (nframes64_t where, const TrackSelection& ts) const;
2165 RegionSelection get_regions_after (nframes64_t where, const TrackSelection& ts) const;
2167 RegionSelection tmp_regions;
2169 RegionSelection& get_regions_for_action ();
2171 sigc::connection fast_screen_update_connection;
2172 gint start_updating ();
2173 gint stop_updating ();
2174 void fast_update_strips ();
2175 bool meters_running;
2177 void select_next_route ();
2178 void select_prev_route ();
2180 RhythmFerret* rhythm_ferret;
2183 #endif /* __ardour_editor_h__ */