remove global LV2 external GUI list, always call LV2 UI cleanup method when appropria...
[ardour2.git] / gtk2_ardour / editor.h
blob7ecab102831fb7eb904bfae64d56feb8555c393a
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 "canvas-noevent-text.h"
61 #include "region_selection.h"
62 #include "canvas.h"
63 #include "time_axis_view.h"
64 #include "draginfo.h"
66 namespace Gtkmm2ext {
67 class TearOff;
70 namespace ARDOUR {
71 class AudioDiskstream;
72 class RouteGroup;
73 class Playlist;
74 class AudioPlaylist;
75 class Region;
76 class Location;
77 class TempoSection;
78 class NamedSelection;
79 class Session;
80 class AudioFilter;
81 class Crossfade;
84 namespace LADSPA {
85 class Plugin;
88 class TimeAxisView;
89 class RouteTimeAxisView;
90 class AudioTimeAxisView;
91 class AutomationTimeAxisView;
92 class AudioRegionView;
93 class CrossfadeView;
94 class PluginSelector;
95 class PlaylistSelector;
96 class Marker;
97 class GroupedButtons;
98 class AutomationLine;
99 class UIExportSpecification;
100 class ExportDialog;
101 class Selection;
102 class TempoLines;
103 class TimeSelection;
104 class TrackSelection;
105 class AutomationSelection;
106 class MixerStrip;
107 class StreamView;
108 class AudioStreamView;
109 class ControlPoint;
110 class SoundFileOmega;
111 class RhythmFerret;
112 class RegionLayeringOrderEditor;
113 #ifdef FFT_ANALYSIS
114 class AnalysisWindow;
115 #endif
117 /* <CMT Additions> */
118 class ImageFrameView;
119 class ImageFrameTimeAxisView;
120 class ImageFrameTimeAxis;
121 class MarkerTimeAxis ;
122 class MarkerView ;
123 class ImageFrameSocketHandler ;
124 class TimeAxisViewItem ;
125 /* </CMT Additions> */
128 class Editor : public PublicEditor
130 public:
131 Editor ();
132 ~Editor ();
134 void connect_to_session (ARDOUR::Session *);
135 ARDOUR::Session* current_session() const { return session; }
136 void first_idle ();
137 virtual bool have_idled() const { return _have_idled; }
139 nframes64_t leftmost_position() const { return leftmost_frame; }
140 nframes64_t current_page_frames() const {
141 return (nframes64_t) floor (canvas_width * frames_per_unit);
144 void cycle_snap_mode ();
145 void cycle_snap_choice ();
146 void set_snap_to (Editing::SnapType);
147 void set_snap_mode (Editing::SnapMode);
148 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
150 void undo (uint32_t n = 1);
151 void redo (uint32_t n = 1);
153 XMLNode& get_state ();
154 int set_state (const XMLNode& );
156 void set_mouse_mode (Editing::MouseMode, bool force=true);
157 void step_mouse_mode (bool next);
158 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
160 void add_imageframe_time_axis(const std::string & track_name, void*) ;
161 void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
162 void connect_to_image_compositor() ;
163 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
164 TimeAxisView* get_named_time_axis(const std::string & name) ;
165 void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
166 void add_to_idle_resize (TimeAxisView*, uint32_t);
168 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
169 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
170 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
172 #ifdef USE_RUBBERBAND
173 std::vector<std::string> rb_opt_strings;
174 #endif
176 //global waveform options
178 void set_show_waveforms (bool yn);
179 bool show_waveforms() const { return _show_waveforms; }
181 void set_show_waveforms_rectified (bool yn);
182 bool show_waveforms_rectified() const { return _show_waveforms_rectified; }
184 void set_show_waveforms_recording (bool yn);
185 bool show_waveforms_recording() const { return _show_waveforms_recording; }
187 //per-track waveform options
189 void set_waveform_scale (Editing::WaveformScale);
191 /* things that need to be public to be used in the main menubar */
193 void new_region_from_selection ();
194 void separate_regions_between (const TimeSelection&);
195 void separate_region_from_selection ();
196 void separate_region_from_punch ();
197 void separate_region_from_loop ();
198 void separate_regions_using_location (ARDOUR::Location&);
199 void transition_to_rolling (bool forward);
201 /* undo related */
203 nframes64_t unit_to_frame (double unit) const {
204 return (nframes64_t) rint (unit * frames_per_unit);
207 double frame_to_unit (nframes64_t frame) const {
208 return rint ((double) frame / (double) frames_per_unit);
211 double frame_to_unit (double frame) const {
212 return rint (frame / frames_per_unit);
215 /* NOTE: these functions assume that the "pixel" coordinate is
216 the result of using the world->canvas affine transform on a
217 world coordinate. These coordinates already take into
218 account any scrolling carried out by adjusting the
219 xscroll_adjustment.
222 nframes64_t pixel_to_frame (double pixel) const {
224 /* pixel can be less than zero when motion events
225 are processed. since we've already run the world->canvas
226 affine, that means that the location *really* is "off
227 to the right" and thus really is "before the start".
230 if (pixel >= 0) {
231 return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
232 } else {
233 return 0;
237 gulong frame_to_pixel (nframes64_t frame) const {
238 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
241 void flush_canvas ();
243 /* selection */
245 Selection& get_selection() const { return *selection; }
246 Selection& get_cut_buffer() const { return *cut_buffer; }
248 bool extend_selection_to_track (TimeAxisView&);
250 void play_selection ();
251 void select_all_in_track (Selection::Operation op);
252 void select_all (Selection::Operation op);
253 void invert_selection_in_track ();
254 void invert_selection ();
255 void deselect_all ();
257 /* tempo */
259 void set_show_measures (bool yn);
260 bool show_measures () const { return _show_measures; }
262 #ifdef FFT_ANALYSIS
263 /* analysis window */
264 void analyze_region_selection();
265 void analyze_range_selection();
266 #endif
268 /* export */
270 /* these initiate export ... */
272 void export_session();
273 void export_selection();
275 void add_toplevel_controls (Gtk::Container&);
276 Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; }
278 void set_zoom_focus (Editing::ZoomFocus);
279 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
280 double get_current_zoom () const { return frames_per_unit; }
282 void temporal_zoom_step (bool coarser);
284 /* stuff that AudioTimeAxisView and related classes use */
286 PlaylistSelector& playlist_selector() const;
287 void route_name_changed (TimeAxisView *);
288 void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
290 void new_playlists (TimeAxisView*);
291 void copy_playlists (TimeAxisView*);
292 void clear_playlists (TimeAxisView*);
294 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
295 void get_onscreen_tracks (TrackViewList&);
297 Width editor_mixer_strip_width;
298 void maybe_add_mixer_strip_width (XMLNode&);
299 void show_editor_mixer (bool yn);
300 void create_editor_mixer ();
301 void set_selected_mixer_strip (TimeAxisView&);
302 void hide_track_in_display (TimeAxisView& tv, bool temporary = false);
303 void show_track_in_display (TimeAxisView& tv);
305 /* nudge is initiated by transport controls owned by ARDOUR_UI */
307 void nudge_forward (bool next, bool force_playhead);
308 void nudge_backward (bool next, bool force_playhead);
310 /* nudge initiated from context menu */
312 void nudge_forward_capture_offset ();
313 void nudge_backward_capture_offset ();
315 /* playhead/screen stuff */
317 void set_stationary_playhead (bool yn);
318 void toggle_stationary_playhead ();
319 bool stationary_playhead() const { return _stationary_playhead; }
321 void set_follow_playhead (bool yn);
322 void toggle_follow_playhead ();
323 bool follow_playhead() const { return _follow_playhead; }
324 bool dragging_playhead () const { return _dragging_playhead; }
326 void toggle_waveform_visibility ();
327 void toggle_waveform_rectified ();
328 void toggle_waveforms_while_recording ();
330 void toggle_measure_visibility ();
331 void toggle_logo_visibility ();
333 double get_physical_screen_width () const { return physical_screen_width; };
334 double physical_screen_width;
335 double physical_screen_height;
337 /* SMPTE timecode & video sync */
339 void smpte_fps_chosen (ARDOUR::SmpteFormat format);
340 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
341 void subframes_per_frame_chosen (uint32_t);
343 void update_smpte_mode();
344 void update_video_pullup();
345 void update_subframes_per_frame ();
347 /* fades & xfades */
349 void toggle_region_fades ();
350 void toggle_region_fades_visible ();
351 void toggle_selected_region_fades (int dir);
352 void update_region_fade_visibility ();
354 void toggle_auto_xfade ();
355 void toggle_xfades_active ();
356 void toggle_xfade_visibility ();
357 bool xfade_visibility() const { return _xfade_visibility; }
358 void update_xfade_visibility ();
359 void update_crossfade_model ();
360 void set_crossfade_model (ARDOUR::CrossfadeModel);
362 /* layers */
363 void set_layer_model (ARDOUR::LayerModel);
364 void update_layering_model ();
366 void toggle_link_region_and_track_selection ();
368 /* redirect shared ops menu. caller must free returned menu */
370 Gtk::Menu* redirect_menu ();
372 /* floating windows/transient */
374 void ensure_float (Gtk::Window&);
376 void show_window ();
378 void scroll_tracks_down_line ();
379 void scroll_tracks_up_line ();
381 void move_selected_tracks (bool up);
383 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
384 void prepare_for_cleanup ();
385 void finish_cleanup ();
387 void maximise_editing_space();
388 void restore_editing_space();
390 void reset_x_origin (nframes64_t);
391 void reset_zoom (double);
392 void reposition_and_zoom (nframes64_t, double);
394 nframes64_t get_preferred_edit_position (bool ignore_playhead = false);
396 bool update_mouse_speed ();
397 bool decelerate_mouse_speed ();
399 void toggle_meter_updating();
401 void show_rhythm_ferret();
403 void goto_visual_state (uint32_t);
404 void save_visual_state (uint32_t);
406 void queue_draw_resize_line (int at);
407 void start_resize_line_ops ();
408 void end_resize_line_ops ();
410 protected:
411 void map_transport_state ();
412 void map_position_change (nframes64_t);
414 void on_realize();
415 bool on_expose_event (GdkEventExpose*);
417 private:
419 ARDOUR::Session *session;
420 bool constructed;
422 // to keep track of the playhead position for control_scroll
423 boost::optional<nframes64_t> _control_scroll_target;
425 PlaylistSelector* _playlist_selector;
427 typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
429 struct VisualState {
430 double y_position;
431 double frames_per_unit;
432 nframes64_t leftmost_frame;
433 Editing::ZoomFocus zoom_focus;
434 std::list<TAVState> track_states;
437 std::list<VisualState*> undo_visual_stack;
438 std::list<VisualState*> redo_visual_stack;
439 VisualState* current_visual_state (bool with_tracks = true);
440 void undo_visual_state ();
441 void redo_visual_state ();
442 void use_visual_state (VisualState&);
443 bool no_save_visual;
444 void swap_visual_state ();
446 std::vector<VisualState*> visual_states;
447 sigc::connection visual_state_op_connection;
448 void start_visual_state_op (uint32_t n);
449 void cancel_visual_state_op (uint32_t n);
450 bool end_visual_state_op (uint32_t n);
452 nframes64_t leftmost_frame;
453 double frames_per_unit;
454 Editing::ZoomFocus zoom_focus;
456 void set_frames_per_unit (double);
457 void post_zoom ();
459 Editing::MouseMode mouse_mode;
461 int post_maximal_editor_width;
462 int post_maximal_pane_position;
463 int pre_maximal_pane_position;
464 int pre_maximal_editor_width;
465 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
467 Gtk::Notebook the_notebook;
468 Gtk::HPaned edit_pane;
470 Gtk::EventBox meter_base;
471 Gtk::HBox meter_box;
472 Gtk::EventBox marker_base;
473 Gtk::HBox marker_box;
474 Gtk::VBox scrollers_rulers_markers_box;
476 void location_changed (ARDOUR::Location *);
477 void location_flags_changed (ARDOUR::Location *, void *);
478 void refresh_location_display ();
479 void refresh_location_display_s (ARDOUR::Change);
480 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
481 void add_new_location (ARDOUR::Location *);
482 void location_gone (ARDOUR::Location *);
483 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
484 gint really_remove_marker (ARDOUR::Location* loc);
485 void goto_nth_marker (int nth);
487 uint32_t location_marker_color;
488 uint32_t location_range_color;
489 uint32_t location_loop_color;
490 uint32_t location_punch_color;
491 uint32_t location_cd_marker_color;
493 struct LocationMarkers {
494 Marker* start;
495 Marker* end;
496 bool valid;
498 LocationMarkers () : start(0), end(0), valid (true) {}
500 ~LocationMarkers ();
502 void hide();
503 void show ();
504 void set_name (const string&);
505 void set_position (nframes64_t start, nframes64_t end = 0);
506 void set_color_rgba (uint32_t);
509 LocationMarkers *find_location_markers (ARDOUR::Location *) const;
510 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
511 Marker* entered_marker;
513 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
514 LocationMarkerMap location_markers;
516 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
517 void clear_marker_display ();
518 void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false);
519 bool choose_new_marker_name(string &name);
520 void update_cd_marker_display ();
521 void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);
523 TimeAxisView* clicked_trackview;
524 AudioTimeAxisView* clicked_audio_trackview;
525 RegionView* clicked_regionview;
526 RegionSelection latest_regionviews;
527 uint32_t clicked_selection;
528 CrossfadeView* clicked_crossfadeview;
529 ControlPoint* clicked_control_point;
531 void sort_track_selection (TrackSelection* sel = 0);
533 void get_relevant_audio_tracks (std::set<AudioTimeAxisView*>& relevant_tracks);
534 void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
535 void mapover_audio_tracks (sigc::slot<void,AudioTimeAxisView&,uint32_t> sl, TimeAxisView*);
537 /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
539 void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
540 void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
541 void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
542 void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
544 /* end */
546 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
547 bool button_release_can_deselect;
549 void catch_vanishing_regionview (RegionView *);
551 void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
552 void select_all_tracks ();
554 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
555 void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false);
556 void set_selected_track_as_side_effect (bool force = false);
557 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
559 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
560 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
561 void collect_new_region_view (RegionView *);
563 Gtk::Menu track_context_menu;
564 Gtk::Menu track_region_context_menu;
565 Gtk::Menu track_selection_context_menu;
566 Gtk::Menu track_crossfade_context_menu;
568 Gtk::MenuItem* region_edit_menu_split_item;
569 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
570 Gtk::Menu * track_region_edit_playlist_menu;
571 Gtk::Menu * track_edit_playlist_submenu;
572 Gtk::Menu * track_selection_edit_playlist_submenu;
574 void popup_track_context_menu (int, int, ItemType, bool, nframes64_t);
575 Gtk::Menu* build_track_context_menu (nframes64_t);
576 Gtk::Menu* build_track_bus_context_menu (nframes64_t);
577 Gtk::Menu* build_track_region_context_menu (nframes64_t frame);
578 Gtk::Menu* build_track_crossfade_context_menu (nframes64_t);
579 Gtk::Menu* build_track_selection_context_menu (nframes64_t);
580 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
581 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
582 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&, nframes64_t position, bool multiple_regions_at_position);
583 void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
584 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
586 void handle_new_route (ARDOUR::Session::RouteList&);
587 void remove_route (TimeAxisView *);
588 bool route_removal;
590 Gtk::HBox global_hpacker;
591 Gtk::VBox global_vpacker;
592 Gtk::VBox vpacker;
594 bool need_resize_line;
595 int resize_line_y;
596 int old_resize_line_y;
598 Gdk::Cursor* current_canvas_cursor;
599 void set_canvas_cursor ();
600 Gdk::Cursor* which_grabber_cursor ();
602 ArdourCanvas::Canvas* track_canvas;
603 ArdourCanvas::NoEventText* verbose_canvas_cursor;
604 bool verbose_cursor_visible;
606 void parameter_changed (const char *);
608 bool track_canvas_motion (GdkEvent*);
610 void set_verbose_canvas_cursor (const string &, double x, double y);
611 void set_verbose_canvas_cursor_text (const string &);
612 void show_verbose_canvas_cursor();
613 void hide_verbose_canvas_cursor();
615 bool verbose_cursor_on; // so far unused
617 Gtk::EventBox time_canvas_event_box;
618 Gtk::EventBox track_canvas_event_box;
619 Gtk::EventBox time_button_event_box;
620 Gtk::EventBox ruler_label_event_box;
622 ArdourCanvas::Pixbuf* logo_item;
623 ArdourCanvas::Group* minsec_group;
624 ArdourCanvas::Group* bbt_group;
625 ArdourCanvas::Group* smpte_group;
626 ArdourCanvas::Group* frame_group;
627 ArdourCanvas::Group* tempo_group;
628 ArdourCanvas::Group* meter_group;
629 ArdourCanvas::Group* marker_group;
630 ArdourCanvas::Group* range_marker_group;
631 ArdourCanvas::Group* transport_marker_group;
632 ArdourCanvas::Group* cd_marker_group;
634 ArdourCanvas::Group* timebar_group;
636 /* These bars never need to be scrolled */
637 ArdourCanvas::Group* meter_bar_group;
638 ArdourCanvas::Group* tempo_bar_group;
639 ArdourCanvas::Group* marker_bar_group;
640 ArdourCanvas::Group* range_marker_bar_group;
641 ArdourCanvas::Group* transport_marker_bar_group;
642 ArdourCanvas::Group* cd_marker_bar_group;
644 ArdourCanvas::Group* _background_group;
646 The _master_group is the group containing all items
647 that require horizontal scrolling..
648 It is primarily used to separate canvas items
649 that require horizontal scrolling from those that do not.
651 ArdourCanvas::Group* _master_group;
653 The _trackview_group is the group containing all trackviews.
654 It is only scrolled vertically.
656 ArdourCanvas::Group* _trackview_group;
658 This canvas group is used for region motion.
659 It sits on top of the _trackview_group
661 ArdourCanvas::Group* _region_motion_group;
663 enum RulerType {
664 ruler_metric_smpte = 0,
665 ruler_metric_bbt = 1,
666 ruler_metric_frames = 2,
667 ruler_metric_minsec = 3,
669 ruler_time_tempo = 4,
670 ruler_time_meter = 5,
671 ruler_time_marker = 6,
672 ruler_time_range_marker = 7,
673 ruler_time_transport_marker = 8,
674 ruler_time_cd_marker = 9,
677 static GtkCustomMetric ruler_metrics[4];
678 Glib::RefPtr<Gtk::ToggleAction> ruler_timecode_action;
679 Glib::RefPtr<Gtk::ToggleAction> ruler_bbt_action;
680 Glib::RefPtr<Gtk::ToggleAction> ruler_samples_action;
681 Glib::RefPtr<Gtk::ToggleAction> ruler_minsec_action;
682 Glib::RefPtr<Gtk::ToggleAction> ruler_tempo_action;
683 Glib::RefPtr<Gtk::ToggleAction> ruler_meter_action;
684 Glib::RefPtr<Gtk::ToggleAction> ruler_marker_action;
685 Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
686 Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
687 Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
688 bool no_ruler_shown_update;
690 gint ruler_button_press (GdkEventButton*);
691 gint ruler_button_release (GdkEventButton*);
692 gint ruler_mouse_motion (GdkEventMotion*);
693 bool ruler_scroll (GdkEventScroll* event);
695 gint ruler_pressed_button;
696 Gtk::Widget * ruler_grabbed_widget;
698 void initialize_rulers ();
699 void update_just_smpte ();
700 void update_fixed_rulers ();
701 void update_tempo_based_rulers ();
702 void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem);
703 void update_ruler_visibility ();
704 void set_ruler_visible (RulerType, bool);
705 void toggle_ruler_visibility (RulerType rt);
706 void ruler_toggled (int);
707 gint ruler_label_button_release (GdkEventButton*);
708 void store_ruler_visibility ();
709 void restore_ruler_visibility ();
711 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
712 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
713 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
714 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
716 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
717 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
718 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
719 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
721 Gtk::Widget *_ruler_separator;
722 GtkWidget *_smpte_ruler;
723 GtkWidget *_bbt_ruler;
724 GtkWidget *_frames_ruler;
725 GtkWidget *_minsec_ruler;
726 Gtk::Widget *smpte_ruler;
727 Gtk::Widget *bbt_ruler;
728 Gtk::Widget *frames_ruler;
729 Gtk::Widget *minsec_ruler;
730 static Editor *ruler_editor;
732 static const double timebar_height;
733 guint32 visible_timebars;
734 gdouble canvas_timebars_vsize;
735 gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
736 Gtk::Menu *editor_ruler_menu;
738 ArdourCanvas::SimpleRect* tempo_bar;
739 ArdourCanvas::SimpleRect* meter_bar;
740 ArdourCanvas::SimpleRect* marker_bar;
741 ArdourCanvas::SimpleRect* range_marker_bar;
742 ArdourCanvas::SimpleRect* transport_marker_bar;
743 ArdourCanvas::SimpleRect* cd_marker_bar;
746 ArdourCanvas::SimpleLine* tempo_line;
747 ArdourCanvas::SimpleLine* meter_line;
748 ArdourCanvas::SimpleLine* marker_line;
749 ArdourCanvas::SimpleLine* range_marker_line;
750 ArdourCanvas::SimpleLine* transport_marker_line;
751 ArdourCanvas::SimpleLine* cd_marker_line;
753 Gtk::Label minsec_label;
754 Gtk::Label bbt_label;
755 Gtk::Label smpte_label;
756 Gtk::Label frame_label;
757 Gtk::Label tempo_label;
758 Gtk::Label meter_label;
759 Gtk::Label mark_label;
760 Gtk::Label range_mark_label;
761 Gtk::Label transport_mark_label;
762 Gtk::Label cd_mark_label;
765 Gtk::VBox time_button_vbox;
766 Gtk::HBox time_button_hbox;
768 struct Cursor {
769 Editor& editor;
770 ArdourCanvas::Points points;
771 ArdourCanvas::Line canvas_item;
772 nframes64_t current_frame;
773 double length;
775 Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
776 ~Cursor ();
778 void set_position (nframes64_t);
779 void set_length (double units);
780 void set_y_axis (double position);
783 friend struct Cursor; /* it needs access to several private
784 fields. XXX fix me.
787 Cursor* playhead_cursor;
788 ArdourCanvas::Group* cursor_group;
790 nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
792 void cursor_to_region_boundary (bool with_selection, int32_t dir);
793 void cursor_to_next_region_boundary (bool with_selection);
794 void cursor_to_previous_region_boundary (bool with_selection);
795 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
796 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
797 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
798 void cursor_to_selection_start (Cursor *);
799 void cursor_to_selection_end (Cursor *);
801 void selected_marker_to_region_boundary (bool with_selection, int32_t dir);
802 void selected_marker_to_next_region_boundary (bool with_selection);
803 void selected_marker_to_previous_region_boundary (bool with_selection);
804 void selected_marker_to_next_region_point (ARDOUR::RegionPoint);
805 void selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
806 void selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
807 void selected_marker_to_selection_start ();
808 void selected_marker_to_selection_end ();
810 void select_all_selectables_using_cursor (Cursor *, bool);
811 void select_all_selectables_using_edit (bool);
812 void select_all_selectables_between (bool within);
813 void select_range_between ();
815 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
816 nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&);
818 vector<nframes64_t> region_boundary_cache;
819 void build_region_boundary_cache ();
821 Gtk::HBox top_hbox;
822 Gtk::HBox bottom_hbox;
824 Gtk::Table edit_packer;
825 Gtk::VScrollbar edit_vscrollbar;
827 Gtk::Adjustment vertical_adjustment;
828 Gtk::Adjustment horizontal_adjustment;
830 Gtk::Layout controls_layout;
831 bool control_layout_scroll (GdkEventScroll* ev);
832 void controls_layout_size_request (Gtk::Requisition*);
833 sigc::connection controls_layout_size_request_connection;
835 Gtk::HScrollbar edit_hscrollbar;
836 bool _dragging_hscrollbar;
838 void reset_hscrollbar_stepping ();
840 bool hscrollbar_button_press (GdkEventButton*);
841 bool hscrollbar_button_release (GdkEventButton*);
842 void hscrollbar_allocate (Gtk::Allocation &alloc);
844 double canvas_width;
845 double canvas_height;
846 double full_canvas_height;
848 bool track_canvas_map_handler (GdkEventAny*);
850 gint edit_controls_button_release (GdkEventButton*);
851 Gtk::Menu *edit_controls_left_menu;
852 Gtk::Menu *edit_controls_right_menu;
854 Gtk::VBox ruler_label_vbox;
855 Gtk::VBox track_canvas_vbox;
856 Gtk::VBox time_canvas_vbox;
857 Gtk::VBox edit_controls_vbox;
858 Gtk::HBox edit_controls_hbox;
860 void control_scroll (float);
861 void access_action (std::string,std::string);
862 bool deferred_control_scroll (nframes64_t);
863 sigc::connection control_scroll_connection;
865 gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
867 ArdourCanvas::Group* get_background_group () const { return _background_group; }
868 ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
869 double last_trackview_group_vertical_offset;
870 void tie_vertical_scrolling ();
871 void scroll_canvas_horizontally ();
872 void scroll_canvas_vertically ();
874 struct VisualChange {
875 enum Type {
876 TimeOrigin = 0x1,
877 ZoomLevel = 0x2
880 Type pending;
881 nframes64_t time_origin;
882 double frames_per_unit;
884 int idle_handler_id;
886 VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1) {}
890 VisualChange pending_visual_change;
892 static int _idle_visual_changer (void *arg);
893 int idle_visual_changer ();
895 void queue_visual_change (nframes64_t);
896 void queue_visual_change (double);
898 void end_location_changed (ARDOUR::Location*);
900 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
901 RegionListDisplayModelColumns() {
902 add (name);
903 add (region);
904 add (color_);
906 Gtk::TreeModelColumn<Glib::ustring> name;
907 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
908 Gtk::TreeModelColumn<Gdk::Color> color_;
911 RegionListDisplayModelColumns region_list_columns;
912 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
914 Glib::RefPtr<Gtk::TreeStore> region_list_model;
915 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
916 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
918 void region_list_selection_changed ();
919 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
920 void region_name_edit (const Glib::ustring&, const Glib::ustring&);
921 void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
923 Gtk::Menu *region_list_menu;
924 Gtk::ScrolledWindow region_list_scroller;
925 Gtk::Frame region_list_frame;
927 bool region_list_display_key_press (GdkEventKey *);
928 bool region_list_display_key_release (GdkEventKey *);
929 bool region_list_display_button_press (GdkEventButton *);
930 bool region_list_display_button_release (GdkEventButton *);
931 void region_list_clear ();
932 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
933 void build_region_list_menu ();
934 void show_region_list_display_context_menu (int button, int time);
936 bool show_automatic_regions_in_region_list;
937 Editing::RegionListSortType region_list_sort_type;
939 void reset_region_list_sort_direction (bool);
940 void reset_region_list_sort_type (Editing::RegionListSortType);
942 void toggle_full_region_list ();
943 void toggle_show_auto_regions ();
945 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
947 /* snapshots */
949 Gtk::ScrolledWindow snapshot_display_scroller;
950 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
951 SnapshotDisplayModelColumns() {
952 add (visible_name);
953 add (real_name);
955 Gtk::TreeModelColumn<Glib::ustring> visible_name;
956 Gtk::TreeModelColumn<Glib::ustring> real_name;
959 SnapshotDisplayModelColumns snapshot_display_columns;
960 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
961 Gtk::TreeView snapshot_display;
962 Gtk::Menu snapshot_context_menu;
964 bool snapshot_display_button_press (GdkEventButton*);
965 void snapshot_display_selection_changed ();
966 void redisplay_snapshots();
967 void popup_snapshot_context_menu (int, int32_t, Glib::ustring);
969 /* named selections */
971 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
972 NamedSelectionDisplayModelColumns() {
973 add (text);
974 add (selection);
976 Gtk::TreeModelColumn<Glib::ustring> text;
977 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
980 NamedSelectionDisplayModelColumns named_selection_columns;
981 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
983 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
984 Gtk::ScrolledWindow named_selection_scroller;
986 void create_named_selection ();
987 void paste_named_selection (float times);
988 void remove_selected_named_selections ();
989 void remove_snapshot (Glib::ustring);
990 void rename_snapshot (Glib::ustring);
992 void handle_new_named_selection ();
993 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
994 void redisplay_named_selections ();
996 bool named_selection_display_button_release (GdkEventButton *ev);
997 bool named_selection_display_key_release (GdkEventKey *ev);
998 void named_selection_display_selection_changed ();
1000 /* track views */
1001 TrackViewList track_views;
1002 TimeAxisView *trackview_by_y_position (double ypos);
1004 static Gdk::Cursor* cross_hair_cursor;
1005 static Gdk::Cursor* trimmer_cursor;
1006 static Gdk::Cursor* selector_cursor;
1007 static Gdk::Cursor* grabber_cursor;
1008 static Gdk::Cursor* grabber_edit_point_cursor;
1009 static Gdk::Cursor* zoom_cursor;
1010 static Gdk::Cursor* time_fx_cursor;
1011 static Gdk::Cursor* fader_cursor;
1012 static Gdk::Cursor* speaker_cursor;
1013 static Gdk::Cursor* wait_cursor;
1014 static Gdk::Cursor* timebar_cursor;
1015 static Gdk::Cursor* transparent_cursor;
1017 static void build_cursors ();
1019 sigc::connection scroll_connection;
1020 nframes64_t last_update_frame;
1021 void center_screen (nframes64_t);
1022 void center_screen_internal (nframes64_t, float);
1024 void update_current_screen ();
1026 void session_going_away ();
1028 nframes64_t cut_buffer_start;
1029 nframes64_t cut_buffer_length;
1031 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
1032 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1033 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1034 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
1035 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1036 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
1038 /* KEYMAP HANDLING */
1040 void register_actions ();
1042 int ensure_cursor (nframes64_t* pos);
1044 void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
1045 void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
1046 void handle_audio_region_removed (boost::weak_ptr<ARDOUR::AudioRegion>);
1047 void add_audio_region_to_region_display (boost::shared_ptr<ARDOUR::AudioRegion>);
1048 void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
1049 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
1050 void redisplay_regions ();
1051 bool no_region_list_redisplay;
1052 void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
1054 list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
1056 void cut_copy (Editing::CutCopyOp);
1057 void cut_copy_points (Editing::CutCopyOp);
1058 void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
1059 void cut_copy_ranges (Editing::CutCopyOp);
1061 void mouse_paste ();
1062 void paste_internal (nframes64_t position, float times);
1064 /* EDITING OPERATIONS */
1066 void reset_point_selection ();
1067 void toggle_region_mute ();
1068 void toggle_region_lock ();
1069 void toggle_region_opaque ();
1070 void toggle_record_enable ();
1071 void set_region_lock_style (ARDOUR::Region::PositionLockStyle);
1072 void raise_region ();
1073 void raise_region_to_top ();
1074 void change_region_layering_order (nframes64_t);
1075 void lower_region ();
1076 void lower_region_to_bottom ();
1077 void split_region ();
1078 void split_region_at (nframes64_t);
1079 void split_regions_at (nframes64_t, RegionSelection&);
1080 void split_region_at_transients ();
1081 void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
1082 void crop_region_to_selection ();
1083 void crop_region_to (nframes64_t start, nframes64_t end);
1084 void set_sync_point (nframes64_t, const RegionSelection&);
1085 void set_region_sync_from_edit_point ();
1086 void remove_region_sync();
1087 void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&);
1088 void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&);
1089 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1090 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
1091 void remove_region ();
1092 void remove_clicked_region ();
1093 void edit_region ();
1094 void rename_region ();
1095 void duplicate_some_regions (RegionSelection&, float times);
1096 void duplicate_selection (float times);
1097 void region_fill_selection ();
1099 void region_fill_track ();
1100 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
1101 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
1102 void split_multichannel_region();
1103 void reverse_region ();
1104 void normalize_region ();
1105 void denormalize_region ();
1106 void adjust_region_scale_amplitude (bool up);
1108 void do_insert_time ();
1109 void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too, bool tempo_too);
1111 void tab_to_transient (bool forward);
1113 void use_region_as_bar ();
1114 void use_range_as_bar ();
1116 void define_one_bar (nframes64_t start, nframes64_t end);
1118 void audition_region_from_region_list ();
1119 void hide_region_from_region_list ();
1120 void remove_region_from_region_list ();
1122 void align (ARDOUR::RegionPoint);
1123 void align_relative (ARDOUR::RegionPoint);
1124 void naturalize ();
1126 void reset_focus ();
1128 void split ();
1130 void cut ();
1131 void copy ();
1132 void paste (float times);
1134 int get_prefix (float&, bool&);
1136 void keyboard_paste ();
1137 void keyboard_insert_region_list_selection ();
1139 void region_from_selection ();
1140 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
1142 void play_from_start ();
1143 void play_from_edit_point ();
1144 void play_from_edit_point_and_return ();
1145 void play_selected_region ();
1146 void play_edit_range ();
1147 void loop_selected_region ();
1148 void play_location (ARDOUR::Location&);
1149 void loop_location (ARDOUR::Location&);
1151 void temporal_zoom_selection ();
1152 void temporal_zoom_region (bool both_axes);
1153 void toggle_zoom_region (bool both_axes);
1154 void temporal_zoom_session ();
1155 void temporal_zoom (gdouble scale);
1156 void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op);
1157 void temporal_zoom_to_frame (bool coarser, nframes64_t frame);
1159 void amplitude_zoom (gdouble scale);
1160 void amplitude_zoom_step (bool in);
1162 void insert_region_list_drag (boost::shared_ptr<ARDOUR::AudioRegion>, int x, int y);
1163 void insert_region_list_selection (float times);
1165 void add_external_audio_action (Editing::ImportMode);
1166 void external_audio_dialog ();
1168 int check_whether_and_how_to_import(string, bool all_or_nothing = true);
1169 bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
1171 SoundFileOmega* sfbrowser;
1173 void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
1175 bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
1176 void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
1178 void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
1179 void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
1181 int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
1182 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool, uint32_t total);
1183 int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
1184 nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
1186 int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
1187 int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
1188 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode,
1189 boost::shared_ptr<ARDOUR::AudioTrack>& existing_track);
1191 boost::shared_ptr<ARDOUR::AudioTrack> get_nth_selected_audio_track (int nth) const;
1193 /* generic interthread progress window */
1195 ArdourDialog* interthread_progress_window;
1196 Gtk::Label interthread_progress_label;
1197 Gtk::VBox interthread_progress_vbox;
1198 Gtk::ProgressBar interthread_progress_bar;
1199 Gtk::Button interthread_cancel_button;
1200 Gtk::Label interthread_cancel_label;
1201 sigc::connection interthread_progress_connection;
1202 void interthread_cancel_clicked ();
1203 void build_interthread_progress_window ();
1204 ARDOUR::InterThreadInfo* current_interthread_info;
1206 #ifdef FFT_ANALYSIS
1207 AnalysisWindow* analysis_window;
1208 #endif
1210 /* import specific info */
1212 struct EditorImportStatus : public ARDOUR::Session::import_status {
1213 Editing::ImportMode mode;
1214 nframes64_t pos;
1215 int target_tracks;
1216 int target_regions;
1217 boost::shared_ptr<ARDOUR::AudioTrack> track;
1218 bool replace;
1221 EditorImportStatus import_status;
1222 gint import_progress_timeout (void *);
1223 static void *_import_thread (void *);
1224 void* import_thread ();
1225 void finish_import ();
1227 /* to support this ... */
1229 void import_audio (bool as_tracks);
1230 void do_import (vector<Glib::ustring> paths, bool split, bool as_tracks);
1232 void move_to_start ();
1233 void move_to_end ();
1234 void goto_frame ();
1235 void center_playhead ();
1236 void center_edit_point ();
1237 void edit_cursor_backward ();
1238 void edit_cursor_forward ();
1239 void playhead_forward_to_grid ();
1240 void playhead_backward_to_grid ();
1241 void playhead_backward ();
1242 void playhead_forward ();
1243 void scroll_playhead (bool forward);
1244 void scroll_backward (float pages=0.8f);
1245 void scroll_forward (float pages=0.8f);
1246 void scroll_tracks_down ();
1247 void scroll_tracks_up ();
1248 void delete_sample_forward ();
1249 void delete_sample_backward ();
1250 void delete_screen ();
1251 void search_backwards ();
1252 void search_forwards ();
1253 void set_mark ();
1254 void clear_markers ();
1255 void clear_ranges ();
1256 void clear_locations ();
1257 void unhide_markers ();
1258 void unhide_ranges ();
1259 void jump_forward_to_mark ();
1260 void jump_backward_to_mark ();
1261 void cursor_align (bool playhead_to_edit);
1263 void remove_last_capture ();
1264 void select_all_selectables_using_time_selection ();
1265 void select_all_selectables_using_loop();
1266 void select_all_selectables_using_punch();
1267 void set_selection_from_range (ARDOUR::Location&);
1268 void set_selection_from_punch ();
1269 void set_selection_from_loop ();
1270 void set_selection_from_audio_region ();
1272 void add_location_mark (nframes64_t where);
1273 void add_location_from_audio_region ();
1274 void add_locations_from_audio_region ();
1275 void add_location_from_selection ();
1276 void set_loop_from_selection (bool play);
1277 void set_punch_from_selection ();
1278 void set_punch_from_region ();
1280 void set_loop_from_edit_range (bool play);
1281 void set_loop_from_region (bool play);
1282 void set_punch_from_edit_range ();
1284 void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd);
1285 void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd);
1287 void add_location_from_playhead_cursor ();
1288 bool select_new_marker;
1290 void reverse_selection ();
1291 void edit_envelope ();
1293 void start_scrolling ();
1294 void stop_scrolling ();
1296 bool _scrubbing;
1297 double last_scrub_x;
1298 int scrubbing_direction;
1299 int scrub_reversals;
1300 int scrub_reverse_distance;
1301 void scrub ();
1303 void keyboard_selection_begin ();
1304 void keyboard_selection_finish (bool add);
1305 bool have_pending_keyboard_selection;
1306 nframes64_t pending_keyboard_selection_start;
1308 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1309 void extend_selection_to_end_of_region (bool next);
1310 void extend_selection_to_start_of_region (bool previous);
1312 Editing::SnapType snap_type;
1313 Editing::SnapMode snap_mode;
1314 double snap_threshold;
1316 void handle_gui_changes (const string &, void *);
1317 bool ignore_gui_changes;
1319 void hide_all_tracks (bool with_select);
1321 DragInfo drag_info;
1322 LineDragInfo current_line_drag_info;
1324 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1325 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1326 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1327 void break_drag ();
1328 void finalize_drag ();
1330 Gtk::Menu fade_context_menu;
1331 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1333 void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1335 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1336 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1337 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1338 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1339 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1340 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1342 void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
1343 void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
1345 void set_fade_length (bool in);
1346 void toggle_fade_active (bool in);
1347 void set_fade_in_active (bool);
1348 void set_fade_out_active (bool);
1350 std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
1351 RegionSelection pre_drag_region_selection;
1352 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1353 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1354 bool check_region_drag_possible (AudioTimeAxisView**);
1355 void possibly_copy_regions_during_grab (GdkEvent*);
1356 void region_drag_splice_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1357 void region_drag_splice_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1359 bool _dragging_playhead;
1360 bool _dragging_edit_point;
1362 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1363 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1364 void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
1365 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1366 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1367 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1368 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1369 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1370 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1372 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1373 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1374 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1375 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1377 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1379 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1380 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1381 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1382 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1383 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1384 void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
1385 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1386 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1387 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1388 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1389 void start_line_grab (AutomationLine *, GdkEvent*);
1390 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1391 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1392 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1393 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1395 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1397 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1398 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1400 void mouse_brush_insert_region (RegionView*, nframes64_t pos);
1401 void brush (nframes64_t);
1403 void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1404 void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1);
1405 double clamp_verbose_cursor_x (double);
1406 double clamp_verbose_cursor_y (double);
1408 /* Canvas event handlers */
1410 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1411 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1412 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1413 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1414 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1415 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1416 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1417 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1418 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1419 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1422 // These variables are used to detect a feedback loop and break it to avoid a gui hang
1423 private:
1424 ArdourCanvas::Item *last_item_entered;
1425 int last_item_entered_n;
1426 public:
1428 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1429 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1430 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1431 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1432 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1433 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1434 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1435 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1436 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1438 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1439 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1440 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1441 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1442 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1443 bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1445 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1446 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1447 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1448 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1449 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1450 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1451 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1452 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1454 /* non-public event handlers */
1456 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1457 bool track_canvas_scroll (GdkEventScroll* event);
1459 bool track_canvas_scroll_event (GdkEventScroll* event);
1460 bool track_canvas_button_press_event (GdkEventButton* event);
1461 bool track_canvas_button_release_event (GdkEventButton* event);
1462 bool track_canvas_motion_notify_event (GdkEventMotion* event);
1464 Gtk::Allocation canvas_allocation;
1465 void track_canvas_allocate (Gtk::Allocation alloc);
1466 bool track_canvas_size_allocated ();
1468 void set_playhead_cursor ();
1470 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1471 void kbd_mute_unmute_region ();
1472 void kbd_brush ();
1474 void kbd_do_brush (GdkEvent*);
1475 void kbd_do_audition (GdkEvent*);
1477 void handle_new_duration ();
1478 void initialize_canvas ();
1480 /* display control */
1482 bool _show_measures;
1484 bool _show_waveforms;
1485 bool _show_waveforms_rectified;
1486 bool _show_waveforms_recording;
1488 bool _stationary_playhead;
1489 bool _follow_playhead;
1491 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1493 TempoLines* tempo_lines;
1495 ArdourCanvas::Group* time_line_group;
1496 ArdourCanvas::SimpleLine* get_time_line ();
1497 void hide_measures ();
1498 void draw_measures ();
1499 bool redraw_measures ();
1501 void new_tempo_section ();
1503 void mouse_add_new_tempo_event (nframes64_t where);
1504 void mouse_add_new_meter_event (nframes64_t where);
1506 void remove_tempo_marker (ArdourCanvas::Item*);
1507 void remove_meter_marker (ArdourCanvas::Item*);
1508 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1509 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1511 void edit_tempo_section (ARDOUR::TempoSection*);
1512 void edit_meter_section (ARDOUR::MeterSection*);
1513 void edit_tempo_marker (ArdourCanvas::Item*);
1514 void edit_meter_marker (ArdourCanvas::Item*);
1516 void marker_menu_edit ();
1517 void marker_menu_remove ();
1518 void marker_menu_rename ();
1519 void marker_menu_lock (bool yn);
1520 void marker_menu_hide ();
1521 void marker_menu_loop_range ();
1522 void marker_menu_select_all_selectables_using_range ();
1523 void marker_menu_select_using_range ();
1524 void marker_menu_separate_regions_using_location ();
1525 void marker_menu_play_from ();
1526 void marker_menu_play_range ();
1527 void marker_menu_set_playhead ();
1528 void marker_menu_set_from_playhead ();
1529 void marker_menu_set_from_selection ();
1530 void marker_menu_range_to_next ();
1531 void marker_menu_export_range ();
1532 void new_transport_marker_menu_set_loop ();
1533 void new_transport_marker_menu_set_punch ();
1534 void update_loop_range_view (bool visibility=false);
1535 void update_punch_range_view (bool visibility=false);
1536 void new_transport_marker_menu_popdown ();
1537 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1538 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1539 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1540 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1541 void build_range_marker_menu (bool loop_or_punch);
1542 void build_marker_menu (bool start_or_end);
1543 void build_tm_marker_menu ();
1544 void build_new_transport_marker_menu ();
1546 Gtk::Menu* tm_marker_menu;
1547 Gtk::Menu* marker_menu;
1548 Gtk::Menu* start_end_marker_menu;
1549 Gtk::Menu* range_marker_menu;
1550 Gtk::Menu* transport_marker_menu;
1551 Gtk::Menu* new_transport_marker_menu;
1552 Gtk::Menu* cd_marker_menu;
1553 ArdourCanvas::Item* marker_menu_item;
1555 typedef list<Marker*> Marks;
1556 Marks metric_marks;
1558 void remove_metric_marks ();
1559 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1561 void compute_current_bbt_points (nframes_t left, nframes_t right);
1562 void tempo_map_changed (ARDOUR::Change);
1563 void redisplay_tempo (bool immediate_redraw);
1565 void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
1567 uint32_t bbt_beat_subdivision;
1569 /* toolbar */
1571 void editor_mixer_button_toggled ();
1573 AudioClock edit_point_clock;
1574 AudioClock zoom_range_clock;
1575 Gtk::Button zoom_in_button;
1576 Gtk::Button zoom_out_button;
1577 Gtk::Button zoom_out_full_button;
1578 Gtk::Button zoom_onetoone_button;
1580 Gtk::VBox toolbar_clock_vbox;
1581 Gtk::VBox toolbar_selection_clock_vbox;
1582 Gtk::Table toolbar_selection_clock_table;
1583 Gtk::Label toolbar_selection_cursor_label;
1585 Gtk::HBox mouse_mode_button_box;
1586 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1587 Gtk::ToggleButton mouse_select_button;
1588 Gtk::ToggleButton mouse_move_button;
1589 Gtk::ToggleButton mouse_gain_button;
1590 Gtk::ToggleButton mouse_zoom_button;
1591 Gtk::ToggleButton mouse_timefx_button;
1592 Gtk::ToggleButton mouse_audition_button;
1593 GroupedButtons *mouse_mode_button_set;
1594 void mouse_mode_toggled (Editing::MouseMode m);
1595 bool ignore_mouse_mode_toggle;
1597 gint mouse_select_button_release (GdkEventButton*);
1599 Gtk::VBox automation_box;
1600 Gtk::Button automation_mode_button;
1601 Gtk::ToggleButton global_automation_button;
1603 Gtk::ComboBoxText edit_mode_selector;
1604 Gtk::VBox edit_mode_box;
1606 void set_edit_mode (ARDOUR::EditMode);
1607 void cycle_edit_mode ();
1608 void edit_mode_selection_done ();
1610 Gtk::ComboBoxText snap_type_selector;
1611 Gtk::ComboBoxText snap_mode_selector;
1612 Gtk::HBox snap_box;
1614 std::vector<std::string> snap_type_strings;
1615 std::vector<std::string> snap_mode_strings;
1617 void snap_type_selection_done ();
1618 void snap_mode_selection_done ();
1619 void snap_mode_chosen (Editing::SnapMode);
1620 void snap_type_chosen (Editing::SnapType);
1622 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1623 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1625 Gtk::ComboBoxText zoom_focus_selector;
1626 Gtk::VBox zoom_focus_box;
1628 std::vector<std::string> zoom_focus_strings;
1630 void zoom_focus_selection_done ();
1631 void zoom_focus_chosen (Editing::ZoomFocus);
1633 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1635 Gtk::HBox zoom_box;
1637 void zoom_adjustment_changed();
1639 void edit_point_clock_changed();
1641 void setup_toolbar ();
1643 Gtkmm2ext::TearOff* tools_tearoff;
1644 Gtk::HBox toolbar_hbox;
1645 Gtk::EventBox toolbar_base;
1646 Gtk::Frame toolbar_frame;
1648 /* selection process */
1650 Selection* selection;
1651 Selection* cut_buffer;
1653 void time_selection_changed ();
1654 void track_selection_changed ();
1655 void region_selection_changed ();
1656 void sensitize_the_right_region_actions (bool have_selected_regions);
1657 void point_selection_changed ();
1658 void marker_selection_changed ();
1660 enum SelectionOp {
1661 CreateSelection,
1662 SelectionStartTrim,
1663 SelectionEndTrim,
1664 SelectionMove
1665 } selection_op;
1667 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1668 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1669 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1670 void cancel_selection ();
1672 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1673 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1674 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1676 bool audio_region_selection_covers (nframes64_t where);
1678 /* transport range select process */
1679 enum RangeMarkerOp {
1680 CreateRangeMarker,
1681 CreateTransportMarker,
1682 CreateCDMarker
1683 } range_marker_op;
1685 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1686 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1687 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1689 ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
1690 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1691 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1692 ArdourCanvas::Line* marker_drag_line;
1693 ArdourCanvas::Points marker_drag_line_points;
1694 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1696 void update_marker_drag_item (ARDOUR::Location *);
1697 #ifdef GTKOSX
1698 ArdourCanvas::SimpleRect *bogus_background_rect;
1699 #endif
1700 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1701 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1702 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1703 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1704 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1705 ArdourCanvas::SimpleLine *transport_punchin_line;
1706 ArdourCanvas::SimpleLine *transport_punchout_line;
1707 ArdourCanvas::SimpleRect *transport_preroll_rect;
1708 ArdourCanvas::SimpleRect *transport_postroll_rect;
1710 ARDOUR::Location* transport_loop_location();
1711 ARDOUR::Location* transport_punch_location();
1713 ARDOUR::Location *temp_location;
1715 /* object rubberband select process */
1717 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1718 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1719 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1721 bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op);
1723 ArdourCanvas::SimpleRect *rubberband_rect;
1725 /* mouse zoom process */
1727 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1728 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1729 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1731 ArdourCanvas::SimpleRect *zoom_rect;
1732 void reposition_zoom_rect (nframes64_t start, nframes64_t end);
1734 /* diskstream/route display management */
1736 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1737 RouteDisplayModelColumns() {
1738 add (text);
1739 add (visible);
1740 add (temporary_visible);
1741 add (tv);
1742 add (route);
1744 Gtk::TreeModelColumn<Glib::ustring> text;
1745 Gtk::TreeModelColumn<bool> visible;
1746 Gtk::TreeModelColumn<bool> temporary_visible;
1747 Gtk::TreeModelColumn<TimeAxisView*> tv;
1748 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
1751 RouteDisplayModelColumns route_display_columns;
1752 Glib::RefPtr<Gtk::ListStore> route_display_model;
1753 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1755 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1756 Gtk::ScrolledWindow route_list_scroller;
1757 Gtk::Menu* route_list_menu;
1759 void update_route_visibility ();
1761 void sync_order_keys (const char*);
1762 bool route_redisplay_does_not_sync_order_keys;
1763 bool route_redisplay_does_not_reset_order_keys;
1765 bool route_list_display_button_press (GdkEventButton*);
1766 void route_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1767 gint x,
1768 gint y,
1769 const Gtk::SelectionData& data,
1770 guint info,
1771 guint time);
1773 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1775 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1776 void route_list_delete (const Gtk::TreeModel::Path&);
1777 void track_list_reorder (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* new_order);
1779 void initial_route_list_display ();
1780 void redisplay_route_list();
1781 bool ignore_route_list_reorder;
1782 bool no_route_list_redisplay;
1783 bool sync_track_view_list_and_route_list ();
1785 void build_route_list_menu ();
1786 void show_route_list_menu ();
1788 void show_all_routes ();
1789 void hide_all_routes ();
1790 void show_all_audiotracks ();
1791 void hide_all_audiotracks ();
1792 void show_tracks_with_regions_at_playhead ();
1793 void show_all_audiobus ();
1794 void hide_all_audiobus ();
1796 void set_all_tracks_visibility (bool yn);
1797 void set_all_audio_visibility (int type, bool yn);
1799 /* edit group management */
1801 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1802 GroupListModelColumns () {
1803 add (is_active);
1804 add (is_visible);
1805 add (text);
1806 add (routegroup);
1808 Gtk::TreeModelColumn<bool> is_active;
1809 Gtk::TreeModelColumn<bool> is_visible;
1810 Gtk::TreeModelColumn<std::string> text;
1811 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1814 GroupListModelColumns group_columns;
1815 Glib::RefPtr<Gtk::ListStore> group_model;
1816 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1818 Gtk::TreeView edit_group_display;
1819 Gtk::ScrolledWindow edit_group_display_scroller;
1820 Gtk::Menu* edit_group_list_menu;
1822 void build_edit_group_list_menu ();
1823 void activate_all_edit_groups ();
1824 void disable_all_edit_groups ();
1825 void show_all_edit_groups ();
1826 void hide_all_edit_groups ();
1828 bool in_edit_group_row_change;
1829 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1830 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1831 void new_edit_group ();
1832 void edit_group_list_button_clicked ();
1833 gint edit_group_list_button_press_event (GdkEventButton* ev);
1834 void add_edit_group (ARDOUR::RouteGroup* group);
1835 void remove_selected_edit_group ();
1836 void edit_groups_changed ();
1837 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1839 Gtk::VBox list_vpacker;
1841 /* autoscrolling */
1843 bool autoscroll_active;
1844 int autoscroll_timeout_tag;
1845 int autoscroll_x;
1846 int autoscroll_y;
1847 int last_autoscroll_x;
1848 int last_autoscroll_y;
1849 uint32_t autoscroll_cnt;
1850 nframes64_t autoscroll_x_distance;
1851 double autoscroll_y_distance;
1853 static gint _autoscroll_canvas (void *);
1854 bool autoscroll_canvas ();
1855 void start_canvas_autoscroll (int x, int y);
1856 void stop_canvas_autoscroll ();
1857 void maybe_autoscroll (GdkEventMotion*);
1858 void maybe_autoscroll_horizontally (GdkEventMotion*);
1859 bool allow_vertical_scroll;
1861 /* trimming */
1862 enum TrimOp {
1863 StartTrim,
1864 EndTrim,
1865 ContentsTrim,
1866 } trim_op;
1868 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1869 void point_trim (GdkEvent*);
1870 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1871 void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool);
1872 void single_start_trim (RegionView&, nframes64_t, bool, bool);
1873 void single_end_trim (RegionView&, nframes64_t, bool, bool);
1875 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1876 void thaw_region_after_trim (RegionView& rv);
1878 void trim_region_front();
1879 void trim_region_back();
1880 void trim_region (bool front);
1882 void trim_region_to_edit_point ();
1883 void trim_region_from_edit_point ();
1884 void trim_region_to_loop ();
1885 void trim_region_to_punch ();
1886 void trim_region_to_location (const ARDOUR::Location&, const char* cmd);
1888 bool show_gain_after_trim;
1890 /* Drag-n-Drop */
1892 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1893 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 track_canvas_drag_data_received (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 region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1908 gint x,
1909 gint y,
1910 const Gtk::SelectionData& data,
1911 guint info,
1912 guint time);
1914 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1915 gint x,
1916 gint y,
1917 const Gtk::SelectionData& data,
1918 guint info,
1919 guint time);
1921 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1922 gint x,
1923 gint y,
1924 const Gtk::SelectionData& data,
1925 guint info,
1926 guint time);
1928 /* audio export */
1930 ExportDialog *export_dialog;
1931 ExportDialog *export_range_markers_dialog;
1933 void export_range (nframes64_t start, nframes64_t end);
1934 void export_range_markers ();
1936 int write_region_selection(RegionSelection&);
1937 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1938 void export_region ();
1939 void bounce_region_selection ();
1940 void bounce_range_selection (bool replace, bool enable_processing = true);
1941 void external_edit_region ();
1943 int write_audio_selection (TimeSelection&);
1944 bool write_audio_range (ARDOUR::AudioPlaylist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1946 void write_selection ();
1948 /* history */
1950 UndoAction get_memento() const;
1952 XMLNode *before; /* used in *_reversible_command */
1953 void begin_reversible_command (string cmd_name);
1954 void commit_reversible_command ();
1956 void update_title ();
1957 void update_title_s (const string & snapshot_name);
1959 struct State {
1960 Selection* selection;
1961 double frames_per_unit;
1963 State();
1964 ~State();
1967 void store_state (State&) const;
1968 void restore_state (State *);
1970 void instant_save ();
1972 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1974 /* freeze operations */
1976 ARDOUR::InterThreadInfo freeze_status;
1977 gint freeze_progress_timeout (void *);
1978 static void* _freeze_thread (void*);
1979 void* freeze_thread ();
1981 void freeze_route ();
1982 void unfreeze_route ();
1984 /* edit-group solo + mute */
1986 void set_edit_group_solo (ARDOUR::Route&, bool);
1987 void set_edit_group_mute (ARDOUR::Route&, bool);
1989 /* duplication */
1991 void duplicate_dialog (bool with_dialog);
1993 nframes64_t event_frame (GdkEvent*, double* px = 0, double* py = 0) const;
1995 /* returns false if mouse pointer is not in track or marker canvas
1997 bool mouse_frame (nframes64_t&, bool& in_track_canvas) const;
1999 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
2000 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
2001 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
2003 struct TimeFXDialog : public ArdourDialog {
2004 ARDOUR::TimeFXRequest request;
2005 Editor& editor;
2006 bool pitching;
2007 Gtk::Adjustment pitch_octave_adjustment;
2008 Gtk::Adjustment pitch_semitone_adjustment;
2009 Gtk::Adjustment pitch_cent_adjustment;
2010 Gtk::SpinButton pitch_octave_spinner;
2011 Gtk::SpinButton pitch_semitone_spinner;
2012 Gtk::SpinButton pitch_cent_spinner;
2013 RegionSelection regions;
2014 Gtk::ProgressBar progress_bar;
2016 /* SoundTouch */
2017 Gtk::ToggleButton quick_button;
2018 Gtk::ToggleButton antialias_button;
2019 Gtk::HBox upper_button_box;
2021 /* RubberBand */
2022 Gtk::ComboBoxText stretch_opts_selector;
2023 Gtk::Label stretch_opts_label;
2024 Gtk::ToggleButton precise_button;
2025 Gtk::ToggleButton preserve_formants_button;
2026 Gtk::HBox opts_box;
2028 Gtk::Button* cancel_button;
2029 Gtk::Button* action_button;
2030 Gtk::VBox packer;
2031 int status;
2033 TimeFXDialog (Editor& e, bool for_pitch);
2035 gint update_progress ();
2036 sigc::connection first_cancel;
2037 sigc::connection first_delete;
2038 void cancel_in_progress ();
2039 gint delete_in_progress (GdkEventAny*);
2042 /* "whats mine is yours" */
2044 friend class TimeFXDialog;
2046 TimeFXDialog* current_timefx;
2048 static void* timefx_thread (void *arg);
2049 void do_timefx (TimeFXDialog&);
2051 int time_stretch (RegionSelection&, float fraction);
2052 int pitch_shift (RegionSelection&, float cents);
2053 void pitch_shift_regions ();
2054 int time_fx (RegionSelection&, float val, bool pitching);
2056 /* editor-mixer strip */
2058 MixerStrip *current_mixer_strip;
2059 bool show_editor_mixer_when_tracks_arrive;
2060 Gtk::VBox current_mixer_strip_vbox;
2061 void cms_deleted ();
2062 void current_mixer_strip_hidden ();
2063 void current_mixer_strip_removed ();
2065 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
2066 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
2067 #ifdef GTKOSX
2068 void ensure_all_elements_drawn ();
2069 #endif
2070 /* nudging tracks */
2072 void nudge_track (bool use_edit_point, bool forwards);
2074 /* xfades */
2076 bool _xfade_visibility;
2078 /* <CMT Additions> */
2079 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
2080 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
2082 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
2083 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
2085 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2086 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
2087 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
2089 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2090 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
2091 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2092 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
2094 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
2095 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2096 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2097 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
2099 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2100 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2101 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2102 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2103 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2104 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2106 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2107 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
2108 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2109 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2110 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
2111 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
2113 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2114 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
2116 ImageFrameSocketHandler* image_socket_listener ;
2117 /* </CMT Additions> */
2119 void toggle_xfade_active (boost::weak_ptr<ARDOUR::Crossfade>);
2120 void toggle_xfade_length (boost::weak_ptr<ARDOUR::Crossfade>);
2121 void edit_xfade (boost::weak_ptr<ARDOUR::Crossfade>);
2122 void xfade_edit_left_region ();
2123 void xfade_edit_right_region ();
2125 static const int32_t default_width = 995;
2126 static const int32_t default_height = 765;
2128 /* nudge */
2130 Gtk::Button nudge_forward_button;
2131 Gtk::Button nudge_backward_button;
2132 Gtk::HBox nudge_hbox;
2133 Gtk::VBox nudge_vbox;
2134 AudioClock nudge_clock;
2136 nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next);
2138 bool nudge_forward_release (GdkEventButton*);
2139 bool nudge_backward_release (GdkEventButton*);
2141 /* audio filters */
2143 void apply_filter (ARDOUR::AudioFilter&, string cmd);
2145 /* handling cleanup */
2147 int playlist_deletion_dialog (boost::shared_ptr<ARDOUR::Playlist>);
2149 vector<sigc::connection> session_connections;
2151 /* tracking step changes of track height */
2153 TimeAxisView* current_stepping_trackview;
2154 ARDOUR::microseconds_t last_track_height_step_timestamp;
2155 gint track_height_step_timeout();
2156 sigc::connection step_timeout;
2158 TimeAxisView* entered_track;
2159 RegionView* entered_regionview;
2162 void ensure_entered_track_selected (bool op_acts_on_objects = false);
2163 bool clear_entered_track;
2164 bool left_track_canvas (GdkEventCrossing*);
2165 bool entered_track_canvas (GdkEventCrossing*);
2166 void set_entered_track (TimeAxisView*);
2167 void set_entered_regionview (RegionView*);
2168 void ensure_track_visible (TimeAxisView*);
2169 gint left_automation_track ();
2171 bool _new_regionviews_show_envelope;
2173 void reset_canvas_action_sensitivity (bool);
2174 void toggle_gain_envelope_visibility ();
2175 void toggle_gain_envelope_active ();
2176 void reset_region_gain_envelopes ();
2178 bool on_key_press_event (GdkEventKey*);
2179 bool on_key_release_event (GdkEventKey*);
2181 void session_state_saved (string);
2183 Glib::RefPtr<Gtk::Action> undo_action;
2184 Glib::RefPtr<Gtk::Action> redo_action;
2186 void history_changed ();
2187 void color_handler ();
2189 Gtk::HBox status_bar_hpacker;
2191 Editing::EditPoint _edit_point;
2193 Gtk::ComboBoxText edit_point_selector;
2195 void set_edit_point_preference (Editing::EditPoint ep, bool force = false);
2196 void cycle_edit_point (bool with_marker);
2197 void set_edit_point ();
2198 void edit_point_selection_done ();
2199 void edit_point_chosen (Editing::EditPoint);
2200 Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
2201 std::vector<std::string> edit_point_strings;
2203 void selected_marker_moved (ARDOUR::Location*);
2204 sigc::connection edit_point_clock_connection_a;
2205 sigc::connection edit_point_clock_connection_b;
2207 bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
2209 void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2210 void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const;
2212 void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false);
2214 sigc::connection fast_screen_update_connection;
2215 gint start_updating ();
2216 gint stop_updating ();
2217 void fast_update_strips ();
2218 bool meters_running;
2220 void select_next_route ();
2221 void select_prev_route ();
2223 void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
2225 RhythmFerret* rhythm_ferret;
2227 void fit_tracks ();
2228 void set_track_height (uint32_t h);
2229 void set_track_height_largest ();
2230 void set_track_height_large ();
2231 void set_track_height_larger ();
2232 void set_track_height_normal ();
2233 void set_track_height_smaller ();
2234 void set_track_height_small ();
2236 void remove_tracks ();
2237 void toggle_tracks_active ();
2239 bool _have_idled;
2240 int resize_idle_id;
2241 int32_t resize_idle_target;
2242 bool idle_resize();
2243 friend gboolean _idle_resize (gpointer);
2244 std::vector<TimeAxisView*> pending_resizes;
2246 RegionLayeringOrderEditor* layering_order_editor;
2248 void update_region_layering_order_editor (nframes64_t frame);
2251 #endif /* __ardour_editor_h__ */