2 Copyright (C) 2000-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_editor_h__
21 #define __ardour_editor_h__
29 #include <glibmm/ustring.h>
31 #include <boost/optional.hpp>
33 #include <libgnomecanvasmm/canvas.h>
34 #include <libgnomecanvasmm/group.h>
35 #include <libgnomecanvasmm/line.h>
36 #include <libgnomecanvasmm/pixbuf.h>
40 #include <gtkmm/layout.h>
41 #include <gtkmm/comboboxtext.h>
43 #include <gtkmm2ext/selector.h>
44 #include <gtkmm2ext/click_box.h>
45 #include <gtkmm2ext/dndtreeview.h>
47 #include <pbd/stateful.h>
48 #include <ardour/session.h>
49 #include <ardour/tempo.h>
50 #include <ardour/stretch.h>
51 #include <ardour/location.h>
52 #include <ardour/audioregion.h>
53 #include <ardour/track.h>
55 #include "audio_clock.h"
56 #include "gtk-custom-ruler.h"
57 #include "ardour_dialog.h"
58 #include "public_editor.h"
61 #include "editor_items.h"
62 #include "region_selection.h"
64 #include "time_axis_view.h"
66 #include "tempo_lines.h"
73 class AudioDiskstream;
92 class AudioTimeAxisView;
93 class AutomationTimeAxisView;
94 class AudioRegionView;
97 class PlaylistSelector;
100 class AutomationLine;
103 class TrackSelection;
104 class AutomationSelection;
107 class AudioStreamView;
109 class SoundFileOmega;
112 class AnalysisWindow;
115 /* <CMT Additions> */
116 class ImageFrameView;
117 class ImageFrameTimeAxisView;
118 class ImageFrameTimeAxis;
119 class MarkerTimeAxis ;
121 class ImageFrameSocketHandler ;
122 class TimeAxisViewItem ;
123 /* </CMT Additions> */
126 class Editor : public PublicEditor
132 void connect_to_session (ARDOUR::Session *);
133 ARDOUR::Session* current_session() const { return session; }
135 virtual bool have_idled() const { return _have_idled; }
137 nframes64_t leftmost_position() const { return leftmost_frame; }
138 nframes64_t current_page_frames() const {
139 return (nframes64_t) floor (canvas_width * frames_per_unit);
142 void cycle_snap_mode ();
143 void cycle_snap_choice ();
144 void set_snap_to (Editing::SnapType);
145 void set_snap_mode (Editing::SnapMode);
146 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
148 void undo (uint32_t n = 1);
149 void redo (uint32_t n = 1);
151 XMLNode& get_state ();
152 int set_state (const XMLNode& );
154 void set_mouse_mode (Editing::MouseMode, bool force=true);
155 void step_mouse_mode (bool next);
156 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
158 void set_midi_edit_cursor (Editing::MidiEditMode);
159 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
160 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
163 void add_imageframe_time_axis(const std::string & track_name, void*) ;
164 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
165 void connect_to_image_compositor() ;
166 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
169 TimeAxisView* get_named_time_axis(const std::string & name) ;
170 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
171 void add_to_idle_resize (TimeAxisView*, uint32_t);
173 RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
175 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
176 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
177 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
179 #ifdef USE_RUBBERBAND
180 std::vector<std::string> rb_opt_strings;
183 /* option editor-access */
185 void set_show_waveforms (bool yn);
186 bool show_waveforms() const { return _show_waveforms; }
188 void set_waveform_scale (Editing::WaveformScale);
190 void set_show_waveforms_recording (bool yn);
191 bool show_waveforms_recording() const { return _show_waveforms_recording; }
193 /* things that need to be public to be used in the main menubar */
195 void new_region_from_selection ();
196 void separate_regions_between (const TimeSelection&);
197 void separate_region_from_selection ();
198 void separate_region_from_punch ();
199 void separate_region_from_loop ();
200 void separate_regions_using_location (ARDOUR::Location&);
201 void toggle_playback (bool with_abort);
202 void transition_to_rolling (bool forward);
206 nframes64_t unit_to_frame (double unit) const {
207 return (nframes64_t) rint (unit * frames_per_unit);
210 double frame_to_unit (nframes64_t frame) const {
211 return rint ((double) frame / (double) frames_per_unit);
214 double frame_to_unit (double frame) const {
215 return rint (frame / frames_per_unit);
218 /* NOTE: these functions assume that the "pixel" coordinate is
219 the result of using the world->canvas affine transform on a
220 world coordinate. These coordinates already take into
221 account any scrolling carried out by adjusting the
225 nframes64_t pixel_to_frame (double pixel) const {
227 /* pixel can be less than zero when motion events
228 are processed. since we've already run the world->canvas
229 affine, that means that the location *really* is "off
230 to the right" and thus really is "before the start".
234 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
240 gulong frame_to_pixel (nframes64_t frame) const {
241 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
244 void flush_canvas ();
248 Selection& get_selection() const { return *selection; }
249 Selection& get_cut_buffer() const { return *cut_buffer; }
251 bool extend_selection_to_track (TimeAxisView&);
253 void play_selection ();
254 void select_all_in_track (Selection::Operation op);
255 void select_all (Selection::Operation op);
256 void invert_selection_in_track ();
257 void invert_selection ();
258 void deselect_all ();
262 void set_show_measures (bool yn);
263 bool show_measures () const { return _show_measures; }
264 bool initial_ruler_update_required;
267 /* analysis window */
268 void analyze_region_selection();
269 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);
300 Width editor_mixer_strip_width;
301 void maybe_add_mixer_strip_width (XMLNode&);
302 void show_editor_mixer (bool yn);
303 void show_editor_list (bool yn);
304 void set_selected_mixer_strip (TimeAxisView&);
305 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
306 void show_track_in_display (TimeAxisView& tv);
308 /* nudge is initiated by transport controls owned by ARDOUR_UI */
310 void nudge_forward (bool next, bool force_playhead);
311 void nudge_backward (bool next, bool force_playhead);
313 /* nudge initiated from context menu */
315 void nudge_forward_capture_offset ();
316 void nudge_backward_capture_offset ();
318 /* playhead/screen stuff */
320 void set_follow_playhead (bool yn);
321 void toggle_follow_playhead ();
322 bool follow_playhead() const { return _follow_playhead; }
323 bool dragging_playhead () const { return _dragging_playhead; }
325 void toggle_waveform_visibility ();
326 void toggle_zero_line_visibility ();
327 void toggle_waveforms_while_recording ();
328 void toggle_measure_visibility ();
329 void toggle_logo_visibility ();
331 /* SMPTE timecode & video sync */
333 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
334 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
335 void subframes_per_frame_chosen (uint32_t);
337 void update_smpte_mode();
338 void update_video_pullup();
339 void update_subframes_per_frame ();
342 void toggle_auto_xfade ();
343 void toggle_xfades_active ();
344 void toggle_xfade_visibility ();
345 bool xfade_visibility() const { return _xfade_visibility; }
346 void update_xfade_visibility ();
347 void update_crossfade_model ();
348 void set_crossfade_model (ARDOUR::CrossfadeModel);
351 void set_layer_model (ARDOUR::LayerModel);
352 void update_layering_model ();
354 void toggle_link_region_and_track_selection ();
356 /* redirect shared ops menu. caller must free returned menu */
358 Gtk::Menu* redirect_menu ();
360 /* floating windows/transient */
362 void ensure_float (Gtk::Window&);
366 void scroll_tracks_down_line ();
367 void scroll_tracks_up_line ();
369 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
370 void prepare_for_cleanup ();
371 void finish_cleanup ();
373 void maximise_editing_space();
374 void restore_editing_space();
376 void reset_x_origin (nframes64_t);
377 void reset_zoom (double);
378 void reposition_and_zoom (nframes64_t, double);
380 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
382 bool update_mouse_speed ();
383 bool decelerate_mouse_speed ();
385 void toggle_meter_updating();
387 void show_rhythm_ferret();
389 void goto_visual_state (uint32_t);
390 void save_visual_state (uint32_t);
392 void queue_draw_resize_line (int at);
393 void start_resize_line_ops ();
394 void end_resize_line_ops ();
397 void map_transport_state ();
398 void map_position_change (nframes64_t);
401 bool on_expose_event (GdkEventExpose*);
405 /// The session that we are editing, or 0
406 void color_handler ();
407 ARDOUR::Session *session;
410 // to keep track of the playhead position for control_scroll
411 boost::optional<nframes64_t> _control_scroll_target;
413 PlaylistSelector* _playlist_selector;
415 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
419 double frames_per_unit;
420 nframes64_t leftmost_frame;
421 Editing::ZoomFocus zoom_focus;
422 bool zoomed_to_region;
423 std::list<TAVState> track_states;
426 std::list<VisualState*> undo_visual_stack;
427 std::list<VisualState*> redo_visual_stack;
428 VisualState* current_visual_state (bool with_tracks = true);
429 void undo_visual_state ();
430 void redo_visual_state ();
431 void use_visual_state (VisualState&);
433 void swap_visual_state ();
435 std::vector<VisualState*> visual_states;
436 sigc::connection visual_state_op_connection;
437 void start_visual_state_op (uint32_t n);
438 void cancel_visual_state_op (uint32_t n);
439 bool end_visual_state_op (uint32_t n);
441 nframes64_t leftmost_frame;
442 double frames_per_unit;
443 Editing::ZoomFocus zoom_focus;
445 void set_frames_per_unit (double);
448 Editing::MouseMode mouse_mode;
449 Editing::MidiEditMode midi_edit_mode;
451 int post_maximal_editor_width;
452 int post_maximal_pane_position;
453 int pre_maximal_pane_position;
454 int pre_maximal_editor_width;
455 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
457 Gtk::Notebook the_notebook;
458 Gtk::HPaned edit_pane;
460 Gtk::EventBox meter_base;
462 Gtk::EventBox marker_base;
463 Gtk::HBox marker_box;
464 Gtk::VBox scrollers_rulers_markers_box;
466 void location_changed (ARDOUR::Location *);
467 void location_flags_changed (ARDOUR::Location *, void *);
468 void refresh_location_display ();
469 void refresh_location_display_s (ARDOUR::Change);
470 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
471 void add_new_location (ARDOUR::Location *);
472 void location_gone (ARDOUR::Location *);
473 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
474 gint really_remove_marker (ARDOUR::Location* loc);
475 void goto_nth_marker (int nth);
477 uint32_t location_marker_color;
478 uint32_t location_range_color;
479 uint32_t location_loop_color;
480 uint32_t location_punch_color;
481 uint32_t location_cd_marker_color;
483 struct LocationMarkers {
488 LocationMarkers () : start(0), end(0), valid (true) {}
494 void set_name (const string&);
495 void set_position (nframes64_t start, nframes64_t end = 0);
496 void set_color_rgba (uint32_t);
499 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
500 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
501 Marker* entered_marker;
503 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
504 LocationMarkerMap location_markers;
506 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
507 void clear_marker_display ();
508 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
509 bool choose_new_marker_name(string &name);
510 void update_cd_marker_display ();
511 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
513 TimeAxisView* clicked_axisview;
514 RouteTimeAxisView* clicked_routeview;
515 /** The last RegionView that was clicked on, or 0 if the last click was not
516 * on a RegionView. This is set up by the canvas event handlers in
517 * editor_canvas_events.cc
519 RegionView* clicked_regionview;
520 RegionSelection latest_regionviews;
521 uint32_t clicked_selection;
522 CrossfadeView* clicked_crossfadeview;
523 ControlPoint* clicked_control_point;
525 void sort_track_selection (TrackSelection* sel = 0);
527 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
528 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
529 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
531 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
533 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
534 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
535 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
536 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
540 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
541 bool button_release_can_deselect;
543 void catch_vanishing_regionview (RegionView *);
545 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
546 void select_all_tracks ();
548 int get_regionview_count_from_region_list (boost::shared_ptr<ARDOUR::Region> region);
550 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
551 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
552 void set_selected_track_as_side_effect (bool force = false);
553 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
555 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
556 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
557 void collect_new_region_view (RegionView *);
558 void collect_and_select_new_region_view (RegionView *);
560 Gtk::Menu track_context_menu;
561 Gtk::Menu track_region_context_menu;
562 Gtk::Menu track_selection_context_menu;
563 Gtk::Menu track_crossfade_context_menu;
565 Gtk::MenuItem* region_edit_menu_split_item;
566 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
567 Gtk::Menu * track_region_edit_playlist_menu;
568 Gtk::Menu * track_edit_playlist_submenu;
569 Gtk::Menu * track_selection_edit_playlist_submenu;
571 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
572 Gtk::Menu* build_track_context_menu (nframes64_t);
573 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
574 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
575 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
576 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
577 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
578 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
579 void add_region_context_items (StreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
580 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
581 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
583 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
585 void handle_new_route (ARDOUR::Session::RouteList&);
586 void remove_route (TimeAxisView *);
589 Gtk::HBox global_hpacker;
590 Gtk::VBox global_vpacker;
593 bool need_resize_line;
595 int old_resize_line_y;
597 Gdk::Cursor* current_canvas_cursor;
598 void set_canvas_cursor ();
599 Gdk::Cursor* which_grabber_cursor ();
601 ArdourCanvas::Canvas* track_canvas;
603 ArdourCanvas::Text* first_action_message;
604 ArdourCanvas::Text* verbose_canvas_cursor;
605 bool verbose_cursor_visible;
607 void parameter_changed (const char *);
609 bool track_canvas_motion (GdkEvent*);
611 void set_verbose_canvas_cursor (const string &, double x, double y);
612 void set_verbose_canvas_cursor_text (const string &);
613 void show_verbose_canvas_cursor();
614 void hide_verbose_canvas_cursor();
616 bool verbose_cursor_on; // so far unused
618 Gtk::EventBox time_canvas_event_box;
619 Gtk::EventBox track_canvas_event_box;
620 Gtk::EventBox time_button_event_box;
621 Gtk::EventBox ruler_label_event_box;
623 ArdourCanvas::Group *minsec_group;
624 ArdourCanvas::Pixbuf *logo_item;
625 ArdourCanvas::Group *bbt_group;
626 ArdourCanvas::Group *smpte_group;
627 ArdourCanvas::Group *frame_group;
628 ArdourCanvas::Group *tempo_group;
629 ArdourCanvas::Group *meter_group;
630 ArdourCanvas::Group *marker_group;
631 ArdourCanvas::Group *range_marker_group;
632 ArdourCanvas::Group *transport_marker_group;
633 ArdourCanvas::Group* cd_marker_group;
635 ArdourCanvas::Group* timebar_group;
637 /* These bars never need to be scrolled */
638 ArdourCanvas::Group* meter_bar_group;
639 ArdourCanvas::Group* tempo_bar_group;
640 ArdourCanvas::Group* marker_bar_group;
641 ArdourCanvas::Group* range_marker_bar_group;
642 ArdourCanvas::Group* transport_marker_bar_group;
643 ArdourCanvas::Group* cd_marker_bar_group;
645 /** The group containing all items that require horizontal scrolling. */
646 ArdourCanvas::Group* _master_group;
648 /* The group containing all trackviews. Only scrolled vertically. */
649 ArdourCanvas::Group* _trackview_group;
651 /* The group used for region motion. Sits on top of _trackview_group */
652 ArdourCanvas::Group* _region_motion_group;
655 ruler_metric_smpte = 0,
656 ruler_metric_bbt = 1,
657 ruler_metric_frames = 2,
658 ruler_metric_minsec = 3,
660 ruler_time_tempo = 4,
661 ruler_time_meter = 5,
662 ruler_time_marker = 6,
663 ruler_time_range_marker = 7,
664 ruler_time_transport_marker = 8,
665 ruler_time_cd_marker = 9,
668 static GtkCustomMetric ruler_metrics[4];
669 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
670 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
671 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
672 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
673 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
674 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
675 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
676 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
677 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
678 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
679 bool no_ruler_shown_update;
681 gint ruler_button_press (GdkEventButton*);
682 gint ruler_button_release (GdkEventButton*);
683 gint ruler_mouse_motion (GdkEventMotion*);
684 bool ruler_scroll (GdkEventScroll* event);
686 gint ruler_pressed_button;
687 Gtk::Widget * ruler_grabbed_widget;
689 void initialize_rulers ();
690 void update_just_smpte ();
691 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
692 void update_fixed_rulers ();
693 void update_tempo_based_rulers ();
694 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
695 void update_ruler_visibility ();
696 void set_ruler_visible (RulerType, bool);
697 void toggle_ruler_visibility (RulerType rt);
698 void ruler_toggled (int);
699 gint ruler_label_button_release (GdkEventButton*);
700 void store_ruler_visibility ();
701 void restore_ruler_visibility ();
703 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
704 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
705 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
706 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
708 enum MinsecRulerScale {
715 MinsecRulerScale minsec_ruler_scale;
717 nframes_t minsec_mark_interval;
718 gint minsec_mark_modulo;
720 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
722 enum SMPTERulerScale {
730 SMPTERulerScale smpte_ruler_scale;
732 nframes_t smpte_mark_interval;
733 gint smpte_mark_modulo;
735 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
745 bbt_show_ticks_detail,
746 bbt_show_ticks_super_detail
749 BBTRulerScale bbt_ruler_scale;
753 uint32_t bbt_bar_helper_on;
754 uint32_t bbt_accent_modulo;
755 void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper);
757 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
758 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
759 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
760 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
762 Gtk::Widget *_ruler_separator;
763 GtkWidget *_smpte_ruler;
764 GtkWidget *_bbt_ruler;
765 GtkWidget *_frames_ruler;
766 GtkWidget *_minsec_ruler;
767 Gtk::Widget *smpte_ruler;
768 Gtk::Widget *bbt_ruler;
769 Gtk::Widget *frames_ruler;
770 Gtk::Widget *minsec_ruler;
771 static Editor *ruler_editor;
773 static const double timebar_height;
774 guint32 visible_timebars;
775 gdouble canvas_timebars_vsize;
776 Gtk::Menu *editor_ruler_menu;
778 ArdourCanvas::SimpleRect* tempo_bar;
779 ArdourCanvas::SimpleRect* meter_bar;
780 ArdourCanvas::SimpleRect* marker_bar;
781 ArdourCanvas::SimpleRect* range_marker_bar;
782 ArdourCanvas::SimpleRect* transport_marker_bar;
783 ArdourCanvas::SimpleRect* cd_marker_bar;
785 Gtk::Label minsec_label;
786 Gtk::Label bbt_label;
787 Gtk::Label smpte_label;
788 Gtk::Label frame_label;
789 Gtk::Label tempo_label;
790 Gtk::Label meter_label;
791 Gtk::Label mark_label;
792 Gtk::Label range_mark_label;
793 Gtk::Label transport_mark_label;
794 Gtk::Label cd_mark_label;
797 Gtk::VBox time_button_vbox;
798 Gtk::HBox time_button_hbox;
802 ArdourCanvas::Points points;
803 ArdourCanvas::Line canvas_item;
804 nframes64_t current_frame;
807 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
810 void set_position (nframes64_t);
811 void set_length (double units);
812 void set_y_axis (double position);
815 friend struct Cursor; /* it needs access to several private
819 Cursor* playhead_cursor;
820 ArdourCanvas::Group* cursor_group;
822 void cursor_to_region_boundary (Cursor*, int32_t dir);
823 void cursor_to_next_region_boundary (Cursor*);
824 void cursor_to_previous_region_boundary (Cursor*);
825 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
826 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
827 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
828 void cursor_to_selection_start (Cursor *);
829 void cursor_to_selection_end (Cursor *);
831 void selected_marker_to_region_boundary (int32_t dir);
832 void selected_marker_to_next_region_boundary ();
833 void selected_marker_to_previous_region_boundary ();
834 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
835 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
836 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
837 void selected_marker_to_selection_start ();
838 void selected_marker_to_selection_end ();
840 void select_all_selectables_using_cursor (Cursor *, bool);
841 void select_all_selectables_using_edit (bool);
842 void select_all_selectables_between (bool within);
843 void select_range_between ();
845 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
846 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
848 vector<nframes64_t> region_boundary_cache;
849 void build_region_boundary_cache ();
852 Gtk::HBox bottom_hbox;
854 Gtk::Table edit_packer;
855 Gtk::VScrollbar edit_vscrollbar;
857 Gtk::Adjustment vertical_adjustment;
858 Gtk::Adjustment horizontal_adjustment;
860 Gtk::Layout controls_layout;
861 bool control_layout_scroll (GdkEventScroll* ev);
862 void controls_layout_size_request (Gtk::Requisition*);
864 Gtk::HScrollbar edit_hscrollbar;
865 bool _dragging_hscrollbar;
867 void reset_hscrollbar_stepping ();
869 bool hscrollbar_button_press (GdkEventButton*);
870 bool hscrollbar_button_release (GdkEventButton*);
871 void hscrollbar_allocate (Gtk::Allocation &alloc);
874 double canvas_height;
875 double full_canvas_height;
876 nframes64_t last_canvas_frame;
878 bool track_canvas_map_handler (GdkEventAny*);
880 gint edit_controls_button_release (GdkEventButton*);
881 Gtk::Menu *edit_controls_left_menu;
882 Gtk::Menu *edit_controls_right_menu;
884 Gtk::VBox ruler_label_vbox;
885 Gtk::VBox track_canvas_vbox;
886 Gtk::VBox time_canvas_vbox;
887 Gtk::VBox edit_controls_vbox;
888 Gtk::HBox edit_controls_hbox;
890 void control_scroll (float);
891 void access_action (std::string,std::string);
892 bool deferred_control_scroll (nframes64_t);
893 sigc::connection control_scroll_connection;
895 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
896 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
897 void tie_vertical_scrolling ();
898 void scroll_canvas_horizontally ();
899 void scroll_canvas_vertically ();
900 void canvas_horizontally_scrolled ();
901 void canvas_scroll_to (nframes64_t);
903 struct VisualChange {
910 nframes64_t time_origin;
911 double frames_per_unit;
915 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
919 VisualChange pending_visual_change;
921 static int _idle_visual_changer (void *arg);
922 int idle_visual_changer ();
924 void queue_visual_change (nframes64_t);
925 void queue_visual_change (double);
927 void end_location_changed (ARDOUR::Location*);
929 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
930 RegionListDisplayModelColumns() {
940 Gtk::TreeModelColumn<Glib::ustring> name;
941 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
942 Gtk::TreeModelColumn<Gdk::Color> color_;
943 Gtk::TreeModelColumn<Glib::ustring> start;
944 Gtk::TreeModelColumn<Glib::ustring> end;
945 Gtk::TreeModelColumn<Glib::ustring> length;
946 Gtk::TreeModelColumn<Glib::ustring> used;
947 Gtk::TreeModelColumn<Glib::ustring> path;
950 RegionListDisplayModelColumns region_list_columns;
951 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
953 Glib::RefPtr<Gtk::TreeStore> region_list_model;
954 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
955 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
957 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
958 void region_list_selection_changed ();
959 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
960 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
961 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
963 Gtk::Menu *region_list_menu;
964 Gtk::ScrolledWindow region_list_scroller;
965 Gtk::Frame region_list_frame;
967 bool region_list_display_key_press (GdkEventKey *);
968 bool region_list_display_key_release (GdkEventKey *);
969 bool region_list_display_button_press (GdkEventButton *);
970 bool region_list_display_button_release (GdkEventButton *);
971 void region_list_clear ();
972 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
973 void build_region_list_menu ();
974 void show_region_list_display_context_menu (int button, int time);
976 bool show_automatic_regions_in_region_list;
977 Editing::RegionListSortType region_list_sort_type;
979 void reset_region_list_sort_direction (bool);
980 void reset_region_list_sort_type (Editing::RegionListSortType);
982 void toggle_full_region_list ();
983 void toggle_show_auto_regions ();
985 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
989 Gtk::ScrolledWindow snapshot_display_scroller;
990 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
991 SnapshotDisplayModelColumns() {
995 Gtk::TreeModelColumn<Glib::ustring> visible_name;
996 Gtk::TreeModelColumn<Glib::ustring> real_name;
999 SnapshotDisplayModelColumns snapshot_display_columns;
1000 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
1001 Gtk::TreeView snapshot_display;
1002 Gtk::Menu snapshot_context_menu;
1004 bool snapshot_display_button_press (GdkEventButton*);
1005 void snapshot_display_selection_changed ();
1006 void redisplay_snapshots();
1007 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
1009 /* named selections */
1011 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1012 NamedSelectionDisplayModelColumns() {
1016 Gtk::TreeModelColumn<Glib::ustring> text;
1017 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
1020 NamedSelectionDisplayModelColumns named_selection_columns;
1021 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
1023 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
1024 Gtk::ScrolledWindow named_selection_scroller;
1026 void create_named_selection ();
1027 void paste_named_selection (float times);
1028 void remove_selected_named_selections ();
1029 void remove_snapshot (Glib::ustring);
1030 void rename_snapshot (Glib::ustring);
1032 void handle_new_named_selection ();
1033 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
1034 void redisplay_named_selections ();
1036 bool named_selection_display_button_release (GdkEventButton *ev);
1037 bool named_selection_display_key_release (GdkEventKey *ev);
1038 void named_selection_display_selection_changed ();
1041 TrackViewList track_views;
1042 TimeAxisView *trackview_by_y_position (double ypos);
1044 static Gdk::Cursor* cross_hair_cursor;
1045 static Gdk::Cursor* trimmer_cursor;
1046 static Gdk::Cursor* selector_cursor;
1047 static Gdk::Cursor* grabber_cursor;
1048 static Gdk::Cursor* grabber_edit_point_cursor;
1049 static Gdk::Cursor* zoom_cursor;
1050 static Gdk::Cursor* time_fx_cursor;
1051 static Gdk::Cursor* fader_cursor;
1052 static Gdk::Cursor* speaker_cursor;
1053 static Gdk::Cursor* midi_pencil_cursor;
1054 static Gdk::Cursor* midi_select_cursor;
1055 static Gdk::Cursor* midi_resize_cursor;
1056 static Gdk::Cursor* midi_erase_cursor;
1057 static Gdk::Cursor* wait_cursor;
1058 static Gdk::Cursor* timebar_cursor;
1059 static Gdk::Cursor* transparent_cursor;
1061 static void build_cursors ();
1063 sigc::connection scroll_connection;
1064 nframes64_t last_update_frame;
1065 void center_screen (nframes64_t);
1066 void center_screen_internal (nframes64_t, float);
1068 void update_current_screen ();
1070 void session_going_away ();
1072 nframes64_t cut_buffer_start;
1073 nframes64_t cut_buffer_length;
1075 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1076 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1077 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1078 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1079 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1080 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1082 /* KEYMAP HANDLING */
1084 void register_actions ();
1086 int ensure_cursor (nframes64_t* pos);
1088 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
1089 void handle_new_regions (vector<boost::weak_ptr<ARDOUR::Region> >& );
1090 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
1091 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
1092 void add_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::Region> > & );
1093 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1094 void redisplay_regions ();
1095 void update_region_row (boost::shared_ptr<ARDOUR::Region>);
1096 bool no_region_list_redisplay;
1097 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
1099 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
1101 void cut_copy (Editing::CutCopyOp);
1102 bool can_cut_copy () const;
1103 void cut_copy_points (Editing::CutCopyOp);
1104 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1105 void cut_copy_ranges (Editing::CutCopyOp);
1107 void mouse_paste ();
1108 void paste_internal (nframes64_t position, float times);
1110 /* EDITING OPERATIONS */
1112 void reset_point_selection ();
1113 void toggle_region_mute ();
1114 void toggle_region_lock ();
1115 void toggle_region_opaque ();
1116 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1117 void raise_region ();
1118 void raise_region_to_top ();
1119 void lower_region ();
1120 void lower_region_to_bottom ();
1121 void split_region ();
1122 void split_region_at (nframes64_t);
1123 void split_regions_at (nframes64_t, RegionSelection&);
1124 void split_region_at_transients ();
1125 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1126 void crop_region_to_selection ();
1127 void crop_region_to (nframes64_t start, nframes64_t end);
1128 void set_sync_point (nframes64_t, const RegionSelection&);
1129 void set_region_sync_from_edit_point ();
1130 void remove_region_sync();
1131 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1132 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1133 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1134 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1135 void remove_selected_regions ();
1136 void remove_clicked_region ();
1137 void edit_region ();
1138 void rename_region ();
1139 void duplicate_some_regions (RegionSelection&, float times);
1140 void duplicate_selection (float times);
1141 void region_fill_selection ();
1143 void region_fill_track ();
1144 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1145 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1146 void split_multichannel_region();
1147 void reverse_region ();
1148 void normalize_region ();
1149 void denormalize_region ();
1150 void adjust_region_scale_amplitude (bool up);
1151 void quantize_region ();
1153 void do_insert_time ();
1154 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1156 void tab_to_transient (bool forward);
1158 void use_region_as_bar ();
1159 void use_range_as_bar ();
1161 void define_one_bar (nframes64_t start, nframes64_t end);
1163 void audition_region_from_region_list ();
1164 void hide_region_from_region_list ();
1165 void remove_region_from_region_list ();
1167 void align (ARDOUR::RegionPoint);
1168 void align_relative (ARDOUR::RegionPoint);
1171 void reset_focus ();
1177 void paste (float times);
1179 int get_prefix (float&, bool&);
1181 void keyboard_paste ();
1182 void keyboard_insert_region_list_selection ();
1184 void region_from_selection ();
1185 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::Region> >&);
1187 void play_from_start ();
1188 void play_from_edit_point ();
1189 void play_from_edit_point_and_return ();
1190 void play_selected_region ();
1191 void play_edit_range ();
1192 void loop_selected_region ();
1193 void play_location (ARDOUR::Location&);
1194 void loop_location (ARDOUR::Location&);
1196 void temporal_zoom_selection ();
1197 void temporal_zoom_region (bool both_axes);
1198 void toggle_zoom_region (bool both_axes);
1199 bool zoomed_to_region;
1200 void temporal_zoom_session ();
1201 void temporal_zoom (gdouble scale);
1202 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1203 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1205 void amplitude_zoom (gdouble scale);
1206 void amplitude_zoom_step (bool in);
1208 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1209 void insert_region_list_selection (float times);
1211 void insert_route_list_drag (boost::shared_ptr<ARDOUR::Route>, int x, int y);
1213 /* import & embed */
1215 void add_external_audio_action (Editing::ImportMode);
1216 void external_audio_dialog ();
1218 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1219 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1221 SoundFileOmega* sfbrowser;
1223 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1225 void _do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1226 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1227 bool idle_do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1229 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1230 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1231 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1233 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1234 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
1235 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1236 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
1238 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1239 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
1240 int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1241 boost::shared_ptr<ARDOUR::Track>& existing_track);
1243 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1244 boost::shared_ptr<ARDOUR::MidiTrack> get_nth_selected_midi_track (int nth) const;
1246 /* generic interthread progress window */
1248 ArdourDialog* interthread_progress_window;
1249 Gtk::Label interthread_progress_label;
1250 Gtk::VBox interthread_progress_vbox;
1251 Gtk::ProgressBar interthread_progress_bar;
1252 Gtk::Button interthread_cancel_button;
1253 Gtk::Label interthread_cancel_label;
1254 sigc::connection interthread_progress_connection;
1255 void interthread_cancel_clicked ();
1256 void build_interthread_progress_window ();
1257 ARDOUR::InterThreadInfo* current_interthread_info;
1260 AnalysisWindow* analysis_window;
1263 /* import specific info */
1265 ARDOUR::Session::import_status import_status;
1266 gint import_progress_timeout (void *);
1267 static void *_import_thread (void *);
1268 void* import_thread ();
1270 /* to support this ... */
1272 void import_audio (bool as_tracks);
1273 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1275 void move_to_start ();
1276 void move_to_end ();
1278 void center_playhead ();
1279 void center_edit_point ();
1280 void edit_cursor_backward ();
1281 void edit_cursor_forward ();
1282 void playhead_forward_to_grid ();
1283 void playhead_backward_to_grid ();
1284 void playhead_backward ();
1285 void playhead_forward ();
1286 void scroll_playhead (bool forward);
1287 void scroll_backward (float pages=0.8f);
1288 void scroll_forward (float pages=0.8f);
1289 void scroll_tracks_down ();
1290 void scroll_tracks_up ();
1291 void delete_sample_forward ();
1292 void delete_sample_backward ();
1293 void delete_screen ();
1294 void search_backwards ();
1295 void search_forwards ();
1297 void clear_markers ();
1298 void clear_ranges ();
1299 void clear_locations ();
1300 void unhide_markers ();
1301 void unhide_ranges ();
1302 void jump_forward_to_mark ();
1303 void jump_backward_to_mark ();
1304 void cursor_align (bool playhead_to_edit);
1306 void remove_last_capture ();
1307 void select_all_selectables_using_time_selection ();
1308 void select_all_selectables_using_loop();
1309 void select_all_selectables_using_punch();
1310 void set_selection_from_range (ARDOUR::Location&);
1311 void set_selection_from_punch ();
1312 void set_selection_from_loop ();
1313 void set_selection_from_region ();
1315 void add_location_mark (nframes64_t where);
1316 void add_location_from_audio_region ();
1317 void add_location_from_selection ();
1318 void set_loop_from_selection (bool play);
1319 void set_punch_from_selection ();
1320 void set_punch_from_region ();
1322 void set_loop_from_edit_range (bool play);
1323 void set_loop_from_region (bool play);
1324 void set_punch_from_edit_range ();
1326 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1327 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1329 void add_location_from_playhead_cursor ();
1330 bool select_new_marker;
1332 void reverse_selection ();
1333 void edit_envelope ();
1335 void start_scrolling ();
1336 void stop_scrolling ();
1339 double last_scrub_x;
1340 int scrubbing_direction;
1341 int scrub_reversals;
1342 int scrub_reverse_distance;
1345 void keyboard_selection_begin ();
1346 void keyboard_selection_finish (bool add);
1347 bool have_pending_keyboard_selection;
1348 nframes64_t pending_keyboard_selection_start;
1350 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1351 void extend_selection_to_end_of_region (bool next);
1352 void extend_selection_to_start_of_region (bool previous);
1354 Editing::SnapType snap_type;
1355 Editing::SnapMode snap_mode;
1357 /// Snap threshold in pixels
1358 double snap_threshold;
1360 void handle_gui_changes (const string &, void *);
1362 void hide_all_tracks (bool with_select);
1365 LineDragInfo current_line_drag_info;
1367 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1368 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1369 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1371 void finalize_drag ();
1373 Gtk::Menu fade_context_menu;
1374 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1376 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1377 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1378 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1379 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1380 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1381 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1383 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1384 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1386 void set_fade_length (bool in);
1387 void toggle_fade_active (bool in);
1388 void set_fade_in_active (bool);
1389 void set_fade_out_active (bool);
1391 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1392 RegionSelection pre_drag_region_selection;
1393 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1394 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1395 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1396 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1397 bool check_region_drag_possible (RouteTimeAxisView**);
1398 void possibly_copy_regions_during_grab (GdkEvent*);
1399 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1400 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1402 bool _dragging_playhead;
1403 bool _dragging_edit_point;
1405 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1406 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1407 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1408 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1409 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1410 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1411 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1412 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1414 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1415 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1416 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1417 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1419 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1421 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1422 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1423 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1424 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1425 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1426 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1427 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1428 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1429 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1430 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1431 void start_line_grab (AutomationLine *, GdkEvent*);
1432 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1433 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1434 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1435 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1437 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1439 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1440 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1442 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1443 void brush (nframes64_t);
1445 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1446 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1447 double clamp_verbose_cursor_x (double);
1448 double clamp_verbose_cursor_y (double);
1450 /* Canvas event handlers */
1452 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1453 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1454 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1455 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1456 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1457 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1458 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1459 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1460 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1461 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1464 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1466 ArdourCanvas::Item *last_item_entered;
1467 int last_item_entered_n;
1470 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1471 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1472 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1473 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1474 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1475 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1476 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1477 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1478 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1480 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1481 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1482 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1483 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1484 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1485 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1487 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1488 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1489 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1490 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1491 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1492 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1493 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1494 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1496 /* non-public event handlers */
1498 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1499 bool track_canvas_scroll (GdkEventScroll* event);
1501 bool track_canvas_scroll_event (GdkEventScroll* event);
1502 bool track_canvas_button_press_event (GdkEventButton* event);
1503 bool track_canvas_button_release_event (GdkEventButton* event);
1504 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1506 Gtk::Allocation canvas_allocation;
1507 bool canvas_idle_queued;
1508 void track_canvas_allocate (Gtk::Allocation alloc);
1509 bool track_canvas_size_allocated ();
1511 void set_playhead_cursor ();
1513 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1514 void kbd_mute_unmute_region ();
1517 void kbd_do_brush (GdkEvent*);
1518 void kbd_do_audition (GdkEvent*);
1520 void handle_new_duration ();
1521 void initialize_canvas ();
1523 /* display control */
1525 bool _show_measures;
1526 /// true to show waveforms, otherwise false
1527 bool _show_waveforms;
1528 /// true if the editor should follow the playhead, otherwise false
1529 bool _follow_playhead;
1530 /// true if waveforms should be shown while recording audio tracks, otherwise false
1531 bool _show_waveforms_recording;
1533 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1535 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1536 TimeLineList free_measure_lines;
1537 TimeLineList used_measure_lines;
1539 ArdourCanvas::Group* time_line_group;
1540 ArdourCanvas::SimpleLine* get_time_line ();
1542 void hide_measures ();
1543 void draw_measures ();
1544 bool redraw_measures ();
1546 void new_tempo_section ();
1548 void mouse_add_new_tempo_event (nframes64_t where);
1549 void mouse_add_new_meter_event (nframes64_t where);
1551 void remove_tempo_marker (ArdourCanvas::Item*);
1552 void remove_meter_marker (ArdourCanvas::Item*);
1553 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1554 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1556 void edit_tempo_section (ARDOUR::TempoSection*);
1557 void edit_meter_section (ARDOUR::MeterSection*);
1558 void edit_tempo_marker (ArdourCanvas::Item*);
1559 void edit_meter_marker (ArdourCanvas::Item*);
1561 void marker_menu_edit ();
1562 void marker_menu_remove ();
1563 void marker_menu_rename ();
1564 void marker_menu_lock (bool yn);
1565 void marker_menu_hide ();
1566 void marker_menu_loop_range ();
1567 void marker_menu_select_all_selectables_using_range ();
1568 void marker_menu_select_using_range ();
1569 void marker_menu_separate_regions_using_location ();
1570 void marker_menu_play_from ();
1571 void marker_menu_play_range ();
1572 void marker_menu_set_playhead ();
1573 void marker_menu_set_from_playhead ();
1574 void marker_menu_set_from_selection ();
1575 void marker_menu_range_to_next ();
1576 void new_transport_marker_menu_set_loop ();
1577 void new_transport_marker_menu_set_punch ();
1578 void update_loop_range_view (bool visibility=false);
1579 void update_punch_range_view (bool visibility=false);
1580 gint new_transport_marker_menu_popdown (GdkEventAny*);
1581 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1582 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1583 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1584 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1585 void build_range_marker_menu (bool loop_or_punch);
1586 void build_marker_menu (bool start_or_end);
1587 void build_tm_marker_menu ();
1588 void build_new_transport_marker_menu ();
1590 Gtk::Menu* tm_marker_menu;
1591 Gtk::Menu* marker_menu;
1592 Gtk::Menu* start_end_marker_menu;
1593 Gtk::Menu* range_marker_menu;
1594 Gtk::Menu* transport_marker_menu;
1595 Gtk::Menu* new_transport_marker_menu;
1596 Gtk::Menu* cd_marker_menu;
1597 ArdourCanvas::Item* marker_menu_item;
1599 typedef list<Marker*> Marks;
1602 void remove_metric_marks ();
1603 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1605 void compute_current_bbt_points (nframes_t left, nframes_t right);
1606 int tempo_map_change_idle_handler_id;
1607 void tempo_map_changed (ARDOUR::Change);
1608 void redisplay_tempo (bool immediate_redraw);
1610 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1612 double snap_length_beats (nframes64_t start);
1614 uint32_t bbt_beat_subdivision;
1618 Gtk::ToggleButton editor_mixer_button;
1619 Gtk::ToggleButton editor_list_button;
1621 void editor_mixer_button_toggled ();
1622 void editor_list_button_toggled ();
1624 AudioClock edit_point_clock;
1625 AudioClock zoom_range_clock;
1626 Gtk::Button zoom_in_button;
1627 Gtk::Button zoom_out_button;
1628 Gtk::Button zoom_out_full_button;
1629 Gtk::Button zoom_onetoone_button;
1631 Gtk::VBox toolbar_clock_vbox;
1632 Gtk::VBox toolbar_selection_clock_vbox;
1633 Gtk::Table toolbar_selection_clock_table;
1634 Gtk::Label toolbar_selection_cursor_label;
1636 Gtk::HBox mouse_mode_button_box;
1637 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1638 Gtk::ToggleButton mouse_select_button;
1639 Gtk::ToggleButton mouse_move_button;
1640 Gtk::ToggleButton mouse_gain_button;
1641 Gtk::ToggleButton mouse_zoom_button;
1642 Gtk::ToggleButton mouse_timefx_button;
1643 Gtk::ToggleButton mouse_audition_button;
1644 Gtk::ToggleButton mouse_note_button;
1645 GroupedButtons *mouse_mode_button_set;
1646 void mouse_mode_toggled (Editing::MouseMode m);
1647 bool ignore_mouse_mode_toggle;
1649 gint mouse_select_button_release (GdkEventButton*);
1651 Gtk::VBox automation_box;
1652 Gtk::Button automation_mode_button;
1653 Gtk::ToggleButton global_automation_button;
1655 Gtk::ComboBoxText edit_mode_selector;
1656 Gtk::VBox edit_mode_box;
1658 void set_edit_mode (ARDOUR::EditMode);
1659 void cycle_edit_mode ();
1660 void edit_mode_selection_done ();
1662 Gtk::ComboBoxText snap_type_selector;
1663 Gtk::ComboBoxText snap_mode_selector;
1666 std::vector<std::string> snap_type_strings;
1667 std::vector<std::string> snap_mode_strings;
1669 void snap_type_selection_done ();
1670 void snap_mode_selection_done ();
1671 void snap_mode_chosen (Editing::SnapMode);
1672 void snap_type_chosen (Editing::SnapType);
1674 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1675 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1677 Gtk::ComboBoxText zoom_focus_selector;
1678 Gtk::VBox zoom_focus_box;
1680 std::vector<std::string> zoom_focus_strings;
1682 void zoom_focus_selection_done ();
1683 void zoom_focus_chosen (Editing::ZoomFocus);
1685 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1689 void zoom_adjustment_changed();
1691 void edit_point_clock_changed();
1693 void setup_toolbar ();
1695 Gtkmm2ext::TearOff* tools_tearoff;
1696 Gtk::HBox toolbar_hbox;
1697 Gtk::EventBox toolbar_base;
1698 Gtk::Frame toolbar_frame;
1702 Gtk::HBox midi_tool_button_box;
1703 Gtkmm2ext::TearOff* midi_tool_tearoff;
1704 Gtk::ToggleButton midi_tool_pencil_button;
1705 Gtk::ToggleButton midi_tool_select_button;
1706 Gtk::ToggleButton midi_tool_resize_button;
1707 Gtk::ToggleButton midi_tool_erase_button;
1708 GroupedButtons *midi_tool_button_set;
1709 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1710 bool ignore_midi_edit_mode_toggle;
1712 Gtkmm2ext::TearOff* midi_tools_tearoff;
1713 Gtk::HBox midi_toolbar_hbox;
1714 Gtk::EventBox midi_toolbar_base;
1715 Gtk::Frame midi_toolbar_frame;
1717 void setup_midi_toolbar ();
1719 /* selection process */
1721 Selection* selection;
1722 Selection* cut_buffer;
1724 void time_selection_changed ();
1725 void track_selection_changed ();
1726 void region_selection_changed ();
1727 void sensitize_the_right_region_actions (bool have_selected_regions);
1728 void point_selection_changed ();
1729 void marker_selection_changed ();
1738 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1739 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1740 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1741 void cancel_selection ();
1743 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1744 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1745 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1747 bool audio_region_selection_covers (nframes64_t where);
1749 /* transport range select process */
1750 enum RangeMarkerOp {
1752 CreateTransportMarker,
1756 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1757 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1758 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1760 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1761 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1762 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1763 ArdourCanvas::Line* marker_drag_line;
1764 ArdourCanvas::Points marker_drag_line_points;
1765 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1767 void update_marker_drag_item (ARDOUR::Location *);
1769 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1770 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1771 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1772 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1773 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1774 ArdourCanvas::SimpleLine *transport_punchin_line;
1775 ArdourCanvas::SimpleLine *transport_punchout_line;
1776 ArdourCanvas::SimpleRect *transport_preroll_rect;
1777 ArdourCanvas::SimpleRect *transport_postroll_rect;
1779 ARDOUR::Location* transport_loop_location();
1780 ARDOUR::Location* transport_punch_location();
1782 ARDOUR::Location *temp_location;
1784 /* object rubberband select process */
1786 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1787 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1788 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1790 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1792 ArdourCanvas::SimpleRect *rubberband_rect;
1794 /* mouse zoom process */
1796 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1797 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1798 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1800 ArdourCanvas::SimpleRect *zoom_rect;
1801 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1803 /* diskstream/route display management */
1805 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1806 RouteDisplayModelColumns() {
1809 add (temporary_visible);
1813 Gtk::TreeModelColumn<Glib::ustring> text;
1814 Gtk::TreeModelColumn<bool> visible;
1815 Gtk::TreeModelColumn<bool> temporary_visible;
1816 Gtk::TreeModelColumn<TimeAxisView*> tv;
1817 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1820 RouteDisplayModelColumns route_display_columns;
1821 Glib::RefPtr<Gtk::ListStore> route_display_model;
1822 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1824 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1825 Gtk::ScrolledWindow route_list_scroller;
1826 Gtk::Menu* route_list_menu;
1828 void update_route_visibility ();
1830 void sync_order_keys ();
1831 bool ignore_route_order_sync;
1833 bool route_list_display_button_press (GdkEventButton*);
1834 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1837 const Gtk::SelectionData& data,
1841 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1843 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1844 void route_list_delete (const Gtk::TreeModel::Path&);
1845 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1847 void initial_route_list_display ();
1848 void redisplay_route_list();
1849 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1850 bool ignore_route_list_reorder;
1851 bool no_route_list_redisplay;
1853 void build_route_list_menu ();
1854 void show_route_list_menu ();
1856 void show_all_routes ();
1857 void hide_all_routes ();
1858 void show_all_audiotracks ();
1859 void hide_all_audiotracks ();
1860 void show_all_audiobus ();
1861 void hide_all_audiobus ();
1863 void set_all_tracks_visibility (bool yn);
1864 void set_all_audio_visibility (int type, bool yn);
1866 /* edit group management */
1868 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1869 GroupListModelColumns () {
1875 Gtk::TreeModelColumn<bool> is_active;
1876 Gtk::TreeModelColumn<bool> is_visible;
1877 Gtk::TreeModelColumn<std::string> text;
1878 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1881 GroupListModelColumns group_columns;
1882 Glib::RefPtr<Gtk::ListStore> group_model;
1883 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1885 Gtk::TreeView edit_group_display;
1886 Gtk::ScrolledWindow edit_group_display_scroller;
1887 Gtk::Menu* edit_group_list_menu;
1889 void build_edit_group_list_menu ();
1890 void activate_all_edit_groups ();
1891 void disable_all_edit_groups ();
1893 bool in_edit_group_row_change;
1894 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1895 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1896 void new_edit_group ();
1897 void edit_group_list_button_clicked ();
1898 gint edit_group_list_button_press_event (GdkEventButton* ev);
1899 void add_edit_group (ARDOUR::RouteGroup* group);
1900 void remove_selected_edit_group ();
1901 void edit_groups_changed ();
1902 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1904 Gtk::VBox list_vpacker;
1908 bool autoscroll_active;
1909 int autoscroll_timeout_tag;
1912 int last_autoscroll_x;
1913 int last_autoscroll_y;
1914 uint32_t autoscroll_cnt;
1915 nframes64_t autoscroll_x_distance;
1916 double autoscroll_y_distance;
1918 static gint _autoscroll_canvas (void *);
1919 bool autoscroll_canvas ();
1920 void start_canvas_autoscroll (int x, int y);
1921 void stop_canvas_autoscroll ();
1922 void maybe_autoscroll (GdkEventMotion*);
1923 void maybe_autoscroll_horizontally (GdkEventMotion*);
1924 bool allow_vertical_scroll;
1933 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1934 void point_trim (GdkEvent*);
1935 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1936 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1937 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1938 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1940 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1941 void thaw_region_after_trim (RegionView& rv);
1943 void trim_region_front();
1944 void trim_region_back();
1945 void trim_region (bool front);
1947 void trim_region_to_edit_point ();
1948 void trim_region_from_edit_point ();
1949 void trim_region_to_loop ();
1950 void trim_region_to_punch ();
1951 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1953 bool show_gain_after_trim;
1957 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1958 const Glib::RefPtr<Gdk::DragContext>& context,
1961 const Gtk::SelectionData& data,
1965 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1968 const Gtk::SelectionData& data,
1972 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1975 const Gtk::SelectionData& data,
1980 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1983 const Gtk::SelectionData& data,
1987 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1990 const Gtk::SelectionData& data,
1994 void drop_routes (const Glib::RefPtr<Gdk::DragContext>& context,
1997 const Gtk::SelectionData& data,
2003 int write_region_selection(RegionSelection&);
2004 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
2005 void bounce_region_selection ();
2006 void bounce_range_selection (bool replace);
2007 void external_edit_region ();
2009 int write_audio_selection (TimeSelection&);
2010 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
2012 void write_selection ();
2016 UndoAction get_memento() const;
2018 XMLNode *before; /* used in *_reversible_command */
2020 void begin_reversible_command (string cmd_name);
2021 void commit_reversible_command ();
2023 void update_title ();
2024 void update_title_s (const string & snapshot_name);
2027 Selection* selection;
2028 double frames_per_unit;
2030 State (PublicEditor const * e);
2034 void store_state (State&) const;
2035 void restore_state (State *);
2037 void instant_save ();
2039 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
2041 /* freeze operations */
2043 ARDOUR::InterThreadInfo freeze_status;
2044 gint freeze_progress_timeout (void *);
2045 static void* _freeze_thread (void*);
2046 void* freeze_thread ();
2048 void freeze_route ();
2049 void unfreeze_route ();
2051 /* edit-group solo + mute */
2053 void set_edit_group_solo (ARDOUR::Route&, bool);
2054 void set_edit_group_mute (ARDOUR::Route&, bool);
2058 void duplicate_dialog (bool with_dialog);
2060 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
2062 /* returns false if mouse pointer is not in track or marker canvas
2064 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
2066 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
2067 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
2068 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
2070 struct TimeFXDialog : public ArdourDialog {
2071 ARDOUR::TimeFXRequest request;
2074 Gtk::Adjustment pitch_octave_adjustment;
2075 Gtk::Adjustment pitch_semitone_adjustment;
2076 Gtk::Adjustment pitch_cent_adjustment;
2077 Gtk::SpinButton pitch_octave_spinner;
2078 Gtk::SpinButton pitch_semitone_spinner;
2079 Gtk::SpinButton pitch_cent_spinner;
2080 RegionSelection regions;
2081 Gtk::ProgressBar progress_bar;
2084 Gtk::ToggleButton quick_button;
2085 Gtk::ToggleButton antialias_button;
2086 Gtk::HBox upper_button_box;
2089 Gtk::ComboBoxText stretch_opts_selector;
2090 Gtk::Label stretch_opts_label;
2091 Gtk::ToggleButton precise_button;
2094 Gtk::Button* cancel_button;
2095 Gtk::Button* action_button;
2099 TimeFXDialog (Editor& e, bool for_pitch);
2101 gint update_progress ();
2102 sigc::connection first_cancel;
2103 sigc::connection first_delete;
2104 void cancel_in_progress ();
2105 gint delete_in_progress (GdkEventAny*);
2108 /* "whats mine is yours" */
2110 friend class TimeFXDialog;
2112 TimeFXDialog* current_timefx;
2114 static void* timefx_thread (void *arg);
2115 void do_timefx (TimeFXDialog&);
2117 int time_stretch (RegionSelection&, float fraction);
2118 int pitch_shift (RegionSelection&, float cents);
2119 void pitch_shift_regions ();
2120 int time_fx (RegionSelection&, float val, bool pitching);
2122 /* editor-mixer strip */
2124 MixerStrip *current_mixer_strip;
2125 bool show_editor_mixer_when_tracks_arrive;
2126 Gtk::VBox current_mixer_strip_vbox;
2127 void cms_new (boost::shared_ptr<ARDOUR::Route>);
2128 void cms_deleted ();
2129 void current_mixer_strip_hidden ();
2130 void current_mixer_strip_removed ();
2132 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2133 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2135 /* nudging tracks */
2137 void nudge_track (bool use_edit_point, bool forwards);
2141 bool _xfade_visibility;
2144 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2145 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2147 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2148 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2150 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2151 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2152 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2154 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2155 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2156 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2157 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2159 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2160 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2161 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2162 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2164 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2165 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2166 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2167 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2168 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2169 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2171 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2172 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2173 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2174 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2175 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2176 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2178 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2179 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2181 ImageFrameSocketHandler* image_socket_listener ;
2184 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2185 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2186 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2187 void xfade_edit_left_region ();
2188 void xfade_edit_right_region ();
2190 static const int32_t default_width = 995;
2191 static const int32_t default_height = 765;
2195 Gtk::Button nudge_forward_button;
2196 Gtk::Button nudge_backward_button;
2197 Gtk::HBox nudge_hbox;
2198 Gtk::VBox nudge_vbox;
2199 AudioClock nudge_clock;
2201 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2203 bool nudge_forward_release (GdkEventButton*);
2204 bool nudge_backward_release (GdkEventButton*);
2208 void apply_filter (ARDOUR::Filter&, string cmd);
2210 /* handling cleanup */
2212 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2214 vector<sigc::connection> session_connections;
2216 /* tracking step changes of track height */
2218 TimeAxisView* current_stepping_trackview;
2219 ARDOUR::microseconds_t last_track_height_step_timestamp;
2220 gint track_height_step_timeout();
2221 sigc::connection step_timeout;
2223 TimeAxisView* entered_track;
2224 RegionView* entered_regionview;
2227 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2228 bool clear_entered_track;
2229 bool left_track_canvas (GdkEventCrossing*);
2230 bool entered_track_canvas (GdkEventCrossing*);
2231 void set_entered_track (TimeAxisView*);
2232 void set_entered_regionview (RegionView*);
2233 gint left_automation_track ();
2235 bool _new_regionviews_show_envelope;
2237 void reset_canvas_action_sensitivity (bool);
2238 void toggle_gain_envelope_visibility ();
2239 void toggle_gain_envelope_active ();
2240 void reset_region_gain_envelopes ();
2242 bool on_key_press_event (GdkEventKey*);
2243 bool on_key_release_event (GdkEventKey*);
2245 void session_state_saved (string);
2247 Glib::RefPtr<Gtk::Action> undo_action;
2248 Glib::RefPtr<Gtk::Action> redo_action;
2250 void history_changed ();
2252 Gtk::HBox status_bar_hpacker;
2254 Editing::EditPoint _edit_point;
2256 Gtk::ComboBoxText edit_point_selector;
2258 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2259 void cycle_edit_point (bool with_marker);
2260 void set_edit_point ();
2261 void edit_point_selection_done ();
2262 void edit_point_chosen (Editing::EditPoint);
2263 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2264 std::vector<std::string> edit_point_strings;
2266 void selected_marker_moved (ARDOUR::Location*);
2267 sigc::connection edit_point_clock_connection_a;
2268 sigc::connection edit_point_clock_connection_b;
2270 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2272 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2273 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2275 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2277 sigc::connection fast_screen_update_connection;
2278 gint start_updating ();
2279 gint stop_updating ();
2280 void fast_update_strips ();
2281 bool meters_running;
2283 void select_next_route ();
2284 void select_prev_route ();
2286 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2288 RhythmFerret* rhythm_ferret;
2291 void set_track_height (uint32_t h);
2292 void set_track_height_largest ();
2293 void set_track_height_large ();
2294 void set_track_height_larger ();
2295 void set_track_height_normal ();
2296 void set_track_height_smaller ();
2297 void set_track_height_small ();
2299 void remove_tracks ();
2300 void toggle_tracks_active ();
2301 void waveform_scale_chosen (Editing::WaveformScale);
2305 int32_t resize_idle_target;
2307 friend gboolean _idle_resize (gpointer);
2308 std::vector<TimeAxisView*> pending_resizes;
2311 #endif /* __ardour_editor_h__ */