speed up track resizing; fixup file DnD; stop use CAAudioFile for imported files
[ardour2.git] / gtk2_ardour / editor.h
blobec11b7cbdd9b9077e868661bbb7e9c07d4f96a14
1 /*
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__
23 #include <list>
24 #include <map>
25 #include <set>
26 #include <string>
27 #include <sys/time.h>
28 #include <glibmm/ustring.h>
30 #include <boost/optional.hpp>
32 #include <libgnomecanvasmm/canvas.h>
33 #include <libgnomecanvasmm/group.h>
34 #include <libgnomecanvasmm/line.h>
35 #include <libgnomecanvasmm/pixbuf.h>
37 #include <cmath>
39 #include <gtkmm/layout.h>
40 #include <gtkmm/comboboxtext.h>
42 #include <gtkmm2ext/selector.h>
43 #include <gtkmm2ext/click_box.h>
44 #include <gtkmm2ext/dndtreeview.h>
46 #include <pbd/stateful.h>
47 #include <ardour/session.h>
48 #include <ardour/tempo.h>
49 #include <ardour/stretch.h>
50 #include <ardour/location.h>
51 #include <ardour/audioregion.h>
53 #include "audio_clock.h"
54 #include "gtk-custom-ruler.h"
55 #include "ardour_dialog.h"
56 #include "public_editor.h"
57 #include "editing.h"
58 #include "enums.h"
59 #include "editor_items.h"
60 #include "region_selection.h"
61 #include "canvas.h"
62 #include "time_axis_view.h"
63 #include "draginfo.h"
65 namespace Gtkmm2ext {
66 class TearOff;
69 namespace ARDOUR {
70 class AudioDiskstream;
71 class RouteGroup;
72 class Playlist;
73 class AudioPlaylist;
74 class Region;
75 class Location;
76 class TempoSection;
77 class NamedSelection;
78 class Session;
79 class AudioFilter;
80 class Crossfade;
83 namespace LADSPA {
84 class Plugin;
87 class TimeAxisView;
88 class RouteTimeAxisView;
89 class AudioTimeAxisView;
90 class AutomationTimeAxisView;
91 class AudioRegionView;
92 class CrossfadeView;
93 class PluginSelector;
94 class PlaylistSelector;
95 class Marker;
96 class GroupedButtons;
97 class AutomationLine;
98 class UIExportSpecification;
99 class ExportDialog;
100 class Selection;
101 class TempoLines;
102 class TimeSelection;
103 class TrackSelection;
104 class AutomationSelection;
105 class MixerStrip;
106 class StreamView;
107 class AudioStreamView;
108 class ControlPoint;
109 class SoundFileOmega;
110 class RhythmFerret;
111 #ifdef FFT_ANALYSIS
112 class AnalysisWindow;
113 #endif
115 /* <CMT Additions> */
116 class ImageFrameView;
117 class ImageFrameTimeAxisView;
118 class ImageFrameTimeAxis;
119 class MarkerTimeAxis ;
120 class MarkerView ;
121 class ImageFrameSocketHandler ;
122 class TimeAxisViewItem ;
123 /* </CMT Additions> */
126 class Editor : public PublicEditor
128 public:
129 Editor ();
130 ~Editor ();
132 void connect_to_session (ARDOUR::Session *);
133 ARDOUR::Session* current_session() const { return session; }
134 void first_idle ();
135 virtual bool have_idled() const { return _have_idled; }
137 nframes64_t leftmost_position() const { return leftmost_frame; }
138 nframes64_t current_page_frames() const {
139 return (nframes64_t) floor (canvas_width * frames_per_unit);
142 void cycle_snap_mode ();
143 void cycle_snap_choice ();
144 void set_snap_to (Editing::SnapType);
145 void set_snap_mode (Editing::SnapMode);
146 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
148 void undo (uint32_t n = 1);
149 void redo (uint32_t n = 1);
151 XMLNode& get_state ();
152 int set_state (const XMLNode& );
154 void set_mouse_mode (Editing::MouseMode, bool force=true);
155 void step_mouse_mode (bool next);
156 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
158 void add_imageframe_time_axis(const std::string & track_name, void*) ;
159 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
160 void connect_to_image_compositor() ;
161 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
162 TimeAxisView* get_named_time_axis(const std::string & name) ;
163 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
164 void add_to_idle_resize (TimeAxisView*, uint32_t);
166 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
167 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
168 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
170 #ifdef USE_RUBBERBAND
171 std::vector<std::string> rb_opt_strings;
172 #endif
174 /* option editor-access */
176 void set_show_waveforms (bool yn);
177 bool show_waveforms() const { return _show_waveforms; }
179 void set_waveform_scale (Editing::WaveformScale);
181 void set_show_waveforms_recording (bool yn);
182 bool show_waveforms_recording() const { return _show_waveforms_recording; }
184 /* things that need to be public to be used in the main menubar */
186 void new_region_from_selection ();
187 void separate_regions_between (const TimeSelection&);
188 void separate_region_from_selection ();
189 void separate_region_from_punch ();
190 void separate_region_from_loop ();
191 void separate_regions_using_location (ARDOUR::Location&);
192 void toggle_playback (bool with_abort);
193 void transition_to_rolling (bool forward);
195 /* undo related */
197 nframes64_t unit_to_frame (double unit) const {
198 return (nframes64_t) rint (unit * frames_per_unit);
201 double frame_to_unit (nframes64_t frame) const {
202 return rint ((double) frame / (double) frames_per_unit);
205 double frame_to_unit (double frame) const {
206 return rint (frame / frames_per_unit);
209 /* NOTE: these functions assume that the "pixel" coordinate is
210 the result of using the world->canvas affine transform on a
211 world coordinate. These coordinates already take into
212 account any scrolling carried out by adjusting the
213 xscroll_adjustment.
216 nframes64_t pixel_to_frame (double pixel) const {
218 /* pixel can be less than zero when motion events
219 are processed. since we've already run the world->canvas
220 affine, that means that the location *really* is "off
221 to the right" and thus really is "before the start".
224 if (pixel >= 0) {
225 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
226 } else {
227 return 0;
231 gulong frame_to_pixel (nframes64_t frame) const {
232 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
235 void flush_canvas ();
237 /* selection */
239 Selection& get_selection() const { return *selection; }
240 Selection& get_cut_buffer() const { return *cut_buffer; }
242 bool extend_selection_to_track (TimeAxisView&);
244 void play_selection ();
245 void select_all_in_track (Selection::Operation op);
246 void select_all (Selection::Operation op);
247 void invert_selection_in_track ();
248 void invert_selection ();
249 void deselect_all ();
251 /* tempo */
253 void set_show_measures (bool yn);
254 bool show_measures () const { return _show_measures; }
256 #ifdef FFT_ANALYSIS
257 /* analysis window */
258 void analyze_region_selection();
259 void analyze_range_selection();
260 #endif
262 /* export */
264 /* these initiate export ... */
266 void export_session();
267 void export_selection();
269 void add_toplevel_controls (Gtk::Container&);
270 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
272 void set_zoom_focus (Editing::ZoomFocus);
273 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
274 double get_current_zoom () const { return frames_per_unit; }
276 void temporal_zoom_step (bool coarser);
278 /* stuff that AudioTimeAxisView and related classes use */
280 PlaylistSelector& playlist_selector() const;
281 void route_name_changed (TimeAxisView *);
282 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
284 void new_playlists (TimeAxisView*);
285 void copy_playlists (TimeAxisView*);
286 void clear_playlists (TimeAxisView*);
288 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
290 Width editor_mixer_strip_width;
291 void maybe_add_mixer_strip_width (XMLNode&);
292 void show_editor_mixer (bool yn);
293 void create_editor_mixer ();
294 void set_selected_mixer_strip (TimeAxisView&);
295 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
296 void show_track_in_display (TimeAxisView& tv);
298 /* nudge is initiated by transport controls owned by ARDOUR_UI */
300 void nudge_forward (bool next, bool force_playhead);
301 void nudge_backward (bool next, bool force_playhead);
303 /* nudge initiated from context menu */
305 void nudge_forward_capture_offset ();
306 void nudge_backward_capture_offset ();
308 /* playhead/screen stuff */
310 void set_follow_playhead (bool yn);
311 void toggle_follow_playhead ();
312 bool follow_playhead() const { return _follow_playhead; }
313 bool dragging_playhead () const { return _dragging_playhead; }
315 void toggle_waveform_visibility ();
316 void toggle_waveforms_while_recording ();
317 void toggle_measure_visibility ();
318 void toggle_logo_visibility ();
320 double get_physical_screen_width () const { return physical_screen_width; };
321 double physical_screen_width;
322 double physical_screen_height;
324 /* SMPTE timecode & video sync */
326 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
327 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
328 void subframes_per_frame_chosen (uint32_t);
330 void update_smpte_mode();
331 void update_video_pullup();
332 void update_subframes_per_frame ();
334 /* fades & xfades */
336 void toggle_region_fades ();
337 void toggle_region_fades_visible ();
338 void toggle_selected_region_fades (int dir);
339 void update_region_fade_visibility ();
341 void toggle_auto_xfade ();
342 void toggle_xfades_active ();
343 void toggle_xfade_visibility ();
344 bool xfade_visibility() const { return _xfade_visibility; }
345 void update_xfade_visibility ();
346 void update_crossfade_model ();
347 void set_crossfade_model (ARDOUR::CrossfadeModel);
349 /* layers */
350 void set_layer_model (ARDOUR::LayerModel);
351 void update_layering_model ();
353 void toggle_link_region_and_track_selection ();
355 /* redirect shared ops menu. caller must free returned menu */
357 Gtk::Menu* redirect_menu ();
359 /* floating windows/transient */
361 void ensure_float (Gtk::Window&);
363 void show_window ();
365 void scroll_tracks_down_line ();
366 void scroll_tracks_up_line ();
368 void move_selected_tracks (bool up);
370 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
371 void prepare_for_cleanup ();
372 void finish_cleanup ();
374 void maximise_editing_space();
375 void restore_editing_space();
377 void reset_x_origin (nframes64_t);
378 void reset_zoom (double);
379 void reposition_and_zoom (nframes64_t, double);
381 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
383 bool update_mouse_speed ();
384 bool decelerate_mouse_speed ();
386 void toggle_meter_updating();
388 void show_rhythm_ferret();
390 void goto_visual_state (uint32_t);
391 void save_visual_state (uint32_t);
393 void queue_draw_resize_line (int at);
394 void start_resize_line_ops ();
395 void end_resize_line_ops ();
397 protected:
398 void map_transport_state ();
399 void map_position_change (nframes64_t);
401 void on_realize();
402 bool on_expose_event (GdkEventExpose*);
404 private:
406 ARDOUR::Session *session;
407 bool constructed;
409 // to keep track of the playhead position for control_scroll
410 boost::optional<nframes64_t> _control_scroll_target;
412 PlaylistSelector* _playlist_selector;
414 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
416 struct VisualState {
417 double y_position;
418 double frames_per_unit;
419 nframes64_t leftmost_frame;
420 Editing::ZoomFocus zoom_focus;
421 bool zoomed_to_region;
422 std::list<TAVState> track_states;
425 std::list<VisualState*> undo_visual_stack;
426 std::list<VisualState*> redo_visual_stack;
427 VisualState* current_visual_state (bool with_tracks = true);
428 void undo_visual_state ();
429 void redo_visual_state ();
430 void use_visual_state (VisualState&);
431 bool no_save_visual;
432 void swap_visual_state ();
434 std::vector<VisualState*> visual_states;
435 sigc::connection visual_state_op_connection;
436 void start_visual_state_op (uint32_t n);
437 void cancel_visual_state_op (uint32_t n);
438 bool end_visual_state_op (uint32_t n);
440 nframes64_t leftmost_frame;
441 double frames_per_unit;
442 Editing::ZoomFocus zoom_focus;
444 void set_frames_per_unit (double);
445 void post_zoom ();
447 Editing::MouseMode mouse_mode;
449 int post_maximal_editor_width;
450 int post_maximal_pane_position;
451 int pre_maximal_pane_position;
452 int pre_maximal_editor_width;
453 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
455 Gtk::Notebook the_notebook;
456 Gtk::HPaned edit_pane;
458 Gtk::EventBox meter_base;
459 Gtk::HBox meter_box;
460 Gtk::EventBox marker_base;
461 Gtk::HBox marker_box;
462 Gtk::VBox scrollers_rulers_markers_box;
464 void location_changed (ARDOUR::Location *);
465 void location_flags_changed (ARDOUR::Location *, void *);
466 void refresh_location_display ();
467 void refresh_location_display_s (ARDOUR::Change);
468 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
469 void add_new_location (ARDOUR::Location *);
470 void location_gone (ARDOUR::Location *);
471 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
472 gint really_remove_marker (ARDOUR::Location* loc);
473 void goto_nth_marker (int nth);
475 uint32_t location_marker_color;
476 uint32_t location_range_color;
477 uint32_t location_loop_color;
478 uint32_t location_punch_color;
479 uint32_t location_cd_marker_color;
481 struct LocationMarkers {
482 Marker* start;
483 Marker* end;
484 bool valid;
486 LocationMarkers () : start(0), end(0), valid (true) {}
488 ~LocationMarkers ();
490 void hide();
491 void show ();
492 void set_name (const string&);
493 void set_position (nframes64_t start, nframes64_t end = 0);
494 void set_color_rgba (uint32_t);
497 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
498 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
499 Marker* entered_marker;
501 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
502 LocationMarkerMap location_markers;
504 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
505 void clear_marker_display ();
506 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
507 bool choose_new_marker_name(string &name);
508 void update_cd_marker_display ();
509 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
511 TimeAxisView* clicked_trackview;
512 AudioTimeAxisView* clicked_audio_trackview;
513 RegionView* clicked_regionview;
514 RegionSelection latest_regionviews;
515 uint32_t clicked_selection;
516 CrossfadeView* clicked_crossfadeview;
517 ControlPoint* clicked_control_point;
519 void sort_track_selection (TrackSelection* sel = 0);
521 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
522 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
523 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
525 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
527 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
528 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
529 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
530 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
532 /* end */
534 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
535 bool button_release_can_deselect;
537 void catch_vanishing_regionview (RegionView *);
539 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
540 void select_all_tracks ();
542 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
543 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
544 void set_selected_track_as_side_effect (bool force = false);
545 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
547 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
548 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
549 void collect_new_region_view (RegionView *);
551 Gtk::Menu track_context_menu;
552 Gtk::Menu track_region_context_menu;
553 Gtk::Menu track_selection_context_menu;
554 Gtk::Menu track_crossfade_context_menu;
556 Gtk::MenuItem* region_edit_menu_split_item;
557 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
558 Gtk::Menu * track_region_edit_playlist_menu;
559 Gtk::Menu * track_edit_playlist_submenu;
560 Gtk::Menu * track_selection_edit_playlist_submenu;
562 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
563 Gtk::Menu* build_track_context_menu (nframes64_t);
564 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
565 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
566 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
567 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
568 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
569 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
570 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
571 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
572 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
574 void handle_new_route (ARDOUR::Session::RouteList&);
575 void remove_route (TimeAxisView *);
576 bool route_removal;
578 Gtk::HBox global_hpacker;
579 Gtk::VBox global_vpacker;
580 Gtk::VBox vpacker;
582 bool need_resize_line;
583 int resize_line_y;
584 int old_resize_line_y;
586 Gdk::Cursor* current_canvas_cursor;
587 void set_canvas_cursor ();
588 Gdk::Cursor* which_grabber_cursor ();
590 ArdourCanvas::Canvas* track_canvas;
592 ArdourCanvas::Text* first_action_message;
593 ArdourCanvas::Text* verbose_canvas_cursor;
594 bool verbose_cursor_visible;
596 void parameter_changed (const char *);
598 bool track_canvas_motion (GdkEvent*);
600 void set_verbose_canvas_cursor (const string &, double x, double y);
601 void set_verbose_canvas_cursor_text (const string &);
602 void show_verbose_canvas_cursor();
603 void hide_verbose_canvas_cursor();
605 bool verbose_cursor_on; // so far unused
607 Gtk::EventBox time_canvas_event_box;
608 Gtk::EventBox track_canvas_event_box;
609 Gtk::EventBox time_button_event_box;
610 Gtk::EventBox ruler_label_event_box;
612 ArdourCanvas::Pixbuf* logo_item;
613 ArdourCanvas::Group* minsec_group;
614 ArdourCanvas::Group* bbt_group;
615 ArdourCanvas::Group* smpte_group;
616 ArdourCanvas::Group* frame_group;
617 ArdourCanvas::Group* tempo_group;
618 ArdourCanvas::Group* meter_group;
619 ArdourCanvas::Group* marker_group;
620 ArdourCanvas::Group* range_marker_group;
621 ArdourCanvas::Group* transport_marker_group;
622 ArdourCanvas::Group* cd_marker_group;
624 ArdourCanvas::Group* timebar_group;
626 /* These bars never need to be scrolled */
627 ArdourCanvas::Group* meter_bar_group;
628 ArdourCanvas::Group* tempo_bar_group;
629 ArdourCanvas::Group* marker_bar_group;
630 ArdourCanvas::Group* range_marker_bar_group;
631 ArdourCanvas::Group* transport_marker_bar_group;
632 ArdourCanvas::Group* cd_marker_bar_group;
634 ArdourCanvas::Group* _background_group;
636 The _master_group is the group containing all items
637 that require horizontal scrolling..
638 It is primarily used to separate canvas items
639 that require horizontal scrolling from those that do not.
641 ArdourCanvas::Group* _master_group;
643 The _trackview_group is the group containing all trackviews.
644 It is only scrolled vertically.
646 ArdourCanvas::Group* _trackview_group;
648 This canvas group is used for region motion.
649 It sits on top of the _trackview_group
651 ArdourCanvas::Group* _region_motion_group;
653 enum RulerType {
654 ruler_metric_smpte = 0,
655 ruler_metric_bbt = 1,
656 ruler_metric_frames = 2,
657 ruler_metric_minsec = 3,
659 ruler_time_tempo = 4,
660 ruler_time_meter = 5,
661 ruler_time_marker = 6,
662 ruler_time_range_marker = 7,
663 ruler_time_transport_marker = 8,
664 ruler_time_cd_marker = 9,
667 static GtkCustomMetric ruler_metrics[4];
668 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
669 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
670 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
671 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
672 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
673 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
674 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
675 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
676 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
677 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
678 bool no_ruler_shown_update;
680 gint ruler_button_press (GdkEventButton*);
681 gint ruler_button_release (GdkEventButton*);
682 gint ruler_mouse_motion (GdkEventMotion*);
683 bool ruler_scroll (GdkEventScroll* event);
685 gint ruler_pressed_button;
686 Gtk::Widget * ruler_grabbed_widget;
688 void initialize_rulers ();
689 void update_just_smpte ();
690 void update_fixed_rulers ();
691 void update_tempo_based_rulers ();
692 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
693 void update_ruler_visibility ();
694 void set_ruler_visible (RulerType, bool);
695 void toggle_ruler_visibility (RulerType rt);
696 void ruler_toggled (int);
697 gint ruler_label_button_release (GdkEventButton*);
698 void store_ruler_visibility ();
699 void restore_ruler_visibility ();
701 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
702 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
703 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
704 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
706 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
707 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
708 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
709 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
711 Gtk::Widget *_ruler_separator;
712 GtkWidget *_smpte_ruler;
713 GtkWidget *_bbt_ruler;
714 GtkWidget *_frames_ruler;
715 GtkWidget *_minsec_ruler;
716 Gtk::Widget *smpte_ruler;
717 Gtk::Widget *bbt_ruler;
718 Gtk::Widget *frames_ruler;
719 Gtk::Widget *minsec_ruler;
720 static Editor *ruler_editor;
722 static const double timebar_height;
723 guint32 visible_timebars;
724 gdouble canvas_timebars_vsize;
725 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
726 Gtk::Menu *editor_ruler_menu;
728 ArdourCanvas::SimpleRect* tempo_bar;
729 ArdourCanvas::SimpleRect* meter_bar;
730 ArdourCanvas::SimpleRect* marker_bar;
731 ArdourCanvas::SimpleRect* range_marker_bar;
732 ArdourCanvas::SimpleRect* transport_marker_bar;
733 ArdourCanvas::SimpleRect* cd_marker_bar;
736 ArdourCanvas::SimpleLine* tempo_line;
737 ArdourCanvas::SimpleLine* meter_line;
738 ArdourCanvas::SimpleLine* marker_line;
739 ArdourCanvas::SimpleLine* range_marker_line;
740 ArdourCanvas::SimpleLine* transport_marker_line;
741 ArdourCanvas::SimpleLine* cd_marker_line;
743 Gtk::Label minsec_label;
744 Gtk::Label bbt_label;
745 Gtk::Label smpte_label;
746 Gtk::Label frame_label;
747 Gtk::Label tempo_label;
748 Gtk::Label meter_label;
749 Gtk::Label mark_label;
750 Gtk::Label range_mark_label;
751 Gtk::Label transport_mark_label;
752 Gtk::Label cd_mark_label;
755 Gtk::VBox time_button_vbox;
756 Gtk::HBox time_button_hbox;
758 struct Cursor {
759 Editor& editor;
760 ArdourCanvas::Points points;
761 ArdourCanvas::Line canvas_item;
762 nframes64_t current_frame;
763 double length;
765 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
766 ~Cursor ();
768 void set_position (nframes64_t);
769 void set_length (double units);
770 void set_y_axis (double position);
773 friend struct Cursor; /* it needs access to several private
774 fields. XXX fix me.
777 Cursor* playhead_cursor;
778 ArdourCanvas::Group* cursor_group;
780 void cursor_to_region_boundary (Cursor*, int32_t dir);
781 void cursor_to_next_region_boundary (Cursor*);
782 void cursor_to_previous_region_boundary (Cursor*);
783 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
784 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
785 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
786 void cursor_to_selection_start (Cursor *);
787 void cursor_to_selection_end (Cursor *);
789 void selected_marker_to_region_boundary (int32_t dir);
790 void selected_marker_to_next_region_boundary ();
791 void selected_marker_to_previous_region_boundary ();
792 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
793 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
794 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
795 void selected_marker_to_selection_start ();
796 void selected_marker_to_selection_end ();
798 void select_all_selectables_using_cursor (Cursor *, bool);
799 void select_all_selectables_using_edit (bool);
800 void select_all_selectables_between (bool within);
801 void select_range_between ();
803 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
804 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
806 vector<nframes64_t> region_boundary_cache;
807 void build_region_boundary_cache ();
809 Gtk::HBox top_hbox;
810 Gtk::HBox bottom_hbox;
812 Gtk::Table edit_packer;
813 Gtk::VScrollbar edit_vscrollbar;
815 Gtk::Adjustment vertical_adjustment;
816 Gtk::Adjustment horizontal_adjustment;
818 Gtk::Layout controls_layout;
819 bool control_layout_scroll (GdkEventScroll* ev);
820 void controls_layout_size_request (Gtk::Requisition*);
821 sigc::connection controls_layout_size_request_connection;
823 Gtk::HScrollbar edit_hscrollbar;
824 bool _dragging_hscrollbar;
826 void reset_hscrollbar_stepping ();
828 bool hscrollbar_button_press (GdkEventButton*);
829 bool hscrollbar_button_release (GdkEventButton*);
830 void hscrollbar_allocate (Gtk::Allocation &alloc);
832 double canvas_width;
833 double canvas_height;
834 double full_canvas_height;
836 bool track_canvas_map_handler (GdkEventAny*);
838 gint edit_controls_button_release (GdkEventButton*);
839 Gtk::Menu *edit_controls_left_menu;
840 Gtk::Menu *edit_controls_right_menu;
842 Gtk::VBox ruler_label_vbox;
843 Gtk::VBox track_canvas_vbox;
844 Gtk::VBox time_canvas_vbox;
845 Gtk::VBox edit_controls_vbox;
846 Gtk::HBox edit_controls_hbox;
848 void control_scroll (float);
849 void access_action (std::string,std::string);
850 bool deferred_control_scroll (nframes64_t);
851 sigc::connection control_scroll_connection;
853 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
855 ArdourCanvas::Group* get_background_group () const { return _background_group; }
856 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
857 double last_trackview_group_vertical_offset;
858 void tie_vertical_scrolling ();
859 void scroll_canvas_horizontally ();
860 void scroll_canvas_vertically ();
861 void canvas_horizontally_scrolled ();
862 void canvas_scroll_to (nframes64_t);
864 struct VisualChange {
865 enum Type {
866 TimeOrigin = 0x1,
867 ZoomLevel = 0x2
870 Type pending;
871 nframes64_t time_origin;
872 double frames_per_unit;
874 int idle_handler_id;
876 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
880 VisualChange pending_visual_change;
882 static int _idle_visual_changer (void *arg);
883 int idle_visual_changer ();
885 void queue_visual_change (nframes64_t);
886 void queue_visual_change (double);
888 void end_location_changed (ARDOUR::Location*);
890 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
891 RegionListDisplayModelColumns() {
892 add (name);
893 add (region);
894 add (color_);
896 Gtk::TreeModelColumn<Glib::ustring> name;
897 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
898 Gtk::TreeModelColumn<Gdk::Color> color_;
901 RegionListDisplayModelColumns region_list_columns;
902 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
904 Glib::RefPtr<Gtk::TreeStore> region_list_model;
905 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
906 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
908 void region_list_selection_changed ();
909 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
910 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
911 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
913 Gtk::Menu *region_list_menu;
914 Gtk::ScrolledWindow region_list_scroller;
915 Gtk::Frame region_list_frame;
917 bool region_list_display_key_press (GdkEventKey *);
918 bool region_list_display_key_release (GdkEventKey *);
919 bool region_list_display_button_press (GdkEventButton *);
920 bool region_list_display_button_release (GdkEventButton *);
921 void region_list_clear ();
922 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
923 void build_region_list_menu ();
924 void show_region_list_display_context_menu (int button, int time);
926 bool show_automatic_regions_in_region_list;
927 Editing::RegionListSortType region_list_sort_type;
929 void reset_region_list_sort_direction (bool);
930 void reset_region_list_sort_type (Editing::RegionListSortType);
932 void toggle_full_region_list ();
933 void toggle_show_auto_regions ();
935 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
937 /* snapshots */
939 Gtk::ScrolledWindow snapshot_display_scroller;
940 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
941 SnapshotDisplayModelColumns() {
942 add (visible_name);
943 add (real_name);
945 Gtk::TreeModelColumn<Glib::ustring> visible_name;
946 Gtk::TreeModelColumn<Glib::ustring> real_name;
949 SnapshotDisplayModelColumns snapshot_display_columns;
950 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
951 Gtk::TreeView snapshot_display;
952 Gtk::Menu snapshot_context_menu;
954 bool snapshot_display_button_press (GdkEventButton*);
955 void snapshot_display_selection_changed ();
956 void redisplay_snapshots();
957 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
959 /* named selections */
961 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
962 NamedSelectionDisplayModelColumns() {
963 add (text);
964 add (selection);
966 Gtk::TreeModelColumn<Glib::ustring> text;
967 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
970 NamedSelectionDisplayModelColumns named_selection_columns;
971 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
973 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
974 Gtk::ScrolledWindow named_selection_scroller;
976 void create_named_selection ();
977 void paste_named_selection (float times);
978 void remove_selected_named_selections ();
979 void remove_snapshot (Glib::ustring);
980 void rename_snapshot (Glib::ustring);
982 void handle_new_named_selection ();
983 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
984 void redisplay_named_selections ();
986 bool named_selection_display_button_release (GdkEventButton *ev);
987 bool named_selection_display_key_release (GdkEventKey *ev);
988 void named_selection_display_selection_changed ();
990 /* track views */
991 TrackViewList track_views;
992 TimeAxisView *trackview_by_y_position (double ypos);
994 static Gdk::Cursor* cross_hair_cursor;
995 static Gdk::Cursor* trimmer_cursor;
996 static Gdk::Cursor* selector_cursor;
997 static Gdk::Cursor* grabber_cursor;
998 static Gdk::Cursor* grabber_edit_point_cursor;
999 static Gdk::Cursor* zoom_cursor;
1000 static Gdk::Cursor* time_fx_cursor;
1001 static Gdk::Cursor* fader_cursor;
1002 static Gdk::Cursor* speaker_cursor;
1003 static Gdk::Cursor* wait_cursor;
1004 static Gdk::Cursor* timebar_cursor;
1005 static Gdk::Cursor* transparent_cursor;
1007 static void build_cursors ();
1009 sigc::connection scroll_connection;
1010 nframes64_t last_update_frame;
1011 void center_screen (nframes64_t);
1012 void center_screen_internal (nframes64_t, float);
1014 void update_current_screen ();
1016 void session_going_away ();
1018 nframes64_t cut_buffer_start;
1019 nframes64_t cut_buffer_length;
1021 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1022 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1023 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1024 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1025 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1026 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1028 /* KEYMAP HANDLING */
1030 void register_actions ();
1032 int ensure_cursor (nframes64_t* pos);
1034 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
1035 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
1036 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
1037 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
1038 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
1039 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1040 void redisplay_regions ();
1041 bool no_region_list_redisplay;
1042 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
1044 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
1046 void cut_copy (Editing::CutCopyOp);
1047 void cut_copy_points (Editing::CutCopyOp);
1048 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1049 void cut_copy_ranges (Editing::CutCopyOp);
1051 void mouse_paste ();
1052 void paste_internal (nframes64_t position, float times);
1054 /* EDITING OPERATIONS */
1056 void reset_point_selection ();
1057 void toggle_region_mute ();
1058 void toggle_region_lock ();
1059 void toggle_region_opaque ();
1060 void toggle_record_enable ();
1061 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1062 void raise_region ();
1063 void raise_region_to_top ();
1064 void lower_region ();
1065 void lower_region_to_bottom ();
1066 void split_region ();
1067 void split_region_at (nframes64_t);
1068 void split_regions_at (nframes64_t, RegionSelection&);
1069 void split_region_at_transients ();
1070 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1071 void crop_region_to_selection ();
1072 void crop_region_to (nframes64_t start, nframes64_t end);
1073 void set_sync_point (nframes64_t, const RegionSelection&);
1074 void set_region_sync_from_edit_point ();
1075 void remove_region_sync();
1076 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1077 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1078 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1079 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1080 void remove_region ();
1081 void remove_clicked_region ();
1082 void edit_region ();
1083 void rename_region ();
1084 void duplicate_some_regions (RegionSelection&, float times);
1085 void duplicate_selection (float times);
1086 void region_fill_selection ();
1088 void region_fill_track ();
1089 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1090 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1091 void split_multichannel_region();
1092 void reverse_region ();
1093 void normalize_region ();
1094 void denormalize_region ();
1095 void adjust_region_scale_amplitude (bool up);
1097 void do_insert_time ();
1098 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1100 void tab_to_transient (bool forward);
1102 void use_region_as_bar ();
1103 void use_range_as_bar ();
1105 void define_one_bar (nframes64_t start, nframes64_t end);
1107 void audition_region_from_region_list ();
1108 void hide_region_from_region_list ();
1109 void remove_region_from_region_list ();
1111 void align (ARDOUR::RegionPoint);
1112 void align_relative (ARDOUR::RegionPoint);
1113 void naturalize ();
1115 void reset_focus ();
1117 void split ();
1119 void cut ();
1120 void copy ();
1121 void paste (float times);
1123 int get_prefix (float&, bool&);
1125 void keyboard_paste ();
1126 void keyboard_insert_region_list_selection ();
1128 void region_from_selection ();
1129 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1131 void play_from_start ();
1132 void play_from_edit_point ();
1133 void play_from_edit_point_and_return ();
1134 void play_selected_region ();
1135 void play_edit_range ();
1136 void loop_selected_region ();
1137 void play_location (ARDOUR::Location&);
1138 void loop_location (ARDOUR::Location&);
1140 void temporal_zoom_selection ();
1141 void temporal_zoom_region (bool both_axes);
1142 void toggle_zoom_region (bool both_axes);
1143 bool zoomed_to_region;
1144 void temporal_zoom_session ();
1145 void temporal_zoom (gdouble scale);
1146 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1147 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1149 void amplitude_zoom (gdouble scale);
1150 void amplitude_zoom_step (bool in);
1152 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1153 void insert_region_list_selection (float times);
1155 void add_external_audio_action (Editing::ImportMode);
1156 void external_audio_dialog ();
1158 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1159 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1161 SoundFileOmega* sfbrowser;
1163 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1165 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1166 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1168 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1169 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1171 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1172 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>, bool, uint32_t total);
1173 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1174 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>);
1176 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1177 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1178 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1179 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1181 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1183 /* generic interthread progress window */
1185 ArdourDialog* interthread_progress_window;
1186 Gtk::Label interthread_progress_label;
1187 Gtk::VBox interthread_progress_vbox;
1188 Gtk::ProgressBar interthread_progress_bar;
1189 Gtk::Button interthread_cancel_button;
1190 Gtk::Label interthread_cancel_label;
1191 sigc::connection interthread_progress_connection;
1192 void interthread_cancel_clicked ();
1193 void build_interthread_progress_window ();
1194 ARDOUR::InterThreadInfo* current_interthread_info;
1196 #ifdef FFT_ANALYSIS
1197 AnalysisWindow* analysis_window;
1198 #endif
1200 /* import specific info */
1202 struct EditorImportStatus : public ARDOUR::Session::import_status {
1203 Editing::ImportMode mode;
1204 nframes64_t pos;
1205 int target_tracks;
1206 int target_regions;
1207 boost::shared_ptr<ARDOUR::AudioTrack> track;
1208 bool replace;
1211 EditorImportStatus import_status;
1212 gint import_progress_timeout (void *);
1213 static void *_import_thread (void *);
1214 void* import_thread ();
1215 void finish_import ();
1217 /* to support this ... */
1219 void import_audio (bool as_tracks);
1220 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1222 void move_to_start ();
1223 void move_to_end ();
1224 void goto_frame ();
1225 void center_playhead ();
1226 void center_edit_point ();
1227 void edit_cursor_backward ();
1228 void edit_cursor_forward ();
1229 void playhead_forward_to_grid ();
1230 void playhead_backward_to_grid ();
1231 void playhead_backward ();
1232 void playhead_forward ();
1233 void scroll_playhead (bool forward);
1234 void scroll_backward (float pages=0.8f);
1235 void scroll_forward (float pages=0.8f);
1236 void scroll_tracks_down ();
1237 void scroll_tracks_up ();
1238 void delete_sample_forward ();
1239 void delete_sample_backward ();
1240 void delete_screen ();
1241 void search_backwards ();
1242 void search_forwards ();
1243 void set_mark ();
1244 void clear_markers ();
1245 void clear_ranges ();
1246 void clear_locations ();
1247 void unhide_markers ();
1248 void unhide_ranges ();
1249 void jump_forward_to_mark ();
1250 void jump_backward_to_mark ();
1251 void cursor_align (bool playhead_to_edit);
1253 void remove_last_capture ();
1254 void select_all_selectables_using_time_selection ();
1255 void select_all_selectables_using_loop();
1256 void select_all_selectables_using_punch();
1257 void set_selection_from_range (ARDOUR::Location&);
1258 void set_selection_from_punch ();
1259 void set_selection_from_loop ();
1260 void set_selection_from_audio_region ();
1262 void add_location_mark (nframes64_t where);
1263 void add_location_from_audio_region ();
1264 void add_location_from_selection ();
1265 void set_loop_from_selection (bool play);
1266 void set_punch_from_selection ();
1267 void set_punch_from_region ();
1269 void set_loop_from_edit_range (bool play);
1270 void set_loop_from_region (bool play);
1271 void set_punch_from_edit_range ();
1273 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1274 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1276 void add_location_from_playhead_cursor ();
1277 bool select_new_marker;
1279 void reverse_selection ();
1280 void edit_envelope ();
1282 void start_scrolling ();
1283 void stop_scrolling ();
1285 bool _scrubbing;
1286 double last_scrub_x;
1287 int scrubbing_direction;
1288 int scrub_reversals;
1289 int scrub_reverse_distance;
1290 void scrub ();
1292 void keyboard_selection_begin ();
1293 void keyboard_selection_finish (bool add);
1294 bool have_pending_keyboard_selection;
1295 nframes64_t pending_keyboard_selection_start;
1297 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1298 void extend_selection_to_end_of_region (bool next);
1299 void extend_selection_to_start_of_region (bool previous);
1301 Editing::SnapType snap_type;
1302 Editing::SnapMode snap_mode;
1303 double snap_threshold;
1305 void handle_gui_changes (const string &, void *);
1306 bool ignore_gui_changes;
1308 void hide_all_tracks (bool with_select);
1310 DragInfo drag_info;
1311 LineDragInfo current_line_drag_info;
1313 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1314 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1315 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1316 void break_drag ();
1317 void finalize_drag ();
1319 Gtk::Menu fade_context_menu;
1320 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1322 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1324 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1325 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1326 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1327 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1328 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1329 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1331 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1332 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1334 void set_fade_length (bool in);
1335 void toggle_fade_active (bool in);
1336 void set_fade_in_active (bool);
1337 void set_fade_out_active (bool);
1339 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1340 RegionSelection pre_drag_region_selection;
1341 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1342 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1343 bool check_region_drag_possible (AudioTimeAxisView**);
1344 void possibly_copy_regions_during_grab (GdkEvent*);
1345 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1346 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1348 bool _dragging_playhead;
1349 bool _dragging_edit_point;
1351 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1352 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1353 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1354 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1355 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1356 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1357 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1358 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1359 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1361 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1362 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1363 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1364 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1366 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1368 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1369 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1370 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1371 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1372 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1373 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1374 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1375 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1376 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1377 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1378 void start_line_grab (AutomationLine *, GdkEvent*);
1379 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1380 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1381 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1382 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1384 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1386 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1387 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1389 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1390 void brush (nframes64_t);
1392 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1393 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1394 double clamp_verbose_cursor_x (double);
1395 double clamp_verbose_cursor_y (double);
1397 /* Canvas event handlers */
1399 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1400 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1401 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1402 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1403 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1404 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1405 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1406 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1407 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1408 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1411 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1412 private:
1413 ArdourCanvas::Item *last_item_entered;
1414 int last_item_entered_n;
1415 public:
1417 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1418 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1419 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1420 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1421 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1422 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1423 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1424 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1425 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1427 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1428 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1429 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1430 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1431 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1432 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1434 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1435 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1436 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1437 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1438 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1439 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1440 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1441 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1443 /* non-public event handlers */
1445 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1446 bool track_canvas_scroll (GdkEventScroll* event);
1448 bool track_canvas_scroll_event (GdkEventScroll* event);
1449 bool track_canvas_button_press_event (GdkEventButton* event);
1450 bool track_canvas_button_release_event (GdkEventButton* event);
1451 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1453 Gtk::Allocation canvas_allocation;
1454 void track_canvas_allocate (Gtk::Allocation alloc);
1455 bool track_canvas_size_allocated ();
1457 void set_playhead_cursor ();
1459 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1460 void kbd_mute_unmute_region ();
1461 void kbd_brush ();
1463 void kbd_do_brush (GdkEvent*);
1464 void kbd_do_audition (GdkEvent*);
1466 void handle_new_duration ();
1467 void initialize_canvas ();
1469 /* display control */
1471 bool _show_measures;
1472 bool _show_waveforms;
1473 bool _follow_playhead;
1474 bool _show_waveforms_recording;
1476 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1478 TempoLines* tempo_lines;
1480 ArdourCanvas::Group* time_line_group;
1481 ArdourCanvas::SimpleLine* get_time_line ();
1482 void hide_measures ();
1483 void draw_measures ();
1484 bool redraw_measures ();
1486 void new_tempo_section ();
1488 void mouse_add_new_tempo_event (nframes64_t where);
1489 void mouse_add_new_meter_event (nframes64_t where);
1491 void remove_tempo_marker (ArdourCanvas::Item*);
1492 void remove_meter_marker (ArdourCanvas::Item*);
1493 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1494 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1496 void edit_tempo_section (ARDOUR::TempoSection*);
1497 void edit_meter_section (ARDOUR::MeterSection*);
1498 void edit_tempo_marker (ArdourCanvas::Item*);
1499 void edit_meter_marker (ArdourCanvas::Item*);
1501 void marker_menu_edit ();
1502 void marker_menu_remove ();
1503 void marker_menu_rename ();
1504 void marker_menu_lock (bool yn);
1505 void marker_menu_hide ();
1506 void marker_menu_loop_range ();
1507 void marker_menu_select_all_selectables_using_range ();
1508 void marker_menu_select_using_range ();
1509 void marker_menu_separate_regions_using_location ();
1510 void marker_menu_play_from ();
1511 void marker_menu_play_range ();
1512 void marker_menu_set_playhead ();
1513 void marker_menu_set_from_playhead ();
1514 void marker_menu_set_from_selection ();
1515 void marker_menu_range_to_next ();
1516 void marker_menu_export_range ();
1517 void new_transport_marker_menu_set_loop ();
1518 void new_transport_marker_menu_set_punch ();
1519 void update_loop_range_view (bool visibility=false);
1520 void update_punch_range_view (bool visibility=false);
1521 void new_transport_marker_menu_popdown ();
1522 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1523 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1524 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1525 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1526 void build_range_marker_menu (bool loop_or_punch);
1527 void build_marker_menu (bool start_or_end);
1528 void build_tm_marker_menu ();
1529 void build_new_transport_marker_menu ();
1531 Gtk::Menu* tm_marker_menu;
1532 Gtk::Menu* marker_menu;
1533 Gtk::Menu* start_end_marker_menu;
1534 Gtk::Menu* range_marker_menu;
1535 Gtk::Menu* transport_marker_menu;
1536 Gtk::Menu* new_transport_marker_menu;
1537 Gtk::Menu* cd_marker_menu;
1538 ArdourCanvas::Item* marker_menu_item;
1540 typedef list<Marker*> Marks;
1541 Marks metric_marks;
1543 void remove_metric_marks ();
1544 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1546 void compute_current_bbt_points (nframes_t left, nframes_t right);
1547 void tempo_map_changed (ARDOUR::Change);
1548 void redisplay_tempo (bool immediate_redraw);
1550 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1552 uint32_t bbt_beat_subdivision;
1554 /* toolbar */
1556 void editor_mixer_button_toggled ();
1558 AudioClock edit_point_clock;
1559 AudioClock zoom_range_clock;
1560 Gtk::Button zoom_in_button;
1561 Gtk::Button zoom_out_button;
1562 Gtk::Button zoom_out_full_button;
1563 Gtk::Button zoom_onetoone_button;
1565 Gtk::VBox toolbar_clock_vbox;
1566 Gtk::VBox toolbar_selection_clock_vbox;
1567 Gtk::Table toolbar_selection_clock_table;
1568 Gtk::Label toolbar_selection_cursor_label;
1570 Gtk::HBox mouse_mode_button_box;
1571 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1572 Gtk::ToggleButton mouse_select_button;
1573 Gtk::ToggleButton mouse_move_button;
1574 Gtk::ToggleButton mouse_gain_button;
1575 Gtk::ToggleButton mouse_zoom_button;
1576 Gtk::ToggleButton mouse_timefx_button;
1577 Gtk::ToggleButton mouse_audition_button;
1578 GroupedButtons *mouse_mode_button_set;
1579 void mouse_mode_toggled (Editing::MouseMode m);
1580 bool ignore_mouse_mode_toggle;
1582 gint mouse_select_button_release (GdkEventButton*);
1584 Gtk::VBox automation_box;
1585 Gtk::Button automation_mode_button;
1586 Gtk::ToggleButton global_automation_button;
1588 Gtk::ComboBoxText edit_mode_selector;
1589 Gtk::VBox edit_mode_box;
1591 void set_edit_mode (ARDOUR::EditMode);
1592 void cycle_edit_mode ();
1593 void edit_mode_selection_done ();
1595 Gtk::ComboBoxText snap_type_selector;
1596 Gtk::ComboBoxText snap_mode_selector;
1597 Gtk::HBox snap_box;
1599 std::vector<std::string> snap_type_strings;
1600 std::vector<std::string> snap_mode_strings;
1602 void snap_type_selection_done ();
1603 void snap_mode_selection_done ();
1604 void snap_mode_chosen (Editing::SnapMode);
1605 void snap_type_chosen (Editing::SnapType);
1607 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1608 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1610 Gtk::ComboBoxText zoom_focus_selector;
1611 Gtk::VBox zoom_focus_box;
1613 std::vector<std::string> zoom_focus_strings;
1615 void zoom_focus_selection_done ();
1616 void zoom_focus_chosen (Editing::ZoomFocus);
1618 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1620 Gtk::HBox zoom_box;
1622 void zoom_adjustment_changed();
1624 void edit_point_clock_changed();
1626 void setup_toolbar ();
1628 Gtkmm2ext::TearOff* tools_tearoff;
1629 Gtk::HBox toolbar_hbox;
1630 Gtk::EventBox toolbar_base;
1631 Gtk::Frame toolbar_frame;
1633 /* selection process */
1635 Selection* selection;
1636 Selection* cut_buffer;
1638 void time_selection_changed ();
1639 void track_selection_changed ();
1640 void region_selection_changed ();
1641 void sensitize_the_right_region_actions (bool have_selected_regions);
1642 void point_selection_changed ();
1643 void marker_selection_changed ();
1645 enum SelectionOp {
1646 CreateSelection,
1647 SelectionStartTrim,
1648 SelectionEndTrim,
1649 SelectionMove
1650 } selection_op;
1652 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1653 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1654 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1655 void cancel_selection ();
1657 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1658 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1659 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1661 bool audio_region_selection_covers (nframes64_t where);
1663 /* transport range select process */
1664 enum RangeMarkerOp {
1665 CreateRangeMarker,
1666 CreateTransportMarker,
1667 CreateCDMarker
1668 } range_marker_op;
1670 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1671 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1672 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1674 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1675 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1676 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1677 ArdourCanvas::Line* marker_drag_line;
1678 ArdourCanvas::Points marker_drag_line_points;
1679 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1681 void update_marker_drag_item (ARDOUR::Location *);
1682 #ifdef GTKOSX
1683 ArdourCanvas::SimpleRect *bogus_background_rect;
1684 #endif
1685 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1686 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1687 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1688 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1689 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1690 ArdourCanvas::SimpleLine *transport_punchin_line;
1691 ArdourCanvas::SimpleLine *transport_punchout_line;
1692 ArdourCanvas::SimpleRect *transport_preroll_rect;
1693 ArdourCanvas::SimpleRect *transport_postroll_rect;
1695 ARDOUR::Location* transport_loop_location();
1696 ARDOUR::Location* transport_punch_location();
1698 ARDOUR::Location *temp_location;
1700 /* object rubberband select process */
1702 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1703 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1704 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1706 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1708 ArdourCanvas::SimpleRect *rubberband_rect;
1710 /* mouse zoom process */
1712 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1713 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1714 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1716 ArdourCanvas::SimpleRect *zoom_rect;
1717 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1719 /* diskstream/route display management */
1721 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1722 RouteDisplayModelColumns() {
1723 add (text);
1724 add (visible);
1725 add (temporary_visible);
1726 add (tv);
1727 add (route);
1729 Gtk::TreeModelColumn<Glib::ustring> text;
1730 Gtk::TreeModelColumn<bool> visible;
1731 Gtk::TreeModelColumn<bool> temporary_visible;
1732 Gtk::TreeModelColumn<TimeAxisView*> tv;
1733 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1736 RouteDisplayModelColumns route_display_columns;
1737 Glib::RefPtr<Gtk::ListStore> route_display_model;
1738 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1740 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1741 Gtk::ScrolledWindow route_list_scroller;
1742 Gtk::Menu* route_list_menu;
1744 void update_route_visibility ();
1746 void sync_order_keys (const char*);
1747 bool route_redisplay_does_not_sync_order_keys;
1748 bool route_redisplay_does_not_reset_order_keys;
1750 bool route_list_display_button_press (GdkEventButton*);
1751 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1752 gint x,
1753 gint y,
1754 const Gtk::SelectionData& data,
1755 guint info,
1756 guint time);
1758 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1760 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1761 void route_list_delete (const Gtk::TreeModel::Path&);
1762 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1764 void initial_route_list_display ();
1765 void redisplay_route_list();
1766 bool ignore_route_list_reorder;
1767 bool no_route_list_redisplay;
1769 void build_route_list_menu ();
1770 void show_route_list_menu ();
1772 void show_all_routes ();
1773 void hide_all_routes ();
1774 void show_all_audiotracks ();
1775 void hide_all_audiotracks ();
1776 void show_all_audiobus ();
1777 void hide_all_audiobus ();
1779 void set_all_tracks_visibility (bool yn);
1780 void set_all_audio_visibility (int type, bool yn);
1782 /* edit group management */
1784 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1785 GroupListModelColumns () {
1786 add (is_active);
1787 add (is_visible);
1788 add (text);
1789 add (routegroup);
1791 Gtk::TreeModelColumn<bool> is_active;
1792 Gtk::TreeModelColumn<bool> is_visible;
1793 Gtk::TreeModelColumn<std::string> text;
1794 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1797 GroupListModelColumns group_columns;
1798 Glib::RefPtr<Gtk::ListStore> group_model;
1799 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1801 Gtk::TreeView edit_group_display;
1802 Gtk::ScrolledWindow edit_group_display_scroller;
1803 Gtk::Menu* edit_group_list_menu;
1805 void build_edit_group_list_menu ();
1806 void activate_all_edit_groups ();
1807 void disable_all_edit_groups ();
1809 bool in_edit_group_row_change;
1810 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1811 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1812 void new_edit_group ();
1813 void edit_group_list_button_clicked ();
1814 gint edit_group_list_button_press_event (GdkEventButton* ev);
1815 void add_edit_group (ARDOUR::RouteGroup* group);
1816 void remove_selected_edit_group ();
1817 void edit_groups_changed ();
1818 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1820 Gtk::VBox list_vpacker;
1822 /* autoscrolling */
1824 bool autoscroll_active;
1825 int autoscroll_timeout_tag;
1826 int autoscroll_x;
1827 int autoscroll_y;
1828 int last_autoscroll_x;
1829 int last_autoscroll_y;
1830 uint32_t autoscroll_cnt;
1831 nframes64_t autoscroll_x_distance;
1832 double autoscroll_y_distance;
1834 static gint _autoscroll_canvas (void *);
1835 bool autoscroll_canvas ();
1836 void start_canvas_autoscroll (int x, int y);
1837 void stop_canvas_autoscroll ();
1838 void maybe_autoscroll (GdkEventMotion*);
1839 void maybe_autoscroll_horizontally (GdkEventMotion*);
1840 bool allow_vertical_scroll;
1842 /* trimming */
1843 enum TrimOp {
1844 StartTrim,
1845 EndTrim,
1846 ContentsTrim,
1847 } trim_op;
1849 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1850 void point_trim (GdkEvent*);
1851 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1852 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1853 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1854 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1856 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1857 void thaw_region_after_trim (RegionView& rv);
1859 void trim_region_front();
1860 void trim_region_back();
1861 void trim_region (bool front);
1863 void trim_region_to_edit_point ();
1864 void trim_region_from_edit_point ();
1865 void trim_region_to_loop ();
1866 void trim_region_to_punch ();
1867 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1869 bool show_gain_after_trim;
1871 /* Drag-n-Drop */
1873 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1874 const Glib::RefPtr<Gdk::DragContext>& context,
1875 gint x,
1876 gint y,
1877 const Gtk::SelectionData& data,
1878 guint info,
1879 guint time);
1881 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1882 gint x,
1883 gint y,
1884 const Gtk::SelectionData& data,
1885 guint info,
1886 guint time);
1888 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1889 gint x,
1890 gint y,
1891 const Gtk::SelectionData& data,
1892 guint info,
1893 guint time);
1895 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1896 gint x,
1897 gint y,
1898 const Gtk::SelectionData& data,
1899 guint info,
1900 guint time);
1902 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1903 gint x,
1904 gint y,
1905 const Gtk::SelectionData& data,
1906 guint info,
1907 guint time);
1909 /* audio export */
1911 ExportDialog *export_dialog;
1912 ExportDialog *export_range_markers_dialog;
1914 void export_range (nframes64_t start, nframes64_t end);
1915 void export_range_markers ();
1917 int write_region_selection(RegionSelection&);
1918 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1919 void export_region ();
1920 void bounce_region_selection ();
1921 void bounce_range_selection (bool replace);
1922 void external_edit_region ();
1924 int write_audio_selection (TimeSelection&);
1925 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1927 void write_selection ();
1929 /* history */
1931 UndoAction get_memento() const;
1933 XMLNode *before; /* used in *_reversible_command */
1934 void begin_reversible_command (string cmd_name);
1935 void commit_reversible_command ();
1937 void update_title ();
1938 void update_title_s (const string & snapshot_name);
1940 struct State {
1941 Selection* selection;
1942 double frames_per_unit;
1944 State();
1945 ~State();
1948 void store_state (State&) const;
1949 void restore_state (State *);
1951 void instant_save ();
1953 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1955 /* freeze operations */
1957 ARDOUR::InterThreadInfo freeze_status;
1958 gint freeze_progress_timeout (void *);
1959 static void* _freeze_thread (void*);
1960 void* freeze_thread ();
1962 void freeze_route ();
1963 void unfreeze_route ();
1965 /* edit-group solo + mute */
1967 void set_edit_group_solo (ARDOUR::Route&, bool);
1968 void set_edit_group_mute (ARDOUR::Route&, bool);
1970 /* duplication */
1972 void duplicate_dialog (bool with_dialog);
1974 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1976 /* returns false if mouse pointer is not in track or marker canvas
1978 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1980 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1981 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1982 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1984 struct TimeFXDialog : public ArdourDialog {
1985 ARDOUR::TimeFXRequest request;
1986 Editor& editor;
1987 bool pitching;
1988 Gtk::Adjustment pitch_octave_adjustment;
1989 Gtk::Adjustment pitch_semitone_adjustment;
1990 Gtk::Adjustment pitch_cent_adjustment;
1991 Gtk::SpinButton pitch_octave_spinner;
1992 Gtk::SpinButton pitch_semitone_spinner;
1993 Gtk::SpinButton pitch_cent_spinner;
1994 RegionSelection regions;
1995 Gtk::ProgressBar progress_bar;
1997 /* SoundTouch */
1998 Gtk::ToggleButton quick_button;
1999 Gtk::ToggleButton antialias_button;
2000 Gtk::HBox upper_button_box;
2002 /* RubberBand */
2003 Gtk::ComboBoxText stretch_opts_selector;
2004 Gtk::Label stretch_opts_label;
2005 Gtk::ToggleButton precise_button;
2006 Gtk::HBox opts_box;
2008 Gtk::Button* cancel_button;
2009 Gtk::Button* action_button;
2010 Gtk::VBox packer;
2011 int status;
2013 TimeFXDialog (Editor& e, bool for_pitch);
2015 gint update_progress ();
2016 sigc::connection first_cancel;
2017 sigc::connection first_delete;
2018 void cancel_in_progress ();
2019 gint delete_in_progress (GdkEventAny*);
2022 /* "whats mine is yours" */
2024 friend class TimeFXDialog;
2026 TimeFXDialog* current_timefx;
2028 static void* timefx_thread (void *arg);
2029 void do_timefx (TimeFXDialog&);
2031 int time_stretch (RegionSelection&, float fraction);
2032 int pitch_shift (RegionSelection&, float cents);
2033 void pitch_shift_regions ();
2034 int time_fx (RegionSelection&, float val, bool pitching);
2036 /* editor-mixer strip */
2038 MixerStrip *current_mixer_strip;
2039 bool show_editor_mixer_when_tracks_arrive;
2040 Gtk::VBox current_mixer_strip_vbox;
2041 void cms_deleted ();
2042 void current_mixer_strip_hidden ();
2043 void current_mixer_strip_removed ();
2045 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2046 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2047 #ifdef GTKOSX
2048 void ensure_all_elements_drawn ();
2049 #endif
2050 /* nudging tracks */
2052 void nudge_track (bool use_edit_point, bool forwards);
2054 /* xfades */
2056 bool _xfade_visibility;
2058 /* <CMT Additions> */
2059 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2060 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2062 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2063 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2065 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2066 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2067 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2069 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2070 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2071 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2072 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2074 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2075 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2076 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2077 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2079 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2080 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2081 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2082 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2083 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2084 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2086 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2087 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2088 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2089 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2090 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2091 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2093 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2094 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2096 ImageFrameSocketHandler* image_socket_listener ;
2097 /* </CMT Additions> */
2099 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2100 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2101 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2102 void xfade_edit_left_region ();
2103 void xfade_edit_right_region ();
2105 static const int32_t default_width = 995;
2106 static const int32_t default_height = 765;
2108 /* nudge */
2110 Gtk::Button nudge_forward_button;
2111 Gtk::Button nudge_backward_button;
2112 Gtk::HBox nudge_hbox;
2113 Gtk::VBox nudge_vbox;
2114 AudioClock nudge_clock;
2116 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2118 bool nudge_forward_release (GdkEventButton*);
2119 bool nudge_backward_release (GdkEventButton*);
2121 /* audio filters */
2123 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2125 /* handling cleanup */
2127 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2129 vector<sigc::connection> session_connections;
2131 /* tracking step changes of track height */
2133 TimeAxisView* current_stepping_trackview;
2134 ARDOUR::microseconds_t last_track_height_step_timestamp;
2135 gint track_height_step_timeout();
2136 sigc::connection step_timeout;
2138 TimeAxisView* entered_track;
2139 RegionView* entered_regionview;
2142 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2143 bool clear_entered_track;
2144 bool left_track_canvas (GdkEventCrossing*);
2145 bool entered_track_canvas (GdkEventCrossing*);
2146 void set_entered_track (TimeAxisView*);
2147 void set_entered_regionview (RegionView*);
2148 void ensure_track_visible (TimeAxisView*);
2149 gint left_automation_track ();
2151 bool _new_regionviews_show_envelope;
2153 void reset_canvas_action_sensitivity (bool);
2154 void toggle_gain_envelope_visibility ();
2155 void toggle_gain_envelope_active ();
2156 void reset_region_gain_envelopes ();
2158 bool on_key_press_event (GdkEventKey*);
2159 bool on_key_release_event (GdkEventKey*);
2161 void session_state_saved (string);
2163 Glib::RefPtr<Gtk::Action> undo_action;
2164 Glib::RefPtr<Gtk::Action> redo_action;
2166 void history_changed ();
2167 void color_handler ();
2169 Gtk::HBox status_bar_hpacker;
2171 Editing::EditPoint _edit_point;
2173 Gtk::ComboBoxText edit_point_selector;
2175 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2176 void cycle_edit_point (bool with_marker);
2177 void set_edit_point ();
2178 void edit_point_selection_done ();
2179 void edit_point_chosen (Editing::EditPoint);
2180 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2181 std::vector<std::string> edit_point_strings;
2183 void selected_marker_moved (ARDOUR::Location*);
2184 sigc::connection edit_point_clock_connection_a;
2185 sigc::connection edit_point_clock_connection_b;
2187 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2189 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2190 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2192 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2194 sigc::connection fast_screen_update_connection;
2195 gint start_updating ();
2196 gint stop_updating ();
2197 void fast_update_strips ();
2198 bool meters_running;
2200 void select_next_route ();
2201 void select_prev_route ();
2203 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2205 RhythmFerret* rhythm_ferret;
2207 void fit_tracks ();
2208 void set_track_height (uint32_t h);
2209 void set_track_height_largest ();
2210 void set_track_height_large ();
2211 void set_track_height_larger ();
2212 void set_track_height_normal ();
2213 void set_track_height_smaller ();
2214 void set_track_height_small ();
2216 void remove_tracks ();
2217 void toggle_tracks_active ();
2218 void waveform_scale_chosen (Editing::WaveformScale);
2220 bool _have_idled;
2221 int resize_idle_id;
2222 int32_t resize_idle_target;
2223 bool idle_resize();
2224 friend gboolean _idle_resize (gpointer);
2225 std::vector<TimeAxisView*> pending_resizes;
2228 #endif /* __ardour_editor_h__ */