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;
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 virtual bool have_idled() const { return _have_idled; }
137 nframes64_t leftmost_position() const { return leftmost_frame; }
138 nframes64_t current_page_frames() const {
139 return (nframes64_t) floor (canvas_width * frames_per_unit);
142 void cycle_snap_mode ();
143 void cycle_snap_choice ();
144 void set_snap_to (Editing::SnapType);
145 void set_snap_mode (Editing::SnapMode);
146 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
148 void undo (uint32_t n = 1);
149 void redo (uint32_t n = 1);
151 XMLNode& get_state ();
152 int set_state (const XMLNode& );
154 void set_mouse_mode (Editing::MouseMode, bool force=true);
155 void step_mouse_mode (bool next);
156 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
158 void add_imageframe_time_axis(const std::string & track_name, void*) ;
159 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
160 void connect_to_image_compositor() ;
161 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
162 TimeAxisView* get_named_time_axis(const std::string & name) ;
163 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
164 void add_to_idle_resize (TimeAxisView*, uint32_t);
166 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
167 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
168 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
170 #ifdef USE_RUBBERBAND
171 std::vector<std::string> rb_opt_strings;
174 /* option editor-access */
176 void set_show_waveforms (bool yn);
177 bool show_waveforms() const { return _show_waveforms; }
179 void set_waveform_scale (Editing::WaveformScale);
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_region_from_punch ();
190 void separate_region_from_loop ();
191 void separate_regions_using_location (ARDOUR::Location&);
192 void toggle_playback (bool with_abort);
193 void transition_to_rolling (bool forward);
197 nframes64_t unit_to_frame (double unit) const {
198 return (nframes64_t) rint (unit * frames_per_unit);
201 double frame_to_unit (nframes64_t frame) const {
202 return rint ((double) frame / (double) frames_per_unit);
205 double frame_to_unit (double frame) const {
206 return rint (frame / frames_per_unit);
209 /* NOTE: these functions assume that the "pixel" coordinate is
210 the result of using the world->canvas affine transform on a
211 world coordinate. These coordinates already take into
212 account any scrolling carried out by adjusting the
216 nframes64_t pixel_to_frame (double pixel) const {
218 /* pixel can be less than zero when motion events
219 are processed. since we've already run the world->canvas
220 affine, that means that the location *really* is "off
221 to the right" and thus really is "before the start".
225 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
231 gulong frame_to_pixel (nframes64_t frame) const {
232 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
235 void flush_canvas ();
239 Selection& get_selection() const { return *selection; }
240 Selection& get_cut_buffer() const { return *cut_buffer; }
242 bool extend_selection_to_track (TimeAxisView&);
244 void play_selection ();
245 void select_all_in_track (Selection::Operation op);
246 void select_all (Selection::Operation op);
247 void invert_selection_in_track ();
248 void invert_selection ();
249 void deselect_all ();
253 void set_show_measures (bool yn);
254 bool show_measures () const { return _show_measures; }
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 create_editor_mixer ();
294 void set_selected_mixer_strip (TimeAxisView&);
295 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
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 double get_physical_screen_width () const { return physical_screen_width; };
321 double physical_screen_width;
322 double physical_screen_height;
324 /* SMPTE timecode & video sync */
326 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
327 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
328 void subframes_per_frame_chosen (uint32_t);
330 void update_smpte_mode();
331 void update_video_pullup();
332 void update_subframes_per_frame ();
336 void toggle_region_fades ();
337 void toggle_region_fades_visible ();
338 void toggle_selected_region_fades (int dir);
339 void update_region_fade_visibility ();
341 void toggle_auto_xfade ();
342 void toggle_xfades_active ();
343 void toggle_xfade_visibility ();
344 bool xfade_visibility() const { return _xfade_visibility; }
345 void update_xfade_visibility ();
346 void update_crossfade_model ();
347 void set_crossfade_model (ARDOUR::CrossfadeModel);
350 void set_layer_model (ARDOUR::LayerModel);
351 void update_layering_model ();
353 void toggle_link_region_and_track_selection ();
355 /* redirect shared ops menu. caller must free returned menu */
357 Gtk::Menu* redirect_menu ();
359 /* floating windows/transient */
361 void ensure_float (Gtk::Window&);
365 void scroll_tracks_down_line ();
366 void scroll_tracks_up_line ();
368 void move_selected_tracks (bool up);
370 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
371 void prepare_for_cleanup ();
372 void finish_cleanup ();
374 void maximise_editing_space();
375 void restore_editing_space();
377 void reset_x_origin (nframes64_t);
378 void reset_zoom (double);
379 void reposition_and_zoom (nframes64_t, double);
381 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
383 bool update_mouse_speed ();
384 bool decelerate_mouse_speed ();
386 void toggle_meter_updating();
388 void show_rhythm_ferret();
390 void goto_visual_state (uint32_t);
391 void save_visual_state (uint32_t);
393 void queue_draw_resize_line (int at);
394 void start_resize_line_ops ();
395 void end_resize_line_ops ();
398 void map_transport_state ();
399 void map_position_change (nframes64_t);
402 bool on_expose_event (GdkEventExpose*);
406 ARDOUR::Session *session;
409 // to keep track of the playhead position for control_scroll
410 boost::optional<nframes64_t> _control_scroll_target;
412 PlaylistSelector* _playlist_selector;
414 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
418 double frames_per_unit;
419 nframes64_t leftmost_frame;
420 Editing::ZoomFocus zoom_focus;
421 bool zoomed_to_region;
422 std::list<TAVState> track_states;
425 std::list<VisualState*> undo_visual_stack;
426 std::list<VisualState*> redo_visual_stack;
427 VisualState* current_visual_state (bool with_tracks = true);
428 void undo_visual_state ();
429 void redo_visual_state ();
430 void use_visual_state (VisualState&);
432 void swap_visual_state ();
434 std::vector<VisualState*> visual_states;
435 sigc::connection visual_state_op_connection;
436 void start_visual_state_op (uint32_t n);
437 void cancel_visual_state_op (uint32_t n);
438 bool end_visual_state_op (uint32_t n);
440 nframes64_t leftmost_frame;
441 double frames_per_unit;
442 Editing::ZoomFocus zoom_focus;
444 void set_frames_per_unit (double);
447 Editing::MouseMode mouse_mode;
449 int post_maximal_editor_width;
450 int post_maximal_pane_position;
451 int pre_maximal_pane_position;
452 int pre_maximal_editor_width;
453 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
455 Gtk::Notebook the_notebook;
456 Gtk::HPaned edit_pane;
458 Gtk::EventBox meter_base;
460 Gtk::EventBox marker_base;
461 Gtk::HBox marker_box;
462 Gtk::VBox scrollers_rulers_markers_box;
464 void location_changed (ARDOUR::Location *);
465 void location_flags_changed (ARDOUR::Location *, void *);
466 void refresh_location_display ();
467 void refresh_location_display_s (ARDOUR::Change);
468 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
469 void add_new_location (ARDOUR::Location *);
470 void location_gone (ARDOUR::Location *);
471 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
472 gint really_remove_marker (ARDOUR::Location* loc);
473 void goto_nth_marker (int nth);
475 uint32_t location_marker_color;
476 uint32_t location_range_color;
477 uint32_t location_loop_color;
478 uint32_t location_punch_color;
479 uint32_t location_cd_marker_color;
481 struct LocationMarkers {
486 LocationMarkers () : start(0), end(0), valid (true) {}
492 void set_name (const string&);
493 void set_position (nframes64_t start, nframes64_t end = 0);
494 void set_color_rgba (uint32_t);
497 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
498 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
499 Marker* entered_marker;
501 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
502 LocationMarkerMap location_markers;
504 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
505 void clear_marker_display ();
506 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
507 bool choose_new_marker_name(string &name);
508 void update_cd_marker_display ();
509 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
511 TimeAxisView* clicked_trackview;
512 AudioTimeAxisView* clicked_audio_trackview;
513 RegionView* clicked_regionview;
514 RegionSelection latest_regionviews;
515 uint32_t clicked_selection;
516 CrossfadeView* clicked_crossfadeview;
517 ControlPoint* clicked_control_point;
519 void sort_track_selection (TrackSelection* sel = 0);
521 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
522 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
523 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
525 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
527 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
528 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
529 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
530 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
534 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
535 bool button_release_can_deselect;
537 void catch_vanishing_regionview (RegionView *);
539 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
540 void select_all_tracks ();
542 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
543 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
544 void set_selected_track_as_side_effect (bool force = false);
545 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
547 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
548 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
549 void collect_new_region_view (RegionView *);
551 Gtk::Menu track_context_menu;
552 Gtk::Menu track_region_context_menu;
553 Gtk::Menu track_selection_context_menu;
554 Gtk::Menu track_crossfade_context_menu;
556 Gtk::MenuItem* region_edit_menu_split_item;
557 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
558 Gtk::Menu * track_region_edit_playlist_menu;
559 Gtk::Menu * track_edit_playlist_submenu;
560 Gtk::Menu * track_selection_edit_playlist_submenu;
562 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
563 Gtk::Menu* build_track_context_menu (nframes64_t);
564 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
565 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
566 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
567 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
568 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
569 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
570 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
571 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
572 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
574 void handle_new_route (ARDOUR::Session::RouteList&);
575 void remove_route (TimeAxisView *);
578 Gtk::HBox global_hpacker;
579 Gtk::VBox global_vpacker;
582 bool need_resize_line;
584 int old_resize_line_y;
586 Gdk::Cursor* current_canvas_cursor;
587 void set_canvas_cursor ();
588 Gdk::Cursor* which_grabber_cursor ();
590 ArdourCanvas::Canvas* track_canvas;
592 ArdourCanvas::Text* first_action_message;
593 ArdourCanvas::Text* verbose_canvas_cursor;
594 bool verbose_cursor_visible;
596 void parameter_changed (const char *);
598 bool track_canvas_motion (GdkEvent*);
600 void set_verbose_canvas_cursor (const string &, double x, double y);
601 void set_verbose_canvas_cursor_text (const string &);
602 void show_verbose_canvas_cursor();
603 void hide_verbose_canvas_cursor();
605 bool verbose_cursor_on; // so far unused
607 Gtk::EventBox time_canvas_event_box;
608 Gtk::EventBox track_canvas_event_box;
609 Gtk::EventBox time_button_event_box;
610 Gtk::EventBox ruler_label_event_box;
612 ArdourCanvas::Pixbuf* logo_item;
613 ArdourCanvas::Group* minsec_group;
614 ArdourCanvas::Group* bbt_group;
615 ArdourCanvas::Group* smpte_group;
616 ArdourCanvas::Group* frame_group;
617 ArdourCanvas::Group* tempo_group;
618 ArdourCanvas::Group* meter_group;
619 ArdourCanvas::Group* marker_group;
620 ArdourCanvas::Group* range_marker_group;
621 ArdourCanvas::Group* transport_marker_group;
622 ArdourCanvas::Group* cd_marker_group;
624 ArdourCanvas::Group* timebar_group;
626 /* These bars never need to be scrolled */
627 ArdourCanvas::Group* meter_bar_group;
628 ArdourCanvas::Group* tempo_bar_group;
629 ArdourCanvas::Group* marker_bar_group;
630 ArdourCanvas::Group* range_marker_bar_group;
631 ArdourCanvas::Group* transport_marker_bar_group;
632 ArdourCanvas::Group* cd_marker_bar_group;
634 ArdourCanvas::Group* _background_group;
636 The _master_group is the group containing all items
637 that require horizontal scrolling..
638 It is primarily used to separate canvas items
639 that require horizontal scrolling from those that do not.
641 ArdourCanvas::Group* _master_group;
643 The _trackview_group is the group containing all trackviews.
644 It is only scrolled vertically.
646 ArdourCanvas::Group* _trackview_group;
648 This canvas group is used for region motion.
649 It sits on top of the _trackview_group
651 ArdourCanvas::Group* _region_motion_group;
654 ruler_metric_smpte = 0,
655 ruler_metric_bbt = 1,
656 ruler_metric_frames = 2,
657 ruler_metric_minsec = 3,
659 ruler_time_tempo = 4,
660 ruler_time_meter = 5,
661 ruler_time_marker = 6,
662 ruler_time_range_marker = 7,
663 ruler_time_transport_marker = 8,
664 ruler_time_cd_marker = 9,
667 static GtkCustomMetric ruler_metrics[4];
668 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
669 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
670 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
671 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
672 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
673 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
674 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
675 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
676 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
677 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
678 bool no_ruler_shown_update;
680 gint ruler_button_press (GdkEventButton*);
681 gint ruler_button_release (GdkEventButton*);
682 gint ruler_mouse_motion (GdkEventMotion*);
683 bool ruler_scroll (GdkEventScroll* event);
685 gint ruler_pressed_button;
686 Gtk::Widget * ruler_grabbed_widget;
688 void initialize_rulers ();
689 void update_just_smpte ();
690 void update_fixed_rulers ();
691 void update_tempo_based_rulers ();
692 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
693 void update_ruler_visibility ();
694 void set_ruler_visible (RulerType, bool);
695 void toggle_ruler_visibility (RulerType rt);
696 void ruler_toggled (int);
697 gint ruler_label_button_release (GdkEventButton*);
698 void store_ruler_visibility ();
699 void restore_ruler_visibility ();
701 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
702 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
703 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
704 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
706 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
707 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
708 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
709 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
711 Gtk::Widget *_ruler_separator;
712 GtkWidget *_smpte_ruler;
713 GtkWidget *_bbt_ruler;
714 GtkWidget *_frames_ruler;
715 GtkWidget *_minsec_ruler;
716 Gtk::Widget *smpte_ruler;
717 Gtk::Widget *bbt_ruler;
718 Gtk::Widget *frames_ruler;
719 Gtk::Widget *minsec_ruler;
720 static Editor *ruler_editor;
722 static const double timebar_height;
723 guint32 visible_timebars;
724 gdouble canvas_timebars_vsize;
725 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
726 Gtk::Menu *editor_ruler_menu;
728 ArdourCanvas::SimpleRect* tempo_bar;
729 ArdourCanvas::SimpleRect* meter_bar;
730 ArdourCanvas::SimpleRect* marker_bar;
731 ArdourCanvas::SimpleRect* range_marker_bar;
732 ArdourCanvas::SimpleRect* transport_marker_bar;
733 ArdourCanvas::SimpleRect* cd_marker_bar;
736 ArdourCanvas::SimpleLine* tempo_line;
737 ArdourCanvas::SimpleLine* meter_line;
738 ArdourCanvas::SimpleLine* marker_line;
739 ArdourCanvas::SimpleLine* range_marker_line;
740 ArdourCanvas::SimpleLine* transport_marker_line;
741 ArdourCanvas::SimpleLine* cd_marker_line;
743 Gtk::Label minsec_label;
744 Gtk::Label bbt_label;
745 Gtk::Label smpte_label;
746 Gtk::Label frame_label;
747 Gtk::Label tempo_label;
748 Gtk::Label meter_label;
749 Gtk::Label mark_label;
750 Gtk::Label range_mark_label;
751 Gtk::Label transport_mark_label;
752 Gtk::Label cd_mark_label;
755 Gtk::VBox time_button_vbox;
756 Gtk::HBox time_button_hbox;
760 ArdourCanvas::Points points;
761 ArdourCanvas::Line canvas_item;
762 nframes64_t current_frame;
765 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
768 void set_position (nframes64_t);
769 void set_length (double units);
770 void set_y_axis (double position);
773 friend struct Cursor; /* it needs access to several private
777 Cursor* playhead_cursor;
778 ArdourCanvas::Group* cursor_group;
780 void cursor_to_region_boundary (Cursor*, int32_t dir);
781 void cursor_to_next_region_boundary (Cursor*);
782 void cursor_to_previous_region_boundary (Cursor*);
783 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
784 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
785 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
786 void cursor_to_selection_start (Cursor *);
787 void cursor_to_selection_end (Cursor *);
789 void selected_marker_to_region_boundary (int32_t dir);
790 void selected_marker_to_next_region_boundary ();
791 void selected_marker_to_previous_region_boundary ();
792 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
793 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
794 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
795 void selected_marker_to_selection_start ();
796 void selected_marker_to_selection_end ();
798 void select_all_selectables_using_cursor (Cursor *, bool);
799 void select_all_selectables_using_edit (bool);
800 void select_all_selectables_between (bool within);
801 void select_range_between ();
803 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
804 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
806 vector<nframes64_t> region_boundary_cache;
807 void build_region_boundary_cache ();
810 Gtk::HBox bottom_hbox;
812 Gtk::Table edit_packer;
813 Gtk::VScrollbar edit_vscrollbar;
815 Gtk::Adjustment vertical_adjustment;
816 Gtk::Adjustment horizontal_adjustment;
818 Gtk::Layout controls_layout;
819 bool control_layout_scroll (GdkEventScroll* ev);
820 void controls_layout_size_request (Gtk::Requisition*);
821 sigc::connection controls_layout_size_request_connection;
823 Gtk::HScrollbar edit_hscrollbar;
824 bool _dragging_hscrollbar;
826 void reset_hscrollbar_stepping ();
828 bool hscrollbar_button_press (GdkEventButton*);
829 bool hscrollbar_button_release (GdkEventButton*);
830 void hscrollbar_allocate (Gtk::Allocation &alloc);
833 double canvas_height;
834 double full_canvas_height;
836 bool track_canvas_map_handler (GdkEventAny*);
838 gint edit_controls_button_release (GdkEventButton*);
839 Gtk::Menu *edit_controls_left_menu;
840 Gtk::Menu *edit_controls_right_menu;
842 Gtk::VBox ruler_label_vbox;
843 Gtk::VBox track_canvas_vbox;
844 Gtk::VBox time_canvas_vbox;
845 Gtk::VBox edit_controls_vbox;
846 Gtk::HBox edit_controls_hbox;
848 void control_scroll (float);
849 void access_action (std::string,std::string);
850 bool deferred_control_scroll (nframes64_t);
851 sigc::connection control_scroll_connection;
853 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
855 ArdourCanvas::Group* get_background_group () const { return _background_group; }
856 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
857 double last_trackview_group_vertical_offset;
858 void tie_vertical_scrolling ();
859 void scroll_canvas_horizontally ();
860 void scroll_canvas_vertically ();
861 void canvas_horizontally_scrolled ();
862 void canvas_scroll_to (nframes64_t);
864 struct VisualChange {
871 nframes64_t time_origin;
872 double frames_per_unit;
876 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
880 VisualChange pending_visual_change;
882 static int _idle_visual_changer (void *arg);
883 int idle_visual_changer ();
885 void queue_visual_change (nframes64_t);
886 void queue_visual_change (double);
888 void end_location_changed (ARDOUR::Location*);
890 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
891 RegionListDisplayModelColumns() {
896 Gtk::TreeModelColumn<Glib::ustring> name;
897 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
898 Gtk::TreeModelColumn<Gdk::Color> color_;
901 RegionListDisplayModelColumns region_list_columns;
902 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
904 Glib::RefPtr<Gtk::TreeStore> region_list_model;
905 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
906 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
908 void region_list_selection_changed ();
909 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
910 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
911 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
913 Gtk::Menu *region_list_menu;
914 Gtk::ScrolledWindow region_list_scroller;
915 Gtk::Frame region_list_frame;
917 bool region_list_display_key_press (GdkEventKey *);
918 bool region_list_display_key_release (GdkEventKey *);
919 bool region_list_display_button_press (GdkEventButton *);
920 bool region_list_display_button_release (GdkEventButton *);
921 void region_list_clear ();
922 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
923 void build_region_list_menu ();
924 void show_region_list_display_context_menu (int button, int time);
926 bool show_automatic_regions_in_region_list;
927 Editing::RegionListSortType region_list_sort_type;
929 void reset_region_list_sort_direction (bool);
930 void reset_region_list_sort_type (Editing::RegionListSortType);
932 void toggle_full_region_list ();
933 void toggle_show_auto_regions ();
935 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
939 Gtk::ScrolledWindow snapshot_display_scroller;
940 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
941 SnapshotDisplayModelColumns() {
945 Gtk::TreeModelColumn<Glib::ustring> visible_name;
946 Gtk::TreeModelColumn<Glib::ustring> real_name;
949 SnapshotDisplayModelColumns snapshot_display_columns;
950 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
951 Gtk::TreeView snapshot_display;
952 Gtk::Menu snapshot_context_menu;
954 bool snapshot_display_button_press (GdkEventButton*);
955 void snapshot_display_selection_changed ();
956 void redisplay_snapshots();
957 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
959 /* named selections */
961 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
962 NamedSelectionDisplayModelColumns() {
966 Gtk::TreeModelColumn<Glib::ustring> text;
967 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
970 NamedSelectionDisplayModelColumns named_selection_columns;
971 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
973 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
974 Gtk::ScrolledWindow named_selection_scroller;
976 void create_named_selection ();
977 void paste_named_selection (float times);
978 void remove_selected_named_selections ();
979 void remove_snapshot (Glib::ustring);
980 void rename_snapshot (Glib::ustring);
982 void handle_new_named_selection ();
983 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
984 void redisplay_named_selections ();
986 bool named_selection_display_button_release (GdkEventButton *ev);
987 bool named_selection_display_key_release (GdkEventKey *ev);
988 void named_selection_display_selection_changed ();
991 TrackViewList track_views;
992 TimeAxisView *trackview_by_y_position (double ypos);
994 static Gdk::Cursor* cross_hair_cursor;
995 static Gdk::Cursor* trimmer_cursor;
996 static Gdk::Cursor* selector_cursor;
997 static Gdk::Cursor* grabber_cursor;
998 static Gdk::Cursor* grabber_edit_point_cursor;
999 static Gdk::Cursor* zoom_cursor;
1000 static Gdk::Cursor* time_fx_cursor;
1001 static Gdk::Cursor* fader_cursor;
1002 static Gdk::Cursor* speaker_cursor;
1003 static Gdk::Cursor* wait_cursor;
1004 static Gdk::Cursor* timebar_cursor;
1005 static Gdk::Cursor* transparent_cursor;
1007 static void build_cursors ();
1009 sigc::connection scroll_connection;
1010 nframes64_t last_update_frame;
1011 void center_screen (nframes64_t);
1012 void center_screen_internal (nframes64_t, float);
1014 void update_current_screen ();
1016 void session_going_away ();
1018 nframes64_t cut_buffer_start;
1019 nframes64_t cut_buffer_length;
1021 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1022 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1023 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1024 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1025 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1026 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1028 /* KEYMAP HANDLING */
1030 void register_actions ();
1032 int ensure_cursor (nframes64_t* pos);
1034 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
1035 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
1036 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
1037 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
1038 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
1039 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1040 void redisplay_regions ();
1041 bool no_region_list_redisplay;
1042 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
1044 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
1046 void cut_copy (Editing::CutCopyOp);
1047 void cut_copy_points (Editing::CutCopyOp);
1048 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1049 void cut_copy_ranges (Editing::CutCopyOp);
1051 void mouse_paste ();
1052 void paste_internal (nframes64_t position, float times);
1054 /* EDITING OPERATIONS */
1056 void reset_point_selection ();
1057 void toggle_region_mute ();
1058 void toggle_region_lock ();
1059 void toggle_region_opaque ();
1060 void toggle_record_enable ();
1061 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1062 void raise_region ();
1063 void raise_region_to_top ();
1064 void lower_region ();
1065 void lower_region_to_bottom ();
1066 void split_region ();
1067 void split_region_at (nframes64_t);
1068 void split_regions_at (nframes64_t, RegionSelection&);
1069 void split_region_at_transients ();
1070 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1071 void crop_region_to_selection ();
1072 void crop_region_to (nframes64_t start, nframes64_t end);
1073 void set_sync_point (nframes64_t, const RegionSelection&);
1074 void set_region_sync_from_edit_point ();
1075 void remove_region_sync();
1076 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1077 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1078 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1079 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1080 void remove_region ();
1081 void remove_clicked_region ();
1082 void edit_region ();
1083 void rename_region ();
1084 void duplicate_some_regions (RegionSelection&, float times);
1085 void duplicate_selection (float times);
1086 void region_fill_selection ();
1088 void region_fill_track ();
1089 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1090 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1091 void split_multichannel_region();
1092 void reverse_region ();
1093 void normalize_region ();
1094 void denormalize_region ();
1095 void adjust_region_scale_amplitude (bool up);
1097 void do_insert_time ();
1098 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1100 void tab_to_transient (bool forward);
1102 void use_region_as_bar ();
1103 void use_range_as_bar ();
1105 void define_one_bar (nframes64_t start, nframes64_t end);
1107 void audition_region_from_region_list ();
1108 void hide_region_from_region_list ();
1109 void remove_region_from_region_list ();
1111 void align (ARDOUR::RegionPoint);
1112 void align_relative (ARDOUR::RegionPoint);
1115 void reset_focus ();
1121 void paste (float times);
1123 int get_prefix (float&, bool&);
1125 void keyboard_paste ();
1126 void keyboard_insert_region_list_selection ();
1128 void region_from_selection ();
1129 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1131 void play_from_start ();
1132 void play_from_edit_point ();
1133 void play_from_edit_point_and_return ();
1134 void play_selected_region ();
1135 void play_edit_range ();
1136 void loop_selected_region ();
1137 void play_location (ARDOUR::Location&);
1138 void loop_location (ARDOUR::Location&);
1140 void temporal_zoom_selection ();
1141 void temporal_zoom_region (bool both_axes);
1142 void toggle_zoom_region (bool both_axes);
1143 bool zoomed_to_region;
1144 void temporal_zoom_session ();
1145 void temporal_zoom (gdouble scale);
1146 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1147 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1149 void amplitude_zoom (gdouble scale);
1150 void amplitude_zoom_step (bool in);
1152 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1153 void insert_region_list_selection (float times);
1155 void add_external_audio_action (Editing::ImportMode);
1156 void external_audio_dialog ();
1158 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1159 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1161 SoundFileOmega* sfbrowser;
1163 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1165 bool idle_drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1168 const Gtk::SelectionData& data,
1172 void _drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1175 const Gtk::SelectionData& data,
1179 void _do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1180 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1181 bool idle_do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1183 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1184 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1185 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1187 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1188 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool);
1189 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1190 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1192 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1193 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1194 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1195 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1197 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1199 /* generic interthread progress window */
1201 ArdourDialog* interthread_progress_window;
1202 Gtk::Label interthread_progress_label;
1203 Gtk::VBox interthread_progress_vbox;
1204 Gtk::ProgressBar interthread_progress_bar;
1205 Gtk::Button interthread_cancel_button;
1206 Gtk::Label interthread_cancel_label;
1207 sigc::connection interthread_progress_connection;
1208 void interthread_cancel_clicked ();
1209 void build_interthread_progress_window ();
1210 ARDOUR::InterThreadInfo* current_interthread_info;
1213 AnalysisWindow* analysis_window;
1216 /* import specific info */
1218 ARDOUR::Session::import_status import_status;
1219 gint import_progress_timeout (void *);
1220 static void *_import_thread (void *);
1221 void* import_thread ();
1223 /* to support this ... */
1225 void import_audio (bool as_tracks);
1226 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1228 void move_to_start ();
1229 void move_to_end ();
1231 void center_playhead ();
1232 void center_edit_point ();
1233 void edit_cursor_backward ();
1234 void edit_cursor_forward ();
1235 void playhead_forward_to_grid ();
1236 void playhead_backward_to_grid ();
1237 void playhead_backward ();
1238 void playhead_forward ();
1239 void scroll_playhead (bool forward);
1240 void scroll_backward (float pages=0.8f);
1241 void scroll_forward (float pages=0.8f);
1242 void scroll_tracks_down ();
1243 void scroll_tracks_up ();
1244 void delete_sample_forward ();
1245 void delete_sample_backward ();
1246 void delete_screen ();
1247 void search_backwards ();
1248 void search_forwards ();
1250 void clear_markers ();
1251 void clear_ranges ();
1252 void clear_locations ();
1253 void unhide_markers ();
1254 void unhide_ranges ();
1255 void jump_forward_to_mark ();
1256 void jump_backward_to_mark ();
1257 void cursor_align (bool playhead_to_edit);
1259 void remove_last_capture ();
1260 void select_all_selectables_using_time_selection ();
1261 void select_all_selectables_using_loop();
1262 void select_all_selectables_using_punch();
1263 void set_selection_from_range (ARDOUR::Location&);
1264 void set_selection_from_punch ();
1265 void set_selection_from_loop ();
1266 void set_selection_from_audio_region ();
1268 void add_location_mark (nframes64_t where);
1269 void add_location_from_audio_region ();
1270 void add_location_from_selection ();
1271 void set_loop_from_selection (bool play);
1272 void set_punch_from_selection ();
1273 void set_punch_from_region ();
1275 void set_loop_from_edit_range (bool play);
1276 void set_loop_from_region (bool play);
1277 void set_punch_from_edit_range ();
1279 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1280 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1282 void add_location_from_playhead_cursor ();
1283 bool select_new_marker;
1285 void reverse_selection ();
1286 void edit_envelope ();
1288 void start_scrolling ();
1289 void stop_scrolling ();
1292 double last_scrub_x;
1293 int scrubbing_direction;
1294 int scrub_reversals;
1295 int scrub_reverse_distance;
1298 void keyboard_selection_begin ();
1299 void keyboard_selection_finish (bool add);
1300 bool have_pending_keyboard_selection;
1301 nframes64_t pending_keyboard_selection_start;
1303 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1304 void extend_selection_to_end_of_region (bool next);
1305 void extend_selection_to_start_of_region (bool previous);
1307 Editing::SnapType snap_type;
1308 Editing::SnapMode snap_mode;
1309 double snap_threshold;
1311 void handle_gui_changes (const string &, void *);
1313 void hide_all_tracks (bool with_select);
1316 LineDragInfo current_line_drag_info;
1318 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1319 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1320 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1322 void finalize_drag ();
1324 Gtk::Menu fade_context_menu;
1325 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1327 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1329 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1330 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1331 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1332 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1333 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1334 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1336 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1337 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1339 void set_fade_length (bool in);
1340 void toggle_fade_active (bool in);
1341 void set_fade_in_active (bool);
1342 void set_fade_out_active (bool);
1344 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1345 RegionSelection pre_drag_region_selection;
1346 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1347 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1348 bool check_region_drag_possible (AudioTimeAxisView**);
1349 void possibly_copy_regions_during_grab (GdkEvent*);
1350 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1351 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1353 bool _dragging_playhead;
1354 bool _dragging_edit_point;
1356 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1357 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1358 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1359 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1360 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1361 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1362 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1363 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1364 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1366 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1367 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1368 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1369 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1371 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1373 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1374 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1375 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1376 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1377 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1378 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1379 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1380 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1381 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1382 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1383 void start_line_grab (AutomationLine *, GdkEvent*);
1384 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1385 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1386 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1387 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1389 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1391 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1392 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1394 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1395 void brush (nframes64_t);
1397 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1398 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1399 double clamp_verbose_cursor_x (double);
1400 double clamp_verbose_cursor_y (double);
1402 /* Canvas event handlers */
1404 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1405 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1406 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1407 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1408 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1409 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1410 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1411 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1412 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1413 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1416 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1418 ArdourCanvas::Item *last_item_entered;
1419 int last_item_entered_n;
1422 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1423 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1424 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1425 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1426 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1427 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1428 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1429 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1430 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1432 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1433 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1434 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1435 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1436 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1437 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1439 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1440 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1441 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1442 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1443 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1444 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1445 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1446 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1448 /* non-public event handlers */
1450 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1451 bool track_canvas_scroll (GdkEventScroll* event);
1453 bool track_canvas_scroll_event (GdkEventScroll* event);
1454 bool track_canvas_button_press_event (GdkEventButton* event);
1455 bool track_canvas_button_release_event (GdkEventButton* event);
1456 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1458 Gtk::Allocation canvas_allocation;
1459 void track_canvas_allocate (Gtk::Allocation alloc);
1460 bool track_canvas_size_allocated ();
1462 void set_playhead_cursor ();
1464 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1465 void kbd_mute_unmute_region ();
1468 void kbd_do_brush (GdkEvent*);
1469 void kbd_do_audition (GdkEvent*);
1471 void handle_new_duration ();
1472 void initialize_canvas ();
1474 /* display control */
1476 bool _show_measures;
1477 bool _show_waveforms;
1478 bool _follow_playhead;
1479 bool _show_waveforms_recording;
1481 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1483 TempoLines* tempo_lines;
1485 ArdourCanvas::Group* time_line_group;
1486 ArdourCanvas::SimpleLine* get_time_line ();
1487 void hide_measures ();
1488 void draw_measures ();
1489 bool redraw_measures ();
1491 void new_tempo_section ();
1493 void mouse_add_new_tempo_event (nframes64_t where);
1494 void mouse_add_new_meter_event (nframes64_t where);
1496 void remove_tempo_marker (ArdourCanvas::Item*);
1497 void remove_meter_marker (ArdourCanvas::Item*);
1498 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1499 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1501 void edit_tempo_section (ARDOUR::TempoSection*);
1502 void edit_meter_section (ARDOUR::MeterSection*);
1503 void edit_tempo_marker (ArdourCanvas::Item*);
1504 void edit_meter_marker (ArdourCanvas::Item*);
1506 void marker_menu_edit ();
1507 void marker_menu_remove ();
1508 void marker_menu_rename ();
1509 void marker_menu_lock (bool yn);
1510 void marker_menu_hide ();
1511 void marker_menu_loop_range ();
1512 void marker_menu_select_all_selectables_using_range ();
1513 void marker_menu_select_using_range ();
1514 void marker_menu_separate_regions_using_location ();
1515 void marker_menu_play_from ();
1516 void marker_menu_play_range ();
1517 void marker_menu_set_playhead ();
1518 void marker_menu_set_from_playhead ();
1519 void marker_menu_set_from_selection ();
1520 void marker_menu_range_to_next ();
1521 void marker_menu_export_range ();
1522 void new_transport_marker_menu_set_loop ();
1523 void new_transport_marker_menu_set_punch ();
1524 void update_loop_range_view (bool visibility=false);
1525 void update_punch_range_view (bool visibility=false);
1526 void new_transport_marker_menu_popdown ();
1527 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1528 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1529 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1530 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1531 void build_range_marker_menu (bool loop_or_punch);
1532 void build_marker_menu (bool start_or_end);
1533 void build_tm_marker_menu ();
1534 void build_new_transport_marker_menu ();
1536 Gtk::Menu* tm_marker_menu;
1537 Gtk::Menu* marker_menu;
1538 Gtk::Menu* start_end_marker_menu;
1539 Gtk::Menu* range_marker_menu;
1540 Gtk::Menu* transport_marker_menu;
1541 Gtk::Menu* new_transport_marker_menu;
1542 Gtk::Menu* cd_marker_menu;
1543 ArdourCanvas::Item* marker_menu_item;
1545 typedef list<Marker*> Marks;
1548 void remove_metric_marks ();
1549 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1551 void compute_current_bbt_points (nframes_t left, nframes_t right);
1552 void tempo_map_changed (ARDOUR::Change);
1553 void redisplay_tempo (bool immediate_redraw);
1555 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1557 uint32_t bbt_beat_subdivision;
1561 void editor_mixer_button_toggled ();
1563 AudioClock edit_point_clock;
1564 AudioClock zoom_range_clock;
1565 Gtk::Button zoom_in_button;
1566 Gtk::Button zoom_out_button;
1567 Gtk::Button zoom_out_full_button;
1568 Gtk::Button zoom_onetoone_button;
1570 Gtk::VBox toolbar_clock_vbox;
1571 Gtk::VBox toolbar_selection_clock_vbox;
1572 Gtk::Table toolbar_selection_clock_table;
1573 Gtk::Label toolbar_selection_cursor_label;
1575 Gtk::HBox mouse_mode_button_box;
1576 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1577 Gtk::ToggleButton mouse_select_button;
1578 Gtk::ToggleButton mouse_move_button;
1579 Gtk::ToggleButton mouse_gain_button;
1580 Gtk::ToggleButton mouse_zoom_button;
1581 Gtk::ToggleButton mouse_timefx_button;
1582 Gtk::ToggleButton mouse_audition_button;
1583 GroupedButtons *mouse_mode_button_set;
1584 void mouse_mode_toggled (Editing::MouseMode m);
1585 bool ignore_mouse_mode_toggle;
1587 gint mouse_select_button_release (GdkEventButton*);
1589 Gtk::VBox automation_box;
1590 Gtk::Button automation_mode_button;
1591 Gtk::ToggleButton global_automation_button;
1593 Gtk::ComboBoxText edit_mode_selector;
1594 Gtk::VBox edit_mode_box;
1596 void set_edit_mode (ARDOUR::EditMode);
1597 void cycle_edit_mode ();
1598 void edit_mode_selection_done ();
1600 Gtk::ComboBoxText snap_type_selector;
1601 Gtk::ComboBoxText snap_mode_selector;
1604 std::vector<std::string> snap_type_strings;
1605 std::vector<std::string> snap_mode_strings;
1607 void snap_type_selection_done ();
1608 void snap_mode_selection_done ();
1609 void snap_mode_chosen (Editing::SnapMode);
1610 void snap_type_chosen (Editing::SnapType);
1612 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1613 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1615 Gtk::ComboBoxText zoom_focus_selector;
1616 Gtk::VBox zoom_focus_box;
1618 std::vector<std::string> zoom_focus_strings;
1620 void zoom_focus_selection_done ();
1621 void zoom_focus_chosen (Editing::ZoomFocus);
1623 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1627 void zoom_adjustment_changed();
1629 void edit_point_clock_changed();
1631 void setup_toolbar ();
1633 Gtkmm2ext::TearOff* tools_tearoff;
1634 Gtk::HBox toolbar_hbox;
1635 Gtk::EventBox toolbar_base;
1636 Gtk::Frame toolbar_frame;
1638 /* selection process */
1640 Selection* selection;
1641 Selection* cut_buffer;
1643 void time_selection_changed ();
1644 void track_selection_changed ();
1645 void region_selection_changed ();
1646 void sensitize_the_right_region_actions (bool have_selected_regions);
1647 void point_selection_changed ();
1648 void marker_selection_changed ();
1657 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1658 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1659 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1660 void cancel_selection ();
1662 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1663 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1664 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1666 bool audio_region_selection_covers (nframes64_t where);
1668 /* transport range select process */
1669 enum RangeMarkerOp {
1671 CreateTransportMarker,
1675 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1676 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1677 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1679 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1680 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1681 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1682 ArdourCanvas::Line* marker_drag_line;
1683 ArdourCanvas::Points marker_drag_line_points;
1684 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1686 void update_marker_drag_item (ARDOUR::Location *);
1688 ArdourCanvas::SimpleRect *bogus_background_rect;
1690 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1691 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1692 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1693 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1694 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1695 ArdourCanvas::SimpleLine *transport_punchin_line;
1696 ArdourCanvas::SimpleLine *transport_punchout_line;
1697 ArdourCanvas::SimpleRect *transport_preroll_rect;
1698 ArdourCanvas::SimpleRect *transport_postroll_rect;
1700 ARDOUR::Location* transport_loop_location();
1701 ARDOUR::Location* transport_punch_location();
1703 ARDOUR::Location *temp_location;
1705 /* object rubberband select process */
1707 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1708 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1709 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1711 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1713 ArdourCanvas::SimpleRect *rubberband_rect;
1715 /* mouse zoom process */
1717 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1718 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1719 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1721 ArdourCanvas::SimpleRect *zoom_rect;
1722 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1724 /* diskstream/route display management */
1726 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1727 RouteDisplayModelColumns() {
1730 add (temporary_visible);
1734 Gtk::TreeModelColumn<Glib::ustring> text;
1735 Gtk::TreeModelColumn<bool> visible;
1736 Gtk::TreeModelColumn<bool> temporary_visible;
1737 Gtk::TreeModelColumn<TimeAxisView*> tv;
1738 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1741 RouteDisplayModelColumns route_display_columns;
1742 Glib::RefPtr<Gtk::ListStore> route_display_model;
1743 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1745 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1746 Gtk::ScrolledWindow route_list_scroller;
1747 Gtk::Menu* route_list_menu;
1749 void update_route_visibility ();
1751 void sync_order_keys (const char*);
1752 bool route_redisplay_does_not_sync_order_keys;
1753 bool route_redisplay_does_not_reset_order_keys;
1755 bool route_list_display_button_press (GdkEventButton*);
1756 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1759 const Gtk::SelectionData& data,
1763 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1765 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1766 void route_list_delete (const Gtk::TreeModel::Path&);
1767 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1769 void initial_route_list_display ();
1770 void redisplay_route_list();
1771 bool ignore_route_list_reorder;
1772 bool no_route_list_redisplay;
1774 void build_route_list_menu ();
1775 void show_route_list_menu ();
1777 void show_all_routes ();
1778 void hide_all_routes ();
1779 void show_all_audiotracks ();
1780 void hide_all_audiotracks ();
1781 void show_all_audiobus ();
1782 void hide_all_audiobus ();
1784 void set_all_tracks_visibility (bool yn);
1785 void set_all_audio_visibility (int type, bool yn);
1787 /* edit group management */
1789 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1790 GroupListModelColumns () {
1796 Gtk::TreeModelColumn<bool> is_active;
1797 Gtk::TreeModelColumn<bool> is_visible;
1798 Gtk::TreeModelColumn<std::string> text;
1799 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1802 GroupListModelColumns group_columns;
1803 Glib::RefPtr<Gtk::ListStore> group_model;
1804 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1806 Gtk::TreeView edit_group_display;
1807 Gtk::ScrolledWindow edit_group_display_scroller;
1808 Gtk::Menu* edit_group_list_menu;
1810 void build_edit_group_list_menu ();
1811 void activate_all_edit_groups ();
1812 void disable_all_edit_groups ();
1814 bool in_edit_group_row_change;
1815 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1816 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1817 void new_edit_group ();
1818 void edit_group_list_button_clicked ();
1819 gint edit_group_list_button_press_event (GdkEventButton* ev);
1820 void add_edit_group (ARDOUR::RouteGroup* group);
1821 void remove_selected_edit_group ();
1822 void edit_groups_changed ();
1823 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1825 Gtk::VBox list_vpacker;
1829 bool autoscroll_active;
1830 int autoscroll_timeout_tag;
1833 int last_autoscroll_x;
1834 int last_autoscroll_y;
1835 uint32_t autoscroll_cnt;
1836 nframes64_t autoscroll_x_distance;
1837 double autoscroll_y_distance;
1839 static gint _autoscroll_canvas (void *);
1840 bool autoscroll_canvas ();
1841 void start_canvas_autoscroll (int x, int y);
1842 void stop_canvas_autoscroll ();
1843 void maybe_autoscroll (GdkEventMotion*);
1844 void maybe_autoscroll_horizontally (GdkEventMotion*);
1845 bool allow_vertical_scroll;
1854 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1855 void point_trim (GdkEvent*);
1856 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1857 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1858 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1859 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1861 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1862 void thaw_region_after_trim (RegionView& rv);
1864 void trim_region_front();
1865 void trim_region_back();
1866 void trim_region (bool front);
1868 void trim_region_to_edit_point ();
1869 void trim_region_from_edit_point ();
1870 void trim_region_to_loop ();
1871 void trim_region_to_punch ();
1872 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1874 bool show_gain_after_trim;
1878 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1879 const Glib::RefPtr<Gdk::DragContext>& context,
1882 const Gtk::SelectionData& data,
1886 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1889 const Gtk::SelectionData& data,
1893 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1896 const Gtk::SelectionData& data,
1900 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1903 const Gtk::SelectionData& data,
1907 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1910 const Gtk::SelectionData& data,
1916 ExportDialog *export_dialog;
1917 ExportDialog *export_range_markers_dialog;
1919 void export_range (nframes64_t start, nframes64_t end);
1920 void export_range_markers ();
1922 int write_region_selection(RegionSelection&);
1923 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1924 void export_region ();
1925 void bounce_region_selection ();
1926 void bounce_range_selection (bool replace);
1927 void external_edit_region ();
1929 int write_audio_selection (TimeSelection&);
1930 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1932 void write_selection ();
1936 UndoAction get_memento() const;
1938 XMLNode *before; /* used in *_reversible_command */
1939 void begin_reversible_command (string cmd_name);
1940 void commit_reversible_command ();
1942 void update_title ();
1943 void update_title_s (const string & snapshot_name);
1946 Selection* selection;
1947 double frames_per_unit;
1953 void store_state (State&) const;
1954 void restore_state (State *);
1956 void instant_save ();
1958 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1960 /* freeze operations */
1962 ARDOUR::InterThreadInfo freeze_status;
1963 gint freeze_progress_timeout (void *);
1964 static void* _freeze_thread (void*);
1965 void* freeze_thread ();
1967 void freeze_route ();
1968 void unfreeze_route ();
1970 /* edit-group solo + mute */
1972 void set_edit_group_solo (ARDOUR::Route&, bool);
1973 void set_edit_group_mute (ARDOUR::Route&, bool);
1977 void duplicate_dialog (bool with_dialog);
1979 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1981 /* returns false if mouse pointer is not in track or marker canvas
1983 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1985 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1986 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1987 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1989 struct TimeFXDialog : public ArdourDialog {
1990 ARDOUR::TimeFXRequest request;
1993 Gtk::Adjustment pitch_octave_adjustment;
1994 Gtk::Adjustment pitch_semitone_adjustment;
1995 Gtk::Adjustment pitch_cent_adjustment;
1996 Gtk::SpinButton pitch_octave_spinner;
1997 Gtk::SpinButton pitch_semitone_spinner;
1998 Gtk::SpinButton pitch_cent_spinner;
1999 RegionSelection regions;
2000 Gtk::ProgressBar progress_bar;
2003 Gtk::ToggleButton quick_button;
2004 Gtk::ToggleButton antialias_button;
2005 Gtk::HBox upper_button_box;
2008 Gtk::ComboBoxText stretch_opts_selector;
2009 Gtk::Label stretch_opts_label;
2010 Gtk::ToggleButton precise_button;
2013 Gtk::Button* cancel_button;
2014 Gtk::Button* action_button;
2018 TimeFXDialog (Editor& e, bool for_pitch);
2020 gint update_progress ();
2021 sigc::connection first_cancel;
2022 sigc::connection first_delete;
2023 void cancel_in_progress ();
2024 gint delete_in_progress (GdkEventAny*);
2027 /* "whats mine is yours" */
2029 friend class TimeFXDialog;
2031 TimeFXDialog* current_timefx;
2033 static void* timefx_thread (void *arg);
2034 void do_timefx (TimeFXDialog&);
2036 int time_stretch (RegionSelection&, float fraction);
2037 int pitch_shift (RegionSelection&, float cents);
2038 void pitch_shift_regions ();
2039 int time_fx (RegionSelection&, float val, bool pitching);
2041 /* editor-mixer strip */
2043 MixerStrip *current_mixer_strip;
2044 bool show_editor_mixer_when_tracks_arrive;
2045 Gtk::VBox current_mixer_strip_vbox;
2046 void cms_deleted ();
2047 void current_mixer_strip_hidden ();
2048 void current_mixer_strip_removed ();
2050 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2051 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2053 void ensure_all_elements_drawn ();
2055 /* nudging tracks */
2057 void nudge_track (bool use_edit_point, bool forwards);
2061 bool _xfade_visibility;
2063 /* <CMT Additions> */
2064 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2065 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2067 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2068 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2070 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2071 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2072 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2074 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2075 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2076 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2077 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2079 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2080 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2081 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2082 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2084 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2085 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2086 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2087 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2088 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2089 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2091 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2092 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2093 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2094 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2095 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2096 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2098 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2099 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2101 ImageFrameSocketHandler* image_socket_listener ;
2102 /* </CMT Additions> */
2104 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2105 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2106 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2107 void xfade_edit_left_region ();
2108 void xfade_edit_right_region ();
2110 static const int32_t default_width = 995;
2111 static const int32_t default_height = 765;
2115 Gtk::Button nudge_forward_button;
2116 Gtk::Button nudge_backward_button;
2117 Gtk::HBox nudge_hbox;
2118 Gtk::VBox nudge_vbox;
2119 AudioClock nudge_clock;
2121 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2123 bool nudge_forward_release (GdkEventButton*);
2124 bool nudge_backward_release (GdkEventButton*);
2128 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2130 /* handling cleanup */
2132 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2134 vector<sigc::connection> session_connections;
2136 /* tracking step changes of track height */
2138 TimeAxisView* current_stepping_trackview;
2139 ARDOUR::microseconds_t last_track_height_step_timestamp;
2140 gint track_height_step_timeout();
2141 sigc::connection step_timeout;
2143 TimeAxisView* entered_track;
2144 RegionView* entered_regionview;
2147 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2148 bool clear_entered_track;
2149 bool left_track_canvas (GdkEventCrossing*);
2150 bool entered_track_canvas (GdkEventCrossing*);
2151 void set_entered_track (TimeAxisView*);
2152 void set_entered_regionview (RegionView*);
2153 void ensure_track_visible (TimeAxisView*);
2154 gint left_automation_track ();
2156 bool _new_regionviews_show_envelope;
2158 void reset_canvas_action_sensitivity (bool);
2159 void toggle_gain_envelope_visibility ();
2160 void toggle_gain_envelope_active ();
2161 void reset_region_gain_envelopes ();
2163 bool on_key_press_event (GdkEventKey*);
2164 bool on_key_release_event (GdkEventKey*);
2166 void session_state_saved (string);
2168 Glib::RefPtr<Gtk::Action> undo_action;
2169 Glib::RefPtr<Gtk::Action> redo_action;
2171 void history_changed ();
2172 void color_handler ();
2174 Gtk::HBox status_bar_hpacker;
2176 Editing::EditPoint _edit_point;
2178 Gtk::ComboBoxText edit_point_selector;
2180 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2181 void cycle_edit_point (bool with_marker);
2182 void set_edit_point ();
2183 void edit_point_selection_done ();
2184 void edit_point_chosen (Editing::EditPoint);
2185 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2186 std::vector<std::string> edit_point_strings;
2188 void selected_marker_moved (ARDOUR::Location*);
2189 sigc::connection edit_point_clock_connection_a;
2190 sigc::connection edit_point_clock_connection_b;
2192 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2194 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2195 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2197 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2199 sigc::connection fast_screen_update_connection;
2200 gint start_updating ();
2201 gint stop_updating ();
2202 void fast_update_strips ();
2203 bool meters_running;
2205 void select_next_route ();
2206 void select_prev_route ();
2208 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2210 RhythmFerret* rhythm_ferret;
2213 void set_track_height (uint32_t h);
2214 void set_track_height_largest ();
2215 void set_track_height_large ();
2216 void set_track_height_larger ();
2217 void set_track_height_normal ();
2218 void set_track_height_smaller ();
2219 void set_track_height_small ();
2221 void remove_tracks ();
2222 void toggle_tracks_active ();
2223 void waveform_scale_chosen (Editing::WaveformScale);
2227 int32_t resize_idle_target;
2229 friend gboolean _idle_resize (gpointer);
2230 std::vector<TimeAxisView*> pending_resizes;
2233 #endif /* __ardour_editor_h__ */