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.
21 #ifndef __ardour_editor_h__
22 #define __ardour_editor_h__
30 #include <libgnomecanvasmm/canvas.h>
31 #include <libgnomecanvasmm/group.h>
32 #include <libgnomecanvasmm/line.h>
36 #include <gtkmm/layout.h>
37 #include <gtkmm/comboboxtext.h>
39 #include <gtkmm2ext/selector.h>
40 #include <gtkmm2ext/click_box.h>
41 #include <gtkmm2ext/dndtreeview.h>
43 #include <pbd/stateful.h>
44 #include <ardour/session.h>
45 #include <ardour/tempo.h>
46 #include <ardour/location.h>
47 #include <ardour/region.h>
49 #include "audio_clock.h"
50 #include "gtk-custom-ruler.h"
51 #include "ardour_dialog.h"
52 #include "public_editor.h"
55 #include "editor_items.h"
56 #include "region_selection.h"
64 namespace LinuxAudioSystems {
69 class AudioDiskstream;
88 class AudioTimeAxisView;
89 class AutomationTimeAxisView;
90 class AudioRegionView;
93 class PlaylistSelector;
97 class UIExportSpecification;
101 class TrackSelection;
102 class AutomationSelection;
105 class AudioStreamView;
108 class AnalysisWindow;
111 /* <CMT Additions> */
112 class ImageFrameView;
113 class ImageFrameTimeAxisView;
114 class ImageFrameTimeAxis;
115 class MarkerTimeAxis ;
117 class ImageFrameSocketHandler ;
118 class TimeAxisViewItem ;
119 /* </CMT Additions> */
122 class Editor : public PublicEditor
125 Editor (ARDOUR::AudioEngine&);
128 void connect_to_session (ARDOUR::Session *);
129 ARDOUR::Session* current_session() const { return session; }
131 nframes_t leftmost_position() const { return leftmost_frame; }
132 nframes_t current_page_frames() const {
133 return (nframes_t) floor (canvas_width * frames_per_unit);
136 void set_snap_to (Editing::SnapType);
137 void set_snap_mode (Editing::SnapMode);
138 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
140 void undo (uint32_t n = 1);
141 void redo (uint32_t n = 1);
143 XMLNode& get_state ();
144 int set_state (const XMLNode& );
146 void set_mouse_mode (Editing::MouseMode, bool force=true);
147 void step_mouse_mode (bool next);
148 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
150 void add_imageframe_time_axis(const string & track_name, void*) ;
151 void add_imageframe_marker_time_axis(const string & track_name, TimeAxisView* marked_track, void*) ;
152 void connect_to_image_compositor() ;
153 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
154 TimeAxisView* get_named_time_axis(const string & name) ;
156 void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
157 void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
158 void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
160 /* option editor-access */
162 void set_show_waveforms (bool yn);
163 bool show_waveforms() const { return _show_waveforms; }
165 void set_show_waveforms_recording (bool yn);
166 bool show_waveforms_recording() const { return _show_waveforms_recording; }
168 /* things that need to be public to be used in the main menubar */
170 void new_region_from_selection ();
171 void separate_region_from_selection ();
172 void separate_regions_using_location (ARDOUR::Location&);
173 void toggle_playback (bool with_abort);
177 nframes_t unit_to_frame (double unit) {
178 return (nframes_t) rint (unit * frames_per_unit);
181 double frame_to_unit (nframes_t frame) {
182 return rint ((double) frame / (double) frames_per_unit);
185 double frame_to_unit (double frame) {
186 return rint (frame / frames_per_unit);
189 /* NOTE: these functions assume that the "pixel" coordinate is
190 the result of using the world->canvas affine transform on a
191 world coordinate. These coordinates already take into
192 account any scrolling carried out by adjusting the
196 nframes_t pixel_to_frame (double pixel) {
198 /* pixel can be less than zero when motion events
199 are processed. since we've already run the world->canvas
200 affine, that means that the location *really* is "off
201 to the right" and thus really is "before the start".
205 return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
211 gulong frame_to_pixel (nframes_t frame) {
212 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
217 Selection& get_selection() const { return *selection; }
218 Selection& get_cut_buffer() const { return *cut_buffer; }
220 void play_selection ();
221 void select_all_in_track (Selection::Operation op);
222 void select_all (Selection::Operation op);
223 void invert_selection_in_track ();
224 void invert_selection ();
228 void set_show_measures (bool yn);
229 bool show_measures () const { return _show_measures; }
230 bool initial_ruler_update_required;
233 /* analysis window */
234 void analyze_region_selection();
235 void analyze_range_selection();
240 /* these initiate export ... */
242 void export_session();
243 void export_selection();
246 void add_toplevel_controls (Gtk::Container&);
248 void set_zoom_focus (Editing::ZoomFocus);
249 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
250 gdouble get_current_zoom () { return frames_per_unit; }
252 void temporal_zoom_step (bool coarser);
254 /* stuff that AudioTimeAxisView and related classes use */
256 PlaylistSelector& playlist_selector() const;
257 void route_name_changed (TimeAxisView *);
258 gdouble frames_per_unit;
259 nframes_t leftmost_frame;
260 void clear_playlist (ARDOUR::Playlist&);
262 void new_playlists ();
263 void copy_playlists ();
264 void clear_playlists ();
266 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
268 Width editor_mixer_strip_width;
269 void show_editor_mixer (bool yn);
270 void set_selected_mixer_strip (TimeAxisView&);
271 void hide_track_in_display (TimeAxisView& tv);
272 void show_track_in_display (TimeAxisView& tv);
274 /* nudge is initiated by transport controls owned by ARDOUR_UI */
276 void nudge_forward (bool next);
277 void nudge_backward (bool next);
279 /* nudge initiated from context menu */
281 void nudge_forward_capture_offset ();
282 void nudge_backward_capture_offset ();
284 /* playhead/screen stuff */
286 void set_follow_playhead (bool yn);
287 void toggle_follow_playhead ();
288 bool follow_playhead() const { return _follow_playhead; }
290 void toggle_waveform_visibility ();
291 void toggle_waveforms_while_recording ();
292 void toggle_measure_visibility ();
294 /* SMPTE timecode & video sync */
296 void smpte_fps_chosen (ARDOUR::Session::SmpteFormat format);
297 void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
299 void update_smpte_mode();
300 void update_video_pullup();
304 void toggle_auto_xfade ();
305 void toggle_xfades_active ();
306 void toggle_xfade_visibility ();
307 bool xfade_visibility() const { return _xfade_visibility; }
308 void update_crossfade_model ();
309 void set_crossfade_model (ARDOUR::CrossfadeModel);
312 void set_layer_model (ARDOUR::LayerModel);
313 void update_layering_model ();
315 /* redirect shared ops menu. caller must free returned menu */
317 Gtk::Menu* redirect_menu ();
319 /* floating windows/transient */
321 void ensure_float (Gtk::Window&);
325 void scroll_tracks_down_line ();
326 void scroll_tracks_up_line ();
328 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
329 void prepare_for_cleanup ();
331 void reposition_x_origin (nframes_t sample);
333 void maximise_editing_space();
334 void restore_editing_space();
337 void map_transport_state ();
338 void map_position_change (nframes_t);
344 ARDOUR::Session *session;
345 ARDOUR::AudioEngine& engine;
348 PlaylistSelector* _playlist_selector;
350 void set_frames_per_unit (double);
352 Editing::MouseMode mouse_mode;
354 int post_maximal_editor_width;
355 int post_maximal_pane_position;
356 int pre_maximal_pane_position;
357 int pre_maximal_editor_width;
358 void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
360 Gtk::Notebook the_notebook;
361 Gtk::HPaned edit_pane;
363 Gtk::EventBox meter_base;
365 Gtk::EventBox marker_base;
366 Gtk::HBox marker_box;
367 Gtk::VBox scrollers_rulers_markers_box;
369 void location_changed (ARDOUR::Location *);
370 void location_flags_changed (ARDOUR::Location *, void *);
371 void refresh_location_display ();
372 void refresh_location_display_s (ARDOUR::Change);
373 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
374 void add_new_location (ARDOUR::Location *);
375 void location_gone (ARDOUR::Location *);
376 void remove_marker (ArdourCanvas::Item&, GdkEvent*);
377 gint really_remove_marker (ARDOUR::Location* loc);
379 uint32_t location_marker_color;
380 uint32_t location_range_color;
381 uint32_t location_loop_color;
382 uint32_t location_punch_color;
383 uint32_t location_cd_marker_color;
385 struct LocationMarkers {
393 void set_name (const string&);
394 void set_position (nframes_t start, nframes_t end = 0);
395 void set_color_rgba (uint32_t);
398 LocationMarkers *find_location_markers (ARDOUR::Location *);
399 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start);
401 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
402 LocationMarkerMap location_markers;
404 void hide_marker (ArdourCanvas::Item*, GdkEvent*);
405 void clear_marker_display ();
406 void mouse_add_new_marker (nframes_t where);
408 TimeAxisView* clicked_axisview;
409 RouteTimeAxisView* clicked_routeview;
410 RegionView* clicked_regionview;
411 RegionView* latest_regionview;
412 uint32_t clicked_selection;
413 CrossfadeView* clicked_crossfadeview;
414 ControlPoint* clicked_control_point;
416 void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
417 void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl);
419 /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
421 void mapped_set_selected_regionview_from_click (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
422 void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
423 void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
424 void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
428 void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
429 bool button_release_can_deselect;
431 void catch_vanishing_regionview (RegionView *);
433 bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
435 bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
436 bool set_selected_track_from_click (Selection::Operation op = Selection::Set, bool no_remove=false);
437 bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
439 void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
440 bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::weak_ptr<ARDOUR::Region>);
441 void collect_new_region_view (RegionView *);
443 Gtk::Menu track_context_menu;
444 Gtk::Menu track_region_context_menu;
445 Gtk::Menu track_selection_context_menu;
446 Gtk::Menu track_crossfade_context_menu;
448 Gtk::MenuItem* region_edit_menu_split_item;
449 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
450 Gtk::Menu * track_region_edit_playlist_menu;
451 Gtk::Menu * track_edit_playlist_submenu;
452 Gtk::Menu * track_selection_edit_playlist_submenu;
454 void popup_track_context_menu (int, int, ItemType, bool, nframes_t);
455 Gtk::Menu* build_track_context_menu (nframes_t);
456 Gtk::Menu* build_track_bus_context_menu (nframes_t);
457 Gtk::Menu* build_track_region_context_menu (nframes_t frame);
458 Gtk::Menu* build_track_crossfade_context_menu (nframes_t);
459 Gtk::Menu* build_track_selection_context_menu (nframes_t);
460 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
461 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
462 void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
463 void add_crossfade_context_items (AudioStreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
464 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
466 void handle_new_route (ARDOUR::Session::RouteList&);
467 void remove_route (TimeAxisView *);
470 Gtk::HBox global_hpacker;
471 Gtk::VBox global_vpacker;
474 Gdk::Cursor* current_canvas_cursor;
476 ArdourCanvas::CanvasAA track_canvas;
477 ArdourCanvas::CanvasAA time_canvas;
479 ArdourCanvas::Text* first_action_message;
480 ArdourCanvas::Text* verbose_canvas_cursor;
481 bool verbose_cursor_visible;
483 void parameter_changed (const char *);
485 bool track_canvas_motion (GdkEvent*);
487 void set_verbose_canvas_cursor (const string &, double x, double y);
488 void set_verbose_canvas_cursor_text (const string &);
489 void show_verbose_canvas_cursor();
490 void hide_verbose_canvas_cursor();
492 bool verbose_cursor_on; // so far unused
494 Gtk::EventBox time_canvas_event_box;
495 Gtk::EventBox track_canvas_event_box;
496 Gtk::EventBox time_button_event_box;
498 ArdourCanvas::Group *minsec_group;
499 ArdourCanvas::Group *bbt_group;
500 ArdourCanvas::Group *smpte_group;
501 ArdourCanvas::Group *frame_group;
502 ArdourCanvas::Group *tempo_group;
503 ArdourCanvas::Group *meter_group;
504 ArdourCanvas::Group *marker_group;
505 ArdourCanvas::Group *range_marker_group;
506 ArdourCanvas::Group *transport_marker_group;
509 ruler_metric_smpte = 0,
510 ruler_metric_bbt = 1,
511 ruler_metric_frames = 2,
512 ruler_metric_minsec = 3,
514 ruler_time_tempo = 4,
515 ruler_time_meter = 5,
516 ruler_time_marker = 6,
517 ruler_time_range_marker = 7,
518 ruler_time_transport_marker = 8,
521 static GtkCustomMetric ruler_metrics[4];
523 bool no_ruler_shown_update;
525 gint ruler_button_press (GdkEventButton*);
526 gint ruler_button_release (GdkEventButton*);
527 gint ruler_mouse_motion (GdkEventMotion*);
529 gint ruler_pressed_button;
530 Gtk::Widget * ruler_grabbed_widget;
532 void initialize_rulers ();
533 void update_just_smpte ();
534 void update_fixed_rulers ();
535 void update_tempo_based_rulers ();
536 void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem);
537 void update_ruler_visibility ();
538 void ruler_toggled (int);
539 gint ruler_label_button_release (GdkEventButton*);
540 void store_ruler_visibility ();
541 void restore_ruler_visibility ();
543 static gint _metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
544 static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
545 static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
546 static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
548 gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint);
549 gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
550 gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
551 gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
553 GtkWidget *_smpte_ruler;
554 GtkWidget *_bbt_ruler;
555 GtkWidget *_frames_ruler;
556 GtkWidget *_minsec_ruler;
557 Gtk::Widget *smpte_ruler;
558 Gtk::Widget *bbt_ruler;
559 Gtk::Widget *frames_ruler;
560 Gtk::Widget *minsec_ruler;
561 static Editor *ruler_editor;
563 static const double timebar_height;
564 guint32 visible_timebars;
565 Gtk::Menu *editor_ruler_menu;
567 ArdourCanvas::SimpleRect* tempo_bar;
568 ArdourCanvas::SimpleRect* meter_bar;
569 ArdourCanvas::SimpleRect* marker_bar;
570 ArdourCanvas::SimpleRect* range_marker_bar;
571 ArdourCanvas::SimpleRect* transport_marker_bar;
574 ArdourCanvas::SimpleLine* tempo_line;
575 ArdourCanvas::SimpleLine* meter_line;
576 ArdourCanvas::SimpleLine* marker_line;
577 ArdourCanvas::SimpleLine* range_marker_line;
578 ArdourCanvas::SimpleLine* transport_marker_line;
580 Gtk::Label minsec_label;
581 Gtk::Label bbt_label;
582 Gtk::Label smpte_label;
583 Gtk::Label frame_label;
584 Gtk::Label tempo_label;
585 Gtk::Label meter_label;
586 Gtk::Label mark_label;
587 Gtk::Label range_mark_label;
588 Gtk::Label transport_mark_label;
591 Gtk::VBox time_button_vbox;
592 Gtk::HBox time_button_hbox;
596 ArdourCanvas::Points points;
597 ArdourCanvas::Line canvas_item;
598 nframes_t current_frame;
601 Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
604 void set_position (nframes_t);
605 void set_length (double units);
606 void set_y_axis (double position);
609 friend struct Cursor; /* it needs access to several private
613 Cursor* playhead_cursor;
615 ArdourCanvas::Group* cursor_group;
617 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
618 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
619 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
620 void cursor_to_selection_start (Cursor *);
621 void cursor_to_selection_end (Cursor *);
622 void select_all_selectables_using_cursor (Cursor *, bool);
623 void select_all_selectables_between_cursors (Cursor *, Cursor *);
625 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
627 vector<nframes_t> region_boundary_cache;
628 void build_region_boundary_cache ();
630 Gtk::VBox trackview_vpacker;
633 Gtk::HBox bottom_hbox;
635 Gtk::Table edit_packer;
636 Gtk::VScrollbar edit_vscrollbar;
638 Gtk::Adjustment vertical_adjustment;
639 Gtk::Adjustment horizontal_adjustment;
641 Gtk::Layout controls_layout;
642 bool control_layout_scroll (GdkEventScroll* ev);
643 void controls_layout_size_request (Gtk::Requisition*);
645 Gtk::HScrollbar edit_hscrollbar;
647 void reset_hscrollbar_stepping ();
649 bool hscrollbar_button_press (GdkEventButton*);
650 bool hscrollbar_button_release (GdkEventButton*);
651 void hscrollbar_allocate (Gtk::Allocation &alloc);
654 double canvas_height;
655 nframes_t last_canvas_frame;
657 bool track_canvas_map_handler (GdkEventAny*);
658 bool time_canvas_map_handler (GdkEventAny*);
660 gint edit_controls_button_release (GdkEventButton*);
661 Gtk::Menu *edit_controls_left_menu;
662 Gtk::Menu *edit_controls_right_menu;
664 Gtk::VBox track_canvas_vbox;
665 Gtk::VBox time_canvas_vbox;
666 Gtk::VBox edit_controls_vbox;
667 Gtk::HBox edit_controls_hbox;
669 void control_scroll (float);
670 bool deferred_control_scroll (nframes_t);
671 sigc::connection control_scroll_connection;
673 void tie_vertical_scrolling ();
674 void canvas_horizontally_scrolled ();
676 void reposition_and_zoom (nframes_t sample, double fpu);
677 gint deferred_reposition_and_zoom (nframes_t sample, double fpu);
678 void end_location_changed (ARDOUR::Location*);
679 bool repos_zoom_queued;
681 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
682 RegionListDisplayModelColumns() {
687 Gtk::TreeModelColumn<Glib::ustring> name;
688 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
689 Gtk::TreeModelColumn<Gdk::Color> color_;
692 RegionListDisplayModelColumns region_list_columns;
693 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
695 Glib::RefPtr<Gtk::TreeStore> region_list_model;
696 Glib::RefPtr<Gtk::ToggleAction> toggle_full_region_list_action;
697 Glib::RefPtr<Gtk::ToggleAction> toggle_show_auto_regions_action;
699 void region_list_selection_changed ();
700 bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
702 Gtk::Menu *region_list_menu;
703 Gtk::ScrolledWindow region_list_scroller;
704 Gtk::Frame region_list_frame;
706 bool region_list_display_key_press (GdkEventKey *);
707 bool region_list_display_key_release (GdkEventKey *);
708 bool region_list_display_button_press (GdkEventButton *);
709 bool region_list_display_button_release (GdkEventButton *);
710 void region_list_clear ();
711 void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
712 void build_region_list_menu ();
713 void show_region_list_display_context_menu (int button, int time);
715 bool show_automatic_regions_in_region_list;
716 Editing::RegionListSortType region_list_sort_type;
718 void reset_region_list_sort_direction (bool);
719 void reset_region_list_sort_type (Editing::RegionListSortType);
721 void toggle_full_region_list ();
722 void toggle_show_auto_regions ();
724 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
728 Gtk::ScrolledWindow snapshot_display_scroller;
729 struct SnapshotDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
730 SnapshotDisplayModelColumns() {
734 Gtk::TreeModelColumn<Glib::ustring> visible_name;
735 Gtk::TreeModelColumn<Glib::ustring> real_name;
738 SnapshotDisplayModelColumns snapshot_display_columns;
739 Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
740 Gtk::TreeView snapshot_display;
742 bool snapshot_display_button_press (GdkEventButton*);
743 void snapshot_display_selection_changed ();
744 void redisplay_snapshots();
746 /* named selections */
748 struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
749 NamedSelectionDisplayModelColumns() {
753 Gtk::TreeModelColumn<Glib::ustring> text;
754 Gtk::TreeModelColumn<ARDOUR::NamedSelection*> selection;
757 NamedSelectionDisplayModelColumns named_selection_columns;
758 Glib::RefPtr<Gtk::TreeStore> named_selection_model;
760 Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
761 Gtk::ScrolledWindow named_selection_scroller;
763 void name_selection();
764 void named_selection_name_chosen ();
765 void create_named_selection (const string &);
766 void paste_named_selection (float times);
768 void handle_new_named_selection ();
769 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
770 void redisplay_named_selections ();
772 gint named_selection_display_button_press (GdkEventButton *ev);
773 void named_selection_display_selection_changed ();
777 TrackViewList track_views;
778 TimeAxisView *trackview_by_y_position (double ypos);
780 static Gdk::Cursor* cross_hair_cursor;
781 static Gdk::Cursor* trimmer_cursor;
782 static Gdk::Cursor* selector_cursor;
783 static Gdk::Cursor* grabber_cursor;
784 static Gdk::Cursor* zoom_cursor;
785 static Gdk::Cursor* time_fx_cursor;
786 static Gdk::Cursor* fader_cursor;
787 static Gdk::Cursor* speaker_cursor;
788 static Gdk::Cursor* wait_cursor;
789 static Gdk::Cursor* timebar_cursor;
791 static void build_cursors ();
793 sigc::connection scroll_connection;
794 nframes_t last_update_frame;
795 void center_screen (nframes_t);
796 void center_screen_internal (nframes_t, float);
798 void update_current_screen ();
800 void session_going_away ();
802 nframes_t cut_buffer_start;
803 nframes_t cut_buffer_length;
805 bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
806 bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
807 bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
808 bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
809 bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
810 bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
812 /* KEYMAP HANDLING */
814 void register_actions ();
816 int ensure_cursor (nframes_t* pos);
818 void handle_new_region (boost::weak_ptr<ARDOUR::Region>);
819 void handle_region_removed (boost::weak_ptr<ARDOUR::Region>);
820 void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
821 void region_hidden (boost::shared_ptr<ARDOUR::Region>);
822 void redisplay_regions ();
823 void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
825 list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
827 void cut_copy (Editing::CutCopyOp);
828 void cut_copy_points (Editing::CutCopyOp);
829 void cut_copy_regions (Editing::CutCopyOp);
830 void cut_copy_ranges (Editing::CutCopyOp);
833 void paste_internal (nframes_t position, float times);
835 /* EDITING OPERATIONS */
837 void reset_point_selection ();
838 void toggle_region_mute ();
839 void toggle_region_lock ();
840 void toggle_region_opaque ();
841 void raise_region ();
842 void raise_region_to_top ();
843 void lower_region ();
844 void lower_region_to_bottom ();
845 void split_region ();
846 void split_region_at (nframes_t);
847 void split_regions_at (nframes_t, RegionSelection&);
848 void crop_region_to_selection ();
849 void set_a_regions_sync_position (boost::shared_ptr<ARDOUR::Region>, nframes_t);
850 void set_region_sync_from_edit_cursor ();
851 void remove_region_sync();
852 void align_selection (ARDOUR::RegionPoint, nframes_t position);
853 void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position);
854 void align_region (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
855 void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes_t position);
856 void remove_clicked_region ();
857 void destroy_clicked_region ();
859 void duplicate_some_regions (RegionSelection&, float times);
860 void duplicate_selection (float times);
861 void region_fill_selection ();
863 void region_fill_track ();
864 void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
865 void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
866 void split_multichannel_region();
867 void reverse_region ();
868 void normalize_region ();
869 void denormalize_region ();
871 void audition_region_from_region_list ();
872 void hide_region_from_region_list ();
873 void remove_region_from_region_list ();
875 void align (ARDOUR::RegionPoint);
876 void align_relative (ARDOUR::RegionPoint);
881 void paste (float times);
883 int get_prefix (float&, bool&);
885 void keyboard_paste ();
886 void keyboard_duplicate_region ();
887 void keyboard_duplicate_selection ();
888 void keyboard_insert_region_list_selection ();
890 void region_from_selection ();
891 void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
894 void rename_region ();
895 void rename_region_finished (bool);
897 void play_from_start ();
898 void play_from_edit_cursor ();
899 void play_selected_region ();
900 void audition_selected_region ();
901 void loop_selected_region ();
902 void play_location (ARDOUR::Location&);
903 void loop_location (ARDOUR::Location&);
905 Editing::ZoomFocus zoom_focus;
907 void temporal_zoom_selection ();
908 void temporal_zoom_session ();
909 void temporal_zoom (gdouble scale);
910 void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
911 void temporal_zoom_to_frame (bool coarser, nframes_t frame);
913 void amplitude_zoom (gdouble scale);
914 void amplitude_zoom_step (bool in);
916 void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
917 void insert_region_list_selection (float times);
919 void add_external_audio_action (Editing::ImportMode);
921 void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t& pos, bool prompt);
922 void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
923 void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
924 int import_sndfile (Glib::ustring path, Editing::ImportMode mode, ARDOUR::AudioTrack* track, nframes_t& pos);
925 int embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
926 ARDOUR::AudioTrack* track, nframes_t& pos, bool prompt);
927 int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, nframes_t& pos, Editing::ImportMode mode);
929 /* generic interthread progress window */
931 ArdourDialog* interthread_progress_window;
932 Gtk::Label interthread_progress_label;
933 Gtk::VBox interthread_progress_vbox;
934 Gtk::ProgressBar interthread_progress_bar;
935 Gtk::Button interthread_cancel_button;
936 Gtk::Label interthread_cancel_label;
937 sigc::connection interthread_progress_connection;
938 void interthread_cancel_clicked ();
939 void build_interthread_progress_window ();
940 ARDOUR::InterThreadInfo* current_interthread_info;
943 AnalysisWindow* analysis_window;
946 /* import specific info */
948 ARDOUR::Session::import_status import_status;
949 gint import_progress_timeout (void *);
950 static void *_import_thread (void *);
951 void* import_thread ();
953 /* to support this ... */
955 void import_audio (bool as_tracks);
956 void do_import (vector<string> paths, bool split, bool as_tracks);
958 void move_to_start ();
961 void center_playhead ();
962 void center_edit_cursor ();
963 void edit_cursor_backward ();
964 void edit_cursor_forward ();
965 void playhead_backward ();
966 void playhead_forward ();
967 void scroll_backward (float pages=0.8f);
968 void scroll_forward (float pages=0.8f);
969 void scroll_tracks_down ();
970 void scroll_tracks_up ();
971 void delete_sample_forward ();
972 void delete_sample_backward ();
973 void delete_screen ();
974 void search_backwards ();
975 void search_forwards ();
977 void clear_markers ();
978 void clear_ranges ();
979 void clear_locations ();
980 void jump_forward_to_mark ();
981 void jump_backward_to_mark ();
982 void cursor_align (bool playhead_to_edit);
984 void remove_last_capture ();
985 void select_all_selectables_using_time_selection ();
986 void select_all_selectables_using_loop();
987 void select_all_selectables_using_punch();
988 void set_selection_from_range (ARDOUR::Location&);
989 void set_selection_from_punch ();
990 void set_selection_from_loop ();
991 void set_selection_from_audio_region ();
993 void add_location_from_audio_region ();
994 void add_location_from_selection ();
995 void set_route_loop_selection ();
997 void add_location_from_playhead_cursor ();
999 void reverse_selection ();
1000 void edit_envelope ();
1002 void start_scrolling ();
1003 void stop_scrolling ();
1005 void keyboard_selection_begin ();
1006 void keyboard_selection_finish (bool add);
1007 bool have_pending_keyboard_selection;
1008 nframes_t pending_keyboard_selection_start;
1010 boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
1011 void extend_selection_to_end_of_region (bool next);
1012 void extend_selection_to_start_of_region (bool previous);
1014 Editing::SnapType snap_type;
1015 Editing::SnapMode snap_mode;
1016 double snap_threshold;
1018 void handle_gui_changes (const string &, void *);
1020 void hide_all_tracks (bool with_select);
1023 LineDragInfo current_line_drag_info;
1025 void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
1026 bool end_grab (ArdourCanvas::Item*, GdkEvent*);
1027 void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
1029 Gtk::Menu fade_context_menu;
1030 void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
1032 void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
1033 void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
1034 void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1035 void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1036 void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1037 void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1039 std::set<ARDOUR::Playlist*> motion_frozen_playlists;
1040 void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1041 void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1043 void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1044 void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1045 void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1046 void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1047 void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1048 void control_point_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1049 void line_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1050 void line_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1052 void tempo_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1053 void tempo_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1054 void meter_marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1055 void meter_marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1057 gint mouse_rename_region (ArdourCanvas::Item*, GdkEvent*);
1059 void start_region_grab (ArdourCanvas::Item*, GdkEvent*);
1060 void start_region_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1061 void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
1062 void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
1063 void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
1064 void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1065 void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
1066 void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
1067 void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
1068 void start_line_grab (AutomationLine *, GdkEvent*);
1069 void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1070 void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1071 void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
1072 void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
1074 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1076 void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
1077 void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
1079 void mouse_brush_insert_region (RegionView*, nframes_t pos);
1080 void brush (nframes_t);
1082 void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1083 void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1085 /* Canvas event handlers */
1087 bool canvas_control_point_event (GdkEvent* event,ArdourCanvas::Item*, ControlPoint*);
1088 bool canvas_line_event (GdkEvent* event,ArdourCanvas::Item*, AutomationLine*);
1089 bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1090 bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1091 bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*);
1092 bool canvas_crossfade_view_event (GdkEvent* event,ArdourCanvas::Item*, CrossfadeView*);
1093 bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1094 bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1095 bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1096 bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
1097 bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1098 bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1099 bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
1100 bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
1101 bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
1102 bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
1103 bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
1104 bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
1105 bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
1107 bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1108 bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1109 bool canvas_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1110 bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1111 bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
1113 bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1114 bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
1115 bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1116 bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
1117 bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
1118 bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1119 bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1120 bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
1122 /* non-public event handlers */
1124 bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1125 bool canvas_edit_cursor_event (GdkEvent* event, ArdourCanvas::Item*);
1126 bool track_canvas_event (GdkEvent* event, ArdourCanvas::Item*);
1127 bool track_canvas_scroll (GdkEventScroll* event);
1129 Gtk::Allocation canvas_allocation;
1130 bool canvas_idle_queued;
1131 void track_canvas_allocate (Gtk::Allocation alloc);
1132 bool track_canvas_idle ();
1134 void set_edit_cursor (GdkEvent* event);
1135 void set_playhead_cursor (GdkEvent* event);
1137 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1138 void kbd_set_playhead_cursor ();
1139 void kbd_set_edit_cursor ();
1140 void kbd_mute_unmute_region ();
1142 void kbd_set_sync_position ();
1143 void kbd_align (ARDOUR::RegionPoint);
1144 void kbd_align_relative (ARDOUR::RegionPoint);
1146 void kbd_audition ();
1148 void kbd_do_split (GdkEvent*);
1149 void kbd_do_set_sync_position (GdkEvent* ev);
1150 void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
1151 void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
1152 void kbd_do_brush (GdkEvent*);
1153 void kbd_do_audition (GdkEvent*);
1155 void handle_new_duration ();
1156 void initialize_canvas ();
1157 void reset_scrolling_region (Gtk::Allocation* alloc = 0);
1159 /* display control */
1161 bool _show_measures;
1162 bool _show_waveforms;
1163 bool _follow_playhead;
1164 bool _show_waveforms_recording;
1166 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1168 typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
1169 TimeLineList free_measure_lines;
1170 TimeLineList used_measure_lines;
1172 ArdourCanvas::Group* time_line_group;
1173 ArdourCanvas::SimpleLine* get_time_line ();
1174 void hide_measures ();
1175 void draw_measures ();
1176 bool lazy_hide_and_draw_measures ();
1178 void new_tempo_section ();
1180 void mouse_add_new_tempo_event (nframes_t where);
1181 void mouse_add_new_meter_event (nframes_t where);
1183 void remove_tempo_marker (ArdourCanvas::Item*);
1184 void remove_meter_marker (ArdourCanvas::Item*);
1185 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1186 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1188 void edit_tempo_section (ARDOUR::TempoSection*);
1189 void edit_meter_section (ARDOUR::MeterSection*);
1190 void edit_tempo_marker (ArdourCanvas::Item*);
1191 void edit_meter_marker (ArdourCanvas::Item*);
1193 void marker_menu_edit ();
1194 void marker_menu_remove ();
1195 void marker_menu_rename ();
1196 void marker_menu_hide ();
1197 void marker_menu_loop_range ();
1198 void marker_menu_select_all_selectables_using_range ();
1199 void marker_menu_separate_regions_using_location ();
1200 void marker_menu_play_from ();
1201 void marker_menu_set_playhead ();
1202 void marker_menu_set_from_playhead ();
1203 void marker_menu_set_from_selection ();
1204 void new_transport_marker_menu_set_loop ();
1205 void new_transport_marker_menu_set_punch ();
1206 void update_loop_range_view (bool visibility=false);
1207 void update_punch_range_view (bool visibility=false);
1208 gint new_transport_marker_menu_popdown (GdkEventAny*);
1209 void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1210 void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1211 void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1212 void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
1213 void build_range_marker_menu ();
1214 void build_marker_menu ();
1215 void build_tm_marker_menu ();
1216 void build_transport_marker_menu ();
1217 void build_new_transport_marker_menu ();
1219 Gtk::Menu* tm_marker_menu;
1220 Gtk::Menu* marker_menu;
1221 Gtk::Menu* range_marker_menu;
1222 Gtk::Menu* transport_marker_menu;
1223 Gtk::Menu* new_transport_marker_menu;
1224 ArdourCanvas::Item* marker_menu_item;
1226 typedef list<Marker*> Marks;
1229 void remove_metric_marks ();
1230 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1232 void tempo_map_changed (ARDOUR::Change);
1233 void redisplay_tempo ();
1235 void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false);
1236 uint32_t bbt_beat_subdivision;
1240 Gtk::ToggleButton editor_mixer_button;
1242 void editor_mixer_button_toggled ();
1244 AudioClock edit_cursor_clock;
1245 AudioClock zoom_range_clock;
1246 Gtk::Button zoom_in_button;
1247 Gtk::Button zoom_out_button;
1248 Gtk::Button zoom_out_full_button;
1249 Gtk::Button zoom_onetoone_button;
1251 Gtk::VBox toolbar_clock_vbox;
1252 Gtk::VBox toolbar_selection_clock_vbox;
1253 Gtk::Table toolbar_selection_clock_table;
1254 Gtk::Label toolbar_selection_cursor_label;
1256 Gtk::HBox mouse_mode_button_box;
1257 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1258 Gtk::ToggleButton mouse_select_button;
1259 Gtk::ToggleButton mouse_move_button;
1260 Gtk::ToggleButton mouse_gain_button;
1261 Gtk::ToggleButton mouse_zoom_button;
1262 Gtk::ToggleButton mouse_timefx_button;
1263 Gtk::ToggleButton mouse_audition_button;
1264 GroupedButtons *mouse_mode_button_set;
1265 void mouse_mode_toggled (Editing::MouseMode m);
1266 bool ignore_mouse_mode_toggle;
1268 gint mouse_select_button_release (GdkEventButton*);
1270 Gtk::VBox automation_box;
1271 Gtk::Button automation_mode_button;
1272 Gtk::ToggleButton global_automation_button;
1274 Gtk::ComboBoxText edit_mode_selector;
1275 Gtk::VBox edit_mode_box;
1277 void edit_mode_selection_done ();
1279 Gtk::ComboBoxText snap_type_selector;
1280 Gtk::ComboBoxText snap_mode_selector;
1283 std::vector<std::string> snap_type_strings;
1284 std::vector<std::string> snap_mode_strings;
1286 void snap_type_selection_done ();
1287 void snap_mode_selection_done ();
1288 void snap_mode_chosen (Editing::SnapMode);
1289 void snap_type_chosen (Editing::SnapType);
1291 Glib::RefPtr<Gtk::RadioAction> snap_type_action (Editing::SnapType);
1292 Glib::RefPtr<Gtk::RadioAction> snap_mode_action (Editing::SnapMode);
1294 Gtk::ComboBoxText zoom_focus_selector;
1295 Gtk::VBox zoom_focus_box;
1297 std::vector<std::string> zoom_focus_strings;
1299 void zoom_focus_selection_done ();
1300 void zoom_focus_chosen (Editing::ZoomFocus);
1302 Glib::RefPtr<Gtk::RadioAction> zoom_focus_action (Editing::ZoomFocus);
1306 void zoom_adjustment_changed();
1308 void edit_cursor_clock_changed();
1310 void setup_toolbar ();
1312 Gtkmm2ext::TearOff* tools_tearoff;
1313 Gtk::HBox toolbar_hbox;
1314 Gtk::EventBox toolbar_base;
1315 Gtk::Frame toolbar_frame;
1317 /* selection process */
1319 Selection* selection;
1320 Selection* cut_buffer;
1322 void time_selection_changed ();
1323 void track_selection_changed ();
1324 void region_selection_changed ();
1325 void point_selection_changed ();
1334 void start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp);
1335 void drag_selection (ArdourCanvas::Item* item, GdkEvent* event);
1336 void end_selection_op (ArdourCanvas::Item* item, GdkEvent* event);
1337 void cancel_selection ();
1339 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1340 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1341 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1343 bool audio_region_selection_covers (nframes_t where);
1345 /* transport range select process */
1346 enum RangeMarkerOp {
1348 CreateTransportMarker
1351 void start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, RangeMarkerOp);
1352 void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1353 void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event);
1355 ArdourCanvas::SimpleRect* range_bar_drag_rect;
1356 ArdourCanvas::SimpleRect* transport_bar_drag_rect;
1357 ArdourCanvas::Line* marker_drag_line;
1358 ArdourCanvas::Points marker_drag_line_points;
1359 ArdourCanvas::SimpleRect* range_marker_drag_rect;
1361 void update_marker_drag_item (ARDOUR::Location *);
1363 ArdourCanvas::SimpleRect *transport_bar_range_rect;
1364 ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
1365 ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
1366 ArdourCanvas::SimpleRect *transport_loop_range_rect;
1367 ArdourCanvas::SimpleRect *transport_punch_range_rect;
1368 ArdourCanvas::SimpleLine *transport_punchin_line;
1369 ArdourCanvas::SimpleLine *transport_punchout_line;
1370 ArdourCanvas::SimpleRect *transport_preroll_rect;
1371 ArdourCanvas::SimpleRect *transport_postroll_rect;
1373 ARDOUR::Location* transport_loop_location();
1374 ARDOUR::Location* transport_punch_location();
1376 ARDOUR::Location *temp_location;
1378 /* object rubberband select process */
1380 void start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1381 void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1382 void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event);
1384 bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
1386 ArdourCanvas::SimpleRect *rubberband_rect;
1388 /* mouse zoom process */
1390 void start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1391 void drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1392 void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
1394 ArdourCanvas::SimpleRect *zoom_rect;
1395 void reposition_zoom_rect (nframes_t start, nframes_t end);
1397 /* diskstream/route display management */
1399 struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
1400 RouteDisplayModelColumns() {
1405 Gtk::TreeModelColumn<Glib::ustring> text;
1406 Gtk::TreeModelColumn<bool> visible;
1407 Gtk::TreeModelColumn<TimeAxisView*> tv;
1410 RouteDisplayModelColumns route_display_columns;
1411 Glib::RefPtr<Gtk::ListStore> route_display_model;
1412 Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
1414 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display;
1415 Gtk::ScrolledWindow route_list_scroller;
1416 Gtk::Menu* route_list_menu;
1418 bool route_list_display_button_press (GdkEventButton*);
1419 bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
1421 void route_list_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1422 void route_list_delete (const Gtk::TreeModel::Path&);
1423 void initial_route_list_display ();
1424 void redisplay_route_list();
1425 void route_list_reordered (const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, int* what);
1426 bool ignore_route_list_reorder;
1427 bool no_route_list_redisplay;
1429 void build_route_list_menu ();
1430 void show_route_list_menu ();
1432 void show_all_routes ();
1433 void hide_all_routes ();
1434 void show_all_audiotracks ();
1435 void hide_all_audiotracks ();
1436 void show_all_audiobus ();
1437 void hide_all_audiobus ();
1439 void set_all_tracks_visibility (bool yn);
1440 void set_all_audio_visibility (int type, bool yn);
1442 /* edit group management */
1444 struct GroupListModelColumns : public Gtk::TreeModel::ColumnRecord {
1445 GroupListModelColumns () {
1451 Gtk::TreeModelColumn<bool> is_active;
1452 Gtk::TreeModelColumn<bool> is_visible;
1453 Gtk::TreeModelColumn<std::string> text;
1454 Gtk::TreeModelColumn<ARDOUR::RouteGroup*> routegroup;
1457 GroupListModelColumns group_columns;
1458 Glib::RefPtr<Gtk::ListStore> group_model;
1459 Glib::RefPtr<Gtk::TreeSelection> group_selection;
1461 Gtk::TreeView edit_group_display;
1462 Gtk::ScrolledWindow edit_group_display_scroller;
1463 Gtk::Menu* edit_group_list_menu;
1465 void build_edit_group_list_menu ();
1466 void activate_all_edit_groups ();
1467 void disable_all_edit_groups ();
1469 bool in_edit_group_row_change;
1470 void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
1471 void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
1472 void new_edit_group ();
1473 void edit_group_list_button_clicked ();
1474 gint edit_group_list_button_press_event (GdkEventButton* ev);
1475 void add_edit_group (ARDOUR::RouteGroup* group);
1476 void remove_selected_edit_group ();
1477 void edit_groups_changed ();
1478 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1480 Gtk::VBox list_vpacker;
1484 bool autoscroll_active;
1485 int autoscroll_timeout_tag;
1486 int autoscroll_direction;
1487 uint32_t autoscroll_cnt;
1488 nframes_t autoscroll_distance;
1490 static gint _autoscroll_canvas (void *);
1491 bool autoscroll_canvas ();
1492 void start_canvas_autoscroll (int direction);
1493 void stop_canvas_autoscroll ();
1494 void maybe_autoscroll (GdkEvent*);
1503 void start_trim (ArdourCanvas::Item*, GdkEvent*);
1504 void point_trim (GdkEvent*);
1505 void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*);
1506 void single_contents_trim (RegionView&, nframes_t, bool, bool, bool);
1507 void single_start_trim (RegionView&, nframes_t, bool, bool);
1508 void single_end_trim (RegionView&, nframes_t, bool, bool);
1510 void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
1511 void thaw_region_after_trim (RegionView& rv);
1513 void trim_region_to_edit_cursor ();
1514 void trim_region_from_edit_cursor ();
1516 bool show_gain_after_trim;
1520 int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
1521 const Glib::RefPtr<Gdk::DragContext>& context,
1524 const Gtk::SelectionData& data,
1528 void track_canvas_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1531 const Gtk::SelectionData& data,
1535 void region_list_display_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context,
1538 const Gtk::SelectionData& data,
1543 void drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
1546 const Gtk::SelectionData& data,
1550 void drop_regions (const Glib::RefPtr<Gdk::DragContext>& context,
1553 const Gtk::SelectionData& data,
1559 ExportDialog *export_dialog;
1560 ExportDialog *export_range_markers_dialog;
1562 void export_range (nframes_t start, nframes_t end);
1563 void export_range_markers ();
1565 int write_region_selection(RegionSelection&);
1566 bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
1567 void export_region ();
1568 void bounce_region_selection ();
1569 void bounce_range_selection ();
1570 void external_edit_region ();
1572 int write_audio_selection (TimeSelection&);
1573 bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
1575 void write_selection ();
1579 UndoAction get_memento() const;
1581 XMLNode *before; /* used in *_reversible_command */
1583 void begin_reversible_command (string cmd_name);
1584 void commit_reversible_command ();
1586 /* visual history */
1588 UndoHistory visual_history;
1589 UndoTransaction current_visual_command;
1592 void update_title ();
1593 void update_title_s (const string & snapshot_name);
1596 Selection* selection;
1597 double frames_per_unit;
1603 void store_state (State&) const;
1604 void restore_state (State *);
1606 void instant_save ();
1608 boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
1610 /* freeze operations */
1612 ARDOUR::InterThreadInfo freeze_status;
1613 gint freeze_progress_timeout (void *);
1614 static void* _freeze_thread (void*);
1615 void* freeze_thread ();
1617 void freeze_route ();
1618 void unfreeze_route ();
1620 /* edit-group solo + mute */
1622 void set_edit_group_solo (ARDOUR::Route&, bool);
1623 void set_edit_group_mute (ARDOUR::Route&, bool);
1627 void duplicate_dialog (bool for_region);
1629 nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
1631 void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
1632 void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
1633 void end_time_fx (ArdourCanvas::Item*, GdkEvent*);
1635 struct TimeStretchDialog : public ArdourDialog {
1636 ARDOUR::Session::TimeStretchRequest request;
1638 RegionSelection regions;
1639 Gtk::ProgressBar progress_bar;
1640 Gtk::ToggleButton quick_button;
1641 Gtk::ToggleButton antialias_button;
1642 Gtk::Button* cancel_button;
1643 Gtk::Button* action_button;
1644 Gtk::HBox upper_button_box;
1648 TimeStretchDialog (Editor& e);
1650 gint update_progress ();
1651 sigc::connection first_cancel;
1652 sigc::connection first_delete;
1653 void cancel_timestretch_in_progress ();
1654 gint delete_timestretch_in_progress (GdkEventAny*);
1657 /* "whats mine is yours" */
1659 friend class TimeStretchDialog;
1661 TimeStretchDialog* current_timestretch;
1663 static void* timestretch_thread (void *arg);
1664 int run_timestretch (RegionSelection&, float fraction);
1665 void do_timestretch (TimeStretchDialog&);
1667 /* editor-mixer strip */
1669 MixerStrip *current_mixer_strip;
1670 bool show_editor_mixer_when_tracks_arrive;
1671 Gtk::VBox current_mixer_strip_vbox;
1672 void cms_deleted ();
1673 void current_mixer_strip_hidden ();
1674 void current_mixer_strip_removed ();
1676 void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
1677 void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
1679 /* nudging tracks */
1681 void nudge_track (bool use_edit_cursor, bool forwards);
1685 bool _xfade_visibility;
1687 /* <CMT Additions> */
1688 void handle_new_imageframe_time_axis_view(const string & track_name, void* src) ;
1689 void handle_new_imageframe_marker_time_axis_view(const string & track_name, TimeAxisView* marked_track) ;
1691 void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
1692 void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
1694 void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1695 void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
1696 void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
1698 gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1699 gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1700 gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1701 gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
1703 gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
1704 gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1705 gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1706 gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
1708 void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1709 void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1710 void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1711 void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1712 void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1713 void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1715 void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1716 void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
1717 void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1718 void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1719 void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
1720 void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
1722 void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1723 void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
1725 ImageFrameSocketHandler* image_socket_listener ;
1726 /* </CMT Additions> */
1728 void toggle_xfade_active (ARDOUR::Crossfade*);
1729 void toggle_xfade_length (ARDOUR::Crossfade*);
1730 void edit_xfade (ARDOUR::Crossfade*);
1731 void xfade_edit_left_region ();
1732 void xfade_edit_right_region ();
1734 static const int32_t default_width = 995;
1735 static const int32_t default_height = 765;
1739 Gtk::Button nudge_forward_button;
1740 Gtk::Button nudge_backward_button;
1741 Gtk::HBox nudge_hbox;
1742 Gtk::VBox nudge_vbox;
1743 AudioClock nudge_clock;
1745 nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
1749 void apply_filter (ARDOUR::AudioFilter&, string cmd);
1751 /* handling cleanup */
1753 int playlist_deletion_dialog (ARDOUR::Playlist*);
1755 vector<sigc::connection> session_connections;
1757 /* tracking step changes of track height */
1759 TimeAxisView* current_stepping_trackview;
1760 struct timeval last_track_height_step_timestamp;
1761 gint track_height_step_timeout();
1762 sigc::connection step_timeout;
1764 TimeAxisView* entered_track;
1765 RegionView* entered_regionview;
1766 bool clear_entered_track;
1767 gint left_track_canvas (GdkEventCrossing*);
1768 void set_entered_track (TimeAxisView*);
1769 void set_entered_regionview (RegionView*);
1770 gint left_automation_track ();
1772 bool _new_regionviews_show_envelope;
1774 void toggle_gain_envelope_visibility ();
1775 void toggle_gain_envelope_active ();
1776 void reset_region_gain_envelopes ();
1778 Gtk::CheckMenuItem* region_envelope_visible_item;
1779 Gtk::CheckMenuItem* region_envelope_active_item;
1780 Gtk::CheckMenuItem* region_mute_item;
1781 Gtk::CheckMenuItem* region_lock_item;
1782 Gtk::CheckMenuItem* region_opaque_item;
1784 bool on_key_press_event (GdkEventKey*);
1786 void session_state_saved (string);
1788 Glib::RefPtr<Gtk::Action> undo_action;
1789 Glib::RefPtr<Gtk::Action> redo_action;
1791 void history_changed ();
1795 #endif /* __ardour_editor_h__ */