revert VST debugging hacks
[ardour2.git] / gtk2_ardour / editor.h
blob1ce860c689383f3c771ca1967f9df75af8794996
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);
289 void get_onscreen_tracks (TrackViewList&);
291 Width editor_mixer_strip_width;
292 void maybe_add_mixer_strip_width (XMLNode&);
293 void show_editor_mixer (bool yn);
294 void create_editor_mixer ();
295 void set_selected_mixer_strip (TimeAxisView&);
296 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
297 void show_track_in_display (TimeAxisView& tv);
299 /* nudge is initiated by transport controls owned by ARDOUR_UI */
301 void nudge_forward (bool next, bool force_playhead);
302 void nudge_backward (bool next, bool force_playhead);
304 /* nudge initiated from context menu */
306 void nudge_forward_capture_offset ();
307 void nudge_backward_capture_offset ();
309 /* playhead/screen stuff */
311 void set_follow_playhead (bool yn);
312 void toggle_follow_playhead ();
313 bool follow_playhead() const { return _follow_playhead; }
314 bool dragging_playhead () const { return _dragging_playhead; }
316 void toggle_waveform_visibility ();
317 void toggle_waveforms_while_recording ();
318 void toggle_measure_visibility ();
319 void toggle_logo_visibility ();
321 double get_physical_screen_width () const { return physical_screen_width; };
322 double physical_screen_width;
323 double physical_screen_height;
325 /* SMPTE timecode & video sync */
327 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
328 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
329 void subframes_per_frame_chosen (uint32_t);
331 void update_smpte_mode();
332 void update_video_pullup();
333 void update_subframes_per_frame ();
335 /* fades & xfades */
337 void toggle_region_fades ();
338 void toggle_region_fades_visible ();
339 void toggle_selected_region_fades (int dir);
340 void update_region_fade_visibility ();
342 void toggle_auto_xfade ();
343 void toggle_xfades_active ();
344 void toggle_xfade_visibility ();
345 bool xfade_visibility() const { return _xfade_visibility; }
346 void update_xfade_visibility ();
347 void update_crossfade_model ();
348 void set_crossfade_model (ARDOUR::CrossfadeModel);
350 /* layers */
351 void set_layer_model (ARDOUR::LayerModel);
352 void update_layering_model ();
354 void toggle_link_region_and_track_selection ();
356 /* redirect shared ops menu. caller must free returned menu */
358 Gtk::Menu* redirect_menu ();
360 /* floating windows/transient */
362 void ensure_float (Gtk::Window&);
364 void show_window ();
366 void scroll_tracks_down_line ();
367 void scroll_tracks_up_line ();
369 void move_selected_tracks (bool up);
371 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
372 void prepare_for_cleanup ();
373 void finish_cleanup ();
375 void maximise_editing_space();
376 void restore_editing_space();
378 void reset_x_origin (nframes64_t);
379 void reset_zoom (double);
380 void reposition_and_zoom (nframes64_t, double);
382 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
384 bool update_mouse_speed ();
385 bool decelerate_mouse_speed ();
387 void toggle_meter_updating();
389 void show_rhythm_ferret();
391 void goto_visual_state (uint32_t);
392 void save_visual_state (uint32_t);
394 void queue_draw_resize_line (int at);
395 void start_resize_line_ops ();
396 void end_resize_line_ops ();
398 protected:
399 void map_transport_state ();
400 void map_position_change (nframes64_t);
402 void on_realize();
403 bool on_expose_event (GdkEventExpose*);
405 private:
407 ARDOUR::Session *session;
408 bool constructed;
410 // to keep track of the playhead position for control_scroll
411 boost::optional<nframes64_t> _control_scroll_target;
413 PlaylistSelector* _playlist_selector;
415 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
417 struct VisualState {
418 double y_position;
419 double frames_per_unit;
420 nframes64_t leftmost_frame;
421 Editing::ZoomFocus zoom_focus;
422 bool zoomed_to_region;
423 std::list<TAVState> track_states;
426 std::list<VisualState*> undo_visual_stack;
427 std::list<VisualState*> redo_visual_stack;
428 VisualState* current_visual_state (bool with_tracks = true);
429 void undo_visual_state ();
430 void redo_visual_state ();
431 void use_visual_state (VisualState&);
432 bool no_save_visual;
433 void swap_visual_state ();
435 std::vector<VisualState*> visual_states;
436 sigc::connection visual_state_op_connection;
437 void start_visual_state_op (uint32_t n);
438 void cancel_visual_state_op (uint32_t n);
439 bool end_visual_state_op (uint32_t n);
441 nframes64_t leftmost_frame;
442 double frames_per_unit;
443 Editing::ZoomFocus zoom_focus;
445 void set_frames_per_unit (double);
446 void post_zoom ();
448 Editing::MouseMode mouse_mode;
450 int post_maximal_editor_width;
451 int post_maximal_pane_position;
452 int pre_maximal_pane_position;
453 int pre_maximal_editor_width;
454 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
456 Gtk::Notebook the_notebook;
457 Gtk::HPaned edit_pane;
459 Gtk::EventBox meter_base;
460 Gtk::HBox meter_box;
461 Gtk::EventBox marker_base;
462 Gtk::HBox marker_box;
463 Gtk::VBox scrollers_rulers_markers_box;
465 void location_changed (ARDOUR::Location *);
466 void location_flags_changed (ARDOUR::Location *, void *);
467 void refresh_location_display ();
468 void refresh_location_display_s (ARDOUR::Change);
469 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
470 void add_new_location (ARDOUR::Location *);
471 void location_gone (ARDOUR::Location *);
472 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
473 gint really_remove_marker (ARDOUR::Location* loc);
474 void goto_nth_marker (int nth);
476 uint32_t location_marker_color;
477 uint32_t location_range_color;
478 uint32_t location_loop_color;
479 uint32_t location_punch_color;
480 uint32_t location_cd_marker_color;
482 struct LocationMarkers {
483 Marker* start;
484 Marker* end;
485 bool valid;
487 LocationMarkers () : start(0), end(0), valid (true) {}
489 ~LocationMarkers ();
491 void hide();
492 void show ();
493 void set_name (const string&);
494 void set_position (nframes64_t start, nframes64_t end = 0);
495 void set_color_rgba (uint32_t);
498 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
499 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
500 Marker* entered_marker;
502 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
503 LocationMarkerMap location_markers;
505 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
506 void clear_marker_display ();
507 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
508 bool choose_new_marker_name(string &name);
509 void update_cd_marker_display ();
510 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
512 TimeAxisView* clicked_trackview;
513 AudioTimeAxisView* clicked_audio_trackview;
514 RegionView* clicked_regionview;
515 RegionSelection latest_regionviews;
516 uint32_t clicked_selection;
517 CrossfadeView* clicked_crossfadeview;
518 ControlPoint* clicked_control_point;
520 void sort_track_selection (TrackSelection* sel = 0);
522 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
523 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
524 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
526 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
528 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
529 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
530 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
531 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
533 /* end */
535 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
536 bool button_release_can_deselect;
538 void catch_vanishing_regionview (RegionView *);
540 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
541 void select_all_tracks ();
543 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
544 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
545 void set_selected_track_as_side_effect (bool force = false);
546 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
548 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
549 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
550 void collect_new_region_view (RegionView *);
552 Gtk::Menu track_context_menu;
553 Gtk::Menu track_region_context_menu;
554 Gtk::Menu track_selection_context_menu;
555 Gtk::Menu track_crossfade_context_menu;
557 Gtk::MenuItem* region_edit_menu_split_item;
558 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
559 Gtk::Menu * track_region_edit_playlist_menu;
560 Gtk::Menu * track_edit_playlist_submenu;
561 Gtk::Menu * track_selection_edit_playlist_submenu;
563 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
564 Gtk::Menu* build_track_context_menu (nframes64_t);
565 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
566 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
567 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
568 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
569 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
570 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
571 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
572 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
573 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
575 void handle_new_route (ARDOUR::Session::RouteList&);
576 void remove_route (TimeAxisView *);
577 bool route_removal;
579 Gtk::HBox global_hpacker;
580 Gtk::VBox global_vpacker;
581 Gtk::VBox vpacker;
583 bool need_resize_line;
584 int resize_line_y;
585 int old_resize_line_y;
587 Gdk::Cursor* current_canvas_cursor;
588 void set_canvas_cursor ();
589 Gdk::Cursor* which_grabber_cursor ();
591 ArdourCanvas::Canvas* track_canvas;
593 ArdourCanvas::Text* first_action_message;
594 ArdourCanvas::Text* verbose_canvas_cursor;
595 bool verbose_cursor_visible;
597 void parameter_changed (const char *);
599 bool track_canvas_motion (GdkEvent*);
601 void set_verbose_canvas_cursor (const string &, double x, double y);
602 void set_verbose_canvas_cursor_text (const string &);
603 void show_verbose_canvas_cursor();
604 void hide_verbose_canvas_cursor();
606 bool verbose_cursor_on; // so far unused
608 Gtk::EventBox time_canvas_event_box;
609 Gtk::EventBox track_canvas_event_box;
610 Gtk::EventBox time_button_event_box;
611 Gtk::EventBox ruler_label_event_box;
613 ArdourCanvas::Pixbuf* logo_item;
614 ArdourCanvas::Group* minsec_group;
615 ArdourCanvas::Group* bbt_group;
616 ArdourCanvas::Group* smpte_group;
617 ArdourCanvas::Group* frame_group;
618 ArdourCanvas::Group* tempo_group;
619 ArdourCanvas::Group* meter_group;
620 ArdourCanvas::Group* marker_group;
621 ArdourCanvas::Group* range_marker_group;
622 ArdourCanvas::Group* transport_marker_group;
623 ArdourCanvas::Group* cd_marker_group;
625 ArdourCanvas::Group* timebar_group;
627 /* These bars never need to be scrolled */
628 ArdourCanvas::Group* meter_bar_group;
629 ArdourCanvas::Group* tempo_bar_group;
630 ArdourCanvas::Group* marker_bar_group;
631 ArdourCanvas::Group* range_marker_bar_group;
632 ArdourCanvas::Group* transport_marker_bar_group;
633 ArdourCanvas::Group* cd_marker_bar_group;
635 ArdourCanvas::Group* _background_group;
637 The _master_group is the group containing all items
638 that require horizontal scrolling..
639 It is primarily used to separate canvas items
640 that require horizontal scrolling from those that do not.
642 ArdourCanvas::Group* _master_group;
644 The _trackview_group is the group containing all trackviews.
645 It is only scrolled vertically.
647 ArdourCanvas::Group* _trackview_group;
649 This canvas group is used for region motion.
650 It sits on top of the _trackview_group
652 ArdourCanvas::Group* _region_motion_group;
654 enum RulerType {
655 ruler_metric_smpte = 0,
656 ruler_metric_bbt = 1,
657 ruler_metric_frames = 2,
658 ruler_metric_minsec = 3,
660 ruler_time_tempo = 4,
661 ruler_time_meter = 5,
662 ruler_time_marker = 6,
663 ruler_time_range_marker = 7,
664 ruler_time_transport_marker = 8,
665 ruler_time_cd_marker = 9,
668 static GtkCustomMetric ruler_metrics[4];
669 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
670 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
671 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
672 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
673 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
674 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
675 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
676 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
677 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
678 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
679 bool no_ruler_shown_update;
681 gint ruler_button_press (GdkEventButton*);
682 gint ruler_button_release (GdkEventButton*);
683 gint ruler_mouse_motion (GdkEventMotion*);
684 bool ruler_scroll (GdkEventScroll* event);
686 gint ruler_pressed_button;
687 Gtk::Widget * ruler_grabbed_widget;
689 void initialize_rulers ();
690 void update_just_smpte ();
691 void update_fixed_rulers ();
692 void update_tempo_based_rulers ();
693 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
694 void update_ruler_visibility ();
695 void set_ruler_visible (RulerType, bool);
696 void toggle_ruler_visibility (RulerType rt);
697 void ruler_toggled (int);
698 gint ruler_label_button_release (GdkEventButton*);
699 void store_ruler_visibility ();
700 void restore_ruler_visibility ();
702 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
703 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
704 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
705 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
707 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
708 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
709 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
710 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
712 Gtk::Widget *_ruler_separator;
713 GtkWidget *_smpte_ruler;
714 GtkWidget *_bbt_ruler;
715 GtkWidget *_frames_ruler;
716 GtkWidget *_minsec_ruler;
717 Gtk::Widget *smpte_ruler;
718 Gtk::Widget *bbt_ruler;
719 Gtk::Widget *frames_ruler;
720 Gtk::Widget *minsec_ruler;
721 static Editor *ruler_editor;
723 static const double timebar_height;
724 guint32 visible_timebars;
725 gdouble canvas_timebars_vsize;
726 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
727 Gtk::Menu *editor_ruler_menu;
729 ArdourCanvas::SimpleRect* tempo_bar;
730 ArdourCanvas::SimpleRect* meter_bar;
731 ArdourCanvas::SimpleRect* marker_bar;
732 ArdourCanvas::SimpleRect* range_marker_bar;
733 ArdourCanvas::SimpleRect* transport_marker_bar;
734 ArdourCanvas::SimpleRect* cd_marker_bar;
737 ArdourCanvas::SimpleLine* tempo_line;
738 ArdourCanvas::SimpleLine* meter_line;
739 ArdourCanvas::SimpleLine* marker_line;
740 ArdourCanvas::SimpleLine* range_marker_line;
741 ArdourCanvas::SimpleLine* transport_marker_line;
742 ArdourCanvas::SimpleLine* cd_marker_line;
744 Gtk::Label minsec_label;
745 Gtk::Label bbt_label;
746 Gtk::Label smpte_label;
747 Gtk::Label frame_label;
748 Gtk::Label tempo_label;
749 Gtk::Label meter_label;
750 Gtk::Label mark_label;
751 Gtk::Label range_mark_label;
752 Gtk::Label transport_mark_label;
753 Gtk::Label cd_mark_label;
756 Gtk::VBox time_button_vbox;
757 Gtk::HBox time_button_hbox;
759 struct Cursor {
760 Editor& editor;
761 ArdourCanvas::Points points;
762 ArdourCanvas::Line canvas_item;
763 nframes64_t current_frame;
764 double length;
766 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
767 ~Cursor ();
769 void set_position (nframes64_t);
770 void set_length (double units);
771 void set_y_axis (double position);
774 friend struct Cursor; /* it needs access to several private
775 fields. XXX fix me.
778 Cursor* playhead_cursor;
779 ArdourCanvas::Group* cursor_group;
781 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
783 void cursor_to_region_boundary (bool with_selection, int32_t dir);
784 void cursor_to_next_region_boundary (bool with_selection);
785 void cursor_to_previous_region_boundary (bool with_selection);
786 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
787 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
788 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
789 void cursor_to_selection_start (Cursor *);
790 void cursor_to_selection_end (Cursor *);
792 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
793 void selected_marker_to_next_region_boundary (bool with_selection);
794 void selected_marker_to_previous_region_boundary (bool with_selection);
795 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
796 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
797 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
798 void selected_marker_to_selection_start ();
799 void selected_marker_to_selection_end ();
801 void select_all_selectables_using_cursor (Cursor *, bool);
802 void select_all_selectables_using_edit (bool);
803 void select_all_selectables_between (bool within);
804 void select_range_between ();
806 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
807 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
809 vector<nframes64_t> region_boundary_cache;
810 void build_region_boundary_cache ();
812 Gtk::HBox top_hbox;
813 Gtk::HBox bottom_hbox;
815 Gtk::Table edit_packer;
816 Gtk::VScrollbar edit_vscrollbar;
818 Gtk::Adjustment vertical_adjustment;
819 Gtk::Adjustment horizontal_adjustment;
821 Gtk::Layout controls_layout;
822 bool control_layout_scroll (GdkEventScroll* ev);
823 void controls_layout_size_request (Gtk::Requisition*);
824 sigc::connection controls_layout_size_request_connection;
826 Gtk::HScrollbar edit_hscrollbar;
827 bool _dragging_hscrollbar;
829 void reset_hscrollbar_stepping ();
831 bool hscrollbar_button_press (GdkEventButton*);
832 bool hscrollbar_button_release (GdkEventButton*);
833 void hscrollbar_allocate (Gtk::Allocation &alloc);
835 double canvas_width;
836 double canvas_height;
837 double full_canvas_height;
839 bool track_canvas_map_handler (GdkEventAny*);
841 gint edit_controls_button_release (GdkEventButton*);
842 Gtk::Menu *edit_controls_left_menu;
843 Gtk::Menu *edit_controls_right_menu;
845 Gtk::VBox ruler_label_vbox;
846 Gtk::VBox track_canvas_vbox;
847 Gtk::VBox time_canvas_vbox;
848 Gtk::VBox edit_controls_vbox;
849 Gtk::HBox edit_controls_hbox;
851 void control_scroll (float);
852 void access_action (std::string,std::string);
853 bool deferred_control_scroll (nframes64_t);
854 sigc::connection control_scroll_connection;
856 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
858 ArdourCanvas::Group* get_background_group () const { return _background_group; }
859 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
860 double last_trackview_group_vertical_offset;
861 void tie_vertical_scrolling ();
862 void scroll_canvas_horizontally ();
863 void scroll_canvas_vertically ();
864 void canvas_horizontally_scrolled ();
865 void canvas_scroll_to (nframes64_t);
867 struct VisualChange {
868 enum Type {
869 TimeOrigin = 0x1,
870 ZoomLevel = 0x2
873 Type pending;
874 nframes64_t time_origin;
875 double frames_per_unit;
877 int idle_handler_id;
879 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
883 VisualChange pending_visual_change;
885 static int _idle_visual_changer (void *arg);
886 int idle_visual_changer ();
888 void queue_visual_change (nframes64_t);
889 void queue_visual_change (double);
891 void end_location_changed (ARDOUR::Location*);
893 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
894 RegionListDisplayModelColumns() {
895 add (name);
896 add (region);
897 add (color_);
899 Gtk::TreeModelColumn<Glib::ustring> name;
900 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
901 Gtk::TreeModelColumn<Gdk::Color> color_;
904 RegionListDisplayModelColumns region_list_columns;
905 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
907 Glib::RefPtr<Gtk::TreeStore> region_list_model;
908 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
909 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
911 void region_list_selection_changed ();
912 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
913 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
914 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
916 Gtk::Menu *region_list_menu;
917 Gtk::ScrolledWindow region_list_scroller;
918 Gtk::Frame region_list_frame;
920 bool region_list_display_key_press (GdkEventKey *);
921 bool region_list_display_key_release (GdkEventKey *);
922 bool region_list_display_button_press (GdkEventButton *);
923 bool region_list_display_button_release (GdkEventButton *);
924 void region_list_clear ();
925 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
926 void build_region_list_menu ();
927 void show_region_list_display_context_menu (int button, int time);
929 bool show_automatic_regions_in_region_list;
930 Editing::RegionListSortType region_list_sort_type;
932 void reset_region_list_sort_direction (bool);
933 void reset_region_list_sort_type (Editing::RegionListSortType);
935 void toggle_full_region_list ();
936 void toggle_show_auto_regions ();
938 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
940 /* snapshots */
942 Gtk::ScrolledWindow snapshot_display_scroller;
943 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
944 SnapshotDisplayModelColumns() {
945 add (visible_name);
946 add (real_name);
948 Gtk::TreeModelColumn<Glib::ustring> visible_name;
949 Gtk::TreeModelColumn<Glib::ustring> real_name;
952 SnapshotDisplayModelColumns snapshot_display_columns;
953 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
954 Gtk::TreeView snapshot_display;
955 Gtk::Menu snapshot_context_menu;
957 bool snapshot_display_button_press (GdkEventButton*);
958 void snapshot_display_selection_changed ();
959 void redisplay_snapshots();
960 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
962 /* named selections */
964 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
965 NamedSelectionDisplayModelColumns() {
966 add (text);
967 add (selection);
969 Gtk::TreeModelColumn<Glib::ustring> text;
970 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
973 NamedSelectionDisplayModelColumns named_selection_columns;
974 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
976 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
977 Gtk::ScrolledWindow named_selection_scroller;
979 void create_named_selection ();
980 void paste_named_selection (float times);
981 void remove_selected_named_selections ();
982 void remove_snapshot (Glib::ustring);
983 void rename_snapshot (Glib::ustring);
985 void handle_new_named_selection ();
986 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
987 void redisplay_named_selections ();
989 bool named_selection_display_button_release (GdkEventButton *ev);
990 bool named_selection_display_key_release (GdkEventKey *ev);
991 void named_selection_display_selection_changed ();
993 /* track views */
994 TrackViewList track_views;
995 TimeAxisView *trackview_by_y_position (double ypos);
997 static Gdk::Cursor* cross_hair_cursor;
998 static Gdk::Cursor* trimmer_cursor;
999 static Gdk::Cursor* selector_cursor;
1000 static Gdk::Cursor* grabber_cursor;
1001 static Gdk::Cursor* grabber_edit_point_cursor;
1002 static Gdk::Cursor* zoom_cursor;
1003 static Gdk::Cursor* time_fx_cursor;
1004 static Gdk::Cursor* fader_cursor;
1005 static Gdk::Cursor* speaker_cursor;
1006 static Gdk::Cursor* wait_cursor;
1007 static Gdk::Cursor* timebar_cursor;
1008 static Gdk::Cursor* transparent_cursor;
1010 static void build_cursors ();
1012 sigc::connection scroll_connection;
1013 nframes64_t last_update_frame;
1014 void center_screen (nframes64_t);
1015 void center_screen_internal (nframes64_t, float);
1017 void update_current_screen ();
1019 void session_going_away ();
1021 nframes64_t cut_buffer_start;
1022 nframes64_t cut_buffer_length;
1024 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1025 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1026 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1027 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1028 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1029 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1031 /* KEYMAP HANDLING */
1033 void register_actions ();
1035 int ensure_cursor (nframes64_t* pos);
1037 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
1038 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
1039 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
1040 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
1041 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
1042 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1043 void redisplay_regions ();
1044 bool no_region_list_redisplay;
1045 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
1047 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
1049 void cut_copy (Editing::CutCopyOp);
1050 void cut_copy_points (Editing::CutCopyOp);
1051 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1052 void cut_copy_ranges (Editing::CutCopyOp);
1054 void mouse_paste ();
1055 void paste_internal (nframes64_t position, float times);
1057 /* EDITING OPERATIONS */
1059 void reset_point_selection ();
1060 void toggle_region_mute ();
1061 void toggle_region_lock ();
1062 void toggle_region_opaque ();
1063 void toggle_record_enable ();
1064 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1065 void raise_region ();
1066 void raise_region_to_top ();
1067 void lower_region ();
1068 void lower_region_to_bottom ();
1069 void split_region ();
1070 void split_region_at (nframes64_t);
1071 void split_regions_at (nframes64_t, RegionSelection&);
1072 void split_region_at_transients ();
1073 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1074 void crop_region_to_selection ();
1075 void crop_region_to (nframes64_t start, nframes64_t end);
1076 void set_sync_point (nframes64_t, const RegionSelection&);
1077 void set_region_sync_from_edit_point ();
1078 void remove_region_sync();
1079 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1080 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1081 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1082 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1083 void remove_region ();
1084 void remove_clicked_region ();
1085 void edit_region ();
1086 void rename_region ();
1087 void duplicate_some_regions (RegionSelection&, float times);
1088 void duplicate_selection (float times);
1089 void region_fill_selection ();
1091 void region_fill_track ();
1092 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1093 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1094 void split_multichannel_region();
1095 void reverse_region ();
1096 void normalize_region ();
1097 void denormalize_region ();
1098 void adjust_region_scale_amplitude (bool up);
1100 void do_insert_time ();
1101 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too);
1103 void tab_to_transient (bool forward);
1105 void use_region_as_bar ();
1106 void use_range_as_bar ();
1108 void define_one_bar (nframes64_t start, nframes64_t end);
1110 void audition_region_from_region_list ();
1111 void hide_region_from_region_list ();
1112 void remove_region_from_region_list ();
1114 void align (ARDOUR::RegionPoint);
1115 void align_relative (ARDOUR::RegionPoint);
1116 void naturalize ();
1118 void reset_focus ();
1120 void split ();
1122 void cut ();
1123 void copy ();
1124 void paste (float times);
1126 int get_prefix (float&, bool&);
1128 void keyboard_paste ();
1129 void keyboard_insert_region_list_selection ();
1131 void region_from_selection ();
1132 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1134 void play_from_start ();
1135 void play_from_edit_point ();
1136 void play_from_edit_point_and_return ();
1137 void play_selected_region ();
1138 void play_edit_range ();
1139 void loop_selected_region ();
1140 void play_location (ARDOUR::Location&);
1141 void loop_location (ARDOUR::Location&);
1143 void temporal_zoom_selection ();
1144 void temporal_zoom_region (bool both_axes);
1145 void toggle_zoom_region (bool both_axes);
1146 bool zoomed_to_region;
1147 void temporal_zoom_session ();
1148 void temporal_zoom (gdouble scale);
1149 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1150 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1152 void amplitude_zoom (gdouble scale);
1153 void amplitude_zoom_step (bool in);
1155 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1156 void insert_region_list_selection (float times);
1158 void add_external_audio_action (Editing::ImportMode);
1159 void external_audio_dialog ();
1161 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1162 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1164 SoundFileOmega* sfbrowser;
1166 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1168 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1169 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1171 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1172 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1174 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1175 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>, bool, uint32_t total);
1176 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1177 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>);
1179 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1180 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1181 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1182 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1184 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1186 /* generic interthread progress window */
1188 ArdourDialog* interthread_progress_window;
1189 Gtk::Label interthread_progress_label;
1190 Gtk::VBox interthread_progress_vbox;
1191 Gtk::ProgressBar interthread_progress_bar;
1192 Gtk::Button interthread_cancel_button;
1193 Gtk::Label interthread_cancel_label;
1194 sigc::connection interthread_progress_connection;
1195 void interthread_cancel_clicked ();
1196 void build_interthread_progress_window ();
1197 ARDOUR::InterThreadInfo* current_interthread_info;
1199 #ifdef FFT_ANALYSIS
1200 AnalysisWindow* analysis_window;
1201 #endif
1203 /* import specific info */
1205 struct EditorImportStatus : public ARDOUR::Session::import_status {
1206 Editing::ImportMode mode;
1207 nframes64_t pos;
1208 int target_tracks;
1209 int target_regions;
1210 boost::shared_ptr<ARDOUR::AudioTrack> track;
1211 bool replace;
1214 EditorImportStatus import_status;
1215 gint import_progress_timeout (void *);
1216 static void *_import_thread (void *);
1217 void* import_thread ();
1218 void finish_import ();
1220 /* to support this ... */
1222 void import_audio (bool as_tracks);
1223 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1225 void move_to_start ();
1226 void move_to_end ();
1227 void goto_frame ();
1228 void center_playhead ();
1229 void center_edit_point ();
1230 void edit_cursor_backward ();
1231 void edit_cursor_forward ();
1232 void playhead_forward_to_grid ();
1233 void playhead_backward_to_grid ();
1234 void playhead_backward ();
1235 void playhead_forward ();
1236 void scroll_playhead (bool forward);
1237 void scroll_backward (float pages=0.8f);
1238 void scroll_forward (float pages=0.8f);
1239 void scroll_tracks_down ();
1240 void scroll_tracks_up ();
1241 void delete_sample_forward ();
1242 void delete_sample_backward ();
1243 void delete_screen ();
1244 void search_backwards ();
1245 void search_forwards ();
1246 void set_mark ();
1247 void clear_markers ();
1248 void clear_ranges ();
1249 void clear_locations ();
1250 void unhide_markers ();
1251 void unhide_ranges ();
1252 void jump_forward_to_mark ();
1253 void jump_backward_to_mark ();
1254 void cursor_align (bool playhead_to_edit);
1256 void remove_last_capture ();
1257 void select_all_selectables_using_time_selection ();
1258 void select_all_selectables_using_loop();
1259 void select_all_selectables_using_punch();
1260 void set_selection_from_range (ARDOUR::Location&);
1261 void set_selection_from_punch ();
1262 void set_selection_from_loop ();
1263 void set_selection_from_audio_region ();
1265 void add_location_mark (nframes64_t where);
1266 void add_location_from_audio_region ();
1267 void add_locations_from_audio_region ();
1268 void add_location_from_selection ();
1269 void set_loop_from_selection (bool play);
1270 void set_punch_from_selection ();
1271 void set_punch_from_region ();
1273 void set_loop_from_edit_range (bool play);
1274 void set_loop_from_region (bool play);
1275 void set_punch_from_edit_range ();
1277 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1278 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1280 void add_location_from_playhead_cursor ();
1281 bool select_new_marker;
1283 void reverse_selection ();
1284 void edit_envelope ();
1286 void start_scrolling ();
1287 void stop_scrolling ();
1289 bool _scrubbing;
1290 double last_scrub_x;
1291 int scrubbing_direction;
1292 int scrub_reversals;
1293 int scrub_reverse_distance;
1294 void scrub ();
1296 void keyboard_selection_begin ();
1297 void keyboard_selection_finish (bool add);
1298 bool have_pending_keyboard_selection;
1299 nframes64_t pending_keyboard_selection_start;
1301 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1302 void extend_selection_to_end_of_region (bool next);
1303 void extend_selection_to_start_of_region (bool previous);
1305 Editing::SnapType snap_type;
1306 Editing::SnapMode snap_mode;
1307 double snap_threshold;
1309 void handle_gui_changes (const string &, void *);
1310 bool ignore_gui_changes;
1312 void hide_all_tracks (bool with_select);
1314 DragInfo drag_info;
1315 LineDragInfo current_line_drag_info;
1317 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1318 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1319 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1320 void break_drag ();
1321 void finalize_drag ();
1323 Gtk::Menu fade_context_menu;
1324 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1326 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1328 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1329 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1330 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1331 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1332 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1333 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1335 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1336 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1338 void set_fade_length (bool in);
1339 void toggle_fade_active (bool in);
1340 void set_fade_in_active (bool);
1341 void set_fade_out_active (bool);
1343 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1344 RegionSelection pre_drag_region_selection;
1345 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1346 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1347 bool check_region_drag_possible (AudioTimeAxisView**);
1348 void possibly_copy_regions_during_grab (GdkEvent*);
1349 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1350 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1352 bool _dragging_playhead;
1353 bool _dragging_edit_point;
1355 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1356 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1357 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1358 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1359 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1360 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1361 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1362 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1363 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1365 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1366 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1367 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1368 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1370 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1372 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1373 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1374 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1375 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1376 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1377 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1378 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1379 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1380 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1381 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1382 void start_line_grab (AutomationLine *, GdkEvent*);
1383 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1384 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1385 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1386 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1388 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1390 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1391 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1393 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1394 void brush (nframes64_t);
1396 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1397 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1398 double clamp_verbose_cursor_x (double);
1399 double clamp_verbose_cursor_y (double);
1401 /* Canvas event handlers */
1403 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1404 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1405 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1406 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1407 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1408 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1409 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1410 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1411 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1412 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1415 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1416 private:
1417 ArdourCanvas::Item *last_item_entered;
1418 int last_item_entered_n;
1419 public:
1421 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1422 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1423 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1424 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1425 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1426 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1427 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1428 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1429 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1431 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1432 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1433 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1434 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1435 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1436 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1438 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1439 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1440 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1441 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1442 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1443 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1444 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1445 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1447 /* non-public event handlers */
1449 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1450 bool track_canvas_scroll (GdkEventScroll* event);
1452 bool track_canvas_scroll_event (GdkEventScroll* event);
1453 bool track_canvas_button_press_event (GdkEventButton* event);
1454 bool track_canvas_button_release_event (GdkEventButton* event);
1455 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1457 Gtk::Allocation canvas_allocation;
1458 void track_canvas_allocate (Gtk::Allocation alloc);
1459 bool track_canvas_size_allocated ();
1461 void set_playhead_cursor ();
1463 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1464 void kbd_mute_unmute_region ();
1465 void kbd_brush ();
1467 void kbd_do_brush (GdkEvent*);
1468 void kbd_do_audition (GdkEvent*);
1470 void handle_new_duration ();
1471 void initialize_canvas ();
1473 /* display control */
1475 bool _show_measures;
1476 bool _show_waveforms;
1477 bool _follow_playhead;
1478 bool _show_waveforms_recording;
1480 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1482 TempoLines* tempo_lines;
1484 ArdourCanvas::Group* time_line_group;
1485 ArdourCanvas::SimpleLine* get_time_line ();
1486 void hide_measures ();
1487 void draw_measures ();
1488 bool redraw_measures ();
1490 void new_tempo_section ();
1492 void mouse_add_new_tempo_event (nframes64_t where);
1493 void mouse_add_new_meter_event (nframes64_t where);
1495 void remove_tempo_marker (ArdourCanvas::Item*);
1496 void remove_meter_marker (ArdourCanvas::Item*);
1497 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1498 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1500 void edit_tempo_section (ARDOUR::TempoSection*);
1501 void edit_meter_section (ARDOUR::MeterSection*);
1502 void edit_tempo_marker (ArdourCanvas::Item*);
1503 void edit_meter_marker (ArdourCanvas::Item*);
1505 void marker_menu_edit ();
1506 void marker_menu_remove ();
1507 void marker_menu_rename ();
1508 void marker_menu_lock (bool yn);
1509 void marker_menu_hide ();
1510 void marker_menu_loop_range ();
1511 void marker_menu_select_all_selectables_using_range ();
1512 void marker_menu_select_using_range ();
1513 void marker_menu_separate_regions_using_location ();
1514 void marker_menu_play_from ();
1515 void marker_menu_play_range ();
1516 void marker_menu_set_playhead ();
1517 void marker_menu_set_from_playhead ();
1518 void marker_menu_set_from_selection ();
1519 void marker_menu_range_to_next ();
1520 void marker_menu_export_range ();
1521 void new_transport_marker_menu_set_loop ();
1522 void new_transport_marker_menu_set_punch ();
1523 void update_loop_range_view (bool visibility=false);
1524 void update_punch_range_view (bool visibility=false);
1525 void new_transport_marker_menu_popdown ();
1526 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1527 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1528 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1529 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1530 void build_range_marker_menu (bool loop_or_punch);
1531 void build_marker_menu (bool start_or_end);
1532 void build_tm_marker_menu ();
1533 void build_new_transport_marker_menu ();
1535 Gtk::Menu* tm_marker_menu;
1536 Gtk::Menu* marker_menu;
1537 Gtk::Menu* start_end_marker_menu;
1538 Gtk::Menu* range_marker_menu;
1539 Gtk::Menu* transport_marker_menu;
1540 Gtk::Menu* new_transport_marker_menu;
1541 Gtk::Menu* cd_marker_menu;
1542 ArdourCanvas::Item* marker_menu_item;
1544 typedef list<Marker*> Marks;
1545 Marks metric_marks;
1547 void remove_metric_marks ();
1548 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1550 void compute_current_bbt_points (nframes_t left, nframes_t right);
1551 void tempo_map_changed (ARDOUR::Change);
1552 void redisplay_tempo (bool immediate_redraw);
1554 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1556 uint32_t bbt_beat_subdivision;
1558 /* toolbar */
1560 void editor_mixer_button_toggled ();
1562 AudioClock edit_point_clock;
1563 AudioClock zoom_range_clock;
1564 Gtk::Button zoom_in_button;
1565 Gtk::Button zoom_out_button;
1566 Gtk::Button zoom_out_full_button;
1567 Gtk::Button zoom_onetoone_button;
1569 Gtk::VBox toolbar_clock_vbox;
1570 Gtk::VBox toolbar_selection_clock_vbox;
1571 Gtk::Table toolbar_selection_clock_table;
1572 Gtk::Label toolbar_selection_cursor_label;
1574 Gtk::HBox mouse_mode_button_box;
1575 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1576 Gtk::ToggleButton mouse_select_button;
1577 Gtk::ToggleButton mouse_move_button;
1578 Gtk::ToggleButton mouse_gain_button;
1579 Gtk::ToggleButton mouse_zoom_button;
1580 Gtk::ToggleButton mouse_timefx_button;
1581 Gtk::ToggleButton mouse_audition_button;
1582 GroupedButtons *mouse_mode_button_set;
1583 void mouse_mode_toggled (Editing::MouseMode m);
1584 bool ignore_mouse_mode_toggle;
1586 gint mouse_select_button_release (GdkEventButton*);
1588 Gtk::VBox automation_box;
1589 Gtk::Button automation_mode_button;
1590 Gtk::ToggleButton global_automation_button;
1592 Gtk::ComboBoxText edit_mode_selector;
1593 Gtk::VBox edit_mode_box;
1595 void set_edit_mode (ARDOUR::EditMode);
1596 void cycle_edit_mode ();
1597 void edit_mode_selection_done ();
1599 Gtk::ComboBoxText snap_type_selector;
1600 Gtk::ComboBoxText snap_mode_selector;
1601 Gtk::HBox snap_box;
1603 std::vector<std::string> snap_type_strings;
1604 std::vector<std::string> snap_mode_strings;
1606 void snap_type_selection_done ();
1607 void snap_mode_selection_done ();
1608 void snap_mode_chosen (Editing::SnapMode);
1609 void snap_type_chosen (Editing::SnapType);
1611 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1612 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1614 Gtk::ComboBoxText zoom_focus_selector;
1615 Gtk::VBox zoom_focus_box;
1617 std::vector<std::string> zoom_focus_strings;
1619 void zoom_focus_selection_done ();
1620 void zoom_focus_chosen (Editing::ZoomFocus);
1622 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1624 Gtk::HBox zoom_box;
1626 void zoom_adjustment_changed();
1628 void edit_point_clock_changed();
1630 void setup_toolbar ();
1632 Gtkmm2ext::TearOff* tools_tearoff;
1633 Gtk::HBox toolbar_hbox;
1634 Gtk::EventBox toolbar_base;
1635 Gtk::Frame toolbar_frame;
1637 /* selection process */
1639 Selection* selection;
1640 Selection* cut_buffer;
1642 void time_selection_changed ();
1643 void track_selection_changed ();
1644 void region_selection_changed ();
1645 void sensitize_the_right_region_actions (bool have_selected_regions);
1646 void point_selection_changed ();
1647 void marker_selection_changed ();
1649 enum SelectionOp {
1650 CreateSelection,
1651 SelectionStartTrim,
1652 SelectionEndTrim,
1653 SelectionMove
1654 } selection_op;
1656 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1657 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1658 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1659 void cancel_selection ();
1661 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1662 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1663 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1665 bool audio_region_selection_covers (nframes64_t where);
1667 /* transport range select process */
1668 enum RangeMarkerOp {
1669 CreateRangeMarker,
1670 CreateTransportMarker,
1671 CreateCDMarker
1672 } range_marker_op;
1674 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1675 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1676 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1678 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1679 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1680 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1681 ArdourCanvas::Line* marker_drag_line;
1682 ArdourCanvas::Points marker_drag_line_points;
1683 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1685 void update_marker_drag_item (ARDOUR::Location *);
1686 #ifdef GTKOSX
1687 ArdourCanvas::SimpleRect *bogus_background_rect;
1688 #endif
1689 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1690 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1691 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1692 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1693 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1694 ArdourCanvas::SimpleLine *transport_punchin_line;
1695 ArdourCanvas::SimpleLine *transport_punchout_line;
1696 ArdourCanvas::SimpleRect *transport_preroll_rect;
1697 ArdourCanvas::SimpleRect *transport_postroll_rect;
1699 ARDOUR::Location* transport_loop_location();
1700 ARDOUR::Location* transport_punch_location();
1702 ARDOUR::Location *temp_location;
1704 /* object rubberband select process */
1706 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1707 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1708 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1710 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1712 ArdourCanvas::SimpleRect *rubberband_rect;
1714 /* mouse zoom process */
1716 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1717 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1718 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1720 ArdourCanvas::SimpleRect *zoom_rect;
1721 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1723 /* diskstream/route display management */
1725 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1726 RouteDisplayModelColumns() {
1727 add (text);
1728 add (visible);
1729 add (temporary_visible);
1730 add (tv);
1731 add (route);
1733 Gtk::TreeModelColumn<Glib::ustring> text;
1734 Gtk::TreeModelColumn<bool> visible;
1735 Gtk::TreeModelColumn<bool> temporary_visible;
1736 Gtk::TreeModelColumn<TimeAxisView*> tv;
1737 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1740 RouteDisplayModelColumns route_display_columns;
1741 Glib::RefPtr<Gtk::ListStore> route_display_model;
1742 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1744 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1745 Gtk::ScrolledWindow route_list_scroller;
1746 Gtk::Menu* route_list_menu;
1748 void update_route_visibility ();
1750 void sync_order_keys (const char*);
1751 bool route_redisplay_does_not_sync_order_keys;
1752 bool route_redisplay_does_not_reset_order_keys;
1754 bool route_list_display_button_press (GdkEventButton*);
1755 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1756 gint x,
1757 gint y,
1758 const Gtk::SelectionData& data,
1759 guint info,
1760 guint time);
1762 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1764 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1765 void route_list_delete (const Gtk::TreeModel::Path&);
1766 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1768 void initial_route_list_display ();
1769 void redisplay_route_list();
1770 bool ignore_route_list_reorder;
1771 bool no_route_list_redisplay;
1772 bool sync_track_view_list_and_route_list ();
1774 void build_route_list_menu ();
1775 void show_route_list_menu ();
1777 void show_all_routes ();
1778 void hide_all_routes ();
1779 void show_all_audiotracks ();
1780 void hide_all_audiotracks ();
1781 void show_all_audiobus ();
1782 void hide_all_audiobus ();
1784 void set_all_tracks_visibility (bool yn);
1785 void set_all_audio_visibility (int type, bool yn);
1787 /* edit group management */
1789 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1790 GroupListModelColumns () {
1791 add (is_active);
1792 add (is_visible);
1793 add (text);
1794 add (routegroup);
1796 Gtk::TreeModelColumn<bool> is_active;
1797 Gtk::TreeModelColumn<bool> is_visible;
1798 Gtk::TreeModelColumn<std::string> text;
1799 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1802 GroupListModelColumns group_columns;
1803 Glib::RefPtr<Gtk::ListStore> group_model;
1804 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1806 Gtk::TreeView edit_group_display;
1807 Gtk::ScrolledWindow edit_group_display_scroller;
1808 Gtk::Menu* edit_group_list_menu;
1810 void build_edit_group_list_menu ();
1811 void activate_all_edit_groups ();
1812 void disable_all_edit_groups ();
1814 bool in_edit_group_row_change;
1815 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1816 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1817 void new_edit_group ();
1818 void edit_group_list_button_clicked ();
1819 gint edit_group_list_button_press_event (GdkEventButton* ev);
1820 void add_edit_group (ARDOUR::RouteGroup* group);
1821 void remove_selected_edit_group ();
1822 void edit_groups_changed ();
1823 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1825 Gtk::VBox list_vpacker;
1827 /* autoscrolling */
1829 bool autoscroll_active;
1830 int autoscroll_timeout_tag;
1831 int autoscroll_x;
1832 int autoscroll_y;
1833 int last_autoscroll_x;
1834 int last_autoscroll_y;
1835 uint32_t autoscroll_cnt;
1836 nframes64_t autoscroll_x_distance;
1837 double autoscroll_y_distance;
1839 static gint _autoscroll_canvas (void *);
1840 bool autoscroll_canvas ();
1841 void start_canvas_autoscroll (int x, int y);
1842 void stop_canvas_autoscroll ();
1843 void maybe_autoscroll (GdkEventMotion*);
1844 void maybe_autoscroll_horizontally (GdkEventMotion*);
1845 bool allow_vertical_scroll;
1847 /* trimming */
1848 enum TrimOp {
1849 StartTrim,
1850 EndTrim,
1851 ContentsTrim,
1852 } trim_op;
1854 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1855 void point_trim (GdkEvent*);
1856 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1857 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1858 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1859 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1861 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1862 void thaw_region_after_trim (RegionView& rv);
1864 void trim_region_front();
1865 void trim_region_back();
1866 void trim_region (bool front);
1868 void trim_region_to_edit_point ();
1869 void trim_region_from_edit_point ();
1870 void trim_region_to_loop ();
1871 void trim_region_to_punch ();
1872 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1874 bool show_gain_after_trim;
1876 /* Drag-n-Drop */
1878 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1879 const Glib::RefPtr<Gdk::DragContext>& context,
1880 gint x,
1881 gint y,
1882 const Gtk::SelectionData& data,
1883 guint info,
1884 guint time);
1886 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1887 gint x,
1888 gint y,
1889 const Gtk::SelectionData& data,
1890 guint info,
1891 guint time);
1893 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1894 gint x,
1895 gint y,
1896 const Gtk::SelectionData& data,
1897 guint info,
1898 guint time);
1900 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1901 gint x,
1902 gint y,
1903 const Gtk::SelectionData& data,
1904 guint info,
1905 guint time);
1907 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1908 gint x,
1909 gint y,
1910 const Gtk::SelectionData& data,
1911 guint info,
1912 guint time);
1914 /* audio export */
1916 ExportDialog *export_dialog;
1917 ExportDialog *export_range_markers_dialog;
1919 void export_range (nframes64_t start, nframes64_t end);
1920 void export_range_markers ();
1922 int write_region_selection(RegionSelection&);
1923 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1924 void export_region ();
1925 void bounce_region_selection ();
1926 void bounce_range_selection (bool replace, bool enable_processing = true);
1927 void external_edit_region ();
1929 int write_audio_selection (TimeSelection&);
1930 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1932 void write_selection ();
1934 /* history */
1936 UndoAction get_memento() const;
1938 XMLNode *before; /* used in *_reversible_command */
1939 void begin_reversible_command (string cmd_name);
1940 void commit_reversible_command ();
1942 void update_title ();
1943 void update_title_s (const string & snapshot_name);
1945 struct State {
1946 Selection* selection;
1947 double frames_per_unit;
1949 State();
1950 ~State();
1953 void store_state (State&) const;
1954 void restore_state (State *);
1956 void instant_save ();
1958 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1960 /* freeze operations */
1962 ARDOUR::InterThreadInfo freeze_status;
1963 gint freeze_progress_timeout (void *);
1964 static void* _freeze_thread (void*);
1965 void* freeze_thread ();
1967 void freeze_route ();
1968 void unfreeze_route ();
1970 /* edit-group solo + mute */
1972 void set_edit_group_solo (ARDOUR::Route&, bool);
1973 void set_edit_group_mute (ARDOUR::Route&, bool);
1975 /* duplication */
1977 void duplicate_dialog (bool with_dialog);
1979 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1981 /* returns false if mouse pointer is not in track or marker canvas
1983 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1985 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1986 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1987 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1989 struct TimeFXDialog : public ArdourDialog {
1990 ARDOUR::TimeFXRequest request;
1991 Editor& editor;
1992 bool pitching;
1993 Gtk::Adjustment pitch_octave_adjustment;
1994 Gtk::Adjustment pitch_semitone_adjustment;
1995 Gtk::Adjustment pitch_cent_adjustment;
1996 Gtk::SpinButton pitch_octave_spinner;
1997 Gtk::SpinButton pitch_semitone_spinner;
1998 Gtk::SpinButton pitch_cent_spinner;
1999 RegionSelection regions;
2000 Gtk::ProgressBar progress_bar;
2002 /* SoundTouch */
2003 Gtk::ToggleButton quick_button;
2004 Gtk::ToggleButton antialias_button;
2005 Gtk::HBox upper_button_box;
2007 /* RubberBand */
2008 Gtk::ComboBoxText stretch_opts_selector;
2009 Gtk::Label stretch_opts_label;
2010 Gtk::ToggleButton precise_button;
2011 Gtk::ToggleButton preserve_formants_button;
2012 Gtk::HBox opts_box;
2014 Gtk::Button* cancel_button;
2015 Gtk::Button* action_button;
2016 Gtk::VBox packer;
2017 int status;
2019 TimeFXDialog (Editor& e, bool for_pitch);
2021 gint update_progress ();
2022 sigc::connection first_cancel;
2023 sigc::connection first_delete;
2024 void cancel_in_progress ();
2025 gint delete_in_progress (GdkEventAny*);
2028 /* "whats mine is yours" */
2030 friend class TimeFXDialog;
2032 TimeFXDialog* current_timefx;
2034 static void* timefx_thread (void *arg);
2035 void do_timefx (TimeFXDialog&);
2037 int time_stretch (RegionSelection&, float fraction);
2038 int pitch_shift (RegionSelection&, float cents);
2039 void pitch_shift_regions ();
2040 int time_fx (RegionSelection&, float val, bool pitching);
2042 /* editor-mixer strip */
2044 MixerStrip *current_mixer_strip;
2045 bool show_editor_mixer_when_tracks_arrive;
2046 Gtk::VBox current_mixer_strip_vbox;
2047 void cms_deleted ();
2048 void current_mixer_strip_hidden ();
2049 void current_mixer_strip_removed ();
2051 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2052 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2053 #ifdef GTKOSX
2054 void ensure_all_elements_drawn ();
2055 #endif
2056 /* nudging tracks */
2058 void nudge_track (bool use_edit_point, bool forwards);
2060 /* xfades */
2062 bool _xfade_visibility;
2064 /* <CMT Additions> */
2065 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2066 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2068 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2069 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2071 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2072 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2073 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2075 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2076 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2077 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2078 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2080 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2081 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2082 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2083 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2085 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2086 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2087 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2088 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2089 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2090 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2092 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2093 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2094 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2095 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2096 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2097 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2099 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2100 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2102 ImageFrameSocketHandler* image_socket_listener ;
2103 /* </CMT Additions> */
2105 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2106 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2107 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2108 void xfade_edit_left_region ();
2109 void xfade_edit_right_region ();
2111 static const int32_t default_width = 995;
2112 static const int32_t default_height = 765;
2114 /* nudge */
2116 Gtk::Button nudge_forward_button;
2117 Gtk::Button nudge_backward_button;
2118 Gtk::HBox nudge_hbox;
2119 Gtk::VBox nudge_vbox;
2120 AudioClock nudge_clock;
2122 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2124 bool nudge_forward_release (GdkEventButton*);
2125 bool nudge_backward_release (GdkEventButton*);
2127 /* audio filters */
2129 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2131 /* handling cleanup */
2133 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2135 vector<sigc::connection> session_connections;
2137 /* tracking step changes of track height */
2139 TimeAxisView* current_stepping_trackview;
2140 ARDOUR::microseconds_t last_track_height_step_timestamp;
2141 gint track_height_step_timeout();
2142 sigc::connection step_timeout;
2144 TimeAxisView* entered_track;
2145 RegionView* entered_regionview;
2148 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2149 bool clear_entered_track;
2150 bool left_track_canvas (GdkEventCrossing*);
2151 bool entered_track_canvas (GdkEventCrossing*);
2152 void set_entered_track (TimeAxisView*);
2153 void set_entered_regionview (RegionView*);
2154 void ensure_track_visible (TimeAxisView*);
2155 gint left_automation_track ();
2157 bool _new_regionviews_show_envelope;
2159 void reset_canvas_action_sensitivity (bool);
2160 void toggle_gain_envelope_visibility ();
2161 void toggle_gain_envelope_active ();
2162 void reset_region_gain_envelopes ();
2164 bool on_key_press_event (GdkEventKey*);
2165 bool on_key_release_event (GdkEventKey*);
2167 void session_state_saved (string);
2169 Glib::RefPtr<Gtk::Action> undo_action;
2170 Glib::RefPtr<Gtk::Action> redo_action;
2172 void history_changed ();
2173 void color_handler ();
2175 Gtk::HBox status_bar_hpacker;
2177 Editing::EditPoint _edit_point;
2179 Gtk::ComboBoxText edit_point_selector;
2181 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2182 void cycle_edit_point (bool with_marker);
2183 void set_edit_point ();
2184 void edit_point_selection_done ();
2185 void edit_point_chosen (Editing::EditPoint);
2186 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2187 std::vector<std::string> edit_point_strings;
2189 void selected_marker_moved (ARDOUR::Location*);
2190 sigc::connection edit_point_clock_connection_a;
2191 sigc::connection edit_point_clock_connection_b;
2193 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2195 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2196 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2198 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2200 sigc::connection fast_screen_update_connection;
2201 gint start_updating ();
2202 gint stop_updating ();
2203 void fast_update_strips ();
2204 bool meters_running;
2206 void select_next_route ();
2207 void select_prev_route ();
2209 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2211 RhythmFerret* rhythm_ferret;
2213 void fit_tracks ();
2214 void set_track_height (uint32_t h);
2215 void set_track_height_largest ();
2216 void set_track_height_large ();
2217 void set_track_height_larger ();
2218 void set_track_height_normal ();
2219 void set_track_height_smaller ();
2220 void set_track_height_small ();
2222 void remove_tracks ();
2223 void toggle_tracks_active ();
2224 void waveform_scale_chosen (Editing::WaveformScale);
2226 bool _have_idled;
2227 int resize_idle_id;
2228 int32_t resize_idle_target;
2229 bool idle_resize();
2230 friend gboolean _idle_resize (gpointer);
2231 std::vector<TimeAxisView*> pending_resizes;
2234 #endif /* __ardour_editor_h__ */