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>
54 #include "audio_clock.h"
55 #include "gtk-custom-ruler.h"
56 #include "ardour_dialog.h"
57 #include "public_editor.h"
60 #include "editor_items.h"
61 #include "region_selection.h"
64 #include "tempo_lines.h"
71 class AudioDiskstream;
90 class AudioTimeAxisView;
91 class AutomationTimeAxisView;
92 class AudioRegionView;
95 class PlaylistSelector;
99 class UIExportSpecification;
103 class TrackSelection;
104 class AutomationSelection;
107 class AudioStreamView;
109 class SoundFileOmega;
111 class AnalysisWindow;
114 /* <CMT Additions> */
115 class ImageFrameView;
116 class ImageFrameTimeAxisView;
117 class ImageFrameTimeAxis;
118 class MarkerTimeAxis ;
120 class ImageFrameSocketHandler ;
121 class TimeAxisViewItem ;
122 /* </CMT Additions> */
125 class Editor : public PublicEditor
131 void connect_to_session (ARDOUR::Session *);
132 ARDOUR::Session* current_session() const { return session; }
134 nframes_t leftmost_position() const { return leftmost_frame; }
135 nframes_t current_page_frames() const {
136 return (nframes_t) floor (canvas_width * frames_per_unit);
139 void cycle_snap_mode ();
140 void cycle_snap_choice ();
141 void set_snap_to (Editing::SnapType);
142 void set_snap_mode (Editing::SnapMode);
143 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
145 void undo (uint32_t n = 1);
146 void redo (uint32_t n = 1);
148 XMLNode& get_state ();
149 int set_state (const XMLNode& );
151 void set_mouse_mode (Editing::MouseMode, bool force=true);
152 void step_mouse_mode (bool next);
153 Editing::MouseMode current_mouse_mode () const { return mouse_mode; }
155 void set_midi_edit_cursor (Editing::MidiEditMode);
156 void set_midi_edit_mode (Editing::MidiEditMode, bool force=true);
157 Editing::MidiEditMode current_midi_edit_mode () const { return midi_edit_mode; }
160 void add_imageframe_time_axis(const std::string & track_name, void*) ;
161 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
162 void connect_to_image_compositor() ;
163 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
164 TimeAxisView* get_named_time_axis(const std::string & name) ;
167 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
168 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
169 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
171 /* option editor-access */
173 void set_show_waveforms (bool yn);
174 bool show_waveforms() const { return _show_waveforms; }
176 void set_show_waveforms_recording (bool yn);
177 bool show_waveforms_recording() const { return _show_waveforms_recording; }
179 /* things that need to be public to be used in the main menubar */
181 void new_region_from_selection ();
182 void separate_regions_between (const TimeSelection&);
183 void separate_region_from_selection ();
184 void separate_regions_using_location (ARDOUR::Location&);
185 void toggle_playback (bool with_abort);
186 void transition_to_rolling (bool forward);
190 nframes_t unit_to_frame (double unit) const {
191 return (nframes_t) rint (unit * frames_per_unit);
194 double frame_to_unit (nframes_t frame) const {
195 return rint ((double) frame / (double) frames_per_unit);
198 double frame_to_unit (double frame) const {
199 return rint (frame / frames_per_unit);
202 /* NOTE: these functions assume that the "pixel" coordinate is
203 the result of using the world->canvas affine transform on a
204 world coordinate. These coordinates already take into
205 account any scrolling carried out by adjusting the
209 nframes64_t pixel_to_frame (double pixel) const {
211 /* pixel can be less than zero when motion events
212 are processed. since we've already run the world->canvas
213 affine, that means that the location *really* is "off
214 to the right" and thus really is "before the start".
218 return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
224 gulong frame_to_pixel (nframes64_t frame) const {
225 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
228 void flush_canvas ();
232 Selection& get_selection() const { return *selection; }
233 Selection& get_cut_buffer() const { return *cut_buffer; }
235 bool extend_selection_to_track (TimeAxisView&);
237 void play_selection ();
238 void select_all_in_selected_tracks (Selection::Operation op);
239 void select_all (Selection::Operation op);
240 void invert_selection_in_selected_tracks ();
241 void invert_selection ();
242 void deselect_all ();
246 void set_show_measures (bool yn);
247 bool show_measures () const { return _show_measures; }
248 bool initial_ruler_update_required;
251 /* analysis window */
252 void analyze_region_selection();
253 void analyze_range_selection();
258 /* these initiate export ... */
260 void export_session();
261 void export_selection();
264 void add_toplevel_controls (Gtk::Container&);
265 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
267 void set_zoom_focus (Editing::ZoomFocus);
268 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
269 double get_current_zoom () const { return frames_per_unit; }
271 void temporal_zoom_step (bool coarser);
273 /* stuff that AudioTimeAxisView and related classes use */
275 PlaylistSelector& playlist_selector() const;
276 void route_name_changed (TimeAxisView *);
277 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
279 void new_playlists (TimeAxisView* v);
280 void copy_playlists (TimeAxisView* v);
281 void clear_playlists (TimeAxisView* v);
283 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
285 Width editor_mixer_strip_width;
286 void maybe_add_mixer_strip_width (XMLNode&);
287 void show_editor_mixer (bool yn);
288 void show_editor_list (bool yn);
289 void set_selected_mixer_strip (TimeAxisView&);
290 void hide_track_in_display (TimeAxisView& tv);
291 void show_track_in_display (TimeAxisView& tv);
293 /* nudge is initiated by transport controls owned by ARDOUR_UI */
295 void nudge_forward (bool next);
296 void nudge_backward (bool next);
298 /* nudge initiated from context menu */
300 void nudge_forward_capture_offset ();
301 void nudge_backward_capture_offset ();
303 /* playhead/screen stuff */
305 void set_follow_playhead (bool yn);
306 void toggle_follow_playhead ();
307 bool follow_playhead() const { return _follow_playhead; }
308 bool dragging_playhead () const { return _dragging_playhead; }
310 void toggle_waveform_visibility ();
311 void toggle_waveforms_while_recording ();
312 void toggle_measure_visibility ();
313 void toggle_logo_visibility ();
315 /* SMPTE timecode & video sync */
317 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
318 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
319 void subframes_per_frame_chosen (uint32_t);
321 void update_smpte_mode();
322 void update_video_pullup();
323 void update_subframes_per_frame ();
326 void toggle_auto_xfade ();
327 void toggle_xfades_active ();
328 void toggle_xfade_visibility ();
329 bool xfade_visibility() const { return _xfade_visibility; }
330 void update_xfade_visibility ();
331 void update_crossfade_model ();
332 void set_crossfade_model (ARDOUR::CrossfadeModel);
335 void set_layer_model (ARDOUR::LayerModel);
336 void update_layering_model ();
338 void toggle_link_region_and_track_selection ();
340 /* redirect shared ops menu. caller must free returned menu */
342 Gtk::Menu* redirect_menu ();
344 /* floating windows/transient */
346 void ensure_float (Gtk::Window&);
350 void scroll_tracks_down_line ();
351 void scroll_tracks_up_line ();
353 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
354 void prepare_for_cleanup ();
356 void maximise_editing_space();
357 void restore_editing_space();
359 void reset_x_origin (nframes_t);
360 void reset_zoom (double);
361 void reposition_and_zoom (nframes_t, double);
363 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
365 bool update_mouse_speed ();
366 bool decelerate_mouse_speed ();
368 void toggle_meter_updating();
371 void map_transport_state ();
372 void map_position_change (nframes_t);
378 /// The session that we are editing, or 0
379 void color_handler ();
380 ARDOUR::Session *session;
383 // to keep track of the playhead position for control_scroll
384 boost::optional<nframes_t> _control_scroll_target;
386 PlaylistSelector* _playlist_selector;
389 double frames_per_unit;
390 nframes_t leftmost_frame;
391 Editing::ZoomFocus zoom_focus;
394 VisualState last_visual_state;
396 nframes_t leftmost_frame;
397 double frames_per_unit;
398 Editing::ZoomFocus zoom_focus;
400 void use_visual_state (const VisualState&);
401 void set_frames_per_unit (double);
402 void swap_visual_state ();
405 Editing::MouseMode mouse_mode;
406 Editing::MidiEditMode midi_edit_mode;
408 int post_maximal_editor_width;
409 int post_maximal_pane_position;
410 int pre_maximal_pane_position;
411 int pre_maximal_editor_width;
412 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
414 Gtk::Notebook the_notebook;
415 Gtk::HPaned edit_pane;
417 Gtk::EventBox meter_base;
419 Gtk::EventBox marker_base;
420 Gtk::HBox marker_box;
421 Gtk::VBox scrollers_rulers_markers_box;
423 void location_changed (ARDOUR::Location *);
424 void location_flags_changed (ARDOUR::Location *, void *);
425 void refresh_location_display ();
426 void refresh_location_display_s (ARDOUR::Change);
427 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
428 void add_new_location (ARDOUR::Location *);
429 void location_gone (ARDOUR::Location *);
430 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
431 gint really_remove_marker (ARDOUR::Location* loc);
432 void goto_nth_marker (int nth);
434 uint32_t location_marker_color;
435 uint32_t location_range_color;
436 uint32_t location_loop_color;
437 uint32_t location_punch_color;
438 uint32_t location_cd_marker_color;
440 struct LocationMarkers {
445 LocationMarkers () : start(0), end(0), valid (true) {}
451 void set_name (const string&);
452 void set_position (nframes_t start, nframes_t end = 0);
453 void set_color_rgba (uint32_t);
456 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
457 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
458 Marker* entered_marker;
460 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
461 LocationMarkerMap location_markers;
463 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
464 void clear_marker_display ();
465 void mouse_add_new_marker (nframes_t where, bool is_cd=false);
466 void update_cd_marker_display ();
467 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
469 TimeAxisView* clicked_axisview;
470 RouteTimeAxisView* clicked_routeview;
471 /** The last RegionView that was clicked on, or 0 if the last click was not
472 * on a RegionView. This is set up by the canvas event handlers in
473 * editor_canvas_events.cc
475 RegionView* clicked_regionview;
476 RegionSelection latest_regionviews;
477 uint32_t clicked_selection;
478 CrossfadeView* clicked_crossfadeview;
479 ControlPoint* clicked_control_point;
481 void sort_track_selection ();
483 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
484 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&) const;
485 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*) const;
487 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
489 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*) const;
490 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
491 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
492 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
496 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
497 bool button_release_can_deselect;
499 void catch_vanishing_regionview (RegionView *);
501 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
502 void select_all_tracks ();
504 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
505 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
506 void set_selected_track_as_side_effect (bool force = false);
507 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
509 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
510 void collect_new_region_view (RegionView *);
511 void collect_and_select_new_region_view (RegionView *);
513 Gtk::MenuItem* region_edit_menu_split_item;
514 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
516 void popup_track_context_menu (int, int, nframes_t);
517 Gtk::Menu* build_track_context_menu (nframes_t);
518 void add_bus_or_audio_track_context_items (Gtk::Menu_Helpers::MenuList&);
519 void add_region_context_items (Gtk::Menu_Helpers::MenuList&);
520 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
521 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
523 void add_item_with_sensitivity (Gtk::Menu_Helpers::MenuList&, Gtk::Menu_Helpers::MenuElem, bool) const;
525 void handle_new_route (ARDOUR::Session::RouteList&);
526 void remove_route (TimeAxisView *);
529 Gtk::HBox global_hpacker;
530 Gtk::VBox global_vpacker;
533 Gdk::Cursor* current_canvas_cursor;
535 ArdourCanvas::CanvasAA track_canvas;
536 ArdourCanvas::CanvasAA time_canvas;
538 ArdourCanvas::Text* first_action_message;
539 ArdourCanvas::Text* verbose_canvas_cursor;
540 bool verbose_cursor_visible;
542 void parameter_changed (const char *);
544 bool track_canvas_motion (GdkEvent*);
546 void set_verbose_canvas_cursor (const string &, double x, double y);
547 void set_verbose_canvas_cursor_text (const string &);
548 void show_verbose_canvas_cursor();
549 void hide_verbose_canvas_cursor();
551 bool verbose_cursor_on; // so far unused
553 Gtk::EventBox time_canvas_event_box;
554 Gtk::EventBox track_canvas_event_box;
555 Gtk::EventBox time_button_event_box;
556 Gtk::Frame time_button_frame;
558 ArdourCanvas::Group *minsec_group;
559 ArdourCanvas::Pixbuf *logo_item;
560 ArdourCanvas::Group *bbt_group;
561 ArdourCanvas::Group *smpte_group;
562 ArdourCanvas::Group *frame_group;
563 ArdourCanvas::Group *tempo_group;
564 ArdourCanvas::Group *meter_group;
565 ArdourCanvas::Group *marker_group;
566 ArdourCanvas::Group *range_marker_group;
567 ArdourCanvas::Group *transport_marker_group;
568 ArdourCanvas::Group* cd_marker_group;
571 ruler_metric_smpte = 0,
572 ruler_metric_bbt = 1,
573 ruler_metric_frames = 2,
574 ruler_metric_minsec = 3,
576 ruler_time_tempo = 4,
577 ruler_time_meter = 5,
578 ruler_time_marker = 6,
579 ruler_time_range_marker = 7,
580 ruler_time_transport_marker = 8,
581 ruler_time_cd_marker = 9,
584 static GtkCustomMetric ruler_metrics[4];
585 bool ruler_shown[10];
586 bool no_ruler_shown_update;
588 gint ruler_button_press (GdkEventButton*);
589 gint ruler_button_release (GdkEventButton*);
590 gint ruler_mouse_motion (GdkEventMotion*);
591 bool ruler_scroll (GdkEventScroll* event);
593 gint ruler_pressed_button;
594 Gtk::Widget * ruler_grabbed_widget;
596 void initialize_rulers ();
597 void update_just_smpte ();
598 void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers
599 void update_fixed_rulers ();
600 void update_tempo_based_rulers ();
601 void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem);
602 void update_ruler_visibility ();
603 void ruler_toggled (int);
604 gint ruler_label_button_release (GdkEventButton*);
605 void store_ruler_visibility ();
606 void restore_ruler_visibility ();
608 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
609 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
610 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
611 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
613 enum MinsecRulerScale {
620 MinsecRulerScale minsec_ruler_scale;
622 nframes_t minsec_mark_interval;
623 gint minsec_mark_modulo;
625 void set_minsec_ruler_scale (gdouble lower, gdouble upper);
627 enum SMPTERulerScale {
635 SMPTERulerScale smpte_ruler_scale;
637 nframes_t smpte_mark_interval;
638 gint smpte_mark_modulo;
640 void set_smpte_ruler_scale (gdouble lower, gdouble upper);
650 bbt_show_ticks_detail,
651 bbt_show_ticks_super_detail
654 BBTRulerScale bbt_ruler_scale;
658 uint32_t bbt_bar_helper_on;
659 uint32_t bbt_accent_modulo;
660 void compute_bbt_ruler_scale (nframes_t lower, nframes_t upper);
662 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
663 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
664 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
665 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
667 Gtk::Widget *_ruler_separator;
668 GtkWidget *_smpte_ruler;
669 GtkWidget *_bbt_ruler;
670 GtkWidget *_frames_ruler;
671 GtkWidget *_minsec_ruler;
672 Gtk::Widget *smpte_ruler;
673 Gtk::Widget *bbt_ruler;
674 Gtk::Widget *frames_ruler;
675 Gtk::Widget *minsec_ruler;
676 static Editor *ruler_editor;
678 static const double timebar_height;
679 guint32 visible_timebars;
680 Gtk::Menu *editor_ruler_menu;
682 ArdourCanvas::SimpleRect* tempo_bar;
683 ArdourCanvas::SimpleRect* meter_bar;
684 ArdourCanvas::SimpleRect* marker_bar;
685 ArdourCanvas::SimpleRect* range_marker_bar;
686 ArdourCanvas::SimpleRect* transport_marker_bar;
687 ArdourCanvas::SimpleRect* cd_marker_bar;
689 Gtk::Label minsec_label;
690 Gtk::Label bbt_label;
691 Gtk::Label smpte_label;
692 Gtk::Label frame_label;
693 Gtk::Label tempo_label;
694 Gtk::Label meter_label;
695 Gtk::Label mark_label;
696 Gtk::Label range_mark_label;
697 Gtk::Label transport_mark_label;
698 Gtk::Label cd_mark_label;
701 Gtk::VBox time_button_vbox;
702 Gtk::HBox time_button_hbox;
706 ArdourCanvas::Points points;
707 ArdourCanvas::Line canvas_item;
708 nframes_t current_frame;
711 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
714 void set_position (nframes_t);
715 void set_length (double units);
716 void set_y_axis (double position);
719 friend struct Cursor; /* it needs access to several private
723 Cursor* playhead_cursor;
724 ArdourCanvas::Group* cursor_group;
726 void cursor_to_region_boundary (Cursor*, int32_t dir);
727 void cursor_to_next_region_boundary (Cursor*);
728 void cursor_to_previous_region_boundary (Cursor*);
729 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
730 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
731 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
732 void cursor_to_selection_start (Cursor *);
733 void cursor_to_selection_end (Cursor *);
735 void selected_marker_to_region_boundary (int32_t dir);
736 void selected_marker_to_next_region_boundary ();
737 void selected_marker_to_previous_region_boundary ();
738 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
739 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
740 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
741 void selected_marker_to_selection_start ();
742 void selected_marker_to_selection_end ();
744 void select_all_selectables_using_cursor (Cursor *, bool);
745 void select_all_selectables_using_edit (bool);
746 void select_all_selectables_between (bool within);
747 void select_range_between ();
749 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
750 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
752 vector<nframes_t> region_boundary_cache;
753 void build_region_boundary_cache ();
755 Gtk::VBox trackview_vpacker;
758 Gtk::HBox bottom_hbox;
760 Gtk::Table edit_packer;
761 Gtk::VScrollbar edit_vscrollbar;
763 Gtk::Adjustment vertical_adjustment;
764 Gtk::Adjustment horizontal_adjustment;
766 Gtk::Layout controls_layout;
767 bool control_layout_scroll (GdkEventScroll* ev);
768 void controls_layout_size_request (Gtk::Requisition*);
770 Gtk::HScrollbar edit_hscrollbar;
771 bool _dragging_hscrollbar;
773 void reset_hscrollbar_stepping ();
775 bool hscrollbar_button_press (GdkEventButton*);
776 bool hscrollbar_button_release (GdkEventButton*);
777 void hscrollbar_allocate (Gtk::Allocation &alloc);
780 double canvas_height;
781 double full_canvas_height;
782 nframes_t last_canvas_frame;
784 bool track_canvas_map_handler (GdkEventAny*);
785 bool time_canvas_map_handler (GdkEventAny*);
787 gint edit_controls_button_release (GdkEventButton*);
788 Gtk::Menu *edit_controls_left_menu;
789 Gtk::Menu *edit_controls_right_menu;
791 Gtk::VBox track_canvas_vbox;
792 Gtk::VBox time_canvas_vbox;
793 Gtk::VBox edit_controls_vbox;
794 Gtk::HBox edit_controls_hbox;
796 void control_scroll (float);
797 bool deferred_control_scroll (nframes_t);
798 sigc::connection control_scroll_connection;
800 void tie_vertical_scrolling ();
801 void canvas_horizontally_scrolled ();
802 void canvas_scroll_to (nframes64_t);
804 struct VisualChange {
811 nframes_t time_origin;
812 double frames_per_unit;
816 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
820 VisualChange pending_visual_change;
822 static int _idle_visual_changer (void *arg);
823 int idle_visual_changer ();
825 void queue_visual_change (nframes_t);
826 void queue_visual_change (double);
828 void end_location_changed (ARDOUR::Location*);
830 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
831 RegionListDisplayModelColumns() {
836 Gtk::TreeModelColumn<Glib::ustring> name;
837 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
838 Gtk::TreeModelColumn<Gdk::Color> color_;
841 RegionListDisplayModelColumns region_list_columns;
842 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
844 Glib::RefPtr<Gtk::TreeStore> region_list_model;
845 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
846 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
848 void region_list_region_changed (ARDOUR::Change, boost::weak_ptr<ARDOUR::Region>);
849 void region_list_selection_changed ();
850 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
851 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
852 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
854 Gtk::Menu *region_list_menu;
855 Gtk::ScrolledWindow region_list_scroller;
856 Gtk::Frame region_list_frame;
858 bool region_list_display_key_press (GdkEventKey *);
859 bool region_list_display_key_release (GdkEventKey *);
860 bool region_list_display_button_press (GdkEventButton *);
861 bool region_list_display_button_release (GdkEventButton *);
862 void region_list_clear ();
863 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
864 void build_region_list_menu ();
865 void show_region_list_display_context_menu (int button, int time);
867 bool show_automatic_regions_in_region_list;
868 Editing::RegionListSortType region_list_sort_type;
870 void reset_region_list_sort_direction (bool);
871 void reset_region_list_sort_type (Editing::RegionListSortType);
873 void toggle_full_region_list ();
874 void toggle_show_auto_regions ();
876 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
880 Gtk::ScrolledWindow snapshot_display_scroller;
881 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
882 SnapshotDisplayModelColumns() {
886 Gtk::TreeModelColumn<Glib::ustring> visible_name;
887 Gtk::TreeModelColumn<Glib::ustring> real_name;
890 SnapshotDisplayModelColumns snapshot_display_columns;
891 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
892 Gtk::TreeView snapshot_display;
893 Gtk::Menu snapshot_context_menu;
895 bool snapshot_display_button_press (GdkEventButton*);
896 void snapshot_display_selection_changed ();
897 void redisplay_snapshots();
898 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
900 /* named selections */
902 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
903 NamedSelectionDisplayModelColumns() {
907 Gtk::TreeModelColumn<Glib::ustring> text;
908 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
911 NamedSelectionDisplayModelColumns named_selection_columns;
912 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
914 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
915 Gtk::ScrolledWindow named_selection_scroller;
917 void create_named_selection ();
918 void paste_named_selection (float times);
919 void remove_selected_named_selections ();
920 void remove_snapshot (Glib::ustring);
921 void rename_snapshot (Glib::ustring);
923 void handle_new_named_selection ();
924 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
925 void redisplay_named_selections ();
927 bool named_selection_display_button_release (GdkEventButton *ev);
928 bool named_selection_display_key_release (GdkEventKey *ev);
929 void named_selection_display_selection_changed ();
932 TrackViewList track_views;
933 TimeAxisView *trackview_by_y_position (double ypos);
935 static Gdk::Cursor* cross_hair_cursor;
936 static Gdk::Cursor* trimmer_cursor;
937 static Gdk::Cursor* selector_cursor;
938 static Gdk::Cursor* grabber_cursor;
939 static Gdk::Cursor* zoom_cursor;
940 static Gdk::Cursor* time_fx_cursor;
941 static Gdk::Cursor* fader_cursor;
942 static Gdk::Cursor* speaker_cursor;
943 static Gdk::Cursor* midi_pencil_cursor;
944 static Gdk::Cursor* midi_select_cursor;
945 static Gdk::Cursor* midi_erase_cursor;
946 static Gdk::Cursor* wait_cursor;
947 static Gdk::Cursor* timebar_cursor;
948 static Gdk::Cursor* transparent_cursor;
950 static void build_cursors ();
952 sigc::connection scroll_connection;
953 nframes_t last_update_frame;
954 void center_screen (nframes_t);
955 void center_screen_internal (nframes_t, float);
957 void update_current_screen ();
959 void session_going_away ();
961 nframes_t cut_buffer_start;
962 nframes_t cut_buffer_length;
964 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
965 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
966 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
967 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
968 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
969 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
971 /* KEYMAP HANDLING */
973 void register_actions ();
975 int ensure_cursor (nframes_t* pos);
977 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
978 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
979 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
980 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
981 void redisplay_regions ();
982 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
984 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
986 void cut_copy (Editing::CutCopyOp);
987 bool can_cut_copy () const;
988 void cut_copy_points (Editing::CutCopyOp);
989 void cut_copy_regions (Editing::CutCopyOp);
990 void cut_copy_ranges (Editing::CutCopyOp);
993 void paste_internal (nframes_t position, float times);
995 /* EDITING OPERATIONS */
997 void reset_point_selection ();
998 void toggle_region_mute ();
999 void toggle_region_lock ();
1000 void toggle_region_opaque ();
1001 void toggle_region_position_lock ();
1002 void raise_region ();
1003 void raise_region_to_top ();
1004 void lower_region ();
1005 void lower_region_to_bottom ();
1006 void split_region ();
1007 void split_region_at (nframes_t);
1008 void split_regions_at (nframes_t, RegionSelection&);
1009 void crop_region_to_selection ();
1010 void crop_region_to (nframes_t start, nframes_t end);
1011 void set_sync_point (nframes64_t, const RegionSelection&);
1012 void set_region_sync_from_edit_point ();
1013 void remove_region_sync();
1014 void align_selection (ARDOUR::RegionPoint, nframes_t position, const RegionSelection&);
1015 void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position, const RegionSelection&);
1016 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
1017 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
1018 void remove_selected_regions ();
1019 void remove_clicked_region ();
1020 void edit_region ();
1021 void rename_region ();
1022 void duplicate_some_regions (RegionSelection&, float times);
1023 void duplicate_selection (float times);
1024 void region_fill_selection ();
1026 void region_fill_track ();
1027 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1028 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1029 void split_multichannel_region();
1030 void reverse_regions ();
1031 void normalize_regions ();
1032 void denormalize_regions ();
1033 void quantize_regions ();
1035 void audition_region_from_region_list ();
1036 void hide_region_from_region_list ();
1037 void remove_region_from_region_list ();
1039 void align (ARDOUR::RegionPoint);
1040 void align_relative (ARDOUR::RegionPoint);
1043 void reset_focus ();
1049 void paste (float times);
1051 int get_prefix (float&, bool&);
1053 void keyboard_paste ();
1054 void keyboard_insert_region_list_selection ();
1056 void region_from_selection ();
1057 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1059 void play_from_start ();
1060 void play_from_edit_point ();
1061 void play_from_edit_point_and_return ();
1062 void play_selected_region ();
1063 void play_edit_range ();
1064 void loop_selected_region ();
1065 void play_location (ARDOUR::Location&);
1066 void loop_location (ARDOUR::Location&);
1068 void temporal_zoom_selection ();
1069 void temporal_zoom_region ();
1070 void toggle_zoom_region ();
1071 bool zoomed_to_region;
1072 void temporal_zoom_session ();
1073 void temporal_zoom (gdouble scale);
1074 void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
1075 void temporal_zoom_to_frame (bool coarser, nframes_t frame);
1077 void amplitude_zoom (gdouble scale);
1078 void amplitude_zoom_step (bool in);
1080 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
1081 void insert_region_list_selection (float times);
1083 /* import & embed */
1085 void add_external_audio_action (Editing::ImportMode);
1086 void external_audio_dialog ();
1087 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1089 SoundFileOmega* sfbrowser;
1091 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1092 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1094 void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1095 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1096 bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1098 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1099 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1100 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1101 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1103 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1104 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1105 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1106 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1108 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1110 /* generic interthread progress window */
1112 ArdourDialog* interthread_progress_window;
1113 Gtk::Label interthread_progress_label;
1114 Gtk::VBox interthread_progress_vbox;
1115 Gtk::ProgressBar interthread_progress_bar;
1116 Gtk::Button interthread_cancel_button;
1117 Gtk::Label interthread_cancel_label;
1118 sigc::connection interthread_progress_connection;
1119 void interthread_cancel_clicked ();
1120 void build_interthread_progress_window ();
1121 ARDOUR::InterThreadInfo* current_interthread_info;
1124 AnalysisWindow* analysis_window;
1127 /* import specific info */
1129 ARDOUR::Session::import_status import_status;
1130 gint import_progress_timeout (void *);
1131 static void *_import_thread (void *);
1132 void* import_thread ();
1134 /* to support this ... */
1136 void import_audio (bool as_tracks);
1137 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1139 void move_to_start ();
1140 void move_to_end ();
1142 void center_playhead ();
1143 void center_edit_point ();
1144 void edit_cursor_backward ();
1145 void edit_cursor_forward ();
1146 void playhead_backward ();
1147 void playhead_forward ();
1148 void scroll_playhead (bool forward);
1149 void scroll_backward (float pages=0.8f);
1150 void scroll_forward (float pages=0.8f);
1151 void scroll_tracks_down ();
1152 void scroll_tracks_up ();
1153 void delete_sample_forward ();
1154 void delete_sample_backward ();
1155 void delete_screen ();
1156 void search_backwards ();
1157 void search_forwards ();
1159 void clear_markers ();
1160 void clear_ranges ();
1161 void clear_locations ();
1162 void unhide_markers ();
1163 void unhide_ranges ();
1164 void jump_forward_to_mark ();
1165 void jump_backward_to_mark ();
1166 void cursor_align (bool playhead_to_edit);
1168 void remove_last_capture ();
1169 void select_all_selectables_using_time_selection ();
1170 void select_all_selectables_using_loop();
1171 void select_all_selectables_using_punch();
1172 void set_selection_from_range (ARDOUR::Location&);
1173 void set_selection_from_punch ();
1174 void set_selection_from_loop ();
1175 void set_selection_from_audio_region ();
1177 void add_location_mark (nframes64_t where);
1178 void add_location_from_audio_region ();
1179 void add_location_from_selection ();
1180 void set_loop_from_selection (bool play);
1181 void set_punch_from_selection ();
1183 void set_loop_from_edit_range (bool play);
1184 void set_loop_from_region (bool play);
1185 void set_punch_from_edit_range ();
1187 void set_loop_range (nframes_t start, nframes_t end, std::string cmd);
1188 void set_punch_range (nframes_t start, nframes_t end, std::string cmd);
1190 void add_location_from_playhead_cursor ();
1191 bool select_new_marker;
1193 void reverse_selection ();
1194 void edit_envelope ();
1196 void start_scrolling ();
1197 void stop_scrolling ();
1200 double last_scrub_x;
1201 int scrubbing_direction;
1202 int scrub_reversals;
1203 int scrub_reverse_distance;
1205 void keyboard_selection_begin ();
1206 void keyboard_selection_finish (bool add);
1207 bool have_pending_keyboard_selection;
1208 nframes_t pending_keyboard_selection_start;
1210 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1211 void extend_selection_to_end_of_region (bool next);
1212 void extend_selection_to_start_of_region (bool previous);
1214 Editing::SnapType snap_type;
1215 Editing::SnapMode snap_mode;
1217 /// Snap threshold in pixels
1218 double snap_threshold;
1220 void handle_gui_changes (const string &, void *);
1222 void hide_all_tracks (bool with_select);
1225 LineDragInfo current_line_drag_info;
1227 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1228 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1229 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1231 Gtk::Menu fade_context_menu;
1232 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1234 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1235 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1236 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1237 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1238 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1239 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1241 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1242 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1244 void set_fade_length (bool in);
1245 void toggle_fade_active (bool in);
1246 void set_fade_in_active (bool);
1247 void set_fade_out_active (bool);
1249 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1250 RegionSelection pre_drag_region_selection;
1251 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1252 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1253 void create_region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1254 void create_region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1255 bool check_region_drag_possible (RouteTimeAxisView**);
1256 void possibly_copy_regions_during_grab (GdkEvent*);
1257 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1258 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1260 bool _dragging_playhead;
1261 bool _dragging_edit_point;
1263 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1264 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1265 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1266 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1267 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1268 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1269 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1270 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1272 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1273 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1274 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1275 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1277 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1279 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1280 void start_create_region_grab (ArdourCanvas::Item*, GdkEvent*);
1281 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1282 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1283 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1284 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1285 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1286 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1287 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1288 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1289 void start_line_grab (AutomationLine *, GdkEvent*);
1290 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1291 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1292 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1293 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1295 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1297 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1298 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1300 void mouse_brush_insert_region (RegionView*, nframes_t pos);
1301 void brush (nframes_t);
1303 void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1304 void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1306 /* Canvas event handlers */
1308 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1309 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1310 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1311 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1312 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1313 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1314 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1315 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1316 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1317 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1318 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1319 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1320 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1321 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1322 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1323 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1324 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1325 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1326 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1328 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1329 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1330 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1331 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1332 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1333 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1335 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1336 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1337 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1338 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1339 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1340 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1341 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1342 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1344 /* non-public event handlers */
1346 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1347 bool track_canvas_scroll (GdkEventScroll* event);
1348 bool time_canvas_scroll (GdkEventScroll* event);
1350 bool track_canvas_scroll_event (GdkEventScroll* event);
1351 bool track_canvas_button_press_event (GdkEventButton* event);
1352 bool track_canvas_button_release_event (GdkEventButton* event);
1353 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1355 bool time_canvas_scroll_event (GdkEventScroll* event);
1357 Gtk::Allocation canvas_allocation;
1358 bool canvas_idle_queued;
1359 void track_canvas_allocate (Gtk::Allocation alloc);
1360 bool track_canvas_size_allocated ();
1362 void set_playhead_cursor ();
1364 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1365 void kbd_mute_unmute_region ();
1368 void kbd_do_brush (GdkEvent*);
1369 void kbd_do_audition (GdkEvent*);
1371 void handle_new_duration ();
1372 void initialize_canvas ();
1373 int canvas_hroizontally_scrolled_handler_id;
1374 void reset_horizontally_scrolling_region (Gtk::Allocation* alloc = 0);
1375 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1377 /* display control */
1379 bool _show_measures;
1380 /// true to show waveforms, otherwise false
1381 bool _show_waveforms;
1382 /// true if the editor should follow the playhead, otherwise false
1383 bool _follow_playhead;
1384 /// true if waveforms should be shown while recording audio tracks, otherwise false
1385 bool _show_waveforms_recording;
1387 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1389 ArdourCanvas::Group* time_line_group;
1390 ArdourCanvas::Group* marker_time_line_group;
1392 TempoLines* tempo_lines;
1393 TempoLines* marker_tempo_lines;
1395 void hide_measures ();
1396 void draw_measures ();
1397 bool redraw_measures ();
1399 void new_tempo_section ();
1401 void mouse_add_new_tempo_event (nframes_t where);
1402 void mouse_add_new_meter_event (nframes_t where);
1404 void remove_tempo_marker (ArdourCanvas::Item*);
1405 void remove_meter_marker (ArdourCanvas::Item*);
1406 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1407 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1409 void edit_tempo_section (ARDOUR::TempoSection*);
1410 void edit_meter_section (ARDOUR::MeterSection*);
1411 void edit_tempo_marker (ArdourCanvas::Item*);
1412 void edit_meter_marker (ArdourCanvas::Item*);
1414 void marker_menu_edit ();
1415 void marker_menu_remove ();
1416 void marker_menu_rename ();
1417 void marker_menu_lock (bool yn);
1418 void marker_menu_hide ();
1419 void marker_menu_loop_range ();
1420 void marker_menu_select_all_selectables_using_range ();
1421 void marker_menu_select_using_range ();
1422 void marker_menu_separate_regions_using_location ();
1423 void marker_menu_play_from ();
1424 void marker_menu_play_range ();
1425 void marker_menu_set_playhead ();
1426 void marker_menu_set_from_playhead ();
1427 void marker_menu_set_from_selection ();
1428 void new_transport_marker_menu_set_loop ();
1429 void new_transport_marker_menu_set_punch ();
1430 void update_loop_range_view (bool visibility=false);
1431 void update_punch_range_view (bool visibility=false);
1432 gint new_transport_marker_menu_popdown (GdkEventAny*);
1433 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1434 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1435 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1436 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1437 void build_range_marker_menu (bool loop_or_punch);
1438 void build_marker_menu (bool start_or_end);
1439 void build_tm_marker_menu ();
1440 void build_new_transport_marker_menu ();
1442 Gtk::Menu* tm_marker_menu;
1443 Gtk::Menu* marker_menu;
1444 Gtk::Menu* start_end_marker_menu;
1445 Gtk::Menu* range_marker_menu;
1446 Gtk::Menu* transport_marker_menu;
1447 Gtk::Menu* new_transport_marker_menu;
1448 Gtk::Menu* cd_marker_menu;
1449 ArdourCanvas::Item* marker_menu_item;
1451 typedef list<Marker*> Marks;
1454 void remove_metric_marks ();
1455 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1457 void compute_current_bbt_points (nframes_t left, nframes_t right);
1458 int tempo_map_change_idle_handler_id;
1459 void tempo_map_changed (ARDOUR::Change);
1460 void redisplay_tempo (bool immediate_redraw);
1462 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1463 void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) {
1464 /* XXX remove this function when everything moves to 64 bit frame counts */
1465 nframes64_t first64 = first;
1466 snap_to (first64, direction, for_mark);
1467 first = (nframes_t) first64;
1470 double snap_length_beats (nframes_t start);
1472 uint32_t bbt_beat_subdivision;
1476 Gtk::ToggleButton editor_mixer_button;
1477 Gtk::ToggleButton editor_list_button;
1479 void editor_mixer_button_toggled ();
1480 void editor_list_button_toggled ();
1482 AudioClock edit_point_clock;
1483 AudioClock zoom_range_clock;
1484 Gtk::Button zoom_in_button;
1485 Gtk::Button zoom_out_button;
1486 Gtk::Button zoom_out_full_button;
1487 Gtk::Button zoom_onetoone_button;
1489 Gtk::VBox toolbar_clock_vbox;
1490 Gtk::VBox toolbar_selection_clock_vbox;
1491 Gtk::Table toolbar_selection_clock_table;
1492 Gtk::Label toolbar_selection_cursor_label;
1494 Gtk::HBox mouse_mode_button_box;
1495 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1496 Gtk::ToggleButton mouse_select_button;
1497 Gtk::ToggleButton mouse_move_button;
1498 Gtk::ToggleButton mouse_gain_button;
1499 Gtk::ToggleButton mouse_zoom_button;
1500 Gtk::ToggleButton mouse_timefx_button;
1501 Gtk::ToggleButton mouse_audition_button;
1502 Gtk::ToggleButton mouse_note_button;
1503 GroupedButtons *mouse_mode_button_set;
1504 void mouse_mode_toggled (Editing::MouseMode m);
1505 bool ignore_mouse_mode_toggle;
1507 gint mouse_select_button_release (GdkEventButton*);
1509 Gtk::VBox automation_box;
1510 Gtk::Button automation_mode_button;
1511 Gtk::ToggleButton global_automation_button;
1513 Gtk::ComboBoxText edit_mode_selector;
1514 Gtk::VBox edit_mode_box;
1516 void set_edit_mode (ARDOUR::EditMode);
1517 void cycle_edit_mode ();
1518 void edit_mode_selection_done ();
1520 Gtk::ComboBoxText snap_type_selector;
1521 Gtk::ComboBoxText snap_mode_selector;
1524 std::vector<std::string> snap_type_strings;
1525 std::vector<std::string> snap_mode_strings;
1527 void snap_type_selection_done ();
1528 void snap_mode_selection_done ();
1529 void snap_mode_chosen (Editing::SnapMode);
1530 void snap_type_chosen (Editing::SnapType);
1532 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1533 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1535 Gtk::ComboBoxText zoom_focus_selector;
1536 Gtk::VBox zoom_focus_box;
1538 std::vector<std::string> zoom_focus_strings;
1540 void zoom_focus_selection_done ();
1541 void zoom_focus_chosen (Editing::ZoomFocus);
1543 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1547 void zoom_adjustment_changed();
1549 void edit_point_clock_changed();
1551 void setup_toolbar ();
1553 Gtkmm2ext::TearOff* tools_tearoff;
1554 Gtk::HBox toolbar_hbox;
1555 Gtk::EventBox toolbar_base;
1556 Gtk::Frame toolbar_frame;
1560 Gtk::HBox midi_tool_button_box;
1561 Gtkmm2ext::TearOff* midi_tool_tearoff;
1562 Gtk::ToggleButton midi_tool_pencil_button;
1563 Gtk::ToggleButton midi_tool_select_button;
1564 Gtk::ToggleButton midi_tool_erase_button;
1565 GroupedButtons *midi_tool_button_set;
1566 void midi_edit_mode_toggled (Editing::MidiEditMode m);
1567 bool ignore_midi_edit_mode_toggle;
1569 Gtkmm2ext::TearOff* midi_tools_tearoff;
1570 Gtk::HBox midi_toolbar_hbox;
1571 Gtk::EventBox midi_toolbar_base;
1572 Gtk::Frame midi_toolbar_frame;
1574 void setup_midi_toolbar ();
1576 /* selection process */
1578 Selection* selection;
1579 Selection* cut_buffer;
1581 void time_selection_changed ();
1582 void track_selection_changed ();
1583 void region_selection_changed ();
1584 void point_selection_changed ();
1585 void marker_selection_changed ();
1594 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1595 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1596 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1597 void cancel_selection ();
1599 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1600 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1601 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1603 bool audio_region_selection_covers (nframes_t where);
1605 /* transport range select process */
1606 enum RangeMarkerOp {
1608 CreateTransportMarker,
1612 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1613 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1614 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1616 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1617 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1618 ArdourCanvas::Line* marker_drag_line;
1619 ArdourCanvas::Points marker_drag_line_points;
1620 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1622 void update_marker_drag_item (ARDOUR::Location *);
1624 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1625 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1626 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1627 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1628 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1629 ArdourCanvas::SimpleLine *transport_punchin_line;
1630 ArdourCanvas::SimpleLine *transport_punchout_line;
1631 ArdourCanvas::SimpleRect *transport_preroll_rect;
1632 ArdourCanvas::SimpleRect *transport_postroll_rect;
1634 ARDOUR::Location* transport_loop_location();
1635 ARDOUR::Location* transport_punch_location();
1637 ARDOUR::Location *temp_location;
1639 /* object rubberband select process */
1641 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1642 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1643 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1645 bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1647 ArdourCanvas::SimpleRect *rubberband_rect;
1649 /* mouse zoom process */
1651 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1652 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1653 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1655 ArdourCanvas::SimpleRect *zoom_rect;
1656 void reposition_zoom_rect (nframes_t start, nframes_t end);
1658 /* diskstream/route display management */
1660 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1661 RouteDisplayModelColumns() {
1667 Gtk::TreeModelColumn<Glib::ustring> text;
1668 Gtk::TreeModelColumn<bool> visible;
1669 Gtk::TreeModelColumn<TimeAxisView*> tv;
1670 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1673 RouteDisplayModelColumns route_display_columns;
1674 Glib::RefPtr<Gtk::ListStore> route_display_model;
1675 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1677 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1678 Gtk::ScrolledWindow route_list_scroller;
1679 Gtk::Menu* route_list_menu;
1681 void sync_order_keys ();
1682 bool ignore_route_order_sync;
1684 bool route_list_display_button_press (GdkEventButton*);
1685 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1688 const Gtk::SelectionData& data,
1692 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1694 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1695 void route_list_delete (const Gtk::TreeModel::Path&);
1696 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1698 void initial_route_list_display ();
1699 void redisplay_route_list();
1700 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1701 bool ignore_route_list_reorder;
1702 bool no_route_list_redisplay;
1704 void build_route_list_menu ();
1705 void show_route_list_menu ();
1707 void show_all_routes ();
1708 void hide_all_routes ();
1709 void show_all_audiotracks ();
1710 void hide_all_audiotracks ();
1711 void show_all_audiobus ();
1712 void hide_all_audiobus ();
1714 void set_all_tracks_visibility (bool yn);
1715 void set_all_audio_visibility (int type, bool yn);
1717 /* edit group management */
1719 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1720 GroupListModelColumns () {
1726 Gtk::TreeModelColumn<bool> is_active;
1727 Gtk::TreeModelColumn<bool> is_visible;
1728 Gtk::TreeModelColumn<std::string> text;
1729 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1732 GroupListModelColumns group_columns;
1733 Glib::RefPtr<Gtk::ListStore> group_model;
1734 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1736 Gtk::TreeView edit_group_display;
1737 Gtk::ScrolledWindow edit_group_display_scroller;
1738 Gtk::Menu* edit_group_list_menu;
1740 void build_edit_group_list_menu ();
1741 void activate_all_edit_groups ();
1742 void disable_all_edit_groups ();
1744 bool in_edit_group_row_change;
1745 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1746 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1747 void new_edit_group ();
1748 void edit_group_list_button_clicked ();
1749 gint edit_group_list_button_press_event (GdkEventButton* ev);
1750 void add_edit_group (ARDOUR::RouteGroup* group);
1751 void remove_selected_edit_group ();
1752 void edit_groups_changed ();
1753 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1755 Gtk::VBox list_vpacker;
1759 bool autoscroll_active;
1760 int autoscroll_timeout_tag;
1761 int autoscroll_direction;
1762 uint32_t autoscroll_cnt;
1763 nframes_t autoscroll_distance;
1765 static gint _autoscroll_canvas (void *);
1766 bool autoscroll_canvas ();
1767 void start_canvas_autoscroll (int direction);
1768 void stop_canvas_autoscroll ();
1769 void maybe_autoscroll (GdkEvent*);
1778 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1779 void point_trim (GdkEvent*);
1780 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1781 void single_contents_trim (RegionView&, nframes_t, bool, bool, bool);
1782 void single_start_trim (RegionView&, nframes_t, bool, bool);
1783 void single_end_trim (RegionView&, nframes_t, bool, bool);
1785 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1786 void thaw_region_after_trim (RegionView& rv);
1788 void trim_region_front();
1789 void trim_region_back();
1790 void trim_region (bool front);
1792 void trim_region_to_edit_point ();
1793 void trim_region_from_edit_point ();
1794 void trim_region_to_loop ();
1795 void trim_region_to_punch ();
1796 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1798 bool show_gain_after_trim;
1802 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1803 const Glib::RefPtr<Gdk::DragContext>& context,
1806 const Gtk::SelectionData& data,
1810 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1813 const Gtk::SelectionData& data,
1817 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1820 const Gtk::SelectionData& data,
1825 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1828 const Gtk::SelectionData& data,
1832 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1835 const Gtk::SelectionData& data,
1841 ExportDialog *export_dialog;
1842 ExportDialog *export_range_markers_dialog;
1844 void export_range (nframes_t start, nframes_t end);
1845 void export_range_markers ();
1847 int write_region_selection(RegionSelection&);
1848 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1849 void export_region ();
1850 void bounce_region_selection ();
1851 void bounce_range_selection ();
1852 void external_edit_region ();
1854 int write_audio_selection (TimeSelection&);
1855 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
1857 void write_selection ();
1861 UndoAction get_memento() const;
1863 XMLNode *before; /* used in *_reversible_command */
1865 void begin_reversible_command (string cmd_name);
1866 void commit_reversible_command ();
1868 /* visual history */
1870 UndoHistory visual_history;
1871 UndoTransaction current_visual_command;
1874 void update_title ();
1875 void update_title_s (const string & snapshot_name);
1878 Selection* selection;
1879 double frames_per_unit;
1881 State (PublicEditor const * e);
1885 void store_state (State&) const;
1886 void restore_state (State *);
1888 void instant_save ();
1890 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1892 /* freeze operations */
1894 ARDOUR::InterThreadInfo freeze_status;
1895 gint freeze_progress_timeout (void *);
1896 static void* _freeze_thread (void*);
1897 void* freeze_thread ();
1899 void freeze_routes ();
1900 void unfreeze_routes ();
1902 /* edit-group solo + mute */
1904 void set_edit_group_solo (ARDOUR::Route&, bool);
1905 void set_edit_group_mute (ARDOUR::Route&, bool);
1909 void duplicate_dialog (bool with_dialog);
1911 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1913 /* returns false if mouse pointer is not in track or marker canvas
1915 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1917 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1918 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1919 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1921 struct TimeFXDialog : public ArdourDialog {
1922 ARDOUR::TimeFXRequest request;
1925 Gtk::Adjustment pitch_octave_adjustment;
1926 Gtk::Adjustment pitch_semitone_adjustment;
1927 Gtk::Adjustment pitch_cent_adjustment;
1928 Gtk::SpinButton pitch_octave_spinner;
1929 Gtk::SpinButton pitch_semitone_spinner;
1930 Gtk::SpinButton pitch_cent_spinner;
1931 RegionSelection regions;
1932 Gtk::ProgressBar progress_bar;
1933 Gtk::ToggleButton quick_button;
1934 Gtk::ToggleButton antialias_button;
1935 Gtk::Button* cancel_button;
1936 Gtk::Button* action_button;
1937 Gtk::HBox upper_button_box;
1941 TimeFXDialog (Editor& e, bool for_pitch);
1943 gint update_progress ();
1944 sigc::connection first_cancel;
1945 sigc::connection first_delete;
1946 void cancel_in_progress ();
1947 gint delete_in_progress (GdkEventAny*);
1950 /* "whats mine is yours" */
1952 friend class TimeFXDialog;
1954 TimeFXDialog* current_timefx;
1956 static void* timefx_thread (void *arg);
1957 void do_timefx (TimeFXDialog&);
1959 int time_stretch (RegionSelection&, float fraction);
1960 int pitch_shift (RegionSelection&, float cents);
1961 void pitch_shift_regions ();
1962 int time_fx (RegionSelection&, float val, bool pitching);
1964 /* editor-mixer strip */
1966 MixerStrip *current_mixer_strip;
1967 bool show_editor_mixer_when_tracks_arrive;
1968 Gtk::VBox current_mixer_strip_vbox;
1969 void cms_new (boost::shared_ptr<ARDOUR::Route>);
1970 void cms_deleted ();
1971 void current_mixer_strip_hidden ();
1972 void current_mixer_strip_removed ();
1974 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1975 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1977 /* nudging tracks */
1979 void nudge_selected_tracks (bool use_edit_cursor, bool forwards);
1983 bool _xfade_visibility;
1986 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1987 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
1989 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1990 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1992 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1993 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1994 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1996 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1997 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1998 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1999 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2001 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2002 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2003 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2004 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2006 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2007 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2008 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2009 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2010 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2011 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2013 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2014 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2015 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2016 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2017 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2018 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2020 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2021 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2023 ImageFrameSocketHandler* image_socket_listener ;
2026 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2027 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2028 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2029 void xfade_edit_left_region ();
2030 void xfade_edit_right_region ();
2032 static const int32_t default_width = 995;
2033 static const int32_t default_height = 765;
2037 Gtk::Button nudge_forward_button;
2038 Gtk::Button nudge_backward_button;
2039 Gtk::HBox nudge_hbox;
2040 Gtk::VBox nudge_vbox;
2041 AudioClock nudge_clock;
2043 nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
2047 void apply_filter (ARDOUR::Filter&, string cmd);
2049 /* handling cleanup */
2051 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2053 vector<sigc::connection> session_connections;
2055 /* tracking step changes of track height */
2057 TimeAxisView* current_stepping_trackview;
2058 struct timeval last_track_height_step_timestamp;
2059 gint track_height_step_timeout();
2060 sigc::connection step_timeout;
2062 TimeAxisView* entered_track;
2063 RegionView* entered_regionview;
2064 void ensure_entered_region_selected (bool op_acts_on_objects = false);
2065 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2066 bool clear_entered_track;
2067 gint left_track_canvas (GdkEventCrossing*);
2068 void set_entered_track (TimeAxisView*);
2069 void set_entered_regionview (RegionView*);
2070 gint left_automation_track ();
2072 bool _new_regionviews_show_envelope;
2074 void toggle_gain_envelope_visibility ();
2075 void toggle_gain_envelope_active ();
2076 void reset_region_gain_envelopes ();
2078 Gtk::CheckMenuItem* region_envelope_visible_item;
2079 Gtk::CheckMenuItem* region_envelope_active_item;
2080 Gtk::CheckMenuItem* region_mute_item;
2081 Gtk::CheckMenuItem* region_lock_item;
2082 Gtk::CheckMenuItem* region_lock_position_item;
2083 Gtk::CheckMenuItem* region_opaque_item;
2085 bool on_key_press_event (GdkEventKey*);
2086 bool on_key_release_event (GdkEventKey*);
2088 void session_state_saved (string);
2090 Glib::RefPtr<Gtk::Action> undo_action;
2091 Glib::RefPtr<Gtk::Action> redo_action;
2093 void history_changed ();
2095 Gtk::HBox status_bar_hpacker;
2097 Editing::EditPoint _edit_point;
2099 Gtk::ComboBoxText edit_point_selector;
2101 void set_edit_point_preference (Editing::EditPoint ep);
2102 void cycle_edit_point (bool with_marker);
2103 void set_edit_point ();
2104 void edit_point_selection_done ();
2105 void edit_point_chosen (Editing::EditPoint);
2106 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2107 std::vector<std::string> edit_point_strings;
2109 void selected_marker_moved (ARDOUR::Location*);
2110 sigc::connection edit_point_clock_connection_a;
2111 sigc::connection edit_point_clock_connection_b;
2113 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2115 RegionSelection get_regions_at (nframes64_t where, const TrackSelection& ts) const;
2116 RegionSelection get_regions_after (nframes64_t where, const TrackSelection& ts) const;
2118 RegionSelection tmp_regions;
2120 RegionSelection& get_regions_for_action ();
2122 sigc::connection fast_screen_update_connection;
2123 gint start_updating ();
2124 gint stop_updating ();
2125 void fast_update_strips ();
2126 bool meters_running;
2128 void select_next_route ();
2129 void select_prev_route ();
2132 #endif /* __ardour_editor_h__ */