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__
30 #include <glibmm/ustring.h>
32 #include <boost/optional.hpp>
34 #include <libgnomecanvasmm/canvas.h>
35 #include <libgnomecanvasmm/group.h>
36 #include <libgnomecanvasmm/line.h>
37 #include <libgnomecanvasmm/pixbuf.h>
41 #include <gtkmm/layout.h>
42 #include <gtkmm/comboboxtext.h>
44 #include <gtkmm2ext/selector.h>
45 #include <gtkmm2ext/click_box.h>
46 #include <gtkmm2ext/dndtreeview.h>
48 #include "pbd/stateful.h"
49 #include "ardour/session.h"
50 #include "ardour/tempo.h"
51 #include "ardour/stretch.h"
52 #include "ardour/location.h"
53 #include "ardour/audioregion.h"
54 #include "ardour/track.h"
55 #include "ardour/types.h"
56 #include "ardour/route_group.h"
58 #include "audio_clock.h"
59 #include "gtk-custom-ruler.h"
60 #include "ardour_dialog.h"
61 #include "public_editor.h"
64 #include "editor_items.h"
65 #include "region_selection.h"
67 #include "editor_summary.h"
74 class AudioDiskstream;
93 class AudioRegionView;
94 class AudioStreamView;
95 class AudioTimeAxisView;
97 class AutomationSelection;
98 class AutomationTimeAxisView;
103 class GlobalPortMatrixWindow;
104 class GroupedButtons;
107 class PlaylistSelector;
108 class PluginSelector;
111 class SoundFileOmega;
117 class TrackSelection;
118 class EditorGroupTabs;
120 /* <CMT Additions> */
121 class ImageFrameView;
122 class ImageFrameTimeAxisView;
123 class ImageFrameTimeAxis;
124 class MarkerTimeAxis ;
126 class ImageFrameSocketHandler ;
127 class TimeAxisViewItem ;
128 /* </CMT Additions> */
130 struct EditorCursor {
132 ArdourCanvas::Points points;
133 ArdourCanvas::Line canvas_item;
134 nframes64_t current_frame;
137 EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
140 void set_position (nframes64_t);
141 void set_length (double units);
142 void set_y_axis (double position);
144 sigc::signal<void, nframes64_t> PositionChanged;
147 class Editor : public PublicEditor
153 void connect_to_session (ARDOUR::Session *);
154 ARDOUR::Session* current_session() const { return session; }
156 virtual bool have_idled () const { return _have_idled; }
158 nframes64_t leftmost_position() const { return leftmost_frame; }
160 nframes64_t current_page_frames() const {
161 return (nframes64_t) floor (_canvas_width * frames_per_unit);
164 double canvas_height () const {
165 return _canvas_height;
168 void cycle_snap_mode ();
169 void cycle_snap_choice ();
170 void set_snap_to (Editing::SnapType);
171 void set_snap_mode (Editing::SnapMode);
172 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
174 void undo (uint32_t n = 1);
175 void redo (uint32_t n = 1);
177 XMLNode& get_state ();
178 int set_state (const XMLNode& );
180 void set_mouse_mode (Editing::MouseMode, bool force=true);
181 void step_mouse_mode (bool next);
182 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
184 void set_midi_edit_cursor (Editing::MidiEditMode);
185 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
186 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
189 void add_imageframe_time_axis(const std::string & track_name, void*) ;
190 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
191 void connect_to_image_compositor() ;
192 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
195 TimeAxisView* get_named_time_axis(const std::string & name) ;
196 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
197 void add_to_idle_resize (TimeAxisView*, int32_t);
199 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
201 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
202 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
203 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
205 #ifdef USE_RUBBERBAND
206 std::vector<std::string> rb_opt_strings;
209 /* option editor-access */
211 void set_show_waveforms_recording (bool yn);
212 bool show_waveforms_recording() const { return _show_waveforms_recording; }
214 /* things that need to be public to be used in the main menubar */
216 void new_region_from_selection ();
217 void separate_regions_between (const TimeSelection&);
218 void separate_region_from_selection ();
219 void separate_region_from_punch ();
220 void separate_region_from_loop ();
221 void separate_regions_using_location (ARDOUR::Location&);
222 void toggle_playback (bool with_abort);
223 void transition_to_rolling (bool forward);
227 nframes64_t unit_to_frame (double unit) const {
228 return (nframes64_t) rint (unit * frames_per_unit);
231 double frame_to_unit (nframes64_t frame) const {
232 return rint ((double) frame / (double) frames_per_unit);
235 double frame_to_unit (double frame) const {
236 return rint (frame / frames_per_unit);
239 /* NOTE: these functions assume that the "pixel" coordinate is
240 the result of using the world->canvas affine transform on a
241 world coordinate. These coordinates already take into
242 account any scrolling carried out by adjusting the
246 nframes64_t pixel_to_frame (double pixel) const {
248 /* pixel can be less than zero when motion events
249 are processed. since we've already run the world->canvas
250 affine, that means that the location *really* is "off
251 to the right" and thus really is "before the start".
255 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
261 gulong frame_to_pixel (nframes64_t frame) const {
262 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
265 void flush_canvas ();
269 Selection& get_selection() const { return *selection; }
270 Selection& get_cut_buffer() const { return *cut_buffer; }
272 bool extend_selection_to_track (TimeAxisView&);
274 void play_selection ();
275 void select_all_in_track (Selection::Operation op);
276 void select_all (Selection::Operation op);
277 void invert_selection_in_track ();
278 void invert_selection ();
279 void deselect_all ();
283 void set_show_measures (bool yn);
284 bool show_measures () const { return _show_measures; }
286 /* analysis window */
288 void analyze_region_selection();
289 void analyze_range_selection();
293 void export_audio ();
294 void export_selection ();
295 void export_range ();
296 void export_region ();
298 void add_toplevel_controls (Gtk::Container&);
299 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
301 void set_zoom_focus (Editing::ZoomFocus);
302 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
303 double get_current_zoom () const { return frames_per_unit; }
305 void temporal_zoom_step (bool coarser);
307 /* stuff that AudioTimeAxisView and related classes use */
309 PlaylistSelector& playlist_selector() const;
310 void route_name_changed (TimeAxisView *);
311 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
313 void new_playlists (TimeAxisView* v);
314 void copy_playlists (TimeAxisView* v);
315 void clear_playlists (TimeAxisView* v);
317 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
318 void get_onscreen_tracks (TrackViewList&);
320 Width editor_mixer_strip_width;
321 void maybe_add_mixer_strip_width (XMLNode&);
322 void show_editor_mixer (bool yn);
323 void create_editor_mixer ();
324 void show_editor_list (bool yn);
325 void set_selected_mixer_strip (TimeAxisView&);
326 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
327 void show_track_in_display (TimeAxisView& tv);
329 /* nudge is initiated by transport controls owned by ARDOUR_UI */
331 void nudge_forward (bool next, bool force_playhead);
332 void nudge_backward (bool next, bool force_playhead);
334 /* nudge initiated from context menu */
336 void nudge_forward_capture_offset ();
337 void nudge_backward_capture_offset ();
339 /* playhead/screen stuff */
341 void set_follow_playhead (bool yn);
342 void toggle_follow_playhead ();
343 bool follow_playhead() const { return _follow_playhead; }
344 bool dragging_playhead () const { return _dragging_playhead; }
346 void toggle_zero_line_visibility ();
347 void toggle_waveforms_while_recording ();
349 void set_group_tabs ();
350 void toggle_measure_visibility ();
351 void toggle_logo_visibility ();
353 double get_physical_screen_width () const { return physical_screen_width; };
354 double physical_screen_width;
355 double physical_screen_height;
359 void toggle_selected_region_fades (int dir);
360 void update_region_fade_visibility ();
361 bool xfade_visibility() const { return _xfade_visibility; }
362 void update_xfade_visibility ();
364 /* redirect shared ops menu. caller must free returned menu */
366 Gtk::Menu* redirect_menu ();
368 /* floating windows/transient */
370 void ensure_float (Gtk::Window&);
374 void scroll_tracks_down_line ();
375 void scroll_tracks_up_line ();
377 void move_selected_tracks (bool up);
379 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
380 void prepare_for_cleanup ();
381 void finish_cleanup ();
383 void maximise_editing_space();
384 void restore_editing_space();
386 void reset_x_origin (nframes64_t);
387 void reset_y_origin (double);
388 void reset_zoom (double);
389 void reposition_and_zoom (nframes64_t, double);
391 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
393 bool update_mouse_speed ();
394 bool decelerate_mouse_speed ();
396 void toggle_meter_updating();
398 void show_rhythm_ferret();
399 void show_bundle_manager ();
400 void show_global_port_matrix (ARDOUR::DataType);
402 void goto_visual_state (uint32_t);
403 void save_visual_state (uint32_t);
405 void update_rec_display ();
408 void map_transport_state ();
409 void map_position_change (nframes64_t);
415 /// The session that we are editing, or 0
416 void color_handler ();
417 ARDOUR::Session *session;
420 // to keep track of the playhead position for control_scroll
421 boost::optional<nframes64_t> _control_scroll_target;
423 PlaylistSelector* _playlist_selector;
425 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
429 double frames_per_unit;
430 nframes64_t leftmost_frame;
431 Editing::ZoomFocus zoom_focus;
432 bool zoomed_to_region;
433 std::list<TAVState> track_states;
436 std::list<VisualState*> undo_visual_stack;
437 std::list<VisualState*> redo_visual_stack;
438 VisualState* current_visual_state (bool with_tracks = true);
439 void undo_visual_state ();
440 void redo_visual_state ();
441 void use_visual_state (VisualState&);
443 void swap_visual_state ();
445 std::vector<VisualState*> visual_states;
446 sigc::connection visual_state_op_connection;
447 void start_visual_state_op (uint32_t n);
448 void cancel_visual_state_op (uint32_t n);
449 bool end_visual_state_op (uint32_t n);
451 nframes64_t leftmost_frame;
452 double frames_per_unit;
453 Editing::ZoomFocus zoom_focus;
455 void set_frames_per_unit (double);
458 Editing::MouseMode mouse_mode;
459 Editing::MidiEditMode midi_edit_mode;
461 int post_maximal_editor_width;
462 int post_maximal_pane_position;
463 int pre_maximal_pane_position;
464 int pre_maximal_editor_width;
465 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
467 Gtk::Notebook the_notebook;
468 Gtk::HPaned edit_pane;
470 Gtk::EventBox meter_base;
472 Gtk::EventBox marker_base;
473 Gtk::HBox marker_box;
474 Gtk::VBox scrollers_rulers_markers_box;
476 void location_changed (ARDOUR::Location *);
477 void location_flags_changed (ARDOUR::Location *, void *);
478 void refresh_location_display ();
479 void refresh_location_display_s (ARDOUR::Change);
480 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
481 void add_new_location (ARDOUR::Location *);
482 void location_gone (ARDOUR::Location *);
483 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
484 gint really_remove_marker (ARDOUR::Location* loc);
485 void goto_nth_marker (int nth);
487 uint32_t location_marker_color;
488 uint32_t location_range_color;
489 uint32_t location_loop_color;
490 uint32_t location_punch_color;
491 uint32_t location_cd_marker_color;
493 struct LocationMarkers {
498 LocationMarkers () : start(0), end(0), valid (true) {}
504 void set_name (const std::string&);
505 void set_position (nframes64_t start, nframes64_t end = 0);
506 void set_color_rgba (uint32_t);
509 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
510 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
511 Marker* entered_marker;
513 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
514 LocationMarkerMap location_markers;
516 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
517 void clear_marker_display ();
518 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
519 bool choose_new_marker_name(std::string &name);
520 void update_cd_marker_display ();
521 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
523 TimeAxisView* clicked_axisview;
524 RouteTimeAxisView* clicked_routeview;
525 /** The last RegionView that was clicked on, or 0 if the last click was not
526 * on a RegionView. This is set up by the canvas event handlers in
527 * editor_canvas_events.cc
529 RegionView* clicked_regionview;
530 RegionSelection latest_regionviews;
531 uint32_t clicked_selection;
532 CrossfadeView* clicked_crossfadeview;
533 ControlPoint* clicked_control_point;
535 void sort_track_selection (TrackSelection* sel = 0);
537 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks) const;
538 void get_equivalent_tracks (RouteTimeAxisView*, std::set<RouteTimeAxisView*> &, ARDOUR::RouteGroup::Property) const;
539 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, ARDOUR::RouteGroup::Property) const;
540 RegionSelection get_equivalent_regions (RegionSelection &, ARDOUR::RouteGroup::Property) const;
541 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, ARDOUR::RouteGroup::Property) const;
543 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
545 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView *, std::vector<RegionView*>*) const;
546 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
547 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
548 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
552 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
553 bool button_release_can_deselect;
555 void catch_vanishing_regionview (RegionView *);
557 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
558 void select_all_tracks ();
560 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
562 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
563 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
564 void set_selected_track_as_side_effect (bool force = false);
565 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
567 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
568 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
569 void collect_new_region_view (RegionView *);
570 void collect_and_select_new_region_view (RegionView *);
572 Gtk::Menu track_context_menu;
573 Gtk::Menu track_region_context_menu;
574 Gtk::Menu track_selection_context_menu;
575 Gtk::Menu track_crossfade_context_menu;
577 Gtk::MenuItem* region_edit_menu_split_item;
578 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
579 Gtk::Menu * track_region_edit_playlist_menu;
580 Gtk::Menu * track_edit_playlist_submenu;
581 Gtk::Menu * track_selection_edit_playlist_submenu;
583 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
584 Gtk::Menu* build_track_context_menu (nframes64_t);
585 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
586 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
587 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
588 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
589 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
590 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
591 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
592 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
593 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
595 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
597 void handle_new_route (ARDOUR::RouteList&);
598 void remove_route (TimeAxisView *);
601 Gtk::HBox global_hpacker;
602 Gtk::VBox global_vpacker;
605 Gdk::Cursor* current_canvas_cursor;
606 void set_canvas_cursor ();
607 Gdk::Cursor* which_grabber_cursor ();
609 ArdourCanvas::Canvas* track_canvas;
611 ArdourCanvas::Text* verbose_canvas_cursor;
612 bool verbose_cursor_visible;
614 void parameter_changed (std::string);
616 bool track_canvas_motion (GdkEvent*);
618 void set_verbose_canvas_cursor (const std::string &, double x, double y);
619 void set_verbose_canvas_cursor_text (const std::string &);
620 void show_verbose_canvas_cursor();
621 void hide_verbose_canvas_cursor();
623 bool verbose_cursor_on; // so far unused
625 Gtk::EventBox time_canvas_event_box;
626 Gtk::EventBox track_canvas_event_box;
627 Gtk::EventBox time_button_event_box;
628 Gtk::EventBox ruler_label_event_box;
630 ArdourCanvas::Group *minsec_group;
631 ArdourCanvas::Pixbuf *logo_item;
632 ArdourCanvas::Group *bbt_group;
633 ArdourCanvas::Group *smpte_group;
634 ArdourCanvas::Group *frame_group;
635 ArdourCanvas::Group *tempo_group;
636 ArdourCanvas::Group *meter_group;
637 ArdourCanvas::Group *marker_group;
638 ArdourCanvas::Group *range_marker_group;
639 ArdourCanvas::Group *transport_marker_group;
640 ArdourCanvas::Group* cd_marker_group;
642 ArdourCanvas::Group* timebar_group;
644 /* These bars never need to be scrolled */
645 ArdourCanvas::Group* meter_bar_group;
646 ArdourCanvas::Group* tempo_bar_group;
647 ArdourCanvas::Group* marker_bar_group;
648 ArdourCanvas::Group* range_marker_bar_group;
649 ArdourCanvas::Group* transport_marker_bar_group;
650 ArdourCanvas::Group* cd_marker_bar_group;
652 /** The group containing all items that require horizontal scrolling. */
653 ArdourCanvas::Group* _background_group;
655 The _master_group is the group containing all items
656 that require horizontal scrolling..
657 It is primarily used to separate canvas items
658 that require horizontal scrolling from those that do not.
660 ArdourCanvas::Group* _master_group;
662 /* The group containing all trackviews. Only scrolled vertically. */
663 ArdourCanvas::Group* _trackview_group;
665 /* The group used for region motion. Sits on top of _trackview_group */
666 ArdourCanvas::Group* _region_motion_group;
669 ruler_metric_smpte = 0,
670 ruler_metric_bbt = 1,
671 ruler_metric_frames = 2,
672 ruler_metric_minsec = 3,
674 ruler_time_tempo = 4,
675 ruler_time_meter = 5,
676 ruler_time_marker = 6,
677 ruler_time_range_marker = 7,
678 ruler_time_transport_marker = 8,
679 ruler_time_cd_marker = 9,
682 static GtkCustomMetric ruler_metrics[4];
683 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
686 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
687 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
688 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
689 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
690 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
691 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
692 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
693 bool no_ruler_shown_update;
695 gint ruler_button_press (GdkEventButton*);
696 gint ruler_button_release (GdkEventButton*);
697 gint ruler_mouse_motion (GdkEventMotion*);
698 bool ruler_scroll (GdkEventScroll* event);
700 Gtk::Widget * ruler_grabbed_widget;
702 void initialize_rulers ();
703 void update_just_smpte ();
704 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
705 void update_fixed_rulers ();
706 void update_tempo_based_rulers ();
707 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
708 void update_ruler_visibility ();
709 void set_ruler_visible (RulerType, bool);
710 void toggle_ruler_visibility (RulerType rt);
711 void ruler_toggled (int);
712 gint ruler_label_button_release (GdkEventButton*);
713 void store_ruler_visibility ();
714 void restore_ruler_visibility ();
716 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
717 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
718 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
719 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
721 enum MinsecRulerScale {
728 MinsecRulerScale minsec_ruler_scale;
730 nframes_t minsec_mark_interval;
731 gint minsec_mark_modulo;
733 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
735 enum SMPTERulerScale {
743 SMPTERulerScale smpte_ruler_scale;
745 nframes_t smpte_mark_interval;
746 gint smpte_mark_modulo;
748 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
758 bbt_show_ticks_detail,
759 bbt_show_ticks_super_detail
762 BBTRulerScale bbt_ruler_scale;
766 uint32_t bbt_bar_helper_on;
767 uint32_t bbt_accent_modulo;
768 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
770 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
771 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
772 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
773 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
775 Gtk::Widget *_ruler_separator;
776 GtkWidget *_smpte_ruler;
777 GtkWidget *_bbt_ruler;
778 GtkWidget *_frames_ruler;
779 GtkWidget *_minsec_ruler;
780 Gtk::Widget *smpte_ruler;
781 Gtk::Widget *bbt_ruler;
782 Gtk::Widget *frames_ruler;
783 Gtk::Widget *minsec_ruler;
784 static Editor *ruler_editor;
786 static const double timebar_height;
787 guint32 visible_timebars;
788 gdouble canvas_timebars_vsize;
789 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
790 Gtk::Menu *editor_ruler_menu;
792 ArdourCanvas::SimpleRect* tempo_bar;
793 ArdourCanvas::SimpleRect* meter_bar;
794 ArdourCanvas::SimpleRect* marker_bar;
795 ArdourCanvas::SimpleRect* range_marker_bar;
796 ArdourCanvas::SimpleRect* transport_marker_bar;
797 ArdourCanvas::SimpleRect* cd_marker_bar;
799 Gtk::Label minsec_label;
800 Gtk::Label bbt_label;
801 Gtk::Label smpte_label;
802 Gtk::Label frame_label;
803 Gtk::Label tempo_label;
804 Gtk::Label meter_label;
805 Gtk::Label mark_label;
806 Gtk::Label range_mark_label;
807 Gtk::Label transport_mark_label;
808 Gtk::Label cd_mark_label;
810 Gtk::VBox time_button_vbox;
811 Gtk::HBox time_button_hbox;
813 friend class EditorCursor;
815 EditorCursor* playhead_cursor;
816 ArdourCanvas::Group* cursor_group;
818 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
820 void cursor_to_region_boundary (bool with_selection, int32_t dir);
821 void cursor_to_next_region_boundary (bool with_selection);
822 void cursor_to_previous_region_boundary (bool with_selection);
823 void cursor_to_next_region_point (EditorCursor*, ARDOUR::RegionPoint);
824 void cursor_to_previous_region_point (EditorCursor*, ARDOUR::RegionPoint);
825 void cursor_to_region_point (EditorCursor*, ARDOUR::RegionPoint, int32_t dir);
826 void cursor_to_selection_start (EditorCursor *);
827 void cursor_to_selection_end (EditorCursor *);
829 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
830 void selected_marker_to_next_region_boundary (bool with_selection);
831 void selected_marker_to_previous_region_boundary (bool with_selection);
832 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
833 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
834 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
835 void selected_marker_to_selection_start ();
836 void selected_marker_to_selection_end ();
838 void select_all_selectables_using_cursor (EditorCursor *, bool);
839 void select_all_selectables_using_edit (bool);
840 void select_all_selectables_between (bool within);
841 void select_range_between ();
843 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
844 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
846 std::vector<nframes64_t> region_boundary_cache;
847 void build_region_boundary_cache ();
850 Gtk::HBox bottom_hbox;
852 Gtk::Table edit_packer;
853 Gtk::VScrollbar edit_vscrollbar;
855 Gtk::Adjustment vertical_adjustment;
856 Gtk::Adjustment horizontal_adjustment;
858 Gtk::Layout controls_layout;
859 bool control_layout_scroll (GdkEventScroll* ev);
860 void controls_layout_size_request (Gtk::Requisition*);
861 sigc::connection controls_layout_size_request_connection;
863 Gtk::HScrollbar edit_hscrollbar;
864 bool _dragging_hscrollbar;
866 void reset_hscrollbar_stepping ();
868 bool hscrollbar_button_press (GdkEventButton*);
869 bool hscrollbar_button_release (GdkEventButton*);
870 void hscrollbar_allocate (Gtk::Allocation &alloc);
872 double _canvas_width;
873 double _canvas_height;
874 double full_canvas_height;
876 bool track_canvas_map_handler (GdkEventAny*);
878 gint edit_controls_button_release (GdkEventButton*);
879 Gtk::Menu *edit_controls_left_menu;
880 Gtk::Menu *edit_controls_right_menu;
882 Gtk::VBox ruler_label_vbox;
883 Gtk::VBox track_canvas_vbox;
884 Gtk::VBox time_canvas_vbox;
885 Gtk::VBox edit_controls_vbox;
886 Gtk::HBox edit_controls_hbox;
888 void control_scroll (float);
889 void access_action (std::string,std::string);
890 bool deferred_control_scroll (nframes64_t);
891 sigc::connection control_scroll_connection;
893 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
895 ArdourCanvas::Group* get_background_group () const { return _background_group; }
896 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
897 double last_trackview_group_vertical_offset;
898 void tie_vertical_scrolling ();
899 void scroll_canvas_horizontally ();
900 void scroll_canvas_vertically ();
902 struct VisualChange {
910 nframes64_t time_origin;
911 double frames_per_unit;
916 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
918 pending = Type (pending | t);
923 VisualChange pending_visual_change;
925 static int _idle_visual_changer (void *arg);
926 int idle_visual_changer ();
928 void queue_visual_change (nframes64_t);
929 void queue_visual_change (double);
930 void queue_visual_change_y (double);
931 void ensure_visual_change_idle_handler ();
933 void end_location_changed (ARDOUR::Location*);
935 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
936 RegionListDisplayModelColumns() {
953 Gtk::TreeModelColumn<Glib::ustring> name;
954 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
955 Gtk::TreeModelColumn<Gdk::Color> color_;
956 Gtk::TreeModelColumn<Glib::ustring> start;
957 Gtk::TreeModelColumn<Glib::ustring> end;
958 Gtk::TreeModelColumn<Glib::ustring> length;
959 Gtk::TreeModelColumn<Glib::ustring> sync;
960 Gtk::TreeModelColumn<Glib::ustring> fadein;
961 Gtk::TreeModelColumn<Glib::ustring> fadeout;
962 Gtk::TreeModelColumn<bool> locked;
963 Gtk::TreeModelColumn<bool> glued;
964 Gtk::TreeModelColumn<bool> muted;
965 Gtk::TreeModelColumn<bool> opaque;
966 Gtk::TreeModelColumn<Glib::ustring> used;
967 Gtk::TreeModelColumn<Glib::ustring> path;
970 RegionListDisplayModelColumns region_list_columns;
971 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
973 Glib::RefPtr<Gtk::TreeStore> region_list_model;
974 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
975 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
977 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
978 void region_list_selection_changed ();
979 sigc::connection region_list_change_connection;
980 void set_selected_in_region_list(RegionSelection&);
981 bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
982 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
983 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
984 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
986 Gtk::Menu *region_list_menu;
987 Gtk::ScrolledWindow region_list_scroller;
988 Gtk::Frame region_list_frame;
990 bool region_list_display_key_press (GdkEventKey *);
991 bool region_list_display_key_release (GdkEventKey *);
992 bool region_list_display_button_press (GdkEventButton *);
993 bool region_list_display_button_release (GdkEventButton *);
994 void region_list_clear ();
995 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
996 void build_region_list_menu ();
997 void show_region_list_display_context_menu (int button, int time);
999 bool show_automatic_regions_in_region_list;
1000 Editing::RegionListSortType region_list_sort_type;
1002 void reset_region_list_sort_direction (bool);
1003 void reset_region_list_sort_type (Editing::RegionListSortType);
1005 void toggle_full_region_list ();
1006 void toggle_show_auto_regions ();
1008 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1012 Gtk::ScrolledWindow snapshot_display_scroller;
1013 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1014 SnapshotDisplayModelColumns() {
1018 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1019 Gtk::TreeModelColumn<Glib::ustring> real_name;
1022 SnapshotDisplayModelColumns snapshot_display_columns;
1023 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1024 Gtk::TreeView snapshot_display;
1025 Gtk::Menu snapshot_context_menu;
1027 bool snapshot_display_button_press (GdkEventButton*);
1028 void snapshot_display_selection_changed ();
1029 void redisplay_snapshots();
1030 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1032 /* named selections */
1034 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1035 NamedSelectionDisplayModelColumns() {
1039 Gtk::TreeModelColumn<Glib::ustring> text;
1040 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1043 NamedSelectionDisplayModelColumns named_selection_columns;
1044 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1046 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1047 Gtk::ScrolledWindow named_selection_scroller;
1049 void create_named_selection ();
1050 void paste_named_selection (float times);
1051 void remove_selected_named_selections ();
1052 void remove_snapshot (Glib::ustring);
1053 void rename_snapshot (Glib::ustring);
1055 void handle_new_named_selection ();
1056 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1057 void redisplay_named_selections ();
1059 bool named_selection_display_button_release (GdkEventButton *ev);
1060 bool named_selection_display_key_release (GdkEventKey *ev);
1061 void named_selection_display_selection_changed ();
1064 TrackViewList track_views;
1065 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1066 TrackSelection axis_views_from_routes (std::list<ARDOUR::Route *>) const;
1068 static Gdk::Cursor* cross_hair_cursor;
1069 static Gdk::Cursor* trimmer_cursor;
1070 static Gdk::Cursor* selector_cursor;
1071 static Gdk::Cursor* grabber_cursor;
1072 static Gdk::Cursor* grabber_edit_point_cursor;
1073 static Gdk::Cursor* zoom_cursor;
1074 static Gdk::Cursor* time_fx_cursor;
1075 static Gdk::Cursor* fader_cursor;
1076 static Gdk::Cursor* speaker_cursor;
1077 static Gdk::Cursor* midi_pencil_cursor;
1078 static Gdk::Cursor* midi_select_cursor;
1079 static Gdk::Cursor* midi_resize_cursor;
1080 static Gdk::Cursor* midi_erase_cursor;
1081 static Gdk::Cursor* wait_cursor;
1082 static Gdk::Cursor* timebar_cursor;
1083 static Gdk::Cursor* transparent_cursor;
1085 static void build_cursors ();
1087 sigc::connection scroll_connection;
1088 nframes64_t last_update_frame;
1089 void center_screen (nframes64_t);
1090 void center_screen_internal (nframes64_t, float);
1092 void update_current_screen ();
1094 void session_going_away ();
1096 nframes64_t cut_buffer_start;
1097 nframes64_t cut_buffer_length;
1099 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1100 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1101 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1102 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
1103 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1104 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1106 /* KEYMAP HANDLING */
1108 void register_actions ();
1110 int ensure_cursor (nframes64_t* pos);
1112 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1113 void handle_new_regions (std::vector<boost::weak_ptr<ARDOUR::Region> >& );
1114 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1115 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1116 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1117 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1118 void redisplay_regions ();
1119 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1120 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1121 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1122 void update_all_region_rows ();
1123 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1124 bool no_region_list_redisplay;
1125 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1127 std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1129 void cut_copy (Editing::CutCopyOp);
1130 bool can_cut_copy () const;
1131 void cut_copy_points (Editing::CutCopyOp);
1132 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1133 void cut_copy_ranges (Editing::CutCopyOp);
1135 void mouse_paste ();
1136 void paste_internal (nframes64_t position, float times);
1138 /* EDITING OPERATIONS */
1140 void reset_point_selection ();
1141 void toggle_region_mute ();
1142 void toggle_region_lock ();
1143 void toggle_region_opaque ();
1144 void toggle_record_enable ();
1145 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1146 void raise_region ();
1147 void raise_region_to_top ();
1148 void lower_region ();
1149 void lower_region_to_bottom ();
1150 void split_region ();
1151 void split_regions_at (nframes64_t, RegionSelection&);
1152 void split_region_at_transients ();
1153 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1154 void crop_region_to_selection ();
1155 void crop_region_to (nframes64_t start, nframes64_t end);
1156 void set_sync_point (nframes64_t, const RegionSelection&);
1157 void set_region_sync_from_edit_point ();
1158 void remove_region_sync();
1159 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1160 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1161 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1162 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1163 void remove_selected_regions ();
1164 void remove_clicked_region ();
1165 void edit_region ();
1166 void rename_region ();
1167 void duplicate_some_regions (RegionSelection&, float times);
1168 void duplicate_selection (float times);
1169 void region_fill_selection ();
1171 void region_fill_track ();
1172 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1173 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1174 void split_multichannel_region();
1175 void reverse_region ();
1176 void strip_region_silence ();
1177 void normalize_region ();
1178 double _last_normalization_value;
1179 void denormalize_region ();
1180 void adjust_region_scale_amplitude (bool up);
1181 void quantize_region ();
1183 void do_insert_time ();
1184 void insert_time (nframes64_t, nframes64_t, Editing::InsertTimeOption, bool, bool, bool);
1186 void tab_to_transient (bool forward);
1188 void use_region_as_bar ();
1189 void use_range_as_bar ();
1191 void define_one_bar (nframes64_t start, nframes64_t end);
1193 void audition_region_from_region_list ();
1194 void hide_region_from_region_list ();
1195 void remove_region_from_region_list ();
1197 void align (ARDOUR::RegionPoint);
1198 void align_relative (ARDOUR::RegionPoint);
1201 void reset_focus ();
1207 void paste (float times);
1209 int get_prefix (float&, bool&);
1211 void keyboard_paste ();
1212 void keyboard_insert_region_list_selection ();
1214 void region_from_selection ();
1215 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1217 void play_from_start ();
1218 void play_from_edit_point ();
1219 void play_from_edit_point_and_return ();
1220 void play_selected_region ();
1221 void play_edit_range ();
1222 void loop_selected_region ();
1223 void play_location (ARDOUR::Location&);
1224 void loop_location (ARDOUR::Location&);
1226 void temporal_zoom_selection ();
1227 void temporal_zoom_region (bool both_axes);
1228 void toggle_zoom_region (bool both_axes);
1229 bool zoomed_to_region;
1230 void temporal_zoom_session ();
1231 void temporal_zoom (gdouble scale);
1232 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const std::string & op);
1233 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1235 void amplitude_zoom (gdouble scale);
1236 void amplitude_zoom_step (bool in);
1238 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1239 void insert_region_list_selection (float times);
1241 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1243 /* import & embed */
1245 void add_external_audio_action (Editing::ImportMode);
1246 void external_audio_dialog ();
1247 void session_import_dialog ();
1249 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1250 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1252 SoundFileOmega* sfbrowser;
1254 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1256 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1257 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1259 void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1260 void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1262 int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1263 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1264 int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1265 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1267 int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1268 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1269 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1270 boost::shared_ptr<ARDOUR::Track>& existing_track);
1272 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1273 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1275 /* generic interthread progress window */
1277 ArdourDialog* interthread_progress_window;
1278 Gtk::Label interthread_progress_label;
1279 Gtk::VBox interthread_progress_vbox;
1280 Gtk::ProgressBar interthread_progress_bar;
1281 Gtk::Button interthread_cancel_button;
1282 Gtk::Label interthread_cancel_label;
1283 sigc::connection interthread_progress_connection;
1284 void interthread_cancel_clicked ();
1285 void build_interthread_progress_window ();
1286 ARDOUR::InterThreadInfo* current_interthread_info;
1288 AnalysisWindow* analysis_window;
1290 /* import specific info */
1292 struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
1293 Editing::ImportMode mode;
1297 boost::shared_ptr<ARDOUR::Track> track;
1301 EditorImportStatus import_status;
1302 gint import_progress_timeout (void *);
1303 static void *_import_thread (void *);
1304 void* import_thread ();
1305 void finish_import ();
1307 /* to support this ... */
1309 void import_audio (bool as_tracks);
1310 void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
1312 void move_to_start ();
1313 void move_to_end ();
1315 void center_playhead ();
1316 void center_edit_point ();
1317 void edit_cursor_backward ();
1318 void edit_cursor_forward ();
1319 void playhead_forward_to_grid ();
1320 void playhead_backward_to_grid ();
1321 void playhead_backward ();
1322 void playhead_forward ();
1323 void scroll_playhead (bool forward);
1324 void scroll_backward (float pages=0.8f);
1325 void scroll_forward (float pages=0.8f);
1326 void scroll_tracks_down ();
1327 void scroll_tracks_up ();
1328 void delete_sample_forward ();
1329 void delete_sample_backward ();
1330 void delete_screen ();
1331 void search_backwards ();
1332 void search_forwards ();
1334 void clear_markers ();
1335 void clear_ranges ();
1336 void clear_locations ();
1337 void unhide_markers ();
1338 void unhide_ranges ();
1339 void jump_forward_to_mark ();
1340 void jump_backward_to_mark ();
1341 void cursor_align (bool playhead_to_edit);
1343 void remove_last_capture ();
1344 void select_all_selectables_using_time_selection ();
1345 void select_all_selectables_using_loop();
1346 void select_all_selectables_using_punch();
1347 void set_selection_from_range (ARDOUR::Location&);
1348 void set_selection_from_punch ();
1349 void set_selection_from_loop ();
1350 void set_selection_from_region ();
1352 void add_location_mark (nframes64_t where);
1353 void add_location_from_audio_region ();
1354 void add_locations_from_audio_region ();
1355 void add_location_from_selection ();
1356 void set_loop_from_selection (bool play);
1357 void set_punch_from_selection ();
1358 void set_punch_from_region ();
1360 void set_loop_from_edit_range (bool play);
1361 void set_loop_from_region (bool play);
1362 void set_punch_from_edit_range ();
1364 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1365 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1367 void add_location_from_playhead_cursor ();
1368 bool select_new_marker;
1370 void reverse_selection ();
1371 void edit_envelope ();
1373 void start_scrolling ();
1374 void stop_scrolling ();
1376 double last_scrub_x;
1377 int scrubbing_direction;
1378 int scrub_reversals;
1379 int scrub_reverse_distance;
1382 void keyboard_selection_begin ();
1383 void keyboard_selection_finish (bool add);
1384 bool have_pending_keyboard_selection;
1385 nframes64_t pending_keyboard_selection_start;
1387 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1388 void extend_selection_to_end_of_region (bool next);
1389 void extend_selection_to_start_of_region (bool previous);
1391 Editing::SnapType snap_type;
1392 Editing::SnapMode snap_mode;
1394 /// Snap threshold in pixels
1395 double snap_threshold;
1397 void handle_gui_changes (const std::string &, void *);
1398 bool ignore_gui_changes;
1400 void hide_all_tracks (bool with_select);
1406 Gtk::Menu fade_context_menu;
1407 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1409 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1410 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1412 void set_fade_length (bool in);
1413 void toggle_fade_active (bool in);
1414 void set_fade_in_active (bool);
1415 void set_fade_out_active (bool);
1417 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1418 RegionSelection pre_drag_region_selection;
1420 bool _dragging_playhead;
1421 bool _dragging_edit_point;
1423 void marker_drag_motion_callback (GdkEvent*);
1424 void marker_drag_finished_callback (GdkEvent*);
1426 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1428 void start_region_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1429 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1430 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1431 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*, RegionView*);
1432 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1434 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1436 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1437 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1439 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1440 void brush (nframes64_t);
1442 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1443 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1444 double clamp_verbose_cursor_x (double);
1445 double clamp_verbose_cursor_y (double);
1447 /* Canvas event handlers */
1449 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1450 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1451 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1452 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1453 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1454 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1455 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1456 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1457 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1458 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1461 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1463 ArdourCanvas::Item *last_item_entered;
1464 int last_item_entered_n;
1467 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1468 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1469 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1470 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1471 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1472 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1473 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1474 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1475 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1477 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1478 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1479 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1480 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1481 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1482 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1484 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1485 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1486 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1487 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1488 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1489 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1490 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1491 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1493 /* non-public event handlers */
1495 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1496 bool track_canvas_scroll (GdkEventScroll* event);
1498 bool track_canvas_scroll_event (GdkEventScroll* event);
1499 bool track_canvas_button_press_event (GdkEventButton* event);
1500 bool track_canvas_button_release_event (GdkEventButton* event);
1501 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1503 Gtk::Allocation canvas_allocation;
1504 void track_canvas_allocate (Gtk::Allocation alloc);
1505 bool track_canvas_size_allocated ();
1506 bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
1508 void set_playhead_cursor ();
1510 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1511 void kbd_mute_unmute_region ();
1514 void kbd_do_brush (GdkEvent*);
1515 void kbd_do_audition (GdkEvent*);
1517 void handle_new_duration ();
1518 void initialize_canvas ();
1520 /* display control */
1522 bool _show_measures;
1523 /// true if the editor should follow the playhead, otherwise false
1524 bool _follow_playhead;
1525 /// true if waveforms should be shown while recording audio tracks, otherwise false
1526 bool _show_waveforms_recording;
1528 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1530 TempoLines* tempo_lines;
1532 ArdourCanvas::Group* time_line_group;
1534 void hide_measures ();
1535 void draw_measures ();
1536 bool redraw_measures ();
1538 void new_tempo_section ();
1540 void mouse_add_new_tempo_event (nframes64_t where);
1541 void mouse_add_new_meter_event (nframes64_t where);
1543 void remove_tempo_marker (ArdourCanvas::Item*);
1544 void remove_meter_marker (ArdourCanvas::Item*);
1545 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1546 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1548 void edit_tempo_section (ARDOUR::TempoSection*);
1549 void edit_meter_section (ARDOUR::MeterSection*);
1550 void edit_tempo_marker (ArdourCanvas::Item*);
1551 void edit_meter_marker (ArdourCanvas::Item*);
1552 void edit_control_point (ArdourCanvas::Item*);
1554 void marker_menu_edit ();
1555 void marker_menu_remove ();
1556 void marker_menu_rename ();
1557 void marker_menu_lock (bool yn);
1558 void marker_menu_hide ();
1559 void marker_menu_loop_range ();
1560 void marker_menu_select_all_selectables_using_range ();
1561 void marker_menu_select_using_range ();
1562 void marker_menu_separate_regions_using_location ();
1563 void marker_menu_play_from ();
1564 void marker_menu_play_range ();
1565 void marker_menu_set_playhead ();
1566 void marker_menu_set_from_playhead ();
1567 void marker_menu_set_from_selection ();
1568 void marker_menu_range_to_next ();
1569 void new_transport_marker_menu_set_loop ();
1570 void new_transport_marker_menu_set_punch ();
1571 void update_loop_range_view (bool visibility=false);
1572 void update_punch_range_view (bool visibility=false);
1573 void new_transport_marker_menu_popdown ();
1574 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1575 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1576 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1577 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1578 void build_range_marker_menu (bool loop_or_punch);
1579 void build_marker_menu (bool start_or_end);
1580 void build_tm_marker_menu ();
1581 void build_new_transport_marker_menu ();
1583 Gtk::Menu* tm_marker_menu;
1584 Gtk::Menu* marker_menu;
1585 Gtk::Menu* start_end_marker_menu;
1586 Gtk::Menu* range_marker_menu;
1587 Gtk::Menu* transport_marker_menu;
1588 Gtk::Menu* new_transport_marker_menu;
1589 Gtk::Menu* cd_marker_menu;
1590 ArdourCanvas::Item* marker_menu_item;
1592 typedef std::list<Marker*> Marks;
1595 void remove_metric_marks ();
1596 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1598 void compute_current_bbt_points (nframes_t left, nframes_t right);
1599 void tempo_map_changed (ARDOUR::Change);
1600 void redisplay_tempo (bool immediate_redraw);
1602 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1603 void snap_to (nframes64_t& first, nframes64_t& last, int32_t direction = 0, bool for_mark = false);
1605 double snap_length_beats (nframes64_t start);
1607 uint32_t bbt_beat_subdivision;
1611 Gtk::ToggleButton editor_mixer_button;
1612 Gtk::ToggleButton editor_list_button;
1613 void editor_mixer_button_toggled ();
1614 void editor_list_button_toggled ();
1616 AudioClock edit_point_clock;
1617 AudioClock zoom_range_clock;
1618 Gtk::Button zoom_in_button;
1619 Gtk::Button zoom_out_button;
1620 Gtk::Button zoom_out_full_button;
1621 Gtk::Button zoom_onetoone_button;
1623 Gtk::VBox toolbar_clock_vbox;
1624 Gtk::VBox toolbar_selection_clock_vbox;
1625 Gtk::Table toolbar_selection_clock_table;
1626 Gtk::Label toolbar_selection_cursor_label;
1628 Gtk::HBox mouse_mode_button_box;
1629 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1630 Gtk::ToggleButton mouse_select_button;
1631 Gtk::ToggleButton mouse_move_button;
1632 Gtk::ToggleButton mouse_gain_button;
1633 Gtk::ToggleButton mouse_zoom_button;
1634 Gtk::ToggleButton mouse_timefx_button;
1635 Gtk::ToggleButton mouse_audition_button;
1636 Gtk::ToggleButton mouse_note_button;
1637 GroupedButtons *mouse_mode_button_set;
1638 void mouse_mode_toggled (Editing::MouseMode m);
1639 bool ignore_mouse_mode_toggle;
1641 gint mouse_select_button_release (GdkEventButton*);
1643 Gtk::VBox automation_box;
1644 Gtk::Button automation_mode_button;
1645 Gtk::ToggleButton global_automation_button;
1647 Gtk::ComboBoxText edit_mode_selector;
1648 Gtk::VBox edit_mode_box;
1650 void set_edit_mode (ARDOUR::EditMode);
1651 void cycle_edit_mode ();
1652 void edit_mode_selection_done ();
1654 Gtk::ComboBoxText snap_type_selector;
1655 Gtk::ComboBoxText snap_mode_selector;
1658 std::vector<std::string> snap_type_strings;
1659 std::vector<std::string> snap_mode_strings;
1661 void snap_type_selection_done ();
1662 void snap_mode_selection_done ();
1663 void snap_mode_chosen (Editing::SnapMode);
1664 void snap_type_chosen (Editing::SnapType);
1666 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1667 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1669 Gtk::ComboBoxText zoom_focus_selector;
1670 Gtk::VBox zoom_focus_box;
1672 std::vector<std::string> zoom_focus_strings;
1674 void zoom_focus_selection_done ();
1675 void zoom_focus_chosen (Editing::ZoomFocus);
1677 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1680 Gtk::VBox zoom_vbox;
1682 void zoom_adjustment_changed();
1684 void edit_point_clock_changed();
1686 void setup_toolbar ();
1688 Gtkmm2ext::TearOff* tools_tearoff;
1689 Gtk::HBox toolbar_hbox;
1690 Gtk::EventBox toolbar_base;
1691 Gtk::Frame toolbar_frame;
1695 Gtk::HBox midi_tool_button_box;
1696 Gtk::ToggleButton midi_tool_pencil_button;
1697 Gtk::ToggleButton midi_tool_select_button;
1698 Gtk::ToggleButton midi_tool_resize_button;
1699 Gtk::ToggleButton midi_tool_erase_button;
1700 Gtk::Button midi_panic_button;
1701 Gtk::ToggleButton midi_sound_notes;
1702 GroupedButtons *midi_tool_button_set;
1703 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1704 void midi_panic_button_pressed ();
1705 bool sound_notes () const { return midi_sound_notes.get_active(); }
1707 bool ignore_midi_edit_mode_toggle;
1709 Gtkmm2ext::TearOff* midi_tools_tearoff;
1710 Gtk::HBox midi_toolbar_hbox;
1711 Gtk::EventBox midi_toolbar_base;
1712 Gtk::Frame midi_toolbar_frame;
1714 void setup_midi_toolbar ();
1716 /* selection process */
1718 Selection* selection;
1719 Selection* cut_buffer;
1721 void time_selection_changed ();
1722 void track_selection_changed ();
1723 void region_selection_changed ();
1724 sigc::connection editor_regions_selection_changed_connection;
1725 void sensitize_the_right_region_actions (bool have_selected_regions);
1726 void point_selection_changed ();
1727 void marker_selection_changed ();
1729 void cancel_selection ();
1731 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1732 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1733 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1735 bool audio_region_selection_covers (nframes64_t where);
1737 /* transport range select process */
1739 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1740 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1741 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1744 ArdourCanvas::SimpleRect *bogus_background_rect;
1746 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1747 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1748 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1749 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1750 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1751 ArdourCanvas::SimpleLine *transport_punchin_line;
1752 ArdourCanvas::SimpleLine *transport_punchout_line;
1753 ArdourCanvas::SimpleRect *transport_preroll_rect;
1754 ArdourCanvas::SimpleRect *transport_postroll_rect;
1756 ARDOUR::Location* transport_loop_location();
1757 ARDOUR::Location* transport_punch_location();
1759 ARDOUR::Location *temp_location;
1761 /* object rubberband select process */
1763 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1765 ArdourCanvas::SimpleRect *rubberband_rect;
1767 /* mouse zoom process */
1769 ArdourCanvas::SimpleRect *zoom_rect;
1770 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1772 /* diskstream/route display management */
1773 Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
1774 Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
1776 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1777 RouteDisplayModelColumns() {
1781 add (temporary_visible);
1786 Gtk::TreeModelColumn<Glib::ustring> text;
1787 Gtk::TreeModelColumn<bool> visible;
1788 Gtk::TreeModelColumn<bool> rec_enabled;
1789 Gtk::TreeModelColumn<bool> temporary_visible;
1790 Gtk::TreeModelColumn<bool> is_track;
1791 Gtk::TreeModelColumn<TimeAxisView*> tv;
1792 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1795 void on_tv_rec_enable_toggled(const Glib::ustring& path_string);
1797 RouteDisplayModelColumns route_display_columns;
1798 Glib::RefPtr<Gtk::ListStore> route_display_model;
1799 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1801 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1802 Gtk::ScrolledWindow route_list_scroller;
1803 Gtk::Menu* route_list_menu;
1805 void update_route_visibility ();
1807 void sync_order_keys (const char*);
1808 bool route_redisplay_does_not_sync_order_keys;
1809 bool route_redisplay_does_not_reset_order_keys;
1811 bool route_list_display_button_press (GdkEventButton*);
1812 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1815 const Gtk::SelectionData& data,
1819 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1821 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1822 void route_list_delete (const Gtk::TreeModel::Path&);
1823 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1825 void initial_route_list_display ();
1826 void redisplay_route_list();
1827 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1828 bool ignore_route_list_reorder;
1829 bool no_route_list_redisplay;
1830 bool sync_track_view_list_and_route_list ();
1832 void build_route_list_menu ();
1833 void show_route_list_menu ();
1835 void show_all_routes ();
1836 void hide_all_routes ();
1837 void show_all_audiotracks ();
1838 void hide_all_audiotracks ();
1839 void show_all_audiobus ();
1840 void hide_all_audiobus ();
1842 void set_all_tracks_visibility (bool yn);
1843 void set_all_audio_visibility (int type, bool yn);
1845 /* edit group management */
1847 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1849 GroupListModelColumns () {
1861 Gtk::TreeModelColumn<bool> is_visible;
1862 Gtk::TreeModelColumn<bool> gain;
1863 Gtk::TreeModelColumn<bool> record;
1864 Gtk::TreeModelColumn<bool> mute;
1865 Gtk::TreeModelColumn<bool> solo;
1866 Gtk::TreeModelColumn<bool> select;
1867 Gtk::TreeModelColumn<bool> edits;
1868 Gtk::TreeModelColumn<std::string> text;
1869 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1872 GroupListModelColumns group_columns;
1874 Glib::RefPtr<Gtk::ListStore> group_model;
1875 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1877 Gtk::TreeView route_group_display;
1878 Gtk::ScrolledWindow route_group_display_scroller;
1879 Gtk::Menu* route_group_menu;
1881 void build_route_group_menu (ARDOUR::RouteGroup *);
1882 void activate_all_route_groups ();
1883 void disable_all_route_groups ();
1884 void subgroup_route_group (ARDOUR::RouteGroup*);
1885 void unsubgroup_route_group (ARDOUR::RouteGroup*);
1887 bool in_route_group_row_change;
1888 void route_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1889 void route_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1890 void new_route_group ();
1891 void new_route_group_from_selection ();
1892 void new_route_group_from_rec_enabled ();
1893 void new_route_group_from_soloed ();
1894 void edit_route_group (ARDOUR::RouteGroup *);
1895 void fit_route_group (ARDOUR::RouteGroup *);
1896 void route_group_list_button_clicked ();
1897 gint route_group_list_button_press_event (GdkEventButton* ev);
1898 void add_route_group (ARDOUR::RouteGroup* group);
1899 void remove_selected_route_group ();
1900 void route_groups_changed ();
1901 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1903 Gtk::VBox list_vpacker;
1907 bool autoscroll_active;
1908 int autoscroll_timeout_tag;
1911 int last_autoscroll_x;
1912 int last_autoscroll_y;
1913 uint32_t autoscroll_cnt;
1914 nframes64_t autoscroll_x_distance;
1915 double autoscroll_y_distance;
1917 static gint _autoscroll_canvas (void *);
1918 bool autoscroll_canvas ();
1919 void start_canvas_autoscroll (int x, int y);
1920 void stop_canvas_autoscroll ();
1921 void maybe_autoscroll (GdkEventMotion*, bool);
1922 bool allow_vertical_scroll;
1925 void point_trim (GdkEvent*);
1926 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1927 void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
1928 void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
1930 void thaw_region_after_trim (RegionView& rv);
1932 void trim_region_front();
1933 void trim_region_back();
1934 void trim_region (bool front);
1936 void trim_region_to_edit_point ();
1937 void trim_region_from_edit_point ();
1938 void trim_region_to_loop ();
1939 void trim_region_to_punch ();
1940 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1942 void trim_to_region(bool forward);
1943 void trim_region_to_previous_region_end();
1944 void trim_region_to_next_region_start();
1946 bool show_gain_after_trim;
1950 int convert_drop_to_paths (
1951 std::vector<Glib::ustring>& paths,
1952 const Glib::RefPtr<Gdk::DragContext>& context,
1955 const Gtk::SelectionData& data,
1959 void track_canvas_drag_data_received (
1960 const Glib::RefPtr<Gdk::DragContext>& context,
1963 const Gtk::SelectionData& data,
1967 void region_list_display_drag_data_received (
1968 const Glib::RefPtr<Gdk::DragContext>& context,
1971 const Gtk::SelectionData& data,
1976 const Glib::RefPtr<Gdk::DragContext>& context,
1979 const Gtk::SelectionData& data,
1984 const Glib::RefPtr<Gdk::DragContext>& context,
1987 const Gtk::SelectionData& data,
1992 const Glib::RefPtr<Gdk::DragContext>& context,
1995 const Gtk::SelectionData& data,
2001 int write_region_selection(RegionSelection&);
2002 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
2003 void bounce_region_selection ();
2004 void bounce_range_selection (bool replace, bool enable_processing);
2005 void external_edit_region ();
2007 int write_audio_selection (TimeSelection&);
2008 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
2010 void write_selection ();
2012 XMLNode *before; /* used in *_reversible_command */
2014 void begin_reversible_command (std::string cmd_name);
2015 void commit_reversible_command ();
2017 void update_title ();
2018 void update_title_s (const std::string & snapshot_name);
2021 Selection* selection;
2022 double frames_per_unit;
2024 State (PublicEditor const * e);
2028 void store_state (State&) const;
2029 void restore_state (State *);
2031 void instant_save ();
2033 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
2035 /* freeze operations */
2037 ARDOUR::InterThreadInfo freeze_status;
2038 gint freeze_progress_timeout (void *);
2039 static void* _freeze_thread (void*);
2040 void* freeze_thread ();
2042 void freeze_route ();
2043 void unfreeze_route ();
2045 /* route-group solo + mute */
2047 void set_route_group_solo (ARDOUR::Route&, bool);
2048 void set_route_group_mute (ARDOUR::Route&, bool);
2052 void duplicate_dialog (bool with_dialog);
2054 nframes64_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
2056 /* returns false if mouse pointer is not in track or marker canvas
2058 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2060 /* "whats mine is yours" */
2062 TimeFXDialog* current_timefx;
2064 static void* timefx_thread (void *arg);
2065 void do_timefx (TimeFXDialog&);
2067 int time_stretch (RegionSelection&, float fraction);
2068 int pitch_shift (RegionSelection&, float cents);
2069 void pitch_shift_regions ();
2070 int time_fx (RegionSelection&, float val, bool pitching);
2072 /* editor-mixer strip */
2074 MixerStrip *current_mixer_strip;
2075 bool show_editor_mixer_when_tracks_arrive;
2076 Gtk::VBox current_mixer_strip_vbox;
2077 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2078 void cms_deleted ();
2079 void current_mixer_strip_hidden ();
2080 void current_mixer_strip_removed ();
2082 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2083 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2085 void ensure_all_elements_drawn ();
2087 /* nudging tracks */
2089 void nudge_track (bool use_edit_point, bool forwards);
2093 bool _xfade_visibility;
2096 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
2097 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
2099 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2100 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2102 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2103 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2104 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2106 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2107 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2108 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2109 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2111 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2112 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2113 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2114 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2116 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2117 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2118 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2119 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2120 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2121 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2123 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2124 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2125 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2126 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2127 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2128 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2130 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2131 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2133 ImageFrameSocketHandler* image_socket_listener ;
2136 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2137 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2138 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2139 void xfade_edit_left_region ();
2140 void xfade_edit_right_region ();
2142 static const int32_t default_width = 995;
2143 static const int32_t default_height = 765;
2147 Gtk::Button nudge_forward_button;
2148 Gtk::Button nudge_backward_button;
2149 Gtk::HBox nudge_hbox;
2150 Gtk::VBox nudge_vbox;
2151 AudioClock nudge_clock;
2153 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2155 bool nudge_forward_release (GdkEventButton*);
2156 bool nudge_backward_release (GdkEventButton*);
2160 void apply_filter (ARDOUR::Filter&, std::string cmd);
2162 /* handling cleanup */
2164 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2166 std::vector<sigc::connection> session_connections;
2168 /* tracking step changes of track height */
2170 TimeAxisView* current_stepping_trackview;
2171 ARDOUR::microseconds_t last_track_height_step_timestamp;
2172 gint track_height_step_timeout();
2173 sigc::connection step_timeout;
2175 TimeAxisView* entered_track;
2176 RegionView* entered_regionview;
2179 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2180 bool clear_entered_track;
2181 bool left_track_canvas (GdkEventCrossing*);
2182 bool entered_track_canvas (GdkEventCrossing*);
2183 void set_entered_track (TimeAxisView*);
2184 void set_entered_regionview (RegionView*);
2185 void ensure_track_visible (TimeAxisView*);
2186 gint left_automation_track ();
2188 bool _new_regionviews_show_envelope;
2190 void reset_canvas_action_sensitivity (bool);
2191 void toggle_gain_envelope_visibility ();
2192 void toggle_gain_envelope_active ();
2193 void reset_region_gain_envelopes ();
2195 bool on_key_press_event (GdkEventKey*);
2196 bool on_key_release_event (GdkEventKey*);
2198 void session_state_saved (std::string);
2200 Glib::RefPtr<Gtk::Action> undo_action;
2201 Glib::RefPtr<Gtk::Action> redo_action;
2203 void history_changed ();
2205 Gtk::HBox status_bar_hpacker;
2207 Editing::EditPoint _edit_point;
2209 Gtk::ComboBoxText edit_point_selector;
2211 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2212 void cycle_edit_point (bool with_marker);
2213 void set_edit_point ();
2214 void edit_point_selection_done ();
2215 void edit_point_chosen (Editing::EditPoint);
2216 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2217 std::vector<std::string> edit_point_strings;
2219 void selected_marker_moved (ARDOUR::Location*);
2220 sigc::connection edit_point_clock_connection_a;
2221 sigc::connection edit_point_clock_connection_b;
2223 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2225 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2226 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2228 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2230 sigc::connection fast_screen_update_connection;
2231 gint start_updating ();
2232 gint stop_updating ();
2233 void fast_update_strips ();
2234 bool meters_running;
2236 void select_next_route ();
2237 void select_prev_route ();
2239 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2241 RhythmFerret* rhythm_ferret;
2242 BundleManager* _bundle_manager;
2243 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2245 void fit_tracks (TrackSelection &);
2246 void fit_selected_tracks ();
2247 void set_track_height (uint32_t h);
2249 void remove_tracks ();
2250 void toggle_tracks_active ();
2255 friend gboolean _idle_resize (gpointer);
2256 int32_t _pending_resize_amount;
2257 TimeAxisView* _pending_resize_view;
2259 void visible_order_range (int*, int*) const;
2262 bool _pending_locate_request;
2264 EditorSummary* _summary;
2265 void region_view_added (RegionView *);
2267 void update_canvas_now ();
2268 void streamview_height_changed ();
2270 EditorGroupTabs* _group_tabs;
2272 void set_route_group_activation (ARDOUR::RouteGroup *, bool);
2275 friend class RegionDrag;
2276 friend class RegionMoveDrag;
2277 friend class RegionSpliceDrag;
2278 friend class TrimDrag;
2279 friend class MeterMarkerDrag;
2280 friend class TempoMarkerDrag;
2281 friend class CursorDrag;
2282 friend class FadeInDrag;
2283 friend class FadeOutDrag;
2284 friend class MarkerDrag;
2285 friend class RegionGainDrag;
2286 friend class ControlPointDrag;
2287 friend class LineDrag;
2288 friend class RubberbandSelectDrag;
2289 friend class TimeFXDrag;
2290 friend class ScrubDrag;
2291 friend class SelectionDrag;
2292 friend class RangeMarkerBarDrag;
2293 friend class MouseZoomDrag;
2294 friend class RegionCreateDrag;
2295 friend class RegionMotionDrag;
2296 friend class RegionInsertDrag;
2298 friend class EditorSummary;
2299 friend class EditorGroupTabs;
2302 #endif /* __ardour_editor_h__ */