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"
57 #include "audio_clock.h"
58 #include "gtk-custom-ruler.h"
59 #include "ardour_dialog.h"
60 #include "public_editor.h"
63 #include "editor_items.h"
64 #include "region_selection.h"
73 class AudioDiskstream;
92 class AudioRegionView;
93 class AudioStreamView;
94 class AudioTimeAxisView;
96 class AutomationSelection;
97 class AutomationTimeAxisView;
101 class GlobalPortMatrixWindow;
102 class GroupedButtons;
105 class PlaylistSelector;
106 class PluginSelector;
109 class SoundFileOmega;
115 class TrackSelection;
117 /* <CMT Additions> */
118 class ImageFrameView;
119 class ImageFrameTimeAxisView;
120 class ImageFrameTimeAxis;
121 class MarkerTimeAxis ;
123 class ImageFrameSocketHandler ;
124 class TimeAxisViewItem ;
125 /* </CMT Additions> */
128 class Editor : public PublicEditor
134 void connect_to_session (ARDOUR::Session *);
135 ARDOUR::Session* current_session() const { return session; }
137 virtual bool have_idled () const { return _have_idled; }
139 nframes64_t leftmost_position() const { return leftmost_frame; }
140 nframes64_t current_page_frames() const {
141 return (nframes64_t) floor (canvas_width * frames_per_unit);
144 void cycle_snap_mode ();
145 void cycle_snap_choice ();
146 void set_snap_to (Editing::SnapType);
147 void set_snap_mode (Editing::SnapMode);
148 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
150 void undo (uint32_t n = 1);
151 void redo (uint32_t n = 1);
153 XMLNode& get_state ();
154 int set_state (const XMLNode& );
156 void set_mouse_mode (Editing::MouseMode, bool force=true);
157 void step_mouse_mode (bool next);
158 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
160 void set_midi_edit_cursor (Editing::MidiEditMode);
161 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
162 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
165 void add_imageframe_time_axis(const std::string & track_name, void*) ;
166 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
167 void connect_to_image_compositor() ;
168 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
171 TimeAxisView* get_named_time_axis(const std::string & name) ;
172 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
173 void add_to_idle_resize (TimeAxisView*, uint32_t);
175 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
177 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
178 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
179 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
181 #ifdef USE_RUBBERBAND
182 std::vector<std::string> rb_opt_strings;
185 /* option editor-access */
187 void set_show_waveforms (bool yn);
188 bool show_waveforms() const { return _show_waveforms; }
190 void set_waveform_scale (Editing::WaveformScale);
192 void set_show_waveforms_recording (bool yn);
193 bool show_waveforms_recording() const { return _show_waveforms_recording; }
195 /* things that need to be public to be used in the main menubar */
197 void new_region_from_selection ();
198 void separate_regions_between (const TimeSelection&);
199 void separate_region_from_selection ();
200 void separate_region_from_punch ();
201 void separate_region_from_loop ();
202 void separate_regions_using_location (ARDOUR::Location&);
203 void toggle_playback (bool with_abort);
204 void transition_to_rolling (bool forward);
208 nframes64_t unit_to_frame (double unit) const {
209 return (nframes64_t) rint (unit * frames_per_unit);
212 double frame_to_unit (nframes64_t frame) const {
213 return rint ((double) frame / (double) frames_per_unit);
216 double frame_to_unit (double frame) const {
217 return rint (frame / frames_per_unit);
220 /* NOTE: these functions assume that the "pixel" coordinate is
221 the result of using the world->canvas affine transform on a
222 world coordinate. These coordinates already take into
223 account any scrolling carried out by adjusting the
227 nframes64_t pixel_to_frame (double pixel) const {
229 /* pixel can be less than zero when motion events
230 are processed. since we've already run the world->canvas
231 affine, that means that the location *really* is "off
232 to the right" and thus really is "before the start".
236 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
242 gulong frame_to_pixel (nframes64_t frame) const {
243 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
246 void flush_canvas ();
250 Selection& get_selection() const { return *selection; }
251 Selection& get_cut_buffer() const { return *cut_buffer; }
253 bool extend_selection_to_track (TimeAxisView&);
255 void play_selection ();
256 void select_all_in_track (Selection::Operation op);
257 void select_all (Selection::Operation op);
258 void invert_selection_in_track ();
259 void invert_selection ();
260 void deselect_all ();
264 void set_show_measures (bool yn);
265 bool show_measures () const { return _show_measures; }
267 /* analysis window */
269 void analyze_region_selection();
270 void analyze_range_selection();
274 void export_audio ();
275 void export_selection ();
276 void export_range ();
277 void export_region ();
279 void add_toplevel_controls (Gtk::Container&);
280 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
282 void set_zoom_focus (Editing::ZoomFocus);
283 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
284 double get_current_zoom () const { return frames_per_unit; }
286 void temporal_zoom_step (bool coarser);
288 /* stuff that AudioTimeAxisView and related classes use */
290 PlaylistSelector& playlist_selector() const;
291 void route_name_changed (TimeAxisView *);
292 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
294 void new_playlists (TimeAxisView* v);
295 void copy_playlists (TimeAxisView* v);
296 void clear_playlists (TimeAxisView* v);
298 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
299 void get_onscreen_tracks (TrackViewList&);
301 Width editor_mixer_strip_width;
302 void maybe_add_mixer_strip_width (XMLNode&);
303 void show_editor_mixer (bool yn);
304 void create_editor_mixer ();
305 void show_editor_list (bool yn);
306 void set_selected_mixer_strip (TimeAxisView&);
307 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
308 void show_track_in_display (TimeAxisView& tv);
310 /* nudge is initiated by transport controls owned by ARDOUR_UI */
312 void nudge_forward (bool next, bool force_playhead);
313 void nudge_backward (bool next, bool force_playhead);
315 /* nudge initiated from context menu */
317 void nudge_forward_capture_offset ();
318 void nudge_backward_capture_offset ();
320 /* playhead/screen stuff */
322 void set_follow_playhead (bool yn);
323 void toggle_follow_playhead ();
324 bool follow_playhead() const { return _follow_playhead; }
325 bool dragging_playhead () const { return _dragging_playhead; }
327 void toggle_waveform_visibility ();
328 void toggle_zero_line_visibility ();
329 void toggle_waveforms_while_recording ();
330 void toggle_measure_visibility ();
331 void toggle_logo_visibility ();
333 double get_physical_screen_width () const { return physical_screen_width; };
334 double physical_screen_width;
335 double physical_screen_height;
339 void toggle_selected_region_fades (int dir);
340 void update_region_fade_visibility ();
341 bool xfade_visibility() const { return _xfade_visibility; }
342 void update_xfade_visibility ();
344 /* redirect shared ops menu. caller must free returned menu */
346 Gtk::Menu* redirect_menu ();
348 /* floating windows/transient */
350 void ensure_float (Gtk::Window&);
354 void scroll_tracks_down_line ();
355 void scroll_tracks_up_line ();
357 void move_selected_tracks (bool up);
359 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
360 void prepare_for_cleanup ();
361 void finish_cleanup ();
363 void maximise_editing_space();
364 void restore_editing_space();
366 void reset_x_origin (nframes64_t);
367 void reset_zoom (double);
368 void reposition_and_zoom (nframes64_t, double);
370 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
372 bool update_mouse_speed ();
373 bool decelerate_mouse_speed ();
375 void toggle_meter_updating();
377 void show_rhythm_ferret();
378 void show_bundle_manager ();
379 void show_global_port_matrix (ARDOUR::DataType);
381 void goto_visual_state (uint32_t);
382 void save_visual_state (uint32_t);
384 void queue_draw_resize_line (int at);
385 void start_resize_line_ops ();
386 void end_resize_line_ops ();
389 void map_transport_state ();
390 void map_position_change (nframes64_t);
393 bool on_expose_event (GdkEventExpose*);
397 /// The session that we are editing, or 0
398 void color_handler ();
399 ARDOUR::Session *session;
402 // to keep track of the playhead position for control_scroll
403 boost::optional<nframes64_t> _control_scroll_target;
405 PlaylistSelector* _playlist_selector;
407 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
411 double frames_per_unit;
412 nframes64_t leftmost_frame;
413 Editing::ZoomFocus zoom_focus;
414 bool zoomed_to_region;
415 std::list<TAVState> track_states;
418 std::list<VisualState*> undo_visual_stack;
419 std::list<VisualState*> redo_visual_stack;
420 VisualState* current_visual_state (bool with_tracks = true);
421 void undo_visual_state ();
422 void redo_visual_state ();
423 void use_visual_state (VisualState&);
425 void swap_visual_state ();
427 std::vector<VisualState*> visual_states;
428 sigc::connection visual_state_op_connection;
429 void start_visual_state_op (uint32_t n);
430 void cancel_visual_state_op (uint32_t n);
431 bool end_visual_state_op (uint32_t n);
433 nframes64_t leftmost_frame;
434 double frames_per_unit;
435 Editing::ZoomFocus zoom_focus;
437 void set_frames_per_unit (double);
440 Editing::MouseMode mouse_mode;
441 Editing::MidiEditMode midi_edit_mode;
443 int post_maximal_editor_width;
444 int post_maximal_pane_position;
445 int pre_maximal_pane_position;
446 int pre_maximal_editor_width;
447 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
449 Gtk::Notebook the_notebook;
450 Gtk::HPaned edit_pane;
452 Gtk::EventBox meter_base;
454 Gtk::EventBox marker_base;
455 Gtk::HBox marker_box;
456 Gtk::VBox scrollers_rulers_markers_box;
458 void location_changed (ARDOUR::Location *);
459 void location_flags_changed (ARDOUR::Location *, void *);
460 void refresh_location_display ();
461 void refresh_location_display_s (ARDOUR::Change);
462 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
463 void add_new_location (ARDOUR::Location *);
464 void location_gone (ARDOUR::Location *);
465 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
466 gint really_remove_marker (ARDOUR::Location* loc);
467 void goto_nth_marker (int nth);
469 uint32_t location_marker_color;
470 uint32_t location_range_color;
471 uint32_t location_loop_color;
472 uint32_t location_punch_color;
473 uint32_t location_cd_marker_color;
475 struct LocationMarkers {
480 LocationMarkers () : start(0), end(0), valid (true) {}
486 void set_name (const std::string&);
487 void set_position (nframes64_t start, nframes64_t end = 0);
488 void set_color_rgba (uint32_t);
491 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
492 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
493 Marker* entered_marker;
495 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
496 LocationMarkerMap location_markers;
498 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
499 void clear_marker_display ();
500 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
501 bool choose_new_marker_name(std::string &name);
502 void update_cd_marker_display ();
503 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
505 TimeAxisView* clicked_axisview;
506 RouteTimeAxisView* clicked_routeview;
507 /** The last RegionView that was clicked on, or 0 if the last click was not
508 * on a RegionView. This is set up by the canvas event handlers in
509 * editor_canvas_events.cc
511 RegionView* clicked_regionview;
512 RegionSelection latest_regionviews;
513 uint32_t clicked_selection;
514 CrossfadeView* clicked_crossfadeview;
515 ControlPoint* clicked_control_point;
517 void sort_track_selection (TrackSelection* sel = 0);
519 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
520 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
521 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
523 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
525 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, std::vector<RegionView*>*) const;
526 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
527 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
528 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
532 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
533 bool button_release_can_deselect;
535 void catch_vanishing_regionview (RegionView *);
537 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
538 void select_all_tracks ();
540 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
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 *);
550 void collect_and_select_new_region_view (RegionView *);
552 Gtk::Menu track_context_menu;
553 Gtk::Menu track_region_context_menu;
554 Gtk::Menu track_selection_context_menu;
555 Gtk::Menu track_crossfade_context_menu;
557 Gtk::MenuItem* region_edit_menu_split_item;
558 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
559 Gtk::Menu * track_region_edit_playlist_menu;
560 Gtk::Menu * track_edit_playlist_submenu;
561 Gtk::Menu * track_selection_edit_playlist_submenu;
563 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
564 Gtk::Menu* build_track_context_menu (nframes64_t);
565 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
566 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
567 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
568 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
569 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
570 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
571 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
572 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
573 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
575 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
577 void handle_new_route (ARDOUR::RouteList&);
578 void remove_route (TimeAxisView *);
581 Gtk::HBox global_hpacker;
582 Gtk::VBox global_vpacker;
585 bool need_resize_line;
587 int old_resize_line_y;
589 Gdk::Cursor* current_canvas_cursor;
590 void set_canvas_cursor ();
591 Gdk::Cursor* which_grabber_cursor ();
593 ArdourCanvas::Canvas* track_canvas;
595 ArdourCanvas::Text* verbose_canvas_cursor;
596 bool verbose_cursor_visible;
598 void parameter_changed (std::string);
600 bool track_canvas_motion (GdkEvent*);
602 void set_verbose_canvas_cursor (const std::string &, double x, double y);
603 void set_verbose_canvas_cursor_text (const std::string &);
604 void show_verbose_canvas_cursor();
605 void hide_verbose_canvas_cursor();
607 bool verbose_cursor_on; // so far unused
609 Gtk::EventBox time_canvas_event_box;
610 Gtk::EventBox track_canvas_event_box;
611 Gtk::EventBox time_button_event_box;
612 Gtk::EventBox ruler_label_event_box;
614 ArdourCanvas::Group *minsec_group;
615 ArdourCanvas::Pixbuf *logo_item;
616 ArdourCanvas::Group *bbt_group;
617 ArdourCanvas::Group *smpte_group;
618 ArdourCanvas::Group *frame_group;
619 ArdourCanvas::Group *tempo_group;
620 ArdourCanvas::Group *meter_group;
621 ArdourCanvas::Group *marker_group;
622 ArdourCanvas::Group *range_marker_group;
623 ArdourCanvas::Group *transport_marker_group;
624 ArdourCanvas::Group* cd_marker_group;
626 ArdourCanvas::Group* timebar_group;
628 /* These bars never need to be scrolled */
629 ArdourCanvas::Group* meter_bar_group;
630 ArdourCanvas::Group* tempo_bar_group;
631 ArdourCanvas::Group* marker_bar_group;
632 ArdourCanvas::Group* range_marker_bar_group;
633 ArdourCanvas::Group* transport_marker_bar_group;
634 ArdourCanvas::Group* cd_marker_bar_group;
636 /** The group containing all items that require horizontal scrolling. */
637 ArdourCanvas::Group* _background_group;
639 The _master_group is the group containing all items
640 that require horizontal scrolling..
641 It is primarily used to separate canvas items
642 that require horizontal scrolling from those that do not.
644 ArdourCanvas::Group* _master_group;
646 /* The group containing all trackviews. Only scrolled vertically. */
647 ArdourCanvas::Group* _trackview_group;
649 /* The group used for region motion. Sits on top of _trackview_group */
650 ArdourCanvas::Group* _region_motion_group;
653 ruler_metric_smpte = 0,
654 ruler_metric_bbt = 1,
655 ruler_metric_frames = 2,
656 ruler_metric_minsec = 3,
658 ruler_time_tempo = 4,
659 ruler_time_meter = 5,
660 ruler_time_marker = 6,
661 ruler_time_range_marker = 7,
662 ruler_time_transport_marker = 8,
663 ruler_time_cd_marker = 9,
666 static GtkCustomMetric ruler_metrics[4];
667 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
668 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
669 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
670 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
671 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
672 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
673 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
674 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
675 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
676 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
677 bool no_ruler_shown_update;
679 gint ruler_button_press (GdkEventButton*);
680 gint ruler_button_release (GdkEventButton*);
681 gint ruler_mouse_motion (GdkEventMotion*);
682 bool ruler_scroll (GdkEventScroll* event);
684 gint ruler_pressed_button;
685 Gtk::Widget * ruler_grabbed_widget;
687 void initialize_rulers ();
688 void update_just_smpte ();
689 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
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 enum MinsecRulerScale {
713 MinsecRulerScale minsec_ruler_scale;
715 nframes_t minsec_mark_interval;
716 gint minsec_mark_modulo;
718 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
720 enum SMPTERulerScale {
728 SMPTERulerScale smpte_ruler_scale;
730 nframes_t smpte_mark_interval;
731 gint smpte_mark_modulo;
733 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
743 bbt_show_ticks_detail,
744 bbt_show_ticks_super_detail
747 BBTRulerScale bbt_ruler_scale;
751 uint32_t bbt_bar_helper_on;
752 uint32_t bbt_accent_modulo;
753 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
755 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
756 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
757 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
758 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
760 Gtk::Widget *_ruler_separator;
761 GtkWidget *_smpte_ruler;
762 GtkWidget *_bbt_ruler;
763 GtkWidget *_frames_ruler;
764 GtkWidget *_minsec_ruler;
765 Gtk::Widget *smpte_ruler;
766 Gtk::Widget *bbt_ruler;
767 Gtk::Widget *frames_ruler;
768 Gtk::Widget *minsec_ruler;
769 static Editor *ruler_editor;
771 static const double timebar_height;
772 guint32 visible_timebars;
773 gdouble canvas_timebars_vsize;
774 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
775 Gtk::Menu *editor_ruler_menu;
777 ArdourCanvas::SimpleRect* tempo_bar;
778 ArdourCanvas::SimpleRect* meter_bar;
779 ArdourCanvas::SimpleRect* marker_bar;
780 ArdourCanvas::SimpleRect* range_marker_bar;
781 ArdourCanvas::SimpleRect* transport_marker_bar;
782 ArdourCanvas::SimpleRect* cd_marker_bar;
784 Gtk::Label minsec_label;
785 Gtk::Label bbt_label;
786 Gtk::Label smpte_label;
787 Gtk::Label frame_label;
788 Gtk::Label tempo_label;
789 Gtk::Label meter_label;
790 Gtk::Label mark_label;
791 Gtk::Label range_mark_label;
792 Gtk::Label transport_mark_label;
793 Gtk::Label cd_mark_label;
795 Gtk::VBox time_button_vbox;
796 Gtk::HBox time_button_hbox;
800 ArdourCanvas::Points points;
801 ArdourCanvas::Line canvas_item;
802 nframes64_t current_frame;
805 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
808 void set_position (nframes64_t);
809 void set_length (double units);
810 void set_y_axis (double position);
813 Cursor* playhead_cursor;
814 ArdourCanvas::Group* cursor_group;
816 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
818 void cursor_to_region_boundary (bool with_selection, int32_t dir);
819 void cursor_to_next_region_boundary (bool with_selection);
820 void cursor_to_previous_region_boundary (bool with_selection);
821 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
822 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
823 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
824 void cursor_to_selection_start (Cursor *);
825 void cursor_to_selection_end (Cursor *);
827 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
828 void selected_marker_to_next_region_boundary (bool with_selection);
829 void selected_marker_to_previous_region_boundary (bool with_selection);
830 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
831 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
832 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
833 void selected_marker_to_selection_start ();
834 void selected_marker_to_selection_end ();
836 void select_all_selectables_using_cursor (Cursor *, bool);
837 void select_all_selectables_using_edit (bool);
838 void select_all_selectables_between (bool within);
839 void select_range_between ();
841 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
842 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
844 std::vector<nframes64_t> region_boundary_cache;
845 void build_region_boundary_cache ();
848 Gtk::HBox bottom_hbox;
850 Gtk::Table edit_packer;
851 Gtk::VScrollbar edit_vscrollbar;
853 Gtk::Adjustment vertical_adjustment;
854 Gtk::Adjustment horizontal_adjustment;
856 Gtk::Layout controls_layout;
857 bool control_layout_scroll (GdkEventScroll* ev);
858 void controls_layout_size_request (Gtk::Requisition*);
859 sigc::connection controls_layout_size_request_connection;
861 Gtk::HScrollbar edit_hscrollbar;
862 bool _dragging_hscrollbar;
864 void reset_hscrollbar_stepping ();
866 bool hscrollbar_button_press (GdkEventButton*);
867 bool hscrollbar_button_release (GdkEventButton*);
868 void hscrollbar_allocate (Gtk::Allocation &alloc);
871 double canvas_height;
872 double full_canvas_height;
874 bool track_canvas_map_handler (GdkEventAny*);
876 gint edit_controls_button_release (GdkEventButton*);
877 Gtk::Menu *edit_controls_left_menu;
878 Gtk::Menu *edit_controls_right_menu;
880 Gtk::VBox ruler_label_vbox;
881 Gtk::VBox track_canvas_vbox;
882 Gtk::VBox time_canvas_vbox;
883 Gtk::VBox edit_controls_vbox;
884 Gtk::HBox edit_controls_hbox;
886 void control_scroll (float);
887 void access_action (std::string,std::string);
888 bool deferred_control_scroll (nframes64_t);
889 sigc::connection control_scroll_connection;
891 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
893 ArdourCanvas::Group* get_background_group () const { return _background_group; }
894 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
895 double last_trackview_group_vertical_offset;
896 void tie_vertical_scrolling ();
897 void scroll_canvas_horizontally ();
898 void scroll_canvas_vertically ();
900 struct VisualChange {
907 nframes64_t time_origin;
908 double frames_per_unit;
912 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
916 VisualChange pending_visual_change;
918 static int _idle_visual_changer (void *arg);
919 int idle_visual_changer ();
921 void queue_visual_change (nframes64_t);
922 void queue_visual_change (double);
924 void end_location_changed (ARDOUR::Location*);
926 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
927 RegionListDisplayModelColumns() {
944 Gtk::TreeModelColumn<Glib::ustring> name;
945 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
946 Gtk::TreeModelColumn<Gdk::Color> color_;
947 Gtk::TreeModelColumn<Glib::ustring> start;
948 Gtk::TreeModelColumn<Glib::ustring> end;
949 Gtk::TreeModelColumn<Glib::ustring> length;
950 Gtk::TreeModelColumn<Glib::ustring> sync;
951 Gtk::TreeModelColumn<Glib::ustring> fadein;
952 Gtk::TreeModelColumn<Glib::ustring> fadeout;
953 Gtk::TreeModelColumn<bool> locked;
954 Gtk::TreeModelColumn<bool> glued;
955 Gtk::TreeModelColumn<bool> muted;
956 Gtk::TreeModelColumn<bool> opaque;
957 Gtk::TreeModelColumn<Glib::ustring> used;
958 Gtk::TreeModelColumn<Glib::ustring> path;
961 RegionListDisplayModelColumns region_list_columns;
962 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
964 Glib::RefPtr<Gtk::TreeStore> region_list_model;
965 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
966 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
968 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
969 void region_list_selection_changed ();
970 sigc::connection region_list_change_connection;
971 void set_selected_in_region_list(RegionSelection&);
972 bool set_selected_in_region_list_subrow(boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
973 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
974 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
975 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
977 Gtk::Menu *region_list_menu;
978 Gtk::ScrolledWindow region_list_scroller;
979 Gtk::Frame region_list_frame;
981 bool region_list_display_key_press (GdkEventKey *);
982 bool region_list_display_key_release (GdkEventKey *);
983 bool region_list_display_button_press (GdkEventButton *);
984 bool region_list_display_button_release (GdkEventButton *);
985 void region_list_clear ();
986 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
987 void build_region_list_menu ();
988 void show_region_list_display_context_menu (int button, int time);
990 bool show_automatic_regions_in_region_list;
991 Editing::RegionListSortType region_list_sort_type;
993 void reset_region_list_sort_direction (bool);
994 void reset_region_list_sort_type (Editing::RegionListSortType);
996 void toggle_full_region_list ();
997 void toggle_show_auto_regions ();
999 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
1003 Gtk::ScrolledWindow snapshot_display_scroller;
1004 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1005 SnapshotDisplayModelColumns() {
1009 Gtk::TreeModelColumn<Glib::ustring> visible_name;
1010 Gtk::TreeModelColumn<Glib::ustring> real_name;
1013 SnapshotDisplayModelColumns snapshot_display_columns;
1014 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1015 Gtk::TreeView snapshot_display;
1016 Gtk::Menu snapshot_context_menu;
1018 bool snapshot_display_button_press (GdkEventButton*);
1019 void snapshot_display_selection_changed ();
1020 void redisplay_snapshots();
1021 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1023 /* named selections */
1025 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1026 NamedSelectionDisplayModelColumns() {
1030 Gtk::TreeModelColumn<Glib::ustring> text;
1031 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1034 NamedSelectionDisplayModelColumns named_selection_columns;
1035 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1037 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1038 Gtk::ScrolledWindow named_selection_scroller;
1040 void create_named_selection ();
1041 void paste_named_selection (float times);
1042 void remove_selected_named_selections ();
1043 void remove_snapshot (Glib::ustring);
1044 void rename_snapshot (Glib::ustring);
1046 void handle_new_named_selection ();
1047 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1048 void redisplay_named_selections ();
1050 bool named_selection_display_button_release (GdkEventButton *ev);
1051 bool named_selection_display_key_release (GdkEventKey *ev);
1052 void named_selection_display_selection_changed ();
1055 TrackViewList track_views;
1056 std::pair<TimeAxisView*, ARDOUR::layer_t> trackview_by_y_position (double);
1058 static Gdk::Cursor* cross_hair_cursor;
1059 static Gdk::Cursor* trimmer_cursor;
1060 static Gdk::Cursor* selector_cursor;
1061 static Gdk::Cursor* grabber_cursor;
1062 static Gdk::Cursor* grabber_edit_point_cursor;
1063 static Gdk::Cursor* zoom_cursor;
1064 static Gdk::Cursor* time_fx_cursor;
1065 static Gdk::Cursor* fader_cursor;
1066 static Gdk::Cursor* speaker_cursor;
1067 static Gdk::Cursor* midi_pencil_cursor;
1068 static Gdk::Cursor* midi_select_cursor;
1069 static Gdk::Cursor* midi_resize_cursor;
1070 static Gdk::Cursor* midi_erase_cursor;
1071 static Gdk::Cursor* wait_cursor;
1072 static Gdk::Cursor* timebar_cursor;
1073 static Gdk::Cursor* transparent_cursor;
1075 static void build_cursors ();
1077 sigc::connection scroll_connection;
1078 nframes64_t last_update_frame;
1079 void center_screen (nframes64_t);
1080 void center_screen_internal (nframes64_t, float);
1082 void update_current_screen ();
1084 void session_going_away ();
1086 nframes64_t cut_buffer_start;
1087 nframes64_t cut_buffer_length;
1089 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1090 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1091 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1092 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1093 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1094 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1096 /* KEYMAP HANDLING */
1098 void register_actions ();
1100 int ensure_cursor (nframes64_t* pos);
1102 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1103 void handle_new_regions (std::vector<boost::weak_ptr<ARDOUR::Region> >& );
1104 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1105 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1106 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1107 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1108 void redisplay_regions ();
1109 void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &);
1110 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1111 bool update_region_subrows (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, int);
1112 void update_all_region_rows ();
1113 void update_all_region_subrows (Gtk::TreeModel::Row const &, int);
1114 bool no_region_list_redisplay;
1115 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1117 std::list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1119 void cut_copy (Editing::CutCopyOp);
1120 bool can_cut_copy () const;
1121 void cut_copy_points (Editing::CutCopyOp);
1122 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1123 void cut_copy_ranges (Editing::CutCopyOp);
1125 void mouse_paste ();
1126 void paste_internal (nframes64_t position, float times);
1128 /* EDITING OPERATIONS */
1130 void reset_point_selection ();
1131 void toggle_region_mute ();
1132 void toggle_region_lock ();
1133 void toggle_region_opaque ();
1134 void toggle_record_enable ();
1135 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1136 void raise_region ();
1137 void raise_region_to_top ();
1138 void lower_region ();
1139 void lower_region_to_bottom ();
1140 void split_region ();
1141 void split_region_at (nframes64_t);
1142 void split_regions_at (nframes64_t, RegionSelection&);
1143 void split_region_at_transients ();
1144 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1145 void crop_region_to_selection ();
1146 void crop_region_to (nframes64_t start, nframes64_t end);
1147 void set_sync_point (nframes64_t, const RegionSelection&);
1148 void set_region_sync_from_edit_point ();
1149 void remove_region_sync();
1150 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1151 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1152 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1153 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1154 void remove_selected_regions ();
1155 void remove_clicked_region ();
1156 void edit_region ();
1157 void rename_region ();
1158 void duplicate_some_regions (RegionSelection&, float times);
1159 void duplicate_selection (float times);
1160 void region_fill_selection ();
1162 void region_fill_track ();
1163 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1164 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1165 void split_multichannel_region();
1166 void reverse_region ();
1167 void strip_region_silence ();
1168 void normalize_region ();
1169 void denormalize_region ();
1170 void adjust_region_scale_amplitude (bool up);
1171 void quantize_region ();
1173 void do_insert_time ();
1174 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1176 void tab_to_transient (bool forward);
1178 void use_region_as_bar ();
1179 void use_range_as_bar ();
1181 void define_one_bar (nframes64_t start, nframes64_t end);
1183 void audition_region_from_region_list ();
1184 void hide_region_from_region_list ();
1185 void remove_region_from_region_list ();
1187 void align (ARDOUR::RegionPoint);
1188 void align_relative (ARDOUR::RegionPoint);
1191 void reset_focus ();
1197 void paste (float times);
1199 int get_prefix (float&, bool&);
1201 void keyboard_paste ();
1202 void keyboard_insert_region_list_selection ();
1204 void region_from_selection ();
1205 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1207 void play_from_start ();
1208 void play_from_edit_point ();
1209 void play_from_edit_point_and_return ();
1210 void play_selected_region ();
1211 void play_edit_range ();
1212 void loop_selected_region ();
1213 void play_location (ARDOUR::Location&);
1214 void loop_location (ARDOUR::Location&);
1216 void temporal_zoom_selection ();
1217 void temporal_zoom_region (bool both_axes);
1218 void toggle_zoom_region (bool both_axes);
1219 bool zoomed_to_region;
1220 void temporal_zoom_session ();
1221 void temporal_zoom (gdouble scale);
1222 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const std::string & op);
1223 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1225 void amplitude_zoom (gdouble scale);
1226 void amplitude_zoom_step (bool in);
1228 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1229 void insert_region_list_selection (float times);
1231 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1233 /* import & embed */
1235 void add_external_audio_action (Editing::ImportMode);
1236 void external_audio_dialog ();
1237 void session_import_dialog ();
1239 int check_whether_and_how_to_import(std::string, bool all_or_nothing = true);
1240 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1242 SoundFileOmega* sfbrowser;
1244 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1246 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1247 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1249 void do_import (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1250 void do_embed (std::vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1252 int import_sndfiles (std::vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1253 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>, bool, uint32_t total);
1254 int embed_sndfiles (std::vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1255 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1257 int add_sources (std::vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1258 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1259 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1260 boost::shared_ptr<ARDOUR::Track>& existing_track);
1262 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1263 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1265 /* generic interthread progress window */
1267 ArdourDialog* interthread_progress_window;
1268 Gtk::Label interthread_progress_label;
1269 Gtk::VBox interthread_progress_vbox;
1270 Gtk::ProgressBar interthread_progress_bar;
1271 Gtk::Button interthread_cancel_button;
1272 Gtk::Label interthread_cancel_label;
1273 sigc::connection interthread_progress_connection;
1274 void interthread_cancel_clicked ();
1275 void build_interthread_progress_window ();
1276 ARDOUR::InterThreadInfo* current_interthread_info;
1278 AnalysisWindow* analysis_window;
1280 /* import specific info */
1282 struct EditorImportStatus : public ARDOUR::Session::ImportStatus {
1283 Editing::ImportMode mode;
1287 boost::shared_ptr<ARDOUR::Track> track;
1291 EditorImportStatus import_status;
1292 gint import_progress_timeout (void *);
1293 static void *_import_thread (void *);
1294 void* import_thread ();
1295 void finish_import ();
1297 /* to support this ... */
1299 void import_audio (bool as_tracks);
1300 void do_import (std::vector<Glib::ustring> paths, bool split, bool as_tracks);
1302 void move_to_start ();
1303 void move_to_end ();
1305 void center_playhead ();
1306 void center_edit_point ();
1307 void edit_cursor_backward ();
1308 void edit_cursor_forward ();
1309 void playhead_forward_to_grid ();
1310 void playhead_backward_to_grid ();
1311 void playhead_backward ();
1312 void playhead_forward ();
1313 void scroll_playhead (bool forward);
1314 void scroll_backward (float pages=0.8f);
1315 void scroll_forward (float pages=0.8f);
1316 void scroll_tracks_down ();
1317 void scroll_tracks_up ();
1318 void delete_sample_forward ();
1319 void delete_sample_backward ();
1320 void delete_screen ();
1321 void search_backwards ();
1322 void search_forwards ();
1324 void clear_markers ();
1325 void clear_ranges ();
1326 void clear_locations ();
1327 void unhide_markers ();
1328 void unhide_ranges ();
1329 void jump_forward_to_mark ();
1330 void jump_backward_to_mark ();
1331 void cursor_align (bool playhead_to_edit);
1333 void remove_last_capture ();
1334 void select_all_selectables_using_time_selection ();
1335 void select_all_selectables_using_loop();
1336 void select_all_selectables_using_punch();
1337 void set_selection_from_range (ARDOUR::Location&);
1338 void set_selection_from_punch ();
1339 void set_selection_from_loop ();
1340 void set_selection_from_region ();
1342 void add_location_mark (nframes64_t where);
1343 void add_location_from_audio_region ();
1344 void add_locations_from_audio_region ();
1345 void add_location_from_selection ();
1346 void set_loop_from_selection (bool play);
1347 void set_punch_from_selection ();
1348 void set_punch_from_region ();
1350 void set_loop_from_edit_range (bool play);
1351 void set_loop_from_region (bool play);
1352 void set_punch_from_edit_range ();
1354 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1355 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1357 void add_location_from_playhead_cursor ();
1358 bool select_new_marker;
1360 void reverse_selection ();
1361 void edit_envelope ();
1363 void start_scrolling ();
1364 void stop_scrolling ();
1367 double last_scrub_x;
1368 int scrubbing_direction;
1369 int scrub_reversals;
1370 int scrub_reverse_distance;
1373 void keyboard_selection_begin ();
1374 void keyboard_selection_finish (bool add);
1375 bool have_pending_keyboard_selection;
1376 nframes64_t pending_keyboard_selection_start;
1378 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1379 void extend_selection_to_end_of_region (bool next);
1380 void extend_selection_to_start_of_region (bool previous);
1382 Editing::SnapType snap_type;
1383 Editing::SnapMode snap_mode;
1385 /// Snap threshold in pixels
1386 double snap_threshold;
1388 void handle_gui_changes (const std::string &, void *);
1389 bool ignore_gui_changes;
1391 void hide_all_tracks (bool with_select);
1394 LineDragInfo current_line_drag_info;
1396 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1397 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1398 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1400 void finalize_drag ();
1402 Gtk::Menu fade_context_menu;
1403 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1405 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1407 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1408 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1409 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1410 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1411 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1412 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1414 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1415 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1417 void set_fade_length (bool in);
1418 void toggle_fade_active (bool in);
1419 void set_fade_in_active (bool);
1420 void set_fade_out_active (bool);
1422 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1423 RegionSelection pre_drag_region_selection;
1424 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1425 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1426 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1427 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1428 bool check_region_drag_possible (RouteTimeAxisView**, ARDOUR::layer_t*);
1429 void possibly_copy_regions_during_grab (GdkEvent*);
1430 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1431 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1433 bool _dragging_playhead;
1434 bool _dragging_edit_point;
1436 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1437 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1438 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1439 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1440 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1441 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1442 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1443 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1444 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1446 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1447 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1448 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1449 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1451 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1453 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1454 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1455 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1456 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1457 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1458 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1459 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1460 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1461 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1462 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1463 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1464 void start_line_grab (AutomationLine *, GdkEvent*);
1465 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1466 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1467 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1468 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1470 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1472 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1473 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1475 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1476 void brush (nframes64_t);
1478 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1479 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1480 double clamp_verbose_cursor_x (double);
1481 double clamp_verbose_cursor_y (double);
1483 /* Canvas event handlers */
1485 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1486 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1487 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1488 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1489 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1490 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1491 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1492 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1493 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1494 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1497 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1499 ArdourCanvas::Item *last_item_entered;
1500 int last_item_entered_n;
1503 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1504 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1505 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1506 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1507 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1508 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1509 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1510 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1511 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1513 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1514 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1515 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1516 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1517 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1518 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1520 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1521 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1522 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1523 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1524 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1525 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1526 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1527 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1529 /* non-public event handlers */
1531 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1532 bool track_canvas_scroll (GdkEventScroll* event);
1534 bool track_canvas_scroll_event (GdkEventScroll* event);
1535 bool track_canvas_button_press_event (GdkEventButton* event);
1536 bool track_canvas_button_release_event (GdkEventButton* event);
1537 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1539 Gtk::Allocation canvas_allocation;
1540 void track_canvas_allocate (Gtk::Allocation alloc);
1541 bool track_canvas_size_allocated ();
1543 void set_playhead_cursor ();
1545 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1546 void kbd_mute_unmute_region ();
1549 void kbd_do_brush (GdkEvent*);
1550 void kbd_do_audition (GdkEvent*);
1552 void handle_new_duration ();
1553 void initialize_canvas ();
1555 /* display control */
1557 bool _show_measures;
1558 /// true to show waveforms, otherwise false
1559 bool _show_waveforms;
1560 /// true if the editor should follow the playhead, otherwise false
1561 bool _follow_playhead;
1562 /// true if waveforms should be shown while recording audio tracks, otherwise false
1563 bool _show_waveforms_recording;
1565 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1567 TempoLines* tempo_lines;
1569 ArdourCanvas::Group* time_line_group;
1571 void hide_measures ();
1572 void draw_measures ();
1573 bool redraw_measures ();
1575 void new_tempo_section ();
1577 void mouse_add_new_tempo_event (nframes64_t where);
1578 void mouse_add_new_meter_event (nframes64_t where);
1580 void remove_tempo_marker (ArdourCanvas::Item*);
1581 void remove_meter_marker (ArdourCanvas::Item*);
1582 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1583 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1585 void edit_tempo_section (ARDOUR::TempoSection*);
1586 void edit_meter_section (ARDOUR::MeterSection*);
1587 void edit_tempo_marker (ArdourCanvas::Item*);
1588 void edit_meter_marker (ArdourCanvas::Item*);
1589 void edit_control_point (ArdourCanvas::Item*);
1591 void marker_menu_edit ();
1592 void marker_menu_remove ();
1593 void marker_menu_rename ();
1594 void marker_menu_lock (bool yn);
1595 void marker_menu_hide ();
1596 void marker_menu_loop_range ();
1597 void marker_menu_select_all_selectables_using_range ();
1598 void marker_menu_select_using_range ();
1599 void marker_menu_separate_regions_using_location ();
1600 void marker_menu_play_from ();
1601 void marker_menu_play_range ();
1602 void marker_menu_set_playhead ();
1603 void marker_menu_set_from_playhead ();
1604 void marker_menu_set_from_selection ();
1605 void marker_menu_range_to_next ();
1606 void new_transport_marker_menu_set_loop ();
1607 void new_transport_marker_menu_set_punch ();
1608 void update_loop_range_view (bool visibility=false);
1609 void update_punch_range_view (bool visibility=false);
1610 void new_transport_marker_menu_popdown ();
1611 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1612 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1613 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1614 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1615 void build_range_marker_menu (bool loop_or_punch);
1616 void build_marker_menu (bool start_or_end);
1617 void build_tm_marker_menu ();
1618 void build_new_transport_marker_menu ();
1620 Gtk::Menu* tm_marker_menu;
1621 Gtk::Menu* marker_menu;
1622 Gtk::Menu* start_end_marker_menu;
1623 Gtk::Menu* range_marker_menu;
1624 Gtk::Menu* transport_marker_menu;
1625 Gtk::Menu* new_transport_marker_menu;
1626 Gtk::Menu* cd_marker_menu;
1627 ArdourCanvas::Item* marker_menu_item;
1629 typedef std::list<Marker*> Marks;
1632 void remove_metric_marks ();
1633 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1635 void compute_current_bbt_points (nframes_t left, nframes_t right);
1636 void tempo_map_changed (ARDOUR::Change);
1637 void redisplay_tempo (bool immediate_redraw);
1639 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1641 double snap_length_beats (nframes64_t start);
1643 uint32_t bbt_beat_subdivision;
1647 Gtk::ToggleButton editor_mixer_button;
1648 Gtk::ToggleButton editor_list_button;
1649 void editor_mixer_button_toggled ();
1650 void editor_list_button_toggled ();
1652 AudioClock edit_point_clock;
1653 AudioClock zoom_range_clock;
1654 Gtk::Button zoom_in_button;
1655 Gtk::Button zoom_out_button;
1656 Gtk::Button zoom_out_full_button;
1657 Gtk::Button zoom_onetoone_button;
1659 Gtk::VBox toolbar_clock_vbox;
1660 Gtk::VBox toolbar_selection_clock_vbox;
1661 Gtk::Table toolbar_selection_clock_table;
1662 Gtk::Label toolbar_selection_cursor_label;
1664 Gtk::HBox mouse_mode_button_box;
1665 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1666 Gtk::ToggleButton mouse_select_button;
1667 Gtk::ToggleButton mouse_move_button;
1668 Gtk::ToggleButton mouse_gain_button;
1669 Gtk::ToggleButton mouse_zoom_button;
1670 Gtk::ToggleButton mouse_timefx_button;
1671 Gtk::ToggleButton mouse_audition_button;
1672 Gtk::ToggleButton mouse_note_button;
1673 GroupedButtons *mouse_mode_button_set;
1674 void mouse_mode_toggled (Editing::MouseMode m);
1675 bool ignore_mouse_mode_toggle;
1677 gint mouse_select_button_release (GdkEventButton*);
1679 Gtk::VBox automation_box;
1680 Gtk::Button automation_mode_button;
1681 Gtk::ToggleButton global_automation_button;
1683 Gtk::ComboBoxText edit_mode_selector;
1684 Gtk::VBox edit_mode_box;
1686 void set_edit_mode (ARDOUR::EditMode);
1687 void cycle_edit_mode ();
1688 void edit_mode_selection_done ();
1690 Gtk::ComboBoxText snap_type_selector;
1691 Gtk::ComboBoxText snap_mode_selector;
1694 std::vector<std::string> snap_type_strings;
1695 std::vector<std::string> snap_mode_strings;
1697 void snap_type_selection_done ();
1698 void snap_mode_selection_done ();
1699 void snap_mode_chosen (Editing::SnapMode);
1700 void snap_type_chosen (Editing::SnapType);
1702 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1703 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1705 Gtk::ComboBoxText zoom_focus_selector;
1706 Gtk::VBox zoom_focus_box;
1708 std::vector<std::string> zoom_focus_strings;
1710 void zoom_focus_selection_done ();
1711 void zoom_focus_chosen (Editing::ZoomFocus);
1713 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1717 void zoom_adjustment_changed();
1719 void edit_point_clock_changed();
1721 void setup_toolbar ();
1723 Gtkmm2ext::TearOff* tools_tearoff;
1724 Gtk::HBox toolbar_hbox;
1725 Gtk::EventBox toolbar_base;
1726 Gtk::Frame toolbar_frame;
1730 Gtk::HBox midi_tool_button_box;
1731 Gtk::ToggleButton midi_tool_pencil_button;
1732 Gtk::ToggleButton midi_tool_select_button;
1733 Gtk::ToggleButton midi_tool_resize_button;
1734 Gtk::ToggleButton midi_tool_erase_button;
1735 Gtk::Button midi_panic_button;
1736 Gtk::ToggleButton midi_sound_notes;
1737 GroupedButtons *midi_tool_button_set;
1738 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1739 void midi_panic_button_pressed ();
1740 bool sound_notes () const { return midi_sound_notes.get_active(); }
1742 bool ignore_midi_edit_mode_toggle;
1744 Gtkmm2ext::TearOff* midi_tools_tearoff;
1745 Gtk::HBox midi_toolbar_hbox;
1746 Gtk::EventBox midi_toolbar_base;
1747 Gtk::Frame midi_toolbar_frame;
1749 void setup_midi_toolbar ();
1751 /* selection process */
1753 Selection* selection;
1754 Selection* cut_buffer;
1756 void time_selection_changed ();
1757 void track_selection_changed ();
1758 void region_selection_changed ();
1759 sigc::connection editor_regions_selection_changed_connection;
1760 void sensitize_the_right_region_actions (bool have_selected_regions);
1761 void point_selection_changed ();
1762 void marker_selection_changed ();
1771 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1772 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1773 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1774 void cancel_selection ();
1776 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1777 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1778 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1780 bool audio_region_selection_covers (nframes64_t where);
1782 /* transport range select process */
1783 enum RangeMarkerOp {
1785 CreateTransportMarker,
1789 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1790 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1791 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1793 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1794 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1795 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1796 ArdourCanvas::Line* marker_drag_line;
1797 ArdourCanvas::Points marker_drag_line_points;
1798 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1800 void update_marker_drag_item (ARDOUR::Location *);
1802 ArdourCanvas::SimpleRect *bogus_background_rect;
1804 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1805 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1806 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1807 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1808 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1809 ArdourCanvas::SimpleLine *transport_punchin_line;
1810 ArdourCanvas::SimpleLine *transport_punchout_line;
1811 ArdourCanvas::SimpleRect *transport_preroll_rect;
1812 ArdourCanvas::SimpleRect *transport_postroll_rect;
1814 ARDOUR::Location* transport_loop_location();
1815 ARDOUR::Location* transport_punch_location();
1817 ARDOUR::Location *temp_location;
1819 /* object rubberband select process */
1821 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1822 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1823 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1825 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1827 ArdourCanvas::SimpleRect *rubberband_rect;
1829 /* mouse zoom process */
1831 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1832 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1833 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1835 ArdourCanvas::SimpleRect *zoom_rect;
1836 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1838 /* diskstream/route display management */
1840 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1841 RouteDisplayModelColumns() {
1844 add (temporary_visible);
1848 Gtk::TreeModelColumn<Glib::ustring> text;
1849 Gtk::TreeModelColumn<bool> visible;
1850 Gtk::TreeModelColumn<bool> temporary_visible;
1851 Gtk::TreeModelColumn<TimeAxisView*> tv;
1852 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1855 RouteDisplayModelColumns route_display_columns;
1856 Glib::RefPtr<Gtk::ListStore> route_display_model;
1857 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1859 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1860 Gtk::ScrolledWindow route_list_scroller;
1861 Gtk::Menu* route_list_menu;
1863 void update_route_visibility ();
1865 void sync_order_keys (const char*);
1866 bool route_redisplay_does_not_sync_order_keys;
1867 bool route_redisplay_does_not_reset_order_keys;
1869 bool route_list_display_button_press (GdkEventButton*);
1870 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1873 const Gtk::SelectionData& data,
1877 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1879 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1880 void route_list_delete (const Gtk::TreeModel::Path&);
1881 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1883 void initial_route_list_display ();
1884 void redisplay_route_list();
1885 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1886 bool ignore_route_list_reorder;
1887 bool no_route_list_redisplay;
1888 bool sync_track_view_list_and_route_list ();
1890 void build_route_list_menu ();
1891 void show_route_list_menu ();
1893 void show_all_routes ();
1894 void hide_all_routes ();
1895 void show_all_audiotracks ();
1896 void hide_all_audiotracks ();
1897 void show_all_audiobus ();
1898 void hide_all_audiobus ();
1900 void set_all_tracks_visibility (bool yn);
1901 void set_all_audio_visibility (int type, bool yn);
1903 /* edit group management */
1905 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1906 GroupListModelColumns () {
1912 Gtk::TreeModelColumn<bool> is_active;
1913 Gtk::TreeModelColumn<bool> is_visible;
1914 Gtk::TreeModelColumn<std::string> text;
1915 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1918 GroupListModelColumns group_columns;
1919 Glib::RefPtr<Gtk::ListStore> group_model;
1920 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1922 Gtk::TreeView edit_group_display;
1923 Gtk::ScrolledWindow edit_group_display_scroller;
1924 Gtk::Menu* edit_group_list_menu;
1926 void build_edit_group_list_menu ();
1927 void activate_all_edit_groups ();
1928 void disable_all_edit_groups ();
1930 bool in_edit_group_row_change;
1931 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1932 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1933 void new_edit_group ();
1934 void edit_group_list_button_clicked ();
1935 gint edit_group_list_button_press_event (GdkEventButton* ev);
1936 void add_edit_group (ARDOUR::RouteGroup* group);
1937 void remove_selected_edit_group ();
1938 void edit_groups_changed ();
1939 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1941 Gtk::VBox list_vpacker;
1945 bool autoscroll_active;
1946 int autoscroll_timeout_tag;
1949 int last_autoscroll_x;
1950 int last_autoscroll_y;
1951 uint32_t autoscroll_cnt;
1952 nframes64_t autoscroll_x_distance;
1953 double autoscroll_y_distance;
1955 static gint _autoscroll_canvas (void *);
1956 bool autoscroll_canvas ();
1957 void start_canvas_autoscroll (int x, int y);
1958 void stop_canvas_autoscroll ();
1959 void maybe_autoscroll (GdkEventMotion*);
1960 void maybe_autoscroll_horizontally (GdkEventMotion*);
1961 bool allow_vertical_scroll;
1970 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1971 void point_trim (GdkEvent*);
1972 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1973 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1974 void single_start_trim (RegionView&, nframes64_t, bool, bool, bool);
1975 void single_end_trim (RegionView&, nframes64_t, bool, bool, bool);
1977 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1978 void thaw_region_after_trim (RegionView& rv);
1980 void trim_region_front();
1981 void trim_region_back();
1982 void trim_region (bool front);
1984 void trim_region_to_edit_point ();
1985 void trim_region_from_edit_point ();
1986 void trim_region_to_loop ();
1987 void trim_region_to_punch ();
1988 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1990 void trim_to_region(bool forward);
1991 void trim_region_to_previous_region_end();
1992 void trim_region_to_next_region_start();
1994 bool show_gain_after_trim;
1998 int convert_drop_to_paths (
1999 std::vector<Glib::ustring>& paths,
2000 const Glib::RefPtr<Gdk::DragContext>& context,
2003 const Gtk::SelectionData& data,
2007 void track_canvas_drag_data_received (
2008 const Glib::RefPtr<Gdk::DragContext>& context,
2011 const Gtk::SelectionData& data,
2015 void region_list_display_drag_data_received (
2016 const Glib::RefPtr<Gdk::DragContext>& context,
2019 const Gtk::SelectionData& data,
2024 const Glib::RefPtr<Gdk::DragContext>& context,
2027 const Gtk::SelectionData& data,
2032 const Glib::RefPtr<Gdk::DragContext>& context,
2035 const Gtk::SelectionData& data,
2040 const Glib::RefPtr<Gdk::DragContext>& context,
2043 const Gtk::SelectionData& data,
2049 int write_region_selection(RegionSelection&);
2050 bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
2051 void bounce_region_selection ();
2052 void bounce_range_selection (bool replace, bool enable_processing);
2053 void external_edit_region ();
2055 int write_audio_selection (TimeSelection&);
2056 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, std::list<ARDOUR::AudioRange>&);
2058 void write_selection ();
2060 XMLNode *before; /* used in *_reversible_command */
2062 void begin_reversible_command (std::string cmd_name);
2063 void commit_reversible_command ();
2065 void update_title ();
2066 void update_title_s (const std::string & snapshot_name);
2069 Selection* selection;
2070 double frames_per_unit;
2072 State (PublicEditor const * e);
2076 void store_state (State&) const;
2077 void restore_state (State *);
2079 void instant_save ();
2081 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
2083 /* freeze operations */
2085 ARDOUR::InterThreadInfo freeze_status;
2086 gint freeze_progress_timeout (void *);
2087 static void* _freeze_thread (void*);
2088 void* freeze_thread ();
2090 void freeze_route ();
2091 void unfreeze_route ();
2093 /* edit-group solo + mute */
2095 void set_edit_group_solo (ARDOUR::Route&, bool);
2096 void set_edit_group_mute (ARDOUR::Route&, bool);
2100 void duplicate_dialog (bool with_dialog);
2102 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
2104 /* returns false if mouse pointer is not in track or marker canvas
2106 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2108 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
2109 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
2110 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
2112 /* "whats mine is yours" */
2114 TimeFXDialog* current_timefx;
2116 static void* timefx_thread (void *arg);
2117 void do_timefx (TimeFXDialog&);
2119 int time_stretch (RegionSelection&, float fraction);
2120 int pitch_shift (RegionSelection&, float cents);
2121 void pitch_shift_regions ();
2122 int time_fx (RegionSelection&, float val, bool pitching);
2124 /* editor-mixer strip */
2126 MixerStrip *current_mixer_strip;
2127 bool show_editor_mixer_when_tracks_arrive;
2128 Gtk::VBox current_mixer_strip_vbox;
2129 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2130 void cms_deleted ();
2131 void current_mixer_strip_hidden ();
2132 void current_mixer_strip_removed ();
2134 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2135 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2137 void ensure_all_elements_drawn ();
2139 /* nudging tracks */
2141 void nudge_track (bool use_edit_point, bool forwards);
2145 bool _xfade_visibility;
2148 void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
2149 void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
2151 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2152 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2154 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2155 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2156 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2158 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2159 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2160 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2161 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2163 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2164 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2165 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2166 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2168 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2169 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2170 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2171 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2172 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2173 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2175 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2176 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2177 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2178 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2179 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2180 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2182 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2183 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2185 ImageFrameSocketHandler* image_socket_listener ;
2188 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2189 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2190 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2191 void xfade_edit_left_region ();
2192 void xfade_edit_right_region ();
2194 static const int32_t default_width = 995;
2195 static const int32_t default_height = 765;
2199 Gtk::Button nudge_forward_button;
2200 Gtk::Button nudge_backward_button;
2201 Gtk::HBox nudge_hbox;
2202 Gtk::VBox nudge_vbox;
2203 AudioClock nudge_clock;
2205 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2207 bool nudge_forward_release (GdkEventButton*);
2208 bool nudge_backward_release (GdkEventButton*);
2212 void apply_filter (ARDOUR::Filter&, std::string cmd);
2214 /* handling cleanup */
2216 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2218 std::vector<sigc::connection> session_connections;
2220 /* tracking step changes of track height */
2222 TimeAxisView* current_stepping_trackview;
2223 ARDOUR::microseconds_t last_track_height_step_timestamp;
2224 gint track_height_step_timeout();
2225 sigc::connection step_timeout;
2227 TimeAxisView* entered_track;
2228 RegionView* entered_regionview;
2231 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2232 bool clear_entered_track;
2233 bool left_track_canvas (GdkEventCrossing*);
2234 bool entered_track_canvas (GdkEventCrossing*);
2235 void set_entered_track (TimeAxisView*);
2236 void set_entered_regionview (RegionView*);
2237 void ensure_track_visible (TimeAxisView*);
2238 gint left_automation_track ();
2240 bool _new_regionviews_show_envelope;
2242 void reset_canvas_action_sensitivity (bool);
2243 void toggle_gain_envelope_visibility ();
2244 void toggle_gain_envelope_active ();
2245 void reset_region_gain_envelopes ();
2247 bool on_key_press_event (GdkEventKey*);
2248 bool on_key_release_event (GdkEventKey*);
2250 void session_state_saved (std::string);
2252 Glib::RefPtr<Gtk::Action> undo_action;
2253 Glib::RefPtr<Gtk::Action> redo_action;
2255 void history_changed ();
2257 Gtk::HBox status_bar_hpacker;
2259 Editing::EditPoint _edit_point;
2261 Gtk::ComboBoxText edit_point_selector;
2263 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2264 void cycle_edit_point (bool with_marker);
2265 void set_edit_point ();
2266 void edit_point_selection_done ();
2267 void edit_point_chosen (Editing::EditPoint);
2268 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2269 std::vector<std::string> edit_point_strings;
2271 void selected_marker_moved (ARDOUR::Location*);
2272 sigc::connection edit_point_clock_connection_a;
2273 sigc::connection edit_point_clock_connection_b;
2275 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2277 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2278 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2280 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2282 sigc::connection fast_screen_update_connection;
2283 gint start_updating ();
2284 gint stop_updating ();
2285 void fast_update_strips ();
2286 bool meters_running;
2288 void select_next_route ();
2289 void select_prev_route ();
2291 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2293 RhythmFerret* rhythm_ferret;
2294 BundleManager* _bundle_manager;
2295 GlobalPortMatrixWindow* _global_port_matrix[ARDOUR::DataType::num_types];
2298 void set_track_height (uint32_t h);
2300 void remove_tracks ();
2301 void toggle_tracks_active ();
2302 void waveform_scale_chosen (Editing::WaveformScale);
2306 int32_t resize_idle_target;
2308 friend gboolean _idle_resize (gpointer);
2309 std::vector<TimeAxisView*> pending_resizes;
2311 void visible_order_range (int*, int*) const;
2312 bool y_movement_disallowed (int, int, int, int, int, std::bitset<512> const &, std::vector<int32_t> const &) const;
2315 bool _pending_locate_request;
2318 #endif /* __ardour_editor_h__ */