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__
34 #include <gtkmm/layout.h>
35 #include <gtkmm/comboboxtext.h>
37 #include <libgnomecanvas/libgnomecanvas.h>
38 #include <libgnomecanvas/gnome-canvas-util.h>
40 #include <libgnomecanvasmm/canvas.h>
41 #include <libgnomecanvasmm/polygon.h>
42 #include <libgnomecanvasmm/text.h>
43 #include <libgnomecanvasmm/rect.h>
44 #include <libgnomecanvasmm/line.h>
46 #include <gtkmm2ext/selector.h>
47 #include <gtkmm2ext/click_box.h>
49 #include <ardour/stateful.h>
50 #include <ardour/session.h>
51 #include <ardour/tempo.h>
52 #include <ardour/location.h>
53 #include <ardour/region.h>
55 #include "keyboard_target.h"
56 #include "audio_clock.h"
57 #include "gtk-custom-ruler.h"
58 #include "ardour_dialog.h"
59 #include "public_editor.h"
62 #include "region_selection.h"
68 namespace LinuxAudioSystems {
91 class AudioTimeAxisView;
92 class AutomationTimeAxisView;
93 class AudioRegionView;
96 class PlaylistSelector;
100 class UIExportSpecification;
104 class TrackSelection;
105 class AutomationSelection;
110 /* <CMT Additions> */
111 class ImageFrameView;
112 class ImageFrameTimeAxisView;
113 class ImageFrameTimeAxis;
114 class MarkerTimeAxis ;
116 class ImageFrameSocketHandler ;
117 class TimeAxisViewItem ;
118 /* </CMT Additions> */
121 class Editor : public PublicEditor
124 Editor (ARDOUR::AudioEngine&);
127 void connect_to_session (ARDOUR::Session *);
128 ARDOUR::Session* current_session() const { return session; }
130 jack_nframes_t leftmost_position() const { return leftmost_frame; }
131 jack_nframes_t current_page_frames() const {
132 return (jack_nframes_t) floor (canvas_width * frames_per_unit);
135 void set_snap_to (Editing::SnapType);
136 void set_snap_mode (Editing::SnapMode);
137 void set_snap_threshold (double pixel_distance) {snap_threshold = pixel_distance;}
139 void undo (uint32_t n = 1);
140 void redo (uint32_t n = 1);
142 XMLNode& get_state ();
143 int set_state (const XMLNode& );
145 void set_mouse_mode (Editing::MouseMode, bool force=true);
146 void step_mouse_mode (bool next);
147 Editing::MouseMode current_mouse_mode () { return mouse_mode; }
149 void add_imageframe_time_axis(std::string track_name, void*) ;
150 void add_imageframe_marker_time_axis(std::string track_name, TimeAxisView* marked_track, void*) ;
151 void connect_to_image_compositor() ;
152 void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
153 TimeAxisView* get_named_time_axis(std::string name) ;
154 /* </CMT Additions> */
156 void consider_auditioning (ARDOUR::Region&);
157 void hide_a_region (ARDOUR::Region&);
158 void remove_a_region (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 toggle_playback (bool with_abort);
176 void set_edit_menu (Gtk::Menu&);
178 jack_nframes_t unit_to_frame (double unit) {
179 return (jack_nframes_t) rint (unit * frames_per_unit);
182 double frame_to_unit (jack_nframes_t frame) {
183 return rint ((double) frame / (double) frames_per_unit);
186 double frame_to_unit (double frame) {
187 return rint (frame / frames_per_unit);
190 /* NOTE: these functions assume that the "pixel" coordinate is
191 the result of using the world->canvas affine transform on a
192 world coordinate. These coordinates already take into
193 account any scrolling carried out by adjusting the
197 jack_nframes_t pixel_to_frame (double pixel) {
199 /* pixel can be less than zero when motion events
200 are processed. since we've already run the world->canvas
201 affine, that means that the location *really* is "off
202 to the right" and thus really is "before the start".
206 return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
212 gulong frame_to_pixel (jack_nframes_t frame) {
213 return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
218 Selection& get_selection() const { return *selection; }
219 Selection& get_cut_buffer() const { return *cut_buffer; }
221 void play_selection ();
222 void select_all_in_track (bool add);
223 void select_all (bool add);
224 void invert_selection_in_track ();
225 void invert_selection ();
229 void set_show_measures (bool yn);
230 bool show_measures () const { return _show_measures; }
234 /* these initiate export ... */
236 void export_session();
237 void export_selection();
239 /* this is what actually does it */
241 void export_audiofile (ARDOUR::AudioExportSpecification&);
245 void add_toplevel_controls (Gtk::Container&);
247 void set_zoom_focus (Editing::ZoomFocus);
248 Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
249 gdouble get_current_zoom () { return frames_per_unit; }
251 void temporal_zoom_step (bool coarser);
253 /* stuff that AudioTimeAxisView and related classes use */
255 PlaylistSelector& playlist_selector() const;
256 void route_name_changed (TimeAxisView *);
257 gdouble frames_per_unit;
258 jack_nframes_t leftmost_frame;
259 void clear_playlist (ARDOUR::Playlist&);
261 TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
263 Width editor_mixer_strip_width;
264 void show_editor_mixer (bool yn);
265 void set_selected_mixer_strip (TimeAxisView&);
266 void unselect_strip_in_display (TimeAxisView& tv);
267 void select_strip_in_display (TimeAxisView& tv);
269 /* nudge is initiated by transport controls owned by ARDOUR_UI */
271 void nudge_forward (bool next);
272 void nudge_backward (bool next);
274 /* nudge initiated from context menu */
276 void nudge_forward_capture_offset ();
277 void nudge_backward_capture_offset ();
279 /* playhead/screen stuff */
281 void set_follow_playhead (bool yn);
282 void toggle_follow_playhead ();
283 bool follow_playhead() const { return _follow_playhead; }
287 void toggle_xfades_active();
288 void toggle_xfade_visibility ();
289 void set_xfade_visibility (bool yn);
290 bool xfade_visibility() const { return _xfade_visibility; }
292 /* redirect shared ops menu. caller must free returned menu */
294 Gtk::Menu* redirect_menu ();
296 /* floating windows/transient */
298 void ensure_float (Gtk::Window&);
302 void scroll_tracks_down_line ();
303 void scroll_tracks_up_line ();
305 bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
306 void prepare_for_cleanup ();
308 void reposition_x_origin (jack_nframes_t sample);
311 void map_transport_state ();
312 void map_position_change (jack_nframes_t);
319 ARDOUR::Session *session;
320 ARDOUR::AudioEngine& engine;
323 PlaylistSelector* _playlist_selector;
333 TransportMarkerBarItem,
335 GainControlPointItem,
337 GainAutomationControlPointItem,
338 GainAutomationLineItem,
339 PanAutomationControlPointItem,
340 PanAutomationLineItem,
341 RedirectAutomationControlPointItem,
342 RedirectAutomationLineItem,
347 AudioRegionViewNameHighlight,
349 StartSelectionTrimItem,
350 EndSelectionTrimItem,
357 /* <CMT Additions> */
360 MarkerViewHandleStartItem,
361 MarkerViewHandleEndItem,
363 ImageFrameTimeAxisItem,
364 ImageFrameHandleStartItem,
365 ImageFrameHandleEndItem,
366 /* </CMT Additions> */
370 /* don't remove this */
375 void set_frames_per_unit (double);
376 void frames_per_unit_modified ();
378 Editing::MouseMode mouse_mode;
379 void mouse_insert (GdkEventButton *);
381 void pane_allocation_handler (GtkAllocation*, Gtk::Paned*);
383 Gtk::HPaned canvas_region_list_pane;
384 Gtk::HPaned track_list_canvas_pane;
386 Gtk::EventBox meter_base;
388 Gtk::EventBox marker_base;
389 Gtk::HBox marker_box;
390 Gtk::VBox scrollers_rulers_markers_box;
392 void location_changed (ARDOUR::Location *);
393 void location_flags_changed (ARDOUR::Location *, void *);
394 void refresh_location_display ();
395 void refresh_location_display_s (ARDOUR::Change);
396 void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
397 void add_new_location (ARDOUR::Location *);
398 void location_gone (ARDOUR::Location *);
399 void remove_marker (Gnome::Canvas::Polygon&, GdkEvent*);
400 gint really_remove_marker (ARDOUR::Location* loc);
402 uint32_t location_marker_color;
403 uint32_t location_range_color;
404 uint32_t location_loop_color;
405 uint32_t location_punch_color;
406 uint32_t location_cd_marker_color;
408 struct LocationMarkers {
416 void set_name (const string&);
417 void set_position (jack_nframes_t start, jack_nframes_t end = 0);
418 void set_color_rgba (uint32_t);
421 LocationMarkers *find_location_markers (ARDOUR::Location *);
422 ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start);
424 typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
425 LocationMarkerMap location_markers;
427 void hide_marker (GnomeCanvasItem*, GdkEvent*);
428 void clear_marker_display ();
429 void mouse_add_new_marker (jack_nframes_t where);
431 TimeAxisView* clicked_trackview;
432 AudioTimeAxisView* clicked_audio_trackview;
433 AudioRegionView* clicked_regionview;
434 AudioRegionView* latest_regionview;
435 uint32_t clicked_selection;
436 CrossfadeView* clicked_crossfadeview;
437 ControlPoint* clicked_control_point;
439 void catch_vanishing_audio_regionview (AudioRegionView *);
440 void set_selected_control_point_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
441 void set_selected_track_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
442 void set_selected_regionview_from_click (bool add = false, bool no_track_remove=false);
443 void set_selected_regionview_from_region_list (ARDOUR::Region& region, bool add = false);
444 gint set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
445 void collect_new_region_view (AudioRegionView *);
447 Gtk::Menu track_context_menu;
448 Gtk::Menu track_region_context_menu;
449 Gtk::Menu track_selection_context_menu;
450 Gtk::Menu track_crossfade_context_menu;
452 Gtk::MenuItem* region_edit_menu_split_item;
453 Gtk::MenuItem* region_edit_menu_split_multichannel_item;
454 Gtk::Menu * track_region_edit_playlist_menu;
455 Gtk::Menu * track_edit_playlist_submenu;
456 Gtk::Menu * track_selection_edit_playlist_submenu;
458 void popup_track_context_menu (int, int, ItemType, bool, jack_nframes_t);
459 Gtk::Menu* build_track_context_menu (jack_nframes_t);
460 Gtk::Menu* build_track_bus_context_menu (jack_nframes_t);
461 Gtk::Menu* build_track_region_context_menu (jack_nframes_t frame);
462 Gtk::Menu* build_track_crossfade_context_menu (jack_nframes_t);
463 Gtk::Menu* build_track_selection_context_menu (jack_nframes_t);
464 void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
465 void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
466 void add_region_context_items (StreamView*, ARDOUR::Region*, Gtk::Menu_Helpers::MenuList&);
467 void add_crossfade_context_items (StreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
468 void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
470 void handle_new_route (ARDOUR::Route&);
471 void handle_new_route_p (ARDOUR::Route*);
472 void remove_route (TimeAxisView *);
475 Gtk::HBox global_hpacker;
476 Gtk::VBox global_vpacker;
479 GdkCursor *current_canvas_cursor;
481 Gnome::Canvas::CanvasAA track_canvas;
482 Gnome::Canvas::CanvasAA time_canvas;
484 Gnome::Canvas::Text* first_action_message;
485 Gnome::Canvas::Text* verbose_canvas_cursor;
486 bool verbose_cursor_visible;
488 void session_control_changed (ARDOUR::Session::ControlType);
489 void queue_session_control_changed (ARDOUR::Session::ControlType);
492 gint track_canvas_motion (GdkEvent*);
493 void set_verbose_canvas_cursor (string, double x, double y);
494 void set_verbose_canvas_cursor_text (string);
495 void show_verbose_canvas_cursor();
496 void hide_verbose_canvas_cursor();
498 bool verbose_cursor_on; // so far unused
500 void flush_track_canvas ();
501 void flush_time_canvas ();
503 Gtk::EventBox time_canvas_event_box;
504 Gtk::EventBox track_canvas_event_box;
505 Gtk::EventBox time_button_event_box;
507 Gnome::Canvas::Group *minsec_group;
508 Gnome::Canvas::Group *bbt_group;
509 Gnome::Canvas::Group *smpte_group;
510 Gnome::Canvas::Group *frame_group;
511 Gnome::Canvas::Group *tempo_group;
512 Gnome::Canvas::Group *meter_group;
513 Gnome::Canvas::Group *marker_group;
514 Gnome::Canvas::Group *range_marker_group;
515 Gnome::Canvas::Group *transport_marker_group;
518 ruler_metric_smpte = 0,
519 ruler_metric_bbt = 1,
520 ruler_metric_frames = 2,
521 ruler_metric_minsec = 3,
523 ruler_time_tempo = 4,
524 ruler_time_meter = 5,
525 ruler_time_marker = 6,
526 ruler_time_range_marker = 7,
527 ruler_time_transport_marker = 8,
530 static GtkCustomMetric ruler_metrics[4];
532 bool no_ruler_shown_update;
534 gint ruler_button_press (GdkEventButton*);
535 gint ruler_button_release (GdkEventButton*);
536 gint ruler_mouse_motion (GdkEventMotion*);
538 gint ruler_pressed_button;
539 Gtk::Widget * ruler_grabbed_widget;
541 void initialize_rulers ();
542 void update_just_smpte ();
543 void update_fixed_rulers ();
544 void update_tempo_based_rulers ();
545 void popup_ruler_menu (jack_nframes_t where = 0, ItemType type = RegionItem);
546 void update_ruler_visibility ();
547 void ruler_toggled (int);
548 gint ruler_label_button_release (GdkEventButton*);
549 void store_ruler_visibility ();
550 void restore_ruler_visibility ();
552 static gint _metric_get_smpte (GtkCustomRulerMark **, gulong, gulong, gint);
553 static gint _metric_get_bbt (GtkCustomRulerMark **, gulong, gulong, gint);
554 static gint _metric_get_frames (GtkCustomRulerMark **, gulong, gulong, gint);
555 static gint _metric_get_minsec (GtkCustomRulerMark **, gulong, gulong, gint);
557 gint metric_get_smpte (GtkCustomRulerMark **, gulong, gulong, gint);
558 gint metric_get_bbt (GtkCustomRulerMark **, gulong, gulong, gint);
559 gint metric_get_frames (GtkCustomRulerMark **, gulong, gulong, gint);
560 gint metric_get_minsec (GtkCustomRulerMark **, gulong, gulong, gint);
562 GtkWidget *_smpte_ruler;
563 GtkWidget *_bbt_ruler;
564 GtkWidget *_frames_ruler;
565 GtkWidget *_minsec_ruler;
566 Gtk::Widget *smpte_ruler;
567 Gtk::Widget *bbt_ruler;
568 Gtk::Widget *frames_ruler;
569 Gtk::Widget *minsec_ruler;
570 static Editor *ruler_editor;
572 static const double timebar_height;
573 guint32 visible_timebars;
574 Gtk::Menu *editor_ruler_menu;
576 Gnome::Canvas::Rect* tempo_bar;
577 Gnome::Canvas::Rect* meter_bar;
578 Gnome::Canvas::Rect* marker_bar;
579 Gnome::Canvas::Rect* range_marker_bar;
580 Gnome::Canvas::Rect* transport_marker_bar;
583 Gnome::Canvas::Line* tempo_line;
584 Gnome::Canvas::Line* meter_line;
585 Gnome::Canvas::Line* marker_line;
586 Gnome::Canvas::Line* range_marker_line;
587 Gnome::Canvas::Line* transport_marker_line;
589 Gnome::Canvas::Points* tempo_line_points;
590 Gnome::Canvas::Points* meter_line_points;
591 Gnome::Canvas::Points* marker_line_points;
592 Gnome::Canvas::Points* range_marker_line_points;
593 Gnome::Canvas::Points* transport_marker_line_points;
595 Gtk::Label minsec_label;
596 Gtk::Label bbt_label;
597 Gtk::Label smpte_label;
598 Gtk::Label frame_label;
599 Gtk::Label tempo_label;
600 Gtk::Label meter_label;
601 Gtk::Label mark_label;
602 Gtk::Label range_mark_label;
603 Gtk::Label transport_mark_label;
606 Gtk::VBox time_button_vbox;
607 Gtk::HBox time_button_hbox;
611 Gnome::Canvas::Points* points;
612 Gnome::Canvas::Item* canvas_item;
613 jack_nframes_t current_frame;
614 GtkSignalFunc callback;
617 Cursor (Editor&, const string& color, GtkSignalFunc callback);
620 void set_position (jack_nframes_t);
621 void set_length (double units);
622 void set_y_axis (double position);
625 friend struct Cursor; /* it needs access to several private
629 Cursor* playhead_cursor;
631 Gnome::Canvas::Group* cursor_group;
633 void cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
634 void cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
635 void cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
636 void cursor_to_selection_start (Cursor *);
637 void cursor_to_selection_end (Cursor *);
639 ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
641 vector<jack_nframes_t> region_boundary_cache;
642 void build_region_boundary_cache ();
644 Gtk::VBox trackview_vpacker;
647 Gtk::HBox bottom_hbox;
649 Gtk::Table edit_packer;
650 Gtk::Frame edit_frame;
651 Gtk::VScrollbar edit_vscrollbar;
653 /* the horizontal scroller works in a rather different way
654 than a regular scrollbar, since its used for
655 zoom control/indication as well. But more importantly,
656 its different components (slider, left arrow, right arrow)
657 have to be packed separately into the edit_packer.
660 Gtk::HScrollbar edit_hscrollbar;
661 Gtk::DrawingArea edit_hscroll_slider;
662 Gtk::Arrow edit_hscroll_left_arrow;
663 Gtk::Arrow edit_hscroll_right_arrow;
664 Gtk::EventBox edit_hscroll_left_arrow_event;
665 Gtk::EventBox edit_hscroll_right_arrow_event;
666 gint edit_hscroll_slider_width;
667 gint edit_hscroll_slider_height;
668 static const gint edit_hscroll_edge_width = 3;
669 bool edit_hscroll_dragging;
670 double edit_hscroll_drag_last;
672 void hscroll_slider_allocate (GtkAllocation *);
673 gint hscroll_slider_expose (GdkEventExpose*);
674 gint hscroll_slider_button_press (GdkEventButton*);
675 gint hscroll_slider_button_release (GdkEventButton*);
676 gint hscroll_slider_motion (GdkEventMotion*);
678 gint hscroll_trough_expose (GdkEventExpose*);
679 gint hscroll_trough_button_press (GdkEventButton*);
680 gint hscroll_trough_button_release (GdkEventButton*);
682 void update_hscroller ();
684 gint hscroll_left_arrow_button_press (GdkEventButton *);
685 gint hscroll_left_arrow_button_release (GdkEventButton *);
686 gint hscroll_right_arrow_button_press (GdkEventButton *);
687 gint hscroll_right_arrow_button_release (GdkEventButton *);
689 guint32 canvas_width;
690 guint32 canvas_height;
692 Gtk::ScrolledWindow track_canvas_scroller;
693 Gtk::ScrolledWindow time_canvas_scroller;
694 Gtk::ScrolledWindow edit_controls_scroller;
696 gint edit_controls_button_release (GdkEventButton*);
697 Gtk::Menu *edit_controls_left_menu;
698 Gtk::Menu *edit_controls_right_menu;
700 void track_canvas_scroller_realized ();
701 void time_canvas_scroller_realized ();
703 Gtk::VBox track_canvas_vbox;
704 Gtk::VBox time_canvas_vbox;
705 Gtk::VBox edit_controls_vbox;
706 Gtk::HBox edit_controls_hbox;
708 void tie_vertical_scrolling ();
709 void canvas_horizontally_scrolled ();
710 void reposition_and_zoom (jack_nframes_t sample, double fpu);
711 gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
712 void end_location_changed (ARDOUR::Location*);
713 bool repos_zoom_queued;
714 bool no_zoom_repos_update;
715 bool no_tempo_map_update;
717 struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
718 RegionListDisplayModelColumns() {
722 Gtk::TreeModelColumn<Glib::ustring> name;
723 Gtk::TreeModelColumn<ARDOUR::Region*> region;
726 RegionListDisplayModelColumns region_list_columns;
727 Gtk::TreeView region_list_display;
728 Glib::RefPtr<Gtk::TreeStore> region_list_model;
729 Glib::RefPtr<Gtk::TreeModelSort> region_list_sort_model;
730 Glib::RefPtr<Gtk::Action> toggle_full_region_list_action;
732 void region_list_selection_changed ();
734 Gtk::Menu *region_list_menu;
735 Gtk::ScrolledWindow region_list_scroller;
736 Gtk::Frame region_list_frame;
738 bool region_list_display_key_press (GdkEventKey *);
739 bool region_list_display_key_release (GdkEventKey *);
740 bool region_list_display_button_press (GdkEventButton *);
741 bool region_list_display_button_release (GdkEventButton *);
742 bool region_list_display_enter_notify (GdkEventCrossing *);
743 bool region_list_display_leave_notify (GdkEventCrossing *);
744 void region_list_clear ();
745 void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
746 void build_region_list_menu ();
748 Gtk::CheckMenuItem* toggle_auto_regions_item;
749 Gtk::CheckMenuItem* toggle_full_region_list_item;
751 Gtk::MenuItem* import_audio_item;
752 Gtk::MenuItem* embed_audio_item;
754 bool show_automatic_regions_in_region_list;
755 Editing::RegionListSortType region_list_sort_type;
757 void reset_region_list_sort_direction (bool);
758 void reset_region_list_sort_type (Editing::RegionListSortType);
760 void toggle_full_region_list ();
761 void toggle_show_auto_regions ();
763 int region_list_sorter (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
765 /* named selections */
767 Gtk::VPaned region_selection_vpane;
768 Gtk::TreeView named_selection_display;
769 Gtk::ScrolledWindow named_selection_scroller;
771 void name_selection();
772 void named_selection_name_chosen ();
773 void create_named_selection (string);
774 void paste_named_selection (float times);
776 void handle_new_named_selection ();
777 void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
778 void redisplay_named_selections ();
780 gint named_selection_display_button_press (GdkEventButton *ev);
781 void named_selection_display_selected (gint row, gint col, GdkEvent *ev);
782 void named_selection_display_unselected (gint row, gint col, GdkEvent *ev);
786 TrackViewList track_views;
787 TimeAxisView *trackview_by_y_position (double ypos);
789 static GdkCursor* cross_hair_cursor;
790 static GdkCursor* trimmer_cursor;
791 static GdkCursor* selector_cursor;
792 static GdkCursor* grabber_cursor;
793 static GdkCursor* zoom_cursor;
794 static GdkCursor* time_fx_cursor;
795 static GdkCursor* fader_cursor;
796 static GdkCursor* speaker_cursor;
797 static GdkCursor* null_cursor;
798 static GdkCursor* wait_cursor;
799 static GdkCursor* timebar_cursor;
801 static void build_cursors ();
803 sigc::connection scroll_connection;
804 jack_nframes_t last_update_frame;
805 void center_screen (jack_nframes_t);
806 void center_screen_internal (jack_nframes_t, float);
808 void update_current_screen ();
809 sigc::connection slower_update_connection;
810 void update_slower ();
812 gint show_track_context_menu (GdkEventButton *);
813 void hide_track_context_menu ();
815 void session_going_away ();
817 jack_nframes_t cut_buffer_start;
818 jack_nframes_t cut_buffer_length;
820 gint typed_event (GnomeCanvasItem*, GdkEvent*, ItemType);
821 gint button_press_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
822 gint button_release_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
823 gint motion_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
824 gint enter_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
825 gint leave_handler (GnomeCanvasItem*, GdkEvent*, ItemType);
827 /* KEYMAP HANDLING */
829 void register_actions ();
830 void install_keybindings ();
832 int ensure_cursor (jack_nframes_t* pos);
834 void fake_handle_new_audio_region (ARDOUR::AudioRegion *);
835 void handle_new_audio_region (ARDOUR::AudioRegion *);
836 void fake_handle_audio_region_removed (ARDOUR::AudioRegion *);
837 void handle_audio_region_removed (ARDOUR::AudioRegion *);
838 void add_audio_region_to_region_display (ARDOUR::AudioRegion *);
839 void region_hidden (ARDOUR::Region*);
840 void redisplay_regions ();
841 void insert_into_tmp_audio_regionlist(ARDOUR::AudioRegion *);
843 list<ARDOUR::AudioRegion *> tmp_audio_region_list;
845 void cut_copy (Editing::CutCopyOp);
846 void cut_copy_points (Editing::CutCopyOp);
847 void cut_copy_regions (Editing::CutCopyOp);
848 void cut_copy_ranges (Editing::CutCopyOp);
851 void paste_internal (jack_nframes_t position, float times);
853 /* EDITING OPERATIONS */
855 void toggle_region_mute ();
856 void toggle_region_opaque ();
857 void raise_region ();
858 void raise_region_to_top ();
859 void lower_region ();
860 void lower_region_to_bottom ();
861 void split_region ();
862 void split_region_at (jack_nframes_t);
863 void split_regions_at (jack_nframes_t, AudioRegionSelection&);
864 void crop_region_to_selection ();
865 void set_region_sync_from_edit_cursor ();
866 void remove_region_sync();
867 void align_selection (ARDOUR::RegionPoint, jack_nframes_t position);
868 void align_selection_relative (ARDOUR::RegionPoint point, jack_nframes_t position);
869 void align_region (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
870 void align_region_internal (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
871 void remove_some_regions ();
872 void remove_clicked_region ();
873 void destroy_clicked_region ();
875 void duplicate_some_regions (AudioRegionSelection&, float times);
876 void duplicate_selection (float times);
877 void region_fill_selection ();
879 void region_fill_track ();
880 void audition_playlist_region_standalone (ARDOUR::AudioRegion&);
881 void audition_playlist_region_via_route (ARDOUR::AudioRegion&, ARDOUR::Route&);
882 void split_multichannel_region();
883 void reverse_region ();
884 void normalize_region ();
885 void denormalize_region ();
887 void audition_region_from_region_list ();
888 void hide_region_from_region_list ();
889 void remove_region_from_region_list ();
891 void align (ARDOUR::RegionPoint);
892 void align_relative (ARDOUR::RegionPoint);
897 void paste (float times);
899 int get_prefix (float&, bool&);
901 void keyboard_paste ();
902 void keyboard_duplicate_region ();
903 void keyboard_duplicate_selection ();
904 void keyboard_nudge ();
905 void keyboard_insert_region_list_selection ();
907 void region_from_selection ();
908 void create_region_from_selection (std::vector<ARDOUR::AudioRegion*>&);
911 void rename_region ();
912 void rename_region_finished (bool);
914 void play_from_start ();
915 void play_from_edit_cursor ();
916 void play_selected_region ();
917 void audition_selected_region ();
918 void toggle_loop_playback ();
919 void loop_selected_region ();
920 void play_location (ARDOUR::Location&);
921 void loop_location (ARDOUR::Location&);
923 Editing::ZoomFocus zoom_focus;
925 void temporal_zoom_selection ();
926 void temporal_zoom_session ();
927 void temporal_zoom (gdouble scale);
928 void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, string op);
929 void temporal_zoom_to_frame (bool coarser, jack_nframes_t frame);
931 void amplitude_zoom (gdouble scale);
932 void amplitude_zoom_step (bool in);
934 void insert_region_list_drag (ARDOUR::AudioRegion&);
935 void insert_region_list_selection (float times);
937 void insert_sndfile (bool as_tracks);
938 void embed_audio (); // inserts into region list
939 int reject_because_rate_differs (string path, SF_INFO& finfo, string action, bool multiple_pending);
941 void do_embed_sndfiles (vector<string> paths, bool split);
942 void embed_sndfile (string path, bool split, bool multiple_files, bool& check_sr);
944 void do_insert_sndfile (vector<string> path, bool multi, jack_nframes_t frame);
945 void insert_paths_as_new_tracks (std::vector<std::string> paths, bool multi); // inserts files as new tracks
946 void insert_sndfile_into (string path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
947 static void* _insert_sndfile_thread (void*);
948 void* insert_sndfile_thread (void*);
950 /* generic interthread progress window */
952 ArdourDialog* interthread_progress_window;
953 Gtk::Label interthread_progress_label;
954 Gtk::VBox interthread_progress_vbox;
955 Gtk::ProgressBar interthread_progress_bar;
956 Gtk::Button interthread_cancel_button;
957 Gtk::Label interthread_cancel_label;
958 sigc::connection interthread_progress_connection;
959 void interthread_cancel_clicked ();
960 void build_interthread_progress_window ();
961 ARDOUR::InterThreadInfo* current_interthread_info;
963 /* import specific info */
965 ARDOUR::Session::import_status import_status;
966 gint import_progress_timeout (void *);
967 static void *_import_thread (void *);
968 void* import_thread ();
969 void catch_new_audio_region (ARDOUR::AudioRegion*);
970 ARDOUR::AudioRegion* last_audio_region;
972 /* to support this ... */
974 void import_audio (bool as_tracks);
975 void do_import (vector<string> paths, bool split, bool as_tracks);
977 void move_to_start ();
980 void center_playhead ();
981 void center_edit_cursor ();
982 void edit_cursor_backward ();
983 void edit_cursor_forward ();
984 void playhead_backward ();
985 void playhead_forward ();
986 void scroll_backward (float pages=0.8f);
987 void scroll_forward (float pages=0.8f);
988 void scroll_tracks_down ();
989 void scroll_tracks_up ();
990 void delete_sample_forward ();
991 void delete_sample_backward ();
992 void delete_screen ();
993 void search_backwards ();
994 void search_forwards ();
996 void clear_markers ();
997 void clear_ranges ();
998 void clear_locations ();
999 void jump_forward_to_mark ();
1000 void jump_backward_to_mark ();
1001 void cursor_align (bool playhead_to_edit);
1003 void remove_last_capture ();
1005 void set_selection_from_range (ARDOUR::Location&);
1006 void set_selection_from_punch ();
1007 void set_selection_from_loop ();
1009 void add_location_from_selection ();
1010 void set_route_loop_selection ();
1012 void add_location_from_playhead_cursor ();
1014 void reverse_selection ();
1015 void edit_envelope ();
1017 void start_scrolling ();
1018 void stop_scrolling ();
1020 void keyboard_selection_begin ();
1021 void keyboard_selection_finish (bool add);
1022 bool have_pending_keyboard_selection;
1023 jack_nframes_t pending_keyboard_selection_start;
1025 ARDOUR::AudioRegion* select_region_for_operation (int dir, TimeAxisView **tv);
1026 void extend_selection_to_end_of_region (bool next);
1027 void extend_selection_to_start_of_region (bool previous);
1029 Editing::SnapType snap_type;
1030 Editing::SnapMode snap_mode;
1031 double snap_threshold;
1033 void soundfile_chosen_for_insert (string selection, bool split_channels);
1034 void soundfile_chosen_for_embed (string selection, bool split_channels);
1035 void soundfile_chosen_for_import (string selection, bool split_channels);
1037 void handle_gui_changes (string, void *);
1039 void hide_all_tracks (bool with_select);
1041 void route_list_selected (gint row, gint col, GdkEvent* ev);
1042 void route_list_unselected (gint row, gint col, GdkEvent* ev);
1043 void redisplay_route_list();
1044 gint route_list_reordered ();
1045 bool ignore_route_list_reorder;
1046 void queue_route_list_reordered (gint row, gint col);
1049 GnomeCanvasItem* item;
1051 jack_nframes_t last_frame_position;
1052 int32_t pointer_frame_offset;
1053 jack_nframes_t grab_frame;
1054 jack_nframes_t last_pointer_frame;
1055 jack_nframes_t current_pointer_frame;
1056 double grab_x, grab_y;
1057 double cumulative_x_drag;
1058 double cumulative_y_drag;
1059 double current_pointer_x;
1060 double current_pointer_y;
1061 void (Editor::*motion_callback)(GnomeCanvasItem*, GdkEvent*);
1062 void (Editor::*finished_callback)(GnomeCanvasItem*, GdkEvent*);
1063 TimeAxisView* last_trackview;
1068 bool move_threshold_passsed;
1069 bool want_move_threshold;
1071 ARDOUR::Location* copied_location;
1074 struct LineDragInfo {
1079 LineDragInfo current_line_drag_info;
1081 void start_grab (GdkEvent*, GdkCursor* cursor = 0);
1082 bool end_grab (GnomeCanvasItem*, GdkEvent*);
1084 Gtk::Menu fade_context_menu;
1085 void popup_fade_context_menu (int, int, GnomeCanvasItem*, ItemType);
1087 void start_fade_in_grab (GnomeCanvasItem*, GdkEvent*);
1088 void start_fade_out_grab (GnomeCanvasItem*, GdkEvent*);
1089 void fade_in_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1090 void fade_out_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1091 void fade_in_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1092 void fade_out_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1094 std::set<ARDOUR::Playlist*> motion_frozen_playlists;
1095 void region_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1096 void region_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1097 void region_copy_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1099 void cursor_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1100 void cursor_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1101 void marker_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1102 void marker_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1103 void control_point_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1104 void control_point_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1105 void line_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1106 void line_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1108 void tempo_marker_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1109 void tempo_marker_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1110 void meter_marker_drag_motion_callback (GnomeCanvasItem*, GdkEvent*);
1111 void meter_marker_drag_finished_callback (GnomeCanvasItem*, GdkEvent*);
1113 gint mouse_rename_region (GnomeCanvasItem*, GdkEvent*);
1115 void start_region_grab (GnomeCanvasItem*, GdkEvent*);
1116 void start_region_copy_grab (GnomeCanvasItem*, GdkEvent*);
1117 void start_region_brush_grab (GnomeCanvasItem*, GdkEvent*);
1118 void start_selection_grab (GnomeCanvasItem*, GdkEvent*);
1119 void start_cursor_grab (GnomeCanvasItem*, GdkEvent*);
1120 void start_marker_grab (GnomeCanvasItem*, GdkEvent*);
1121 void start_control_point_grab (GnomeCanvasItem*, GdkEvent*);
1122 void start_line_grab_from_regionview (GnomeCanvasItem*, GdkEvent*);
1123 void start_line_grab_from_line (GnomeCanvasItem*, GdkEvent*);
1124 void start_line_grab (AutomationLine *, GdkEvent*);
1125 void start_tempo_marker_grab (GnomeCanvasItem*, GdkEvent*);
1126 void start_meter_marker_grab (GnomeCanvasItem*, GdkEvent*);
1128 void region_view_item_click (AudioRegionView&, GdkEventButton*);
1130 void remove_gain_control_point (GnomeCanvasItem*, GdkEvent*);
1131 void remove_control_point (GnomeCanvasItem*, GdkEvent*);
1133 void mouse_brush_insert_region (AudioRegionView*, jack_nframes_t pos);
1134 void brush (jack_nframes_t);
1136 void show_verbose_time_cursor (jack_nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
1137 void show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
1139 /* Canvas event handlers */
1141 gint canvas_crossfade_view_event (GdkEvent* event);
1142 gint canvas_fade_in_event (GdkEvent* event);
1143 gint canvas_fade_in_handle_event (GdkEvent* event);
1144 gint canvas_fade_out_event (GdkEvent* event);
1145 gint canvas_fade_out_handle_event (GdkEvent* event);
1146 gint canvas_region_view_event (GdkEvent* event);
1147 gint canvas_region_view_name_highlight_event (GdkEvent* event);
1148 gint canvas_region_view_name_event (GdkEvent* event);
1149 gint canvas_stream_view_event (GdkEvent* event);
1150 gint canvas_marker_event (GdkEvent* event);
1151 gint canvas_zoom_rect_event (GdkEvent* event);
1152 gint canvas_selection_rect_event (GdkEvent* event);
1153 gint canvas_selection_start_trim_event (GdkEvent* event);
1154 gint canvas_selection_end_trim_event (GdkEvent* event);
1155 gint canvas_control_point_event (GdkEvent* event);
1156 gint canvas_line_event (GdkEvent* event);
1157 gint canvas_tempo_marker_event (GdkEvent* event);
1158 gint canvas_meter_marker_event (GdkEvent* event);
1159 gint canvas_tempo_bar_event (GdkEvent* event);
1160 gint canvas_meter_bar_event (GdkEvent* event);
1161 gint canvas_marker_bar_event (GdkEvent* event);
1162 gint canvas_range_marker_bar_event (GdkEvent* event);
1163 gint canvas_transport_marker_bar_event (GdkEvent* event);
1164 gint canvas_imageframe_item_view_event(GdkEvent* event) ;
1165 gint canvas_imageframe_view_event(GdkEvent* event) ;
1166 gint canvas_imageframe_start_handle_event(GdkEvent* event) ;
1167 gint canvas_imageframe_end_handle_event(GdkEvent* event) ;
1168 gint canvas_marker_time_axis_view_event(GdkEvent* event) ;
1169 gint canvas_markerview_item_view_event(GdkEvent* event) ;
1170 gint canvas_markerview_start_handle_event(GdkEvent* event) ;
1171 gint canvas_markerview_end_handle_event(GdkEvent* event) ;
1172 gint canvas_automation_track_event(GdkEvent* event) ;
1175 gint canvas_crossfade_view_event (GnomeCanvasItem* item, GdkEvent* event, CrossfadeView*);
1176 gint canvas_fade_in_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
1177 gint canvas_fade_in_handle_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
1178 gint canvas_fade_out_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
1179 gint canvas_fade_out_handle_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
1180 gint canvas_region_view_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
1181 gint canvas_stream_view_event (GnomeCanvasItem* item, GdkEvent* event, AudioTimeAxisView*);
1182 gint canvas_automation_track_event (GnomeCanvasItem* item, GdkEvent* event, AutomationTimeAxisView*);
1183 gint canvas_marker_event (GnomeCanvasItem* item, GdkEvent* event);
1184 gint canvas_zoom_rect_event (GnomeCanvasItem* item, GdkEvent* event);
1185 gint canvas_selection_rect_event (GnomeCanvasItem* item, GdkEvent* event);
1186 gint canvas_selection_start_trim_event (GnomeCanvasItem* item, GdkEvent* event);
1187 gint canvas_selection_end_trim_event (GnomeCanvasItem* item, GdkEvent* event);
1188 gint canvas_control_point_event (GnomeCanvasItem* item, GdkEvent* event);
1189 gint canvas_line_event (GnomeCanvasItem* item, GdkEvent* event);
1190 gint canvas_tempo_marker_event (GnomeCanvasItem* item, GdkEvent* event);
1191 gint canvas_meter_marker_event (GnomeCanvasItem* item, GdkEvent* event);
1192 gint canvas_tempo_bar_event (GnomeCanvasItem* item, GdkEvent* event);
1193 gint canvas_meter_bar_event (GnomeCanvasItem* item, GdkEvent* event);
1194 gint canvas_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
1195 gint canvas_range_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
1196 gint canvas_transport_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
1197 gint canvas_region_view_name_highlight_event (GnomeCanvasItem* item, GdkEvent* event);
1198 gint canvas_region_view_name_event (GnomeCanvasItem* item, GdkEvent* event);
1201 gint canvas_copy_region_event (GdkEvent* event);
1202 gint canvas_playhead_cursor_event (GdkEvent* event);
1203 gint canvas_edit_cursor_event (GdkEvent* event);
1204 gint track_canvas_event (GdkEvent* event);
1206 gint track_canvas_button_press_event (GdkEventButton *);
1207 gint track_canvas_button_release_event (GdkEventButton *);
1209 void track_canvas_allocate (GtkAllocation* alloc);
1210 void time_canvas_allocate (GtkAllocation* alloc);
1212 void set_edit_cursor (GdkEvent* event);
1213 void set_playhead_cursor (GdkEvent* event);
1215 void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
1216 void kbd_set_playhead_cursor ();
1217 void kbd_set_edit_cursor ();
1219 void kbd_align (ARDOUR::RegionPoint);
1220 void kbd_align_relative (ARDOUR::RegionPoint);
1222 void kbd_audition ();
1224 void kbd_do_split (GdkEvent*);
1225 void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
1226 void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
1227 void kbd_do_brush (GdkEvent*);
1228 void kbd_do_audition (GdkEvent*);
1230 void fake_handle_new_duration ();
1231 void handle_new_duration ();
1232 void initialize_canvas ();
1233 void reset_scrolling_region (GtkAllocation* alloc = 0);
1234 void scroll_canvas ();
1236 /* sub-event loop handling */
1238 int32_t sub_event_loop_status;
1239 void run_sub_event_loop ();
1240 void finish_sub_event_loop (int status);
1241 gint finish_sub_event_loop_on_delete (GdkEventAny*, int32_t status);
1243 /* display control */
1245 bool _show_measures;
1246 bool _show_waveforms;
1247 bool _follow_playhead;
1248 bool _show_waveforms_recording;
1250 void add_bbt_marks (ARDOUR::TempoMap::BBTPointList&);
1252 ARDOUR::TempoMap::BBTPointList *current_bbt_points;
1254 typedef vector<GnomeCanvasItem*> TimeLineList;
1255 TimeLineList free_measure_lines;
1256 TimeLineList used_measure_lines;
1258 GnomeCanvasItem* time_line_group;
1259 GnomeCanvasItem* get_time_line ();
1260 void hide_measures ();
1261 void draw_measures ();
1262 void draw_time_bars ();
1264 void new_tempo_section ();
1266 void mouse_add_new_tempo_event (jack_nframes_t where);
1267 void mouse_add_new_meter_event (jack_nframes_t where);
1269 void remove_tempo_marker (GnomeCanvasItem*);
1270 void remove_meter_marker (GnomeCanvasItem*);
1271 gint real_remove_tempo_marker (ARDOUR::TempoSection*);
1272 gint real_remove_meter_marker (ARDOUR::MeterSection*);
1274 void edit_tempo_section (ARDOUR::TempoSection*);
1275 void edit_meter_section (ARDOUR::MeterSection*);
1276 void edit_tempo_marker (GnomeCanvasItem*);
1277 void edit_meter_marker (GnomeCanvasItem*);
1279 void marker_menu_edit ();
1280 void marker_menu_remove ();
1281 void marker_menu_rename ();
1282 void marker_menu_hide ();
1283 void marker_menu_loop_range ();
1284 void marker_menu_play_from ();
1285 void marker_menu_set_playhead ();
1286 void marker_menu_set_from_playhead ();
1287 void marker_menu_set_from_selection ();
1288 void new_transport_marker_menu_set_loop ();
1289 void new_transport_marker_menu_set_punch ();
1290 void update_loop_range_view (bool visibility=false);
1291 void update_punch_range_view (bool visibility=false);
1292 gint new_transport_marker_menu_popdown (GdkEventAny*);
1293 void marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
1294 void tm_marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
1295 void transport_marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
1296 void new_transport_marker_context_menu (GdkEventButton*, GnomeCanvasItem*);
1297 void build_marker_menu ();
1298 void build_tm_marker_menu ();
1299 void build_transport_marker_menu ();
1300 void build_new_transport_marker_menu ();
1302 Gtk::Menu* tm_marker_menu;
1303 Gtk::Menu* marker_menu;
1304 Gtk::Menu* transport_marker_menu;
1305 Gtk::Menu* new_transport_marker_menu;
1306 GnomeCanvasItem* marker_menu_item;
1308 typedef list<Marker*> Marks;
1311 void remove_metric_marks ();
1312 void draw_metric_marks (const ARDOUR::Metrics& metrics);
1314 void tempo_map_changed (ARDOUR::Change);
1315 void redisplay_tempo ();
1317 void snap_to (jack_nframes_t& first, int32_t direction = 0, bool for_mark = false);
1318 uint32_t bbt_beat_subdivision;
1322 Gtk::ToggleButton editor_mixer_button;
1324 void editor_mixer_button_toggled ();
1326 AudioClock selection_start_clock;
1327 Gtk::Label selection_start_clock_label;
1328 AudioClock selection_end_clock;
1329 Gtk::Label selection_end_clock_label;
1330 AudioClock edit_cursor_clock;
1331 Gtk::Label edit_cursor_clock_label;
1332 AudioClock zoom_range_clock;
1333 Gtk::Button zoom_in_button;
1334 Gtk::Button zoom_out_button;
1335 Gtk::Button zoom_out_full_button;
1336 Gtk::Button zoom_onetoone_button;
1338 Gtk::VBox toolbar_clock_vbox;
1339 Gtk::VBox toolbar_selection_clock_vbox;
1340 Gtk::Table toolbar_selection_clock_table;
1341 Gtk::Label toolbar_selection_cursor_label;
1343 Gtk::Table mouse_mode_button_table;
1344 Gtkmm2ext::TearOff* mouse_mode_tearoff;
1345 Gtk::ToggleButton mouse_select_button;
1346 Gtk::ToggleButton mouse_move_button;
1347 Gtk::ToggleButton mouse_gain_button;
1348 Gtk::ToggleButton mouse_zoom_button;
1349 Gtk::ToggleButton mouse_timefx_button;
1350 Gtk::ToggleButton mouse_audition_button;
1351 GroupedButtons *mouse_mode_button_set;
1352 void mouse_mode_toggled (Editing::MouseMode m);
1353 bool ignore_mouse_mode_toggle;
1355 gint mouse_select_button_release (GdkEventButton*);
1357 Gtk::VBox automation_box;
1358 Gtk::Button automation_mode_button;
1359 Gtk::ToggleButton global_automation_button;
1361 Gtk::ComboBoxText edit_mode_selector;
1362 Gtk::Label edit_mode_label;
1363 Gtk::VBox edit_mode_box;
1365 gint edit_mode_selection_done (GdkEventAny*);
1367 Gtk::ComboBoxText snap_type_selector;
1368 Gtk::Label snap_type_label;
1369 Gtk::VBox snap_type_box;
1371 gint snap_type_selection_done (GdkEventAny*);
1373 Gtk::ComboBoxText snap_mode_selector;
1374 Gtk::Label snap_mode_label;
1375 Gtk::VBox snap_mode_box;
1377 gint snap_mode_selection_done (GdkEventAny*);
1379 Gtk::ComboBoxText zoom_focus_selector;
1380 Gtk::Label zoom_focus_label;
1381 Gtk::VBox zoom_focus_box;
1383 gint zoom_focus_selection_done (GdkEventAny*);
1385 Gtk::Label zoom_indicator_label;
1386 Gtk::HBox zoom_indicator_box;
1387 Gtk::VBox zoom_indicator_vbox;
1389 void update_zoom_indicator ();
1390 void zoom_adjustment_changed();
1392 void edit_cursor_clock_changed();
1394 void setup_toolbar ();
1396 Gtkmm2ext::TearOff* tools_tearoff;
1397 Gtk::HBox toolbar_hbox;
1398 Gtk::EventBox toolbar_base;
1399 Gtk::Frame toolbar_frame;
1401 /* selection process */
1403 Selection* selection;
1404 Selection* cut_buffer;
1406 void time_selection_changed ();
1407 void track_selection_changed ();
1408 void region_selection_changed ();
1409 void point_selection_changed ();
1410 void audio_track_selection_changed ();
1411 void line_selection_changed ();
1420 void start_selection_op (GnomeCanvasItem* item, GdkEvent* event, SelectionOp);
1421 void drag_selection (GnomeCanvasItem* item, GdkEvent* event);
1422 void end_selection_op (GnomeCanvasItem* item, GdkEvent* event);
1423 void cancel_selection ();
1425 void region_selection_op (void (ARDOUR::Region::*pmf)(void));
1426 void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*);
1427 void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool);
1429 bool audio_region_selection_covers (jack_nframes_t where);
1431 Gtk::VPaned route_group_vpane;
1432 Gtk::Frame route_list_frame;
1433 Gtk::Frame edit_group_list_frame;
1435 /* transport range select process */
1436 enum RangeMarkerOp {
1438 CreateTransportMarker
1441 void start_range_markerbar_op (GnomeCanvasItem* item, GdkEvent* event, RangeMarkerOp);
1442 void drag_range_markerbar_op (GnomeCanvasItem* item, GdkEvent* event);
1443 void end_range_markerbar_op (GnomeCanvasItem* item, GdkEvent* event);
1446 GnomeCanvasItem *range_bar_drag_rect;
1447 GnomeCanvasItem *transport_bar_drag_rect;
1448 GnomeCanvasItem *marker_drag_line;
1449 GnomeCanvasPoints *marker_drag_line_points;
1450 GnomeCanvasItem *range_marker_drag_rect;
1452 void update_marker_drag_item (ARDOUR::Location *);
1454 GnomeCanvasItem *transport_bar_range_rect;
1455 GnomeCanvasItem *transport_bar_preroll_rect;
1456 GnomeCanvasItem *transport_bar_postroll_rect;
1457 GnomeCanvasItem *transport_loop_range_rect;
1458 GnomeCanvasItem *transport_punch_range_rect;
1459 GnomeCanvasItem *transport_punchin_line;
1460 GnomeCanvasItem *transport_punchout_line;
1461 GnomeCanvasItem *transport_preroll_rect;
1462 GnomeCanvasItem *transport_postroll_rect;
1464 ARDOUR::Location* transport_loop_location();
1465 ARDOUR::Location* transport_punch_location();
1467 ARDOUR::Location *temp_location;
1469 /* object rubberband select process */
1471 void start_rubberband_select (GnomeCanvasItem* item, GdkEvent* event);
1472 void drag_rubberband_select (GnomeCanvasItem* item, GdkEvent* event);
1473 void end_rubberband_select (GnomeCanvasItem* item, GdkEvent* event);
1475 bool select_all_within (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, bool add);
1477 GnomeCanvasItem *rubberband_rect;
1479 /* mouse zoom process */
1481 void start_mouse_zoom (GnomeCanvasItem* item, GdkEvent* event);
1482 void drag_mouse_zoom (GnomeCanvasItem* item, GdkEvent* event);
1483 void end_mouse_zoom (GnomeCanvasItem* item, GdkEvent* event);
1485 GnomeCanvasItem *zoom_rect;
1486 void reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end);
1488 /* diskstream/route display management */
1490 Gtk::TreeView route_list;
1491 Gtk::ScrolledWindow route_list_scroller;
1492 Gtk::Menu *route_list_menu;
1494 void route_list_column_click (gint);
1495 void build_route_list_menu ();
1496 void select_all_routes ();
1497 void unselect_all_routes ();
1498 void select_all_audiotracks ();
1499 void unselect_all_audiotracks ();
1500 void select_all_audiobus ();
1501 void unselect_all_audiobus ();
1503 /* edit group management */
1505 Gtk::Button edit_group_list_button;
1506 Gtk::Label edit_group_list_button_label;
1507 Gtk::TreeView edit_group_list;
1508 Gtk::ScrolledWindow edit_group_list_scroller;
1509 Gtk::Menu *edit_group_list_menu;
1510 Gtk::VBox edit_group_vbox;
1513 void edit_group_list_column_click (gint);
1514 void build_edit_group_list_menu ();
1515 void select_all_edit_groups ();
1516 void unselect_all_edit_groups ();
1517 void new_edit_group ();
1518 void edit_group_list_button_clicked ();
1519 gint edit_group_list_button_press_event (GdkEventButton* ev);
1520 void edit_group_selected (gint row, gint col, GdkEvent* ev);
1521 void edit_group_unselected (gint row, gint col, GdkEvent* ev);
1522 void fake_add_edit_group (ARDOUR::RouteGroup* group);
1523 void add_edit_group (ARDOUR::RouteGroup* group);
1524 void group_flags_changed (void*, ARDOUR::RouteGroup*);
1526 Gtk::VBox list_vpacker;
1528 static GdkPixmap* check_pixmap;
1529 static GdkBitmap* check_mask;
1530 static GdkPixmap* empty_pixmap;
1531 static GdkBitmap* empty_mask;
1535 int autoscroll_timeout_tag;
1536 int autoscroll_direction;
1537 uint32_t autoscroll_cnt;
1538 jack_nframes_t autoscroll_distance;
1540 static gint _autoscroll_canvas (void *);
1541 gint autoscroll_canvas ();
1542 void start_canvas_autoscroll (int direction);
1543 void stop_canvas_autoscroll ();
1544 void maybe_autoscroll (GdkEvent*);
1553 void start_trim (GnomeCanvasItem*, GdkEvent*);
1554 void point_trim (GdkEvent*);
1555 void trim_motion_callback (GnomeCanvasItem*, GdkEvent*);
1556 void single_contents_trim (AudioRegionView&, jack_nframes_t, bool, bool, bool);
1557 void single_start_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1558 void single_end_trim (AudioRegionView&, jack_nframes_t, bool, bool);
1560 void trim_finished_callback (GnomeCanvasItem*, GdkEvent*);
1561 void thaw_region_after_trim (AudioRegionView& rv);
1563 void trim_region_to_edit_cursor ();
1564 void trim_region_from_edit_cursor ();
1566 bool show_gain_after_trim;
1570 int convert_drop_to_paths (std::vector<std::string>& paths,
1571 GdkDragContext *context,
1574 GtkSelectionData *data,
1578 void track_canvas_drag_data_received (GdkDragContext *context,
1581 GtkSelectionData *data,
1585 void region_list_display_drag_data_received (GdkDragContext *context,
1588 GtkSelectionData *data,
1594 ExportDialog *export_dialog;
1595 void export_range (jack_nframes_t start, jack_nframes_t end);
1597 int write_region_selection(AudioRegionSelection&);
1598 bool write_region (string path, ARDOUR::AudioRegion&);
1599 void export_region ();
1600 void write_a_region ();
1601 void bounce_region_selection ();
1602 void bounce_range_selection ();
1603 void external_edit_region ();
1605 int write_audio_selection (TimeSelection&);
1606 bool write_audio_range (ARDOUR::Playlist&, uint32_t channels, list<ARDOUR::AudioRange>&);
1608 void write_selection ();
1612 UndoAction get_memento() const;
1614 void begin_reversible_command (string cmd_name);
1615 void commit_reversible_command ();
1617 /* visual history */
1619 UndoHistory visual_history;
1620 UndoCommand current_visual_command;
1622 void begin_reversible_visual_command (string cmd_name);
1623 void commit_reversible_visual_command ();
1625 void update_title ();
1626 void update_title_s (string snapshot_name);
1629 Selection* selection;
1630 double frames_per_unit;
1636 void store_state (State&) const;
1637 void restore_state (State *);
1639 void instant_save ();
1641 ARDOUR::AudioRegion* last_audition_region;
1643 /* freeze operations */
1645 ARDOUR::InterThreadInfo freeze_status;
1646 gint freeze_progress_timeout (void *);
1647 static void* _freeze_thread (void*);
1648 void* freeze_thread ();
1650 void freeze_route ();
1651 void unfreeze_route ();
1653 /* edit-group solo + mute */
1655 void set_edit_group_solo (ARDOUR::Route&, bool);
1656 void set_edit_group_mute (ARDOUR::Route&, bool);
1660 void duplicate_dialog (bool for_region);
1664 Gtk::Menu* edit_menu;
1665 void edit_menu_map_handler ();
1667 jack_nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
1669 void time_fx_motion (GnomeCanvasItem*, GdkEvent*);
1670 void start_time_fx (GnomeCanvasItem*, GdkEvent*);
1671 void end_time_fx (GnomeCanvasItem*, GdkEvent*);
1673 struct TimeStretchDialog : public ArdourDialog {
1674 ARDOUR::Session::TimeStretchRequest request;
1676 AudioRegionSelection regions;
1677 Gtk::ProgressBar progress_bar;
1678 Gtk::ToggleButton quick_button;
1679 Gtk::ToggleButton antialias_button;
1680 Gtk::Button cancel_button;
1681 Gtk::Button action_button;
1682 Gtk::HBox lower_button_box;
1683 Gtk::HBox upper_button_box;
1687 TimeStretchDialog (Editor& e);
1689 gint update_progress ();
1690 sigc::connection first_cancel;
1691 sigc::connection first_delete;
1692 void cancel_timestretch_in_progress ();
1693 gint delete_timestretch_in_progress (GdkEventAny*);
1696 /* "whats mine is yours" */
1698 friend class TimeStretchDialog;
1700 TimeStretchDialog* current_timestretch;
1702 static void* timestretch_thread (void *arg);
1703 int run_timestretch (AudioRegionSelection&, float fraction);
1704 void do_timestretch (TimeStretchDialog&);
1706 /* editor-mixer strip */
1708 MixerStrip *current_mixer_strip;
1709 Gtk::VBox current_mixer_strip_vbox;
1710 void cms_deleted ();
1711 void current_mixer_strip_hidden ();
1712 void current_mixer_strip_removed ();
1714 void detach_tearoff (Gtk::Box* b, Gtk::Widget* w);
1715 void reattach_tearoff (Gtk::Box* b, Gtk::Widget* w, int32_t n);
1717 /* nudging tracks */
1719 void nudge_track (bool use_edit_cursor, bool forwards);
1723 bool _xfade_visibility;
1725 /* <CMT Additions> */
1726 void handle_new_imageframe_time_axis_view(std::string track_name, void* src) ;
1727 void handle_new_imageframe_marker_time_axis_view(std::string track_name, TimeAxisView* marked_track) ;
1729 void start_imageframe_grab(GnomeCanvasItem*, GdkEvent*) ;
1730 void start_markerview_grab(GnomeCanvasItem*, GdkEvent*) ;
1732 void imageframe_drag_motion_callback(GnomeCanvasItem*, GdkEvent*) ;
1733 void markerview_drag_motion_callback(GnomeCanvasItem*, GdkEvent*) ;
1734 void timeaxis_item_drag_finished_callback(GnomeCanvasItem*, GdkEvent*) ;
1736 gint canvas_imageframe_item_view_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameView* ifv);
1737 gint canvas_imageframe_view_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
1738 gint canvas_imageframe_start_handle_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameView* ifv);
1739 gint canvas_imageframe_end_handle_event(GnomeCanvasItem* item, GdkEvent* event, ImageFrameView* ifv);
1741 gint canvas_marker_time_axis_view_event(GnomeCanvasItem* item, GdkEvent* event, MarkerTimeAxis* mta);
1742 gint canvas_markerview_item_view_event(GnomeCanvasItem* item, GdkEvent* event, MarkerView* mv);
1743 gint canvas_markerview_start_handle_event(GnomeCanvasItem* item, GdkEvent* event, MarkerView* mv);
1744 gint canvas_markerview_end_handle_event(GnomeCanvasItem* item, GdkEvent* event, MarkerView* mv);
1746 void imageframe_start_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
1747 void imageframe_end_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
1748 void imageframe_start_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
1749 void imageframe_start_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
1750 void imageframe_end_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
1751 void imageframe_end_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
1753 void markerview_item_start_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
1754 void markerview_item_end_handle_op(GnomeCanvasItem* item, GdkEvent* event) ;
1755 void markerview_start_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
1756 void markerview_start_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
1757 void markerview_end_handle_trim_motion(GnomeCanvasItem* item, GdkEvent* event) ;
1758 void markerview_end_handle_end_trim(GnomeCanvasItem* item, GdkEvent* event) ;
1760 void popup_imageframe_edit_menu(int button, int32_t time, GnomeCanvasItem* ifv, bool with_frame) ;
1761 void popup_marker_time_axis_edit_menu(int button, int32_t time, GnomeCanvasItem* ifv, bool with_frame) ;
1763 ImageFrameSocketHandler* image_socket_listener ;
1764 /* </CMT Additions> */
1766 void toggle_xfade_active (ARDOUR::Crossfade*);
1767 void toggle_xfade_length (ARDOUR::Crossfade*);
1768 void edit_xfade (ARDOUR::Crossfade*);
1769 void remove_xfade ();
1770 void xfade_edit_left_region ();
1771 void xfade_edit_right_region ();
1773 static const int32_t default_width = 995;
1774 static const int32_t default_height = 765;
1778 Gtk::Button nudge_forward_button;
1779 Gtk::Button nudge_backward_button;
1780 Gtk::HBox nudge_hbox;
1781 Gtk::VBox nudge_vbox;
1782 Gtk::Label nudge_label;
1783 AudioClock nudge_clock;
1785 jack_nframes_t get_nudge_distance (jack_nframes_t pos, jack_nframes_t& next);
1789 void apply_filter (ARDOUR::AudioFilter&, string cmd);
1791 /* handling cleanup */
1793 int playlist_deletion_dialog (ARDOUR::Playlist*);
1795 vector<sigc::connection> session_connections;
1797 /* tracking step changes of track height */
1799 TimeAxisView* current_stepping_trackview;
1800 struct timeval last_track_height_step_timestamp;
1801 gint track_height_step_timeout();
1802 sigc::connection step_timeout;
1804 TimeAxisView* entered_track;
1805 AudioRegionView* entered_regionview;
1806 bool clear_entered_track;
1807 gint left_track_canvas (GdkEventCrossing*);
1808 void set_entered_track (TimeAxisView*);
1809 void set_entered_regionview (AudioRegionView*);
1810 gint left_automation_track ();
1812 bool _new_regionviews_show_envelope;
1814 void toggle_gain_envelope_visibility ();
1815 void toggle_gain_envelope_active ();
1817 typedef std::map<Editing::ColorID,std::string> ColorStyleMap;
1818 void init_colormap ();
1822 Glib::RefPtr<Gtk::UIManager> ui_manager;
1825 #endif /* __ardour_editor_h__ */