2 Copyright (C) 2000-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_editor_h__
21 #define __ardour_editor_h__
28 #include <glibmm/ustring.h>
30 #include <boost/optional.hpp>
32 #include <libgnomecanvasmm/canvas.h>
33 #include <libgnomecanvasmm/group.h>
34 #include <libgnomecanvasmm/line.h>
35 #include <libgnomecanvasmm/pixbuf.h>
39 #include <gtkmm/layout.h>
40 #include <gtkmm/comboboxtext.h>
42 #include <gtkmm2ext/selector.h>
43 #include <gtkmm2ext/click_box.h>
44 #include <gtkmm2ext/dndtreeview.h>
46 #include <pbd/stateful.h>
47 #include <ardour/session.h>
48 #include <ardour/tempo.h>
49 #include <ardour/stretch.h>
50 #include <ardour/location.h>
51 #include <ardour/audioregion.h>
53 #include "audio_clock.h"
54 #include "gtk-custom-ruler.h"
55 #include "ardour_dialog.h"
56 #include "public_editor.h"
59 #include "editor_items.h"
60 #include "region_selection.h"
62 #include "time_axis_view.h"
70 class AudioDiskstream;
88 class RouteTimeAxisView;
89 class AudioTimeAxisView;
90 class AutomationTimeAxisView;
91 class AudioRegionView;
94 class PlaylistSelector;
98 class UIExportSpecification;
102 class TrackSelection;
103 class AutomationSelection;
106 class AudioStreamView;
108 class SoundFileOmega;
111 class AnalysisWindow;
114 /* <CMT Additions> */
115 class ImageFrameView;
116 class ImageFrameTimeAxisView;
117 class ImageFrameTimeAxis;
118 class MarkerTimeAxis ;
120 class ImageFrameSocketHandler ;
121 class TimeAxisViewItem ;
122 /* </CMT Additions> */
125 class Editor : public PublicEditor
131 void connect_to_session (ARDOUR::Session *);
132 ARDOUR::Session* current_session() const { return session; }
134 virtual bool have_idled() const { return _have_idled; }
136 nframes64_t leftmost_position() const { return leftmost_frame; }
137 nframes64_t current_page_frames() const {
138 return (nframes64_t) floor (canvas_width * frames_per_unit);
141 void cycle_snap_mode ();
142 void cycle_snap_choice ();
143 void set_snap_to (Editing::SnapType);
144 void set_snap_mode (Editing::SnapMode);
145 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
147 void undo (uint32_t n = 1);
148 void redo (uint32_t n = 1);
150 XMLNode& get_state ();
151 int set_state (const XMLNode& );
153 void set_mouse_mode (Editing::MouseMode, bool force=true);
154 void step_mouse_mode (bool next);
155 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
157 void add_imageframe_time_axis(const std::string & track_name, void*) ;
158 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
159 void connect_to_image_compositor() ;
160 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
161 TimeAxisView* get_named_time_axis(const std::string & name) ;
162 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
163 void add_to_idle_resize (TimeAxisView*, uint32_t);
165 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
166 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
167 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
169 #ifdef USE_RUBBERBAND
170 std::vector<std::string> rb_opt_strings;
173 /* option editor-access */
175 void set_show_waveforms (bool yn);
176 bool show_waveforms() const { return _show_waveforms; }
178 void set_waveform_scale (Editing::WaveformScale);
180 void set_show_waveforms_recording (bool yn);
181 bool show_waveforms_recording() const { return _show_waveforms_recording; }
183 /* things that need to be public to be used in the main menubar */
185 void new_region_from_selection ();
186 void separate_regions_between (const TimeSelection&);
187 void separate_region_from_selection ();
188 void separate_region_from_punch ();
189 void separate_region_from_loop ();
190 void separate_regions_using_location (ARDOUR::Location&);
191 void toggle_playback (bool with_abort);
192 void transition_to_rolling (bool forward);
196 nframes64_t unit_to_frame (double unit) const {
197 return (nframes64_t) rint (unit * frames_per_unit);
200 double frame_to_unit (nframes64_t frame) const {
201 return rint ((double) frame / (double) frames_per_unit);
204 double frame_to_unit (double frame) const {
205 return rint (frame / frames_per_unit);
208 /* NOTE: these functions assume that the "pixel" coordinate is
209 the result of using the world->canvas affine transform on a
210 world coordinate. These coordinates already take into
211 account any scrolling carried out by adjusting the
215 nframes64_t pixel_to_frame (double pixel) const {
217 /* pixel can be less than zero when motion events
218 are processed. since we've already run the world->canvas
219 affine, that means that the location *really* is "off
220 to the right" and thus really is "before the start".
224 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
230 gulong frame_to_pixel (nframes64_t frame) const {
231 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
234 void flush_canvas ();
238 Selection& get_selection() const { return *selection; }
239 Selection& get_cut_buffer() const { return *cut_buffer; }
241 bool extend_selection_to_track (TimeAxisView&);
243 void play_selection ();
244 void select_all_in_track (Selection::Operation op);
245 void select_all (Selection::Operation op);
246 void invert_selection_in_track ();
247 void invert_selection ();
248 void deselect_all ();
252 void set_show_measures (bool yn);
253 bool show_measures () const { return _show_measures; }
254 bool initial_ruler_update_required;
257 /* analysis window */
258 void analyze_region_selection();
259 void analyze_range_selection();
264 /* these initiate export ... */
266 void export_session();
267 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*);
285 void copy_playlists (TimeAxisView*);
286 void clear_playlists (TimeAxisView*);
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 set_selected_mixer_strip (TimeAxisView&);
294 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
295 void show_track_in_display (TimeAxisView& tv);
297 /* nudge is initiated by transport controls owned by ARDOUR_UI */
299 void nudge_forward (bool next, bool force_playhead);
300 void nudge_backward (bool next, bool force_playhead);
302 /* nudge initiated from context menu */
304 void nudge_forward_capture_offset ();
305 void nudge_backward_capture_offset ();
307 /* playhead/screen stuff */
309 void set_follow_playhead (bool yn);
310 void toggle_follow_playhead ();
311 bool follow_playhead() const { return _follow_playhead; }
312 bool dragging_playhead () const { return _dragging_playhead; }
314 void toggle_waveform_visibility ();
315 void toggle_waveforms_while_recording ();
316 void toggle_measure_visibility ();
317 void toggle_logo_visibility ();
319 /* SMPTE timecode & video sync */
321 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
322 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
323 void subframes_per_frame_chosen (uint32_t);
325 void update_smpte_mode();
326 void update_video_pullup();
327 void update_subframes_per_frame ();
330 void toggle_auto_xfade ();
331 void toggle_xfades_active ();
332 void toggle_xfade_visibility ();
333 bool xfade_visibility() const { return _xfade_visibility; }
334 void update_xfade_visibility ();
335 void update_crossfade_model ();
336 void set_crossfade_model (ARDOUR::CrossfadeModel);
339 void set_layer_model (ARDOUR::LayerModel);
340 void update_layering_model ();
342 void toggle_link_region_and_track_selection ();
344 /* redirect shared ops menu. caller must free returned menu */
346 Gtk::Menu* redirect_menu ();
348 /* floating windows/transient */
350 void ensure_float (Gtk::Window&);
354 void scroll_tracks_down_line ();
355 void scroll_tracks_up_line ();
357 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
358 void prepare_for_cleanup ();
359 void finish_cleanup ();
361 void maximise_editing_space();
362 void restore_editing_space();
364 void reset_x_origin (nframes64_t);
365 void reset_zoom (double);
366 void reposition_and_zoom (nframes64_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();
377 void goto_visual_state (uint32_t);
378 void save_visual_state (uint32_t);
380 void queue_draw_resize_line (int at);
381 void start_resize_line_ops ();
382 void end_resize_line_ops ();
385 void map_transport_state ();
386 void map_position_change (nframes64_t);
389 bool on_expose_event (GdkEventExpose*);
393 ARDOUR::Session *session;
396 // to keep track of the playhead position for control_scroll
397 boost::optional<nframes64_t> _control_scroll_target;
399 PlaylistSelector* _playlist_selector;
401 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
405 double frames_per_unit;
406 nframes64_t leftmost_frame;
407 Editing::ZoomFocus zoom_focus;
408 bool zoomed_to_region;
409 std::list<TAVState> track_states;
412 std::list<VisualState*> undo_visual_stack;
413 std::list<VisualState*> redo_visual_stack;
414 VisualState* current_visual_state (bool with_tracks = true);
415 void undo_visual_state ();
416 void redo_visual_state ();
417 void use_visual_state (VisualState&);
419 void swap_visual_state ();
421 std::vector<VisualState*> visual_states;
422 sigc::connection visual_state_op_connection;
423 void start_visual_state_op (uint32_t n);
424 void cancel_visual_state_op (uint32_t n);
425 bool end_visual_state_op (uint32_t n);
427 nframes64_t leftmost_frame;
428 double frames_per_unit;
429 Editing::ZoomFocus zoom_focus;
431 void set_frames_per_unit (double);
434 Editing::MouseMode mouse_mode;
436 int post_maximal_editor_width;
437 int post_maximal_pane_position;
438 int pre_maximal_pane_position;
439 int pre_maximal_editor_width;
440 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
442 Gtk::Notebook the_notebook;
443 Gtk::HPaned edit_pane;
445 Gtk::EventBox meter_base;
447 Gtk::EventBox marker_base;
448 Gtk::HBox marker_box;
449 Gtk::VBox scrollers_rulers_markers_box;
451 void location_changed (ARDOUR::Location *);
452 void location_flags_changed (ARDOUR::Location *, void *);
453 void refresh_location_display ();
454 void refresh_location_display_s (ARDOUR::Change);
455 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
456 void add_new_location (ARDOUR::Location *);
457 void location_gone (ARDOUR::Location *);
458 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
459 gint really_remove_marker (ARDOUR::Location* loc);
460 void goto_nth_marker (int nth);
462 uint32_t location_marker_color;
463 uint32_t location_range_color;
464 uint32_t location_loop_color;
465 uint32_t location_punch_color;
466 uint32_t location_cd_marker_color;
468 struct LocationMarkers {
473 LocationMarkers () : start(0), end(0), valid (true) {}
479 void set_name (const string&);
480 void set_position (nframes64_t start, nframes64_t end = 0);
481 void set_color_rgba (uint32_t);
484 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
485 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
486 Marker* entered_marker;
488 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
489 LocationMarkerMap location_markers;
491 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
492 void clear_marker_display ();
493 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
494 bool choose_new_marker_name(string &name);
495 void update_cd_marker_display ();
496 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
498 TimeAxisView* clicked_trackview;
499 AudioTimeAxisView* clicked_audio_trackview;
500 RegionView* clicked_regionview;
501 RegionSelection latest_regionviews;
502 uint32_t clicked_selection;
503 CrossfadeView* clicked_crossfadeview;
504 ControlPoint* clicked_control_point;
506 void sort_track_selection (TrackSelection* sel = 0);
508 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
509 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
510 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
512 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
514 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
515 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t);
516 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t);
517 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
521 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
522 bool button_release_can_deselect;
524 void catch_vanishing_regionview (RegionView *);
526 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
527 void select_all_tracks ();
529 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
530 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
531 void set_selected_track_as_side_effect (bool force = false);
532 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
534 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
535 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
536 void collect_new_region_view (RegionView *);
538 Gtk::Menu track_context_menu;
539 Gtk::Menu track_region_context_menu;
540 Gtk::Menu track_selection_context_menu;
541 Gtk::Menu track_crossfade_context_menu;
543 Gtk::MenuItem* region_edit_menu_split_item;
544 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
545 Gtk::Menu * track_region_edit_playlist_menu;
546 Gtk::Menu * track_edit_playlist_submenu;
547 Gtk::Menu * track_selection_edit_playlist_submenu;
549 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
550 Gtk::Menu* build_track_context_menu (nframes64_t);
551 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
552 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
553 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
554 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
555 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
556 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
557 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
558 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
559 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
561 void handle_new_route (ARDOUR::Session::RouteList&);
562 void remove_route (TimeAxisView *);
565 Gtk::HBox global_hpacker;
566 Gtk::VBox global_vpacker;
569 bool need_resize_line;
571 int old_resize_line_y;
573 Gdk::Cursor* current_canvas_cursor;
574 void set_canvas_cursor ();
575 Gdk::Cursor* which_grabber_cursor ();
577 ArdourCanvas::Canvas* track_canvas;
578 ArdourCanvas::Canvas* time_canvas;
580 ArdourCanvas::Text* first_action_message;
581 ArdourCanvas::Text* verbose_canvas_cursor;
582 bool verbose_cursor_visible;
584 void parameter_changed (const char *);
586 bool track_canvas_motion (GdkEvent*);
588 void set_verbose_canvas_cursor (const string &, double x, double y);
589 void set_verbose_canvas_cursor_text (const string &);
590 void show_verbose_canvas_cursor();
591 void hide_verbose_canvas_cursor();
593 bool verbose_cursor_on; // so far unused
595 Gtk::EventBox time_canvas_event_box;
596 Gtk::EventBox track_canvas_event_box;
597 Gtk::EventBox time_button_event_box;
598 Gtk::Frame time_button_frame;
600 ArdourCanvas::Pixbuf* logo_item;
601 ArdourCanvas::Group* minsec_group;
602 ArdourCanvas::Group* bbt_group;
603 ArdourCanvas::Group* smpte_group;
604 ArdourCanvas::Group* frame_group;
605 ArdourCanvas::Group* tempo_group;
606 ArdourCanvas::Group* meter_group;
607 ArdourCanvas::Group* marker_group;
608 ArdourCanvas::Group* range_marker_group;
609 ArdourCanvas::Group* transport_marker_group;
610 ArdourCanvas::Group* cd_marker_group;
613 ruler_metric_smpte = 0,
614 ruler_metric_bbt = 1,
615 ruler_metric_frames = 2,
616 ruler_metric_minsec = 3,
618 ruler_time_tempo = 4,
619 ruler_time_meter = 5,
620 ruler_time_marker = 6,
621 ruler_time_range_marker = 7,
622 ruler_time_transport_marker = 8,
623 ruler_time_cd_marker = 9,
626 static GtkCustomMetric ruler_metrics[4];
627 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
628 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
629 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
630 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
631 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
632 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
633 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
634 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
635 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
636 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
637 bool no_ruler_shown_update;
639 gint ruler_button_press (GdkEventButton*);
640 gint ruler_button_release (GdkEventButton*);
641 gint ruler_mouse_motion (GdkEventMotion*);
642 bool ruler_scroll (GdkEventScroll* event);
644 gint ruler_pressed_button;
645 Gtk::Widget * ruler_grabbed_widget;
647 void initialize_rulers ();
648 void update_just_smpte ();
649 void update_fixed_rulers ();
650 void update_tempo_based_rulers ();
651 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
652 void update_ruler_visibility ();
653 void set_ruler_visible (RulerType, bool);
654 void toggle_ruler_visibility (RulerType rt);
655 void ruler_toggled (int);
656 gint ruler_label_button_release (GdkEventButton*);
657 void store_ruler_visibility ();
658 void restore_ruler_visibility ();
660 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
661 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
662 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
663 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
665 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
666 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
667 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
668 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
670 Gtk::Widget *_ruler_separator;
671 GtkWidget *_smpte_ruler;
672 GtkWidget *_bbt_ruler;
673 GtkWidget *_frames_ruler;
674 GtkWidget *_minsec_ruler;
675 Gtk::Widget *smpte_ruler;
676 Gtk::Widget *bbt_ruler;
677 Gtk::Widget *frames_ruler;
678 Gtk::Widget *minsec_ruler;
679 static Editor *ruler_editor;
681 static const double timebar_height;
682 guint32 visible_timebars;
683 Gtk::Menu *editor_ruler_menu;
685 ArdourCanvas::SimpleRect* tempo_bar;
686 ArdourCanvas::SimpleRect* meter_bar;
687 ArdourCanvas::SimpleRect* marker_bar;
688 ArdourCanvas::SimpleRect* range_marker_bar;
689 ArdourCanvas::SimpleRect* transport_marker_bar;
690 ArdourCanvas::SimpleRect* cd_marker_bar;
693 ArdourCanvas::SimpleLine* tempo_line;
694 ArdourCanvas::SimpleLine* meter_line;
695 ArdourCanvas::SimpleLine* marker_line;
696 ArdourCanvas::SimpleLine* range_marker_line;
697 ArdourCanvas::SimpleLine* transport_marker_line;
698 ArdourCanvas::SimpleLine* cd_marker_line;
700 Gtk::Label minsec_label;
701 Gtk::Label bbt_label;
702 Gtk::Label smpte_label;
703 Gtk::Label frame_label;
704 Gtk::Label tempo_label;
705 Gtk::Label meter_label;
706 Gtk::Label mark_label;
707 Gtk::Label range_mark_label;
708 Gtk::Label transport_mark_label;
709 Gtk::Label cd_mark_label;
712 Gtk::VBox time_button_vbox;
713 Gtk::HBox time_button_hbox;
717 ArdourCanvas::Points points;
718 ArdourCanvas::Line canvas_item;
719 nframes64_t current_frame;
722 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
725 void set_position (nframes64_t);
726 void set_length (double units);
727 void set_y_axis (double position);
730 friend struct Cursor; /* it needs access to several private
734 Cursor* playhead_cursor;
735 ArdourCanvas::Group* cursor_group;
737 void cursor_to_region_boundary (Cursor*, int32_t dir);
738 void cursor_to_next_region_boundary (Cursor*);
739 void cursor_to_previous_region_boundary (Cursor*);
740 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
741 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
742 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
743 void cursor_to_selection_start (Cursor *);
744 void cursor_to_selection_end (Cursor *);
746 void selected_marker_to_region_boundary (int32_t dir);
747 void selected_marker_to_next_region_boundary ();
748 void selected_marker_to_previous_region_boundary ();
749 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
750 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
751 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
752 void selected_marker_to_selection_start ();
753 void selected_marker_to_selection_end ();
755 void select_all_selectables_using_cursor (Cursor *, bool);
756 void select_all_selectables_using_edit (bool);
757 void select_all_selectables_between (bool within);
758 void select_range_between ();
760 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
761 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
763 vector<nframes64_t> region_boundary_cache;
764 void build_region_boundary_cache ();
767 Gtk::HBox bottom_hbox;
769 Gtk::Table edit_packer;
770 Gtk::VScrollbar edit_vscrollbar;
772 Gtk::Adjustment vertical_adjustment;
773 Gtk::Adjustment horizontal_adjustment;
775 Gtk::Layout controls_layout;
776 bool control_layout_scroll (GdkEventScroll* ev);
777 void controls_layout_size_request (Gtk::Requisition*);
779 Gtk::HScrollbar edit_hscrollbar;
780 bool _dragging_hscrollbar;
782 void reset_hscrollbar_stepping ();
784 bool hscrollbar_button_press (GdkEventButton*);
785 bool hscrollbar_button_release (GdkEventButton*);
786 void hscrollbar_allocate (Gtk::Allocation &alloc);
789 double canvas_height;
790 double full_canvas_height;
791 nframes64_t last_canvas_frame;
793 bool track_canvas_map_handler (GdkEventAny*);
794 bool time_canvas_map_handler (GdkEventAny*);
796 gint edit_controls_button_release (GdkEventButton*);
797 Gtk::Menu *edit_controls_left_menu;
798 Gtk::Menu *edit_controls_right_menu;
800 Gtk::VBox track_canvas_vbox;
801 Gtk::VBox time_canvas_vbox;
802 Gtk::VBox edit_controls_vbox;
803 Gtk::HBox edit_controls_hbox;
805 void control_scroll (float);
806 void access_action (std::string,std::string);
807 bool deferred_control_scroll (nframes64_t);
808 sigc::connection control_scroll_connection;
810 void tie_vertical_scrolling ();
811 void canvas_horizontally_scrolled ();
812 void canvas_scroll_to (nframes64_t);
814 struct VisualChange {
821 nframes64_t time_origin;
822 double frames_per_unit;
826 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
830 VisualChange pending_visual_change;
832 static int _idle_visual_changer (void *arg);
833 int idle_visual_changer ();
835 void queue_visual_change (nframes64_t);
836 void queue_visual_change (double);
838 void end_location_changed (ARDOUR::Location*);
840 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
841 RegionListDisplayModelColumns() {
846 Gtk::TreeModelColumn<Glib::ustring> name;
847 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
848 Gtk::TreeModelColumn<Gdk::Color> color_;
851 RegionListDisplayModelColumns region_list_columns;
852 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
854 Glib::RefPtr<Gtk::TreeStore> region_list_model;
855 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
856 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
858 void region_list_selection_changed ();
859 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
860 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
861 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
863 Gtk::Menu *region_list_menu;
864 Gtk::ScrolledWindow region_list_scroller;
865 Gtk::Frame region_list_frame;
867 bool region_list_display_key_press (GdkEventKey *);
868 bool region_list_display_key_release (GdkEventKey *);
869 bool region_list_display_button_press (GdkEventButton *);
870 bool region_list_display_button_release (GdkEventButton *);
871 void region_list_clear ();
872 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
873 void build_region_list_menu ();
874 void show_region_list_display_context_menu (int button, int time);
876 bool show_automatic_regions_in_region_list;
877 Editing::RegionListSortType region_list_sort_type;
879 void reset_region_list_sort_direction (bool);
880 void reset_region_list_sort_type (Editing::RegionListSortType);
882 void toggle_full_region_list ();
883 void toggle_show_auto_regions ();
885 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
889 Gtk::ScrolledWindow snapshot_display_scroller;
890 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
891 SnapshotDisplayModelColumns() {
895 Gtk::TreeModelColumn<Glib::ustring> visible_name;
896 Gtk::TreeModelColumn<Glib::ustring> real_name;
899 SnapshotDisplayModelColumns snapshot_display_columns;
900 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
901 Gtk::TreeView snapshot_display;
902 Gtk::Menu snapshot_context_menu;
904 bool snapshot_display_button_press (GdkEventButton*);
905 void snapshot_display_selection_changed ();
906 void redisplay_snapshots();
907 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
909 /* named selections */
911 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
912 NamedSelectionDisplayModelColumns() {
916 Gtk::TreeModelColumn<Glib::ustring> text;
917 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
920 NamedSelectionDisplayModelColumns named_selection_columns;
921 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
923 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
924 Gtk::ScrolledWindow named_selection_scroller;
926 void create_named_selection ();
927 void paste_named_selection (float times);
928 void remove_selected_named_selections ();
929 void remove_snapshot (Glib::ustring);
930 void rename_snapshot (Glib::ustring);
932 void handle_new_named_selection ();
933 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
934 void redisplay_named_selections ();
936 bool named_selection_display_button_release (GdkEventButton *ev);
937 bool named_selection_display_key_release (GdkEventKey *ev);
938 void named_selection_display_selection_changed ();
941 TrackViewList track_views;
942 TimeAxisView *trackview_by_y_position (double ypos);
944 static Gdk::Cursor* cross_hair_cursor;
945 static Gdk::Cursor* trimmer_cursor;
946 static Gdk::Cursor* selector_cursor;
947 static Gdk::Cursor* grabber_cursor;
948 static Gdk::Cursor* grabber_edit_point_cursor;
949 static Gdk::Cursor* zoom_cursor;
950 static Gdk::Cursor* time_fx_cursor;
951 static Gdk::Cursor* fader_cursor;
952 static Gdk::Cursor* speaker_cursor;
953 static Gdk::Cursor* wait_cursor;
954 static Gdk::Cursor* timebar_cursor;
955 static Gdk::Cursor* transparent_cursor;
957 static void build_cursors ();
959 sigc::connection scroll_connection;
960 nframes64_t last_update_frame;
961 void center_screen (nframes64_t);
962 void center_screen_internal (nframes64_t, float);
964 void update_current_screen ();
966 void session_going_away ();
968 nframes64_t cut_buffer_start;
969 nframes64_t cut_buffer_length;
971 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
972 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
973 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
974 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
975 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
976 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
978 /* KEYMAP HANDLING */
980 void register_actions ();
982 int ensure_cursor (nframes64_t* pos);
984 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
985 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
986 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
987 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
988 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
989 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
990 void redisplay_regions ();
991 bool no_region_list_redisplay;
992 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
994 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
996 void cut_copy (Editing::CutCopyOp);
997 void cut_copy_points (Editing::CutCopyOp);
998 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
999 void cut_copy_ranges (Editing::CutCopyOp);
1001 void mouse_paste ();
1002 void paste_internal (nframes64_t position, float times);
1004 /* EDITING OPERATIONS */
1006 void reset_point_selection ();
1007 void toggle_region_mute ();
1008 void toggle_region_lock ();
1009 void toggle_region_opaque ();
1010 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1011 void raise_region ();
1012 void raise_region_to_top ();
1013 void lower_region ();
1014 void lower_region_to_bottom ();
1015 void split_region ();
1016 void split_region_at (nframes64_t);
1017 void split_regions_at (nframes64_t, RegionSelection&);
1018 void split_region_at_transients ();
1019 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1020 void crop_region_to_selection ();
1021 void crop_region_to (nframes64_t start, nframes64_t end);
1022 void set_sync_point (nframes64_t, const RegionSelection&);
1023 void set_region_sync_from_edit_point ();
1024 void remove_region_sync();
1025 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1026 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1027 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1028 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1029 void remove_region ();
1030 void remove_clicked_region ();
1031 void edit_region ();
1032 void rename_region ();
1033 void duplicate_some_regions (RegionSelection&, float times);
1034 void duplicate_selection (float times);
1035 void region_fill_selection ();
1037 void region_fill_track ();
1038 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1039 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1040 void split_multichannel_region();
1041 void reverse_region ();
1042 void normalize_region ();
1043 void denormalize_region ();
1044 void adjust_region_scale_amplitude (bool up);
1046 void do_insert_time ();
1047 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1049 void tab_to_transient (bool forward);
1051 void use_region_as_bar ();
1052 void use_range_as_bar ();
1054 void define_one_bar (nframes64_t start, nframes64_t end);
1056 void audition_region_from_region_list ();
1057 void hide_region_from_region_list ();
1058 void remove_region_from_region_list ();
1060 void align (ARDOUR::RegionPoint);
1061 void align_relative (ARDOUR::RegionPoint);
1064 void reset_focus ();
1070 void paste (float times);
1072 int get_prefix (float&, bool&);
1074 void keyboard_paste ();
1075 void keyboard_insert_region_list_selection ();
1077 void region_from_selection ();
1078 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1080 void play_from_start ();
1081 void play_from_edit_point ();
1082 void play_from_edit_point_and_return ();
1083 void play_selected_region ();
1084 void play_edit_range ();
1085 void loop_selected_region ();
1086 void play_location (ARDOUR::Location&);
1087 void loop_location (ARDOUR::Location&);
1089 void temporal_zoom_selection ();
1090 void temporal_zoom_region (bool both_axes);
1091 void toggle_zoom_region (bool both_axes);
1092 bool zoomed_to_region;
1093 void temporal_zoom_session ();
1094 void temporal_zoom (gdouble scale);
1095 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1096 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1098 void amplitude_zoom (gdouble scale);
1099 void amplitude_zoom_step (bool in);
1101 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1102 void insert_region_list_selection (float times);
1104 void add_external_audio_action (Editing::ImportMode);
1105 void external_audio_dialog ();
1107 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1108 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1110 SoundFileOmega* sfbrowser;
1112 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1114 void _do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1115 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1116 bool idle_do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1118 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1119 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1120 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1122 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1123 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool);
1124 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1125 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1127 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1128 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1129 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1130 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1132 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1134 /* generic interthread progress window */
1136 ArdourDialog* interthread_progress_window;
1137 Gtk::Label interthread_progress_label;
1138 Gtk::VBox interthread_progress_vbox;
1139 Gtk::ProgressBar interthread_progress_bar;
1140 Gtk::Button interthread_cancel_button;
1141 Gtk::Label interthread_cancel_label;
1142 sigc::connection interthread_progress_connection;
1143 void interthread_cancel_clicked ();
1144 void build_interthread_progress_window ();
1145 ARDOUR::InterThreadInfo* current_interthread_info;
1148 AnalysisWindow* analysis_window;
1151 /* import specific info */
1153 ARDOUR::Session::import_status import_status;
1154 gint import_progress_timeout (void *);
1155 static void *_import_thread (void *);
1156 void* import_thread ();
1158 /* to support this ... */
1160 void import_audio (bool as_tracks);
1161 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1163 void move_to_start ();
1164 void move_to_end ();
1166 void center_playhead ();
1167 void center_edit_point ();
1168 void edit_cursor_backward ();
1169 void edit_cursor_forward ();
1170 void playhead_forward_to_grid ();
1171 void playhead_backward_to_grid ();
1172 void playhead_backward ();
1173 void playhead_forward ();
1174 void scroll_playhead (bool forward);
1175 void scroll_backward (float pages=0.8f);
1176 void scroll_forward (float pages=0.8f);
1177 void scroll_tracks_down ();
1178 void scroll_tracks_up ();
1179 void delete_sample_forward ();
1180 void delete_sample_backward ();
1181 void delete_screen ();
1182 void search_backwards ();
1183 void search_forwards ();
1185 void clear_markers ();
1186 void clear_ranges ();
1187 void clear_locations ();
1188 void unhide_markers ();
1189 void unhide_ranges ();
1190 void jump_forward_to_mark ();
1191 void jump_backward_to_mark ();
1192 void cursor_align (bool playhead_to_edit);
1194 void remove_last_capture ();
1195 void select_all_selectables_using_time_selection ();
1196 void select_all_selectables_using_loop();
1197 void select_all_selectables_using_punch();
1198 void set_selection_from_range (ARDOUR::Location&);
1199 void set_selection_from_punch ();
1200 void set_selection_from_loop ();
1201 void set_selection_from_audio_region ();
1203 void add_location_mark (nframes64_t where);
1204 void add_location_from_audio_region ();
1205 void add_location_from_selection ();
1206 void set_loop_from_selection (bool play);
1207 void set_punch_from_selection ();
1208 void set_punch_from_region ();
1210 void set_loop_from_edit_range (bool play);
1211 void set_loop_from_region (bool play);
1212 void set_punch_from_edit_range ();
1214 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1215 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1217 void add_location_from_playhead_cursor ();
1218 bool select_new_marker;
1220 void reverse_selection ();
1221 void edit_envelope ();
1223 void start_scrolling ();
1224 void stop_scrolling ();
1227 double last_scrub_x;
1228 int scrubbing_direction;
1229 int scrub_reversals;
1230 int scrub_reverse_distance;
1233 void keyboard_selection_begin ();
1234 void keyboard_selection_finish (bool add);
1235 bool have_pending_keyboard_selection;
1236 nframes64_t pending_keyboard_selection_start;
1238 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1239 void extend_selection_to_end_of_region (bool next);
1240 void extend_selection_to_start_of_region (bool previous);
1242 Editing::SnapType snap_type;
1243 Editing::SnapMode snap_mode;
1244 double snap_threshold;
1246 void handle_gui_changes (const string &, void *);
1248 void hide_all_tracks (bool with_select);
1251 LineDragInfo current_line_drag_info;
1253 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1254 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1255 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1257 void finalize_drag ();
1259 Gtk::Menu fade_context_menu;
1260 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1262 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1263 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1264 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1265 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1266 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1267 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1269 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1270 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1272 void set_fade_length (bool in);
1273 void toggle_fade_active (bool in);
1274 void set_fade_in_active (bool);
1275 void set_fade_out_active (bool);
1277 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1278 RegionSelection pre_drag_region_selection;
1279 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1280 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1281 bool check_region_drag_possible (AudioTimeAxisView**);
1282 void possibly_copy_regions_during_grab (GdkEvent*);
1283 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1284 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1286 bool _dragging_playhead;
1287 bool _dragging_edit_point;
1289 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1290 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1291 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1292 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1293 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1294 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1295 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1296 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1298 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1299 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1300 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1301 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1303 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1305 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1306 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1307 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1308 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1309 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1310 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1311 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1312 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1313 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1314 void start_line_grab (AutomationLine *, GdkEvent*);
1315 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1316 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1317 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1318 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1320 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1322 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1323 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1325 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1326 void brush (nframes64_t);
1328 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1329 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1330 double clamp_verbose_cursor_x (double);
1331 double clamp_verbose_cursor_y (double);
1333 /* Canvas event handlers */
1335 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1336 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1337 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1338 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1339 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1340 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1341 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1342 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1343 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1344 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1347 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1349 ArdourCanvas::Item *last_item_entered;
1350 int last_item_entered_n;
1353 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1354 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1355 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1356 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1357 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1358 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1359 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1360 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1361 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1363 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1364 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1365 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1366 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1367 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1368 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1370 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1371 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1372 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1373 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1374 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1375 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1376 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1377 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1379 /* non-public event handlers */
1381 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1382 bool track_canvas_scroll (GdkEventScroll* event);
1383 bool time_canvas_scroll (GdkEventScroll* event);
1385 bool track_canvas_scroll_event (GdkEventScroll* event);
1386 bool track_canvas_button_press_event (GdkEventButton* event);
1387 bool track_canvas_button_release_event (GdkEventButton* event);
1388 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1390 bool time_canvas_scroll_event (GdkEventScroll* event);
1392 Gtk::Allocation canvas_allocation;
1393 bool canvas_idle_queued;
1394 void track_canvas_allocate (Gtk::Allocation alloc);
1395 bool track_canvas_size_allocated ();
1397 void set_playhead_cursor ();
1399 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1400 void kbd_mute_unmute_region ();
1403 void kbd_do_brush (GdkEvent*);
1404 void kbd_do_audition (GdkEvent*);
1406 void handle_new_duration ();
1407 void initialize_canvas ();
1408 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1410 /* display control */
1412 bool _show_measures;
1413 bool _show_waveforms;
1414 bool _follow_playhead;
1415 bool _show_waveforms_recording;
1417 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1419 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1420 TimeLineList free_measure_lines;
1421 TimeLineList used_measure_lines;
1423 ArdourCanvas::Group* time_line_group;
1424 ArdourCanvas::SimpleLine* get_time_line ();
1425 void hide_measures ();
1426 void draw_measures ();
1427 bool lazy_hide_and_draw_measures ();
1429 void new_tempo_section ();
1431 void mouse_add_new_tempo_event (nframes64_t where);
1432 void mouse_add_new_meter_event (nframes64_t where);
1434 void remove_tempo_marker (ArdourCanvas::Item*);
1435 void remove_meter_marker (ArdourCanvas::Item*);
1436 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1437 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1439 void edit_tempo_section (ARDOUR::TempoSection*);
1440 void edit_meter_section (ARDOUR::MeterSection*);
1441 void edit_tempo_marker (ArdourCanvas::Item*);
1442 void edit_meter_marker (ArdourCanvas::Item*);
1444 void marker_menu_edit ();
1445 void marker_menu_remove ();
1446 void marker_menu_rename ();
1447 void marker_menu_lock (bool yn);
1448 void marker_menu_hide ();
1449 void marker_menu_loop_range ();
1450 void marker_menu_select_all_selectables_using_range ();
1451 void marker_menu_select_using_range ();
1452 void marker_menu_separate_regions_using_location ();
1453 void marker_menu_play_from ();
1454 void marker_menu_play_range ();
1455 void marker_menu_set_playhead ();
1456 void marker_menu_set_from_playhead ();
1457 void marker_menu_set_from_selection ();
1458 void marker_menu_range_to_next ();
1459 void marker_menu_export_range ();
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 tempo_map_changed (ARDOUR::Change);
1490 void redisplay_tempo (bool immediate_redraw);
1492 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1494 uint32_t bbt_beat_subdivision;
1498 Gtk::ToggleButton editor_mixer_button;
1500 void editor_mixer_button_toggled ();
1502 AudioClock edit_point_clock;
1503 AudioClock zoom_range_clock;
1504 Gtk::Button zoom_in_button;
1505 Gtk::Button zoom_out_button;
1506 Gtk::Button zoom_out_full_button;
1507 Gtk::Button zoom_onetoone_button;
1509 Gtk::VBox toolbar_clock_vbox;
1510 Gtk::VBox toolbar_selection_clock_vbox;
1511 Gtk::Table toolbar_selection_clock_table;
1512 Gtk::Label toolbar_selection_cursor_label;
1514 Gtk::HBox mouse_mode_button_box;
1515 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1516 Gtk::ToggleButton mouse_select_button;
1517 Gtk::ToggleButton mouse_move_button;
1518 Gtk::ToggleButton mouse_gain_button;
1519 Gtk::ToggleButton mouse_zoom_button;
1520 Gtk::ToggleButton mouse_timefx_button;
1521 Gtk::ToggleButton mouse_audition_button;
1522 GroupedButtons *mouse_mode_button_set;
1523 void mouse_mode_toggled (Editing::MouseMode m);
1524 bool ignore_mouse_mode_toggle;
1526 gint mouse_select_button_release (GdkEventButton*);
1528 Gtk::VBox automation_box;
1529 Gtk::Button automation_mode_button;
1530 Gtk::ToggleButton global_automation_button;
1532 Gtk::ComboBoxText edit_mode_selector;
1533 Gtk::VBox edit_mode_box;
1535 void set_edit_mode (ARDOUR::EditMode);
1536 void cycle_edit_mode ();
1537 void edit_mode_selection_done ();
1539 Gtk::ComboBoxText snap_type_selector;
1540 Gtk::ComboBoxText snap_mode_selector;
1543 std::vector<std::string> snap_type_strings;
1544 std::vector<std::string> snap_mode_strings;
1546 void snap_type_selection_done ();
1547 void snap_mode_selection_done ();
1548 void snap_mode_chosen (Editing::SnapMode);
1549 void snap_type_chosen (Editing::SnapType);
1551 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1552 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1554 Gtk::ComboBoxText zoom_focus_selector;
1555 Gtk::VBox zoom_focus_box;
1557 std::vector<std::string> zoom_focus_strings;
1559 void zoom_focus_selection_done ();
1560 void zoom_focus_chosen (Editing::ZoomFocus);
1562 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1566 void zoom_adjustment_changed();
1568 void edit_point_clock_changed();
1570 void setup_toolbar ();
1572 Gtkmm2ext::TearOff* tools_tearoff;
1573 Gtk::HBox toolbar_hbox;
1574 Gtk::EventBox toolbar_base;
1575 Gtk::Frame toolbar_frame;
1577 /* selection process */
1579 Selection* selection;
1580 Selection* cut_buffer;
1582 void time_selection_changed ();
1583 void track_selection_changed ();
1584 void region_selection_changed ();
1585 void sensitize_the_right_region_actions (bool have_selected_regions);
1586 void point_selection_changed ();
1587 void marker_selection_changed ();
1596 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1597 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1598 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1599 void cancel_selection ();
1601 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1602 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1603 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1605 bool audio_region_selection_covers (nframes64_t where);
1607 /* transport range select process */
1608 enum RangeMarkerOp {
1610 CreateTransportMarker,
1614 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1615 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1616 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1618 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1619 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1620 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1621 ArdourCanvas::Line* marker_drag_line;
1622 ArdourCanvas::Points marker_drag_line_points;
1623 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1625 void update_marker_drag_item (ARDOUR::Location *);
1627 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1628 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1629 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1630 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1631 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1632 ArdourCanvas::SimpleLine *transport_punchin_line;
1633 ArdourCanvas::SimpleLine *transport_punchout_line;
1634 ArdourCanvas::SimpleRect *transport_preroll_rect;
1635 ArdourCanvas::SimpleRect *transport_postroll_rect;
1637 ARDOUR::Location* transport_loop_location();
1638 ARDOUR::Location* transport_punch_location();
1640 ARDOUR::Location *temp_location;
1642 /* object rubberband select process */
1644 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1645 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1646 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1648 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1650 ArdourCanvas::SimpleRect *rubberband_rect;
1652 /* mouse zoom process */
1654 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1655 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1656 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1658 ArdourCanvas::SimpleRect *zoom_rect;
1659 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1661 /* diskstream/route display management */
1663 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1664 RouteDisplayModelColumns() {
1667 add (temporary_visible);
1671 Gtk::TreeModelColumn<Glib::ustring> text;
1672 Gtk::TreeModelColumn<bool> visible;
1673 Gtk::TreeModelColumn<bool> temporary_visible;
1674 Gtk::TreeModelColumn<TimeAxisView*> tv;
1675 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1678 RouteDisplayModelColumns route_display_columns;
1679 Glib::RefPtr<Gtk::ListStore> route_display_model;
1680 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1682 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1683 Gtk::ScrolledWindow route_list_scroller;
1684 Gtk::Menu* route_list_menu;
1686 void update_route_visibility ();
1688 void sync_order_keys ();
1689 bool ignore_route_order_sync;
1691 bool route_list_display_button_press (GdkEventButton*);
1692 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1695 const Gtk::SelectionData& data,
1699 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1701 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1702 void route_list_delete (const Gtk::TreeModel::Path&);
1703 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1705 void initial_route_list_display ();
1706 void redisplay_route_list();
1707 bool ignore_route_list_reorder;
1708 bool no_route_list_redisplay;
1710 void build_route_list_menu ();
1711 void show_route_list_menu ();
1713 void show_all_routes ();
1714 void hide_all_routes ();
1715 void show_all_audiotracks ();
1716 void hide_all_audiotracks ();
1717 void show_all_audiobus ();
1718 void hide_all_audiobus ();
1720 void set_all_tracks_visibility (bool yn);
1721 void set_all_audio_visibility (int type, bool yn);
1723 /* edit group management */
1725 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1726 GroupListModelColumns () {
1732 Gtk::TreeModelColumn<bool> is_active;
1733 Gtk::TreeModelColumn<bool> is_visible;
1734 Gtk::TreeModelColumn<std::string> text;
1735 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1738 GroupListModelColumns group_columns;
1739 Glib::RefPtr<Gtk::ListStore> group_model;
1740 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1742 Gtk::TreeView edit_group_display;
1743 Gtk::ScrolledWindow edit_group_display_scroller;
1744 Gtk::Menu* edit_group_list_menu;
1746 void build_edit_group_list_menu ();
1747 void activate_all_edit_groups ();
1748 void disable_all_edit_groups ();
1750 bool in_edit_group_row_change;
1751 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1752 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1753 void new_edit_group ();
1754 void edit_group_list_button_clicked ();
1755 gint edit_group_list_button_press_event (GdkEventButton* ev);
1756 void add_edit_group (ARDOUR::RouteGroup* group);
1757 void remove_selected_edit_group ();
1758 void edit_groups_changed ();
1759 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1761 Gtk::VBox list_vpacker;
1765 bool autoscroll_active;
1766 int autoscroll_timeout_tag;
1769 int last_autoscroll_x;
1770 int last_autoscroll_y;
1771 uint32_t autoscroll_cnt;
1772 nframes64_t autoscroll_x_distance;
1773 double autoscroll_y_distance;
1775 static gint _autoscroll_canvas (void *);
1776 bool autoscroll_canvas ();
1777 void start_canvas_autoscroll (int x, int y);
1778 void stop_canvas_autoscroll ();
1779 void maybe_autoscroll (GdkEventMotion*);
1780 bool allow_vertical_scroll;
1789 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1790 void point_trim (GdkEvent*);
1791 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1792 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1793 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1794 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1796 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1797 void thaw_region_after_trim (RegionView& rv);
1799 void trim_region_front();
1800 void trim_region_back();
1801 void trim_region (bool front);
1803 void trim_region_to_edit_point ();
1804 void trim_region_from_edit_point ();
1805 void trim_region_to_loop ();
1806 void trim_region_to_punch ();
1807 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1809 bool show_gain_after_trim;
1813 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1814 const Glib::RefPtr<Gdk::DragContext>& context,
1817 const Gtk::SelectionData& data,
1821 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1824 const Gtk::SelectionData& data,
1828 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1831 const Gtk::SelectionData& data,
1836 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1839 const Gtk::SelectionData& data,
1843 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1846 const Gtk::SelectionData& data,
1852 ExportDialog *export_dialog;
1853 ExportDialog *export_range_markers_dialog;
1855 void export_range (nframes64_t start, nframes64_t end);
1856 void export_range_markers ();
1858 int write_region_selection(RegionSelection&);
1859 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1860 void export_region ();
1861 void bounce_region_selection ();
1862 void bounce_range_selection (bool replace);
1863 void external_edit_region ();
1865 int write_audio_selection (TimeSelection&);
1866 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1868 void write_selection ();
1872 UndoAction get_memento() const;
1874 XMLNode *before; /* used in *_reversible_command */
1875 void begin_reversible_command (string cmd_name);
1876 void commit_reversible_command ();
1878 void update_title ();
1879 void update_title_s (const string & snapshot_name);
1882 Selection* selection;
1883 double frames_per_unit;
1889 void store_state (State&) const;
1890 void restore_state (State *);
1892 void instant_save ();
1894 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1896 /* freeze operations */
1898 ARDOUR::InterThreadInfo freeze_status;
1899 gint freeze_progress_timeout (void *);
1900 static void* _freeze_thread (void*);
1901 void* freeze_thread ();
1903 void freeze_route ();
1904 void unfreeze_route ();
1906 /* edit-group solo + mute */
1908 void set_edit_group_solo (ARDOUR::Route&, bool);
1909 void set_edit_group_mute (ARDOUR::Route&, bool);
1913 void duplicate_dialog (bool with_dialog);
1915 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1917 /* returns false if mouse pointer is not in track or marker canvas
1919 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1921 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1922 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1923 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1925 struct TimeFXDialog : public ArdourDialog {
1926 ARDOUR::TimeFXRequest request;
1929 Gtk::Adjustment pitch_octave_adjustment;
1930 Gtk::Adjustment pitch_semitone_adjustment;
1931 Gtk::Adjustment pitch_cent_adjustment;
1932 Gtk::SpinButton pitch_octave_spinner;
1933 Gtk::SpinButton pitch_semitone_spinner;
1934 Gtk::SpinButton pitch_cent_spinner;
1935 RegionSelection regions;
1936 Gtk::ProgressBar progress_bar;
1939 Gtk::ToggleButton quick_button;
1940 Gtk::ToggleButton antialias_button;
1941 Gtk::HBox upper_button_box;
1944 Gtk::ComboBoxText stretch_opts_selector;
1945 Gtk::Label stretch_opts_label;
1946 Gtk::ToggleButton precise_button;
1949 Gtk::Button* cancel_button;
1950 Gtk::Button* action_button;
1954 TimeFXDialog (Editor& e, bool for_pitch);
1956 gint update_progress ();
1957 sigc::connection first_cancel;
1958 sigc::connection first_delete;
1959 void cancel_in_progress ();
1960 gint delete_in_progress (GdkEventAny*);
1963 /* "whats mine is yours" */
1965 friend class TimeFXDialog;
1967 TimeFXDialog* current_timefx;
1969 static void* timefx_thread (void *arg);
1970 void do_timefx (TimeFXDialog&);
1972 int time_stretch (RegionSelection&, float fraction);
1973 int pitch_shift (RegionSelection&, float cents);
1974 void pitch_shift_regions ();
1975 int time_fx (RegionSelection&, float val, bool pitching);
1977 /* editor-mixer strip */
1979 MixerStrip *current_mixer_strip;
1980 bool show_editor_mixer_when_tracks_arrive;
1981 Gtk::VBox current_mixer_strip_vbox;
1982 void cms_deleted ();
1983 void current_mixer_strip_hidden ();
1984 void current_mixer_strip_removed ();
1986 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1987 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1989 /* nudging tracks */
1991 void nudge_track (bool use_edit_point, bool forwards);
1995 bool _xfade_visibility;
1997 /* <CMT Additions> */
1998 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1999 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2001 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2002 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2004 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2005 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2006 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2008 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2009 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2010 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2011 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2013 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2014 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2015 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2016 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2018 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2019 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2020 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2021 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2022 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2023 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2025 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2026 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2027 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2028 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2029 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2030 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2032 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2033 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2035 ImageFrameSocketHandler* image_socket_listener ;
2036 /* </CMT Additions> */
2038 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2039 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2040 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2041 void xfade_edit_left_region ();
2042 void xfade_edit_right_region ();
2044 static const int32_t default_width = 995;
2045 static const int32_t default_height = 765;
2049 Gtk::Button nudge_forward_button;
2050 Gtk::Button nudge_backward_button;
2051 Gtk::HBox nudge_hbox;
2052 Gtk::VBox nudge_vbox;
2053 AudioClock nudge_clock;
2055 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2057 bool nudge_forward_release (GdkEventButton*);
2058 bool nudge_backward_release (GdkEventButton*);
2062 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2064 /* handling cleanup */
2066 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2068 vector<sigc::connection> session_connections;
2070 /* tracking step changes of track height */
2072 TimeAxisView* current_stepping_trackview;
2073 ARDOUR::microseconds_t last_track_height_step_timestamp;
2074 gint track_height_step_timeout();
2075 sigc::connection step_timeout;
2077 TimeAxisView* entered_track;
2078 RegionView* entered_regionview;
2081 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2082 bool clear_entered_track;
2083 bool left_track_canvas (GdkEventCrossing*);
2084 bool entered_track_canvas (GdkEventCrossing*);
2085 void set_entered_track (TimeAxisView*);
2086 void set_entered_regionview (RegionView*);
2087 gint left_automation_track ();
2089 bool _new_regionviews_show_envelope;
2091 void reset_canvas_action_sensitivity (bool);
2092 void toggle_gain_envelope_visibility ();
2093 void toggle_gain_envelope_active ();
2094 void reset_region_gain_envelopes ();
2096 bool on_key_press_event (GdkEventKey*);
2097 bool on_key_release_event (GdkEventKey*);
2099 void session_state_saved (string);
2101 Glib::RefPtr<Gtk::Action> undo_action;
2102 Glib::RefPtr<Gtk::Action> redo_action;
2104 void history_changed ();
2105 void color_handler ();
2107 Gtk::HBox status_bar_hpacker;
2109 Editing::EditPoint _edit_point;
2111 Gtk::ComboBoxText edit_point_selector;
2113 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2114 void cycle_edit_point (bool with_marker);
2115 void set_edit_point ();
2116 void edit_point_selection_done ();
2117 void edit_point_chosen (Editing::EditPoint);
2118 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2119 std::vector<std::string> edit_point_strings;
2121 void selected_marker_moved (ARDOUR::Location*);
2122 sigc::connection edit_point_clock_connection_a;
2123 sigc::connection edit_point_clock_connection_b;
2125 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2127 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2128 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2130 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2132 sigc::connection fast_screen_update_connection;
2133 gint start_updating ();
2134 gint stop_updating ();
2135 void fast_update_strips ();
2136 bool meters_running;
2138 void select_next_route ();
2139 void select_prev_route ();
2141 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2143 RhythmFerret* rhythm_ferret;
2146 void set_track_height (uint32_t h);
2147 void set_track_height_largest ();
2148 void set_track_height_large ();
2149 void set_track_height_larger ();
2150 void set_track_height_normal ();
2151 void set_track_height_smaller ();
2152 void set_track_height_small ();
2154 void remove_tracks ();
2155 void toggle_tracks_active ();
2156 void waveform_scale_chosen (Editing::WaveformScale);
2160 int32_t resize_idle_target;
2162 friend gboolean _idle_resize (gpointer);
2163 std::vector<TimeAxisView*> pending_resizes;
2166 #endif /* __ardour_editor_h__ */