X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor.h;h=eb51fb5beb999a70bd9c37ee7ef8216353257c46;hb=e11b3f90c2d02735a071d526d67cfd0de90cbac3;hp=bfdbcd4a6c216656c3d3dea8ea56b8f58d6a32bc;hpb=e92c1669c1cdf857b8a3900abb9f891e6ca9fdad;p=ardour.git diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index bfdbcd4a6c..eb51fb5beb 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -50,6 +50,7 @@ #include #include #include +#include #include "audio_clock.h" #include "gtk-custom-ruler.h" @@ -61,7 +62,6 @@ #include "region_selection.h" #include "canvas.h" #include "draginfo.h" -#include "tempo_lines.h" namespace Gtkmm2ext { class TearOff; @@ -96,9 +96,8 @@ class PlaylistSelector; class Marker; class GroupedButtons; class AutomationLine; -class UIExportSpecification; -class ExportDialog; class Selection; +class TempoLines; class TimeSelection; class TrackSelection; class AutomationSelection; @@ -107,6 +106,7 @@ class StreamView; class AudioStreamView; class ControlPoint; class SoundFileOmega; +class RhythmFerret; #ifdef FFT_ANALYSIS class AnalysisWindow; #endif @@ -127,13 +127,15 @@ class Editor : public PublicEditor public: Editor (); ~Editor (); - + void connect_to_session (ARDOUR::Session *); ARDOUR::Session* current_session() const { return session; } + void first_idle (); + virtual bool have_idled() const { return _have_idled; } - nframes_t leftmost_position() const { return leftmost_frame; } - nframes_t current_page_frames() const { - return (nframes_t) floor (canvas_width * frames_per_unit); + nframes64_t leftmost_position() const { return leftmost_frame; } + nframes64_t current_page_frames() const { + return (nframes64_t) floor (canvas_width * frames_per_unit); } void cycle_snap_mode (); @@ -161,9 +163,14 @@ class Editor : public PublicEditor void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ; void connect_to_image_compositor() ; void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ; - TimeAxisView* get_named_time_axis(const std::string & name) ; #endif + TimeAxisView* get_named_time_axis(const std::string & name) ; + void foreach_time_axis_view (sigc::slot); + void add_to_idle_resize (TimeAxisView*, uint32_t); + + RouteTimeAxisView* get_route_view_by_id (PBD::ID& id); + void consider_auditioning (boost::shared_ptr); void hide_a_region (boost::shared_ptr); void remove_a_region (boost::shared_ptr); @@ -177,6 +184,8 @@ class Editor : public PublicEditor void set_show_waveforms (bool yn); bool show_waveforms() const { return _show_waveforms; } + void set_waveform_scale (Editing::WaveformScale); + void set_show_waveforms_recording (bool yn); bool show_waveforms_recording() const { return _show_waveforms_recording; } @@ -185,17 +194,19 @@ class Editor : public PublicEditor void new_region_from_selection (); void separate_regions_between (const TimeSelection&); void separate_region_from_selection (); + void separate_region_from_punch (); + void separate_region_from_loop (); void separate_regions_using_location (ARDOUR::Location&); void toggle_playback (bool with_abort); void transition_to_rolling (bool forward); /* undo related */ - nframes_t unit_to_frame (double unit) const { - return (nframes_t) rint (unit * frames_per_unit); + nframes64_t unit_to_frame (double unit) const { + return (nframes64_t) rint (unit * frames_per_unit); } - double frame_to_unit (nframes_t frame) const { + double frame_to_unit (nframes64_t frame) const { return rint ((double) frame / (double) frames_per_unit); } @@ -219,14 +230,14 @@ class Editor : public PublicEditor */ if (pixel >= 0) { - return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit); + return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit); } else { return 0; } } gulong frame_to_pixel (nframes64_t frame) const { - return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit))); + return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit))); } void flush_canvas (); @@ -249,7 +260,6 @@ class Editor : public PublicEditor void set_show_measures (bool yn); bool show_measures () const { return _show_measures; } - bool initial_ruler_update_required; #ifdef FFT_ANALYSIS /* analysis window */ @@ -258,12 +268,11 @@ class Editor : public PublicEditor #endif /* export */ - - /* these initiate export ... */ - void export_session(); - void export_selection(); - + void export_audio (); + void export_selection (); + void export_range (); + void export_region (); void add_toplevel_controls (Gtk::Container&); Gtk::HBox& get_status_bar_packer() { return status_bar_hpacker; } @@ -291,13 +300,13 @@ class Editor : public PublicEditor void show_editor_mixer (bool yn); void show_editor_list (bool yn); void set_selected_mixer_strip (TimeAxisView&); - void hide_track_in_display (TimeAxisView& tv); + void hide_track_in_display (TimeAxisView& tv, bool temporary = false); void show_track_in_display (TimeAxisView& tv); /* nudge is initiated by transport controls owned by ARDOUR_UI */ - void nudge_forward (bool next); - void nudge_backward (bool next); + void nudge_forward (bool next, bool force_playhead); + void nudge_backward (bool next, bool force_playhead); /* nudge initiated from context menu */ @@ -312,6 +321,7 @@ class Editor : public PublicEditor bool dragging_playhead () const { return _dragging_playhead; } void toggle_waveform_visibility (); + void toggle_zero_line_visibility (); void toggle_waveforms_while_recording (); void toggle_measure_visibility (); void toggle_logo_visibility (); @@ -356,13 +366,14 @@ class Editor : public PublicEditor bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; } void prepare_for_cleanup (); + void finish_cleanup (); void maximise_editing_space(); void restore_editing_space(); - void reset_x_origin (nframes_t); + void reset_x_origin (nframes64_t); void reset_zoom (double); - void reposition_and_zoom (nframes_t, double); + void reposition_and_zoom (nframes64_t, double); nframes64_t get_preferred_edit_position (bool ignore_playhead = false); @@ -371,11 +382,21 @@ class Editor : public PublicEditor void toggle_meter_updating(); + void show_rhythm_ferret(); + + void goto_visual_state (uint32_t); + void save_visual_state (uint32_t); + + void queue_draw_resize_line (int at); + void start_resize_line_ops (); + void end_resize_line_ops (); + protected: void map_transport_state (); - void map_position_change (nframes_t); + void map_position_change (nframes64_t); void on_realize(); + bool on_expose_event (GdkEventExpose*); private: @@ -385,25 +406,41 @@ class Editor : public PublicEditor bool constructed; // to keep track of the playhead position for control_scroll - boost::optional _control_scroll_target; + boost::optional _control_scroll_target; PlaylistSelector* _playlist_selector; + typedef std::pair TAVState; + struct VisualState { - double frames_per_unit; - nframes_t leftmost_frame; - Editing::ZoomFocus zoom_focus; + double y_position; + double frames_per_unit; + nframes64_t leftmost_frame; + Editing::ZoomFocus zoom_focus; + bool zoomed_to_region; + std::list track_states; }; - VisualState last_visual_state; + std::list undo_visual_stack; + std::list redo_visual_stack; + VisualState* current_visual_state (bool with_tracks = true); + void undo_visual_state (); + void redo_visual_state (); + void use_visual_state (VisualState&); + bool no_save_visual; + void swap_visual_state (); + + std::vector visual_states; + sigc::connection visual_state_op_connection; + void start_visual_state_op (uint32_t n); + void cancel_visual_state_op (uint32_t n); + bool end_visual_state_op (uint32_t n); - nframes_t leftmost_frame; + nframes64_t leftmost_frame; double frames_per_unit; Editing::ZoomFocus zoom_focus; - void use_visual_state (const VisualState&); void set_frames_per_unit (double); - void swap_visual_state (); void post_zoom (); Editing::MouseMode mouse_mode; @@ -453,7 +490,7 @@ class Editor : public PublicEditor void hide(); void show (); void set_name (const string&); - void set_position (nframes_t start, nframes_t end = 0); + void set_position (nframes64_t start, nframes64_t end = 0); void set_color_rgba (uint32_t); }; @@ -466,7 +503,8 @@ class Editor : public PublicEditor void hide_marker (ArdourCanvas::Item*, GdkEvent*); void clear_marker_display (); - void mouse_add_new_marker (nframes_t where, bool is_cd=false); + void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false); + bool choose_new_marker_name(string &name); void update_cd_marker_display (); void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location); @@ -505,6 +543,8 @@ class Editor : public PublicEditor void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false); void select_all_tracks (); + int get_regionview_count_from_region_list (boost::shared_ptr region); + bool set_selected_control_point_from_click (Selection::Operation op = Selection::Set, bool no_remove=false); void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false); void set_selected_track_as_side_effect (bool force = false); @@ -526,12 +566,12 @@ class Editor : public PublicEditor Gtk::Menu * track_edit_playlist_submenu; Gtk::Menu * track_selection_edit_playlist_submenu; - void popup_track_context_menu (int, int, ItemType, bool, nframes_t); - Gtk::Menu* build_track_context_menu (nframes_t); - Gtk::Menu* build_track_bus_context_menu (nframes_t); - Gtk::Menu* build_track_region_context_menu (nframes_t frame); - Gtk::Menu* build_track_crossfade_context_menu (nframes_t); - Gtk::Menu* build_track_selection_context_menu (nframes_t); + void popup_track_context_menu (int, int, ItemType, bool, nframes64_t); + Gtk::Menu* build_track_context_menu (nframes64_t); + Gtk::Menu* build_track_bus_context_menu (nframes64_t); + Gtk::Menu* build_track_region_context_menu (nframes64_t frame); + Gtk::Menu* build_track_crossfade_context_menu (nframes64_t); + Gtk::Menu* build_track_selection_context_menu (nframes64_t); void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&); void add_bus_context_items (Gtk::Menu_Helpers::MenuList&); void add_region_context_items (StreamView*, boost::shared_ptr, Gtk::Menu_Helpers::MenuList&); @@ -548,10 +588,15 @@ class Editor : public PublicEditor Gtk::VBox global_vpacker; Gtk::VBox vpacker; + bool need_resize_line; + int resize_line_y; + int old_resize_line_y; + Gdk::Cursor* current_canvas_cursor; + void set_canvas_cursor (); + Gdk::Cursor* which_grabber_cursor (); - ArdourCanvas::CanvasAA track_canvas; - ArdourCanvas::CanvasAA time_canvas; + ArdourCanvas::Canvas* track_canvas; ArdourCanvas::Text* first_action_message; ArdourCanvas::Text* verbose_canvas_cursor; @@ -571,7 +616,7 @@ class Editor : public PublicEditor Gtk::EventBox time_canvas_event_box; Gtk::EventBox track_canvas_event_box; Gtk::EventBox time_button_event_box; - Gtk::Frame time_button_frame; + Gtk::EventBox ruler_label_event_box; ArdourCanvas::Group *minsec_group; ArdourCanvas::Pixbuf *logo_item; @@ -584,8 +629,27 @@ class Editor : public PublicEditor ArdourCanvas::Group *range_marker_group; ArdourCanvas::Group *transport_marker_group; ArdourCanvas::Group* cd_marker_group; + + ArdourCanvas::Group* timebar_group; + + /* These bars never need to be scrolled */ + ArdourCanvas::Group* meter_bar_group; + ArdourCanvas::Group* tempo_bar_group; + ArdourCanvas::Group* marker_bar_group; + ArdourCanvas::Group* range_marker_bar_group; + ArdourCanvas::Group* transport_marker_bar_group; + ArdourCanvas::Group* cd_marker_bar_group; + + /** The group containing all items that require horizontal scrolling. */ + ArdourCanvas::Group* _master_group; + + /* The group containing all trackviews. Only scrolled vertically. */ + ArdourCanvas::Group* _trackview_group; - enum { + /* The group used for region motion. Sits on top of _trackview_group */ + ArdourCanvas::Group* _region_motion_group; + + enum RulerType { ruler_metric_smpte = 0, ruler_metric_bbt = 1, ruler_metric_frames = 2, @@ -600,7 +664,16 @@ class Editor : public PublicEditor }; static GtkCustomMetric ruler_metrics[4]; - bool ruler_shown[10]; + Glib::RefPtr ruler_timecode_action; + Glib::RefPtr ruler_bbt_action; + Glib::RefPtr ruler_samples_action; + Glib::RefPtr ruler_minsec_action; + Glib::RefPtr ruler_tempo_action; + Glib::RefPtr ruler_meter_action; + Glib::RefPtr ruler_marker_action; + Glib::RefPtr ruler_range_action; + Glib::RefPtr ruler_loop_punch_action; + Glib::RefPtr ruler_cd_marker_action; bool no_ruler_shown_update; gint ruler_button_press (GdkEventButton*); @@ -616,8 +689,10 @@ class Editor : public PublicEditor void compute_fixed_ruler_scale (); //calculates the RulerScale of the fixed rulers void update_fixed_rulers (); void update_tempo_based_rulers (); - void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem); + void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem); void update_ruler_visibility (); + void set_ruler_visible (RulerType, bool); + void toggle_ruler_visibility (RulerType rt); void ruler_toggled (int); gint ruler_label_button_release (GdkEventButton*); void store_ruler_visibility (); @@ -675,7 +750,7 @@ class Editor : public PublicEditor gint bbt_nmarks; uint32_t bbt_bar_helper_on; uint32_t bbt_accent_modulo; - void compute_bbt_ruler_scale (nframes_t lower, nframes_t upper); + void compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper); gint metric_get_smpte (GtkCustomRulerMark **, gdouble, gdouble, gint); gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint); @@ -695,6 +770,7 @@ class Editor : public PublicEditor static const double timebar_height; guint32 visible_timebars; + gdouble canvas_timebars_vsize; Gtk::Menu *editor_ruler_menu; ArdourCanvas::SimpleRect* tempo_bar; @@ -723,13 +799,13 @@ class Editor : public PublicEditor Editor& editor; ArdourCanvas::Points points; ArdourCanvas::Line canvas_item; - nframes_t current_frame; + nframes64_t current_frame; double length; Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*)); ~Cursor (); - void set_position (nframes_t); + void set_position (nframes64_t); void set_length (double units); void set_y_axis (double position); }; @@ -764,14 +840,12 @@ class Editor : public PublicEditor void select_all_selectables_between (bool within); void select_range_between (); - boost::shared_ptr find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0); + boost::shared_ptr find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0); nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&); - vector region_boundary_cache; + vector region_boundary_cache; void build_region_boundary_cache (); - Gtk::VBox trackview_vpacker; - Gtk::HBox top_hbox; Gtk::HBox bottom_hbox; @@ -784,6 +858,7 @@ class Editor : public PublicEditor Gtk::Layout controls_layout; bool control_layout_scroll (GdkEventScroll* ev); void controls_layout_size_request (Gtk::Requisition*); + sigc::connection controls_layout_size_request_connection; Gtk::HScrollbar edit_hscrollbar; bool _dragging_hscrollbar; @@ -797,25 +872,30 @@ class Editor : public PublicEditor double canvas_width; double canvas_height; double full_canvas_height; - nframes_t last_canvas_frame; + nframes64_t last_canvas_frame; bool track_canvas_map_handler (GdkEventAny*); - bool time_canvas_map_handler (GdkEventAny*); gint edit_controls_button_release (GdkEventButton*); Gtk::Menu *edit_controls_left_menu; Gtk::Menu *edit_controls_right_menu; + Gtk::VBox ruler_label_vbox; Gtk::VBox track_canvas_vbox; Gtk::VBox time_canvas_vbox; Gtk::VBox edit_controls_vbox; Gtk::HBox edit_controls_hbox; void control_scroll (float); - bool deferred_control_scroll (nframes_t); + void access_action (std::string,std::string); + bool deferred_control_scroll (nframes64_t); sigc::connection control_scroll_connection; + gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;} + ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; } void tie_vertical_scrolling (); + void scroll_canvas_horizontally (); + void scroll_canvas_vertically (); void canvas_horizontally_scrolled (); void canvas_scroll_to (nframes64_t); @@ -826,7 +906,7 @@ class Editor : public PublicEditor }; Type pending; - nframes_t time_origin; + nframes64_t time_origin; double frames_per_unit; int idle_handler_id; @@ -840,20 +920,44 @@ class Editor : public PublicEditor static int _idle_visual_changer (void *arg); int idle_visual_changer (); - void queue_visual_change (nframes_t); + void queue_visual_change (nframes64_t); void queue_visual_change (double); void end_location_changed (ARDOUR::Location*); struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { RegionListDisplayModelColumns() { - add (name); + add (name); add (region); add (color_); + add (start); + add (end); + add (length); + add (sync); + add (fadein); + add (fadeout); + add (locked); + add (glued); + add (muted); + add (opaque); + add (used); + add (path); } Gtk::TreeModelColumn name; Gtk::TreeModelColumn > region; Gtk::TreeModelColumn color_; + Gtk::TreeModelColumn start; + Gtk::TreeModelColumn end; + Gtk::TreeModelColumn length; + Gtk::TreeModelColumn sync; + Gtk::TreeModelColumn fadein; + Gtk::TreeModelColumn fadeout; + Gtk::TreeModelColumn locked; + Gtk::TreeModelColumn glued; + Gtk::TreeModelColumn muted; + Gtk::TreeModelColumn opaque; + Gtk::TreeModelColumn used; + Gtk::TreeModelColumn path; }; RegionListDisplayModelColumns region_list_columns; @@ -954,12 +1058,14 @@ class Editor : public PublicEditor static Gdk::Cursor* trimmer_cursor; static Gdk::Cursor* selector_cursor; static Gdk::Cursor* grabber_cursor; + static Gdk::Cursor* grabber_edit_point_cursor; static Gdk::Cursor* zoom_cursor; static Gdk::Cursor* time_fx_cursor; static Gdk::Cursor* fader_cursor; static Gdk::Cursor* speaker_cursor; static Gdk::Cursor* midi_pencil_cursor; static Gdk::Cursor* midi_select_cursor; + static Gdk::Cursor* midi_resize_cursor; static Gdk::Cursor* midi_erase_cursor; static Gdk::Cursor* wait_cursor; static Gdk::Cursor* timebar_cursor; @@ -968,16 +1074,16 @@ class Editor : public PublicEditor static void build_cursors (); sigc::connection scroll_connection; - nframes_t last_update_frame; - void center_screen (nframes_t); - void center_screen_internal (nframes_t, float); + nframes64_t last_update_frame; + void center_screen (nframes64_t); + void center_screen_internal (nframes64_t, float); void update_current_screen (); void session_going_away (); - nframes_t cut_buffer_start; - nframes_t cut_buffer_length; + nframes64_t cut_buffer_start; + nframes64_t cut_buffer_length; bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); @@ -990,13 +1096,19 @@ class Editor : public PublicEditor void register_actions (); - int ensure_cursor (nframes_t* pos); + int ensure_cursor (nframes64_t* pos); void handle_new_region (boost::weak_ptr); + void handle_new_regions (vector >& ); void handle_region_removed (boost::weak_ptr); void add_region_to_region_display (boost::shared_ptr); + void add_regions_to_region_display (std::vector > & ); void region_hidden (boost::shared_ptr); void redisplay_regions (); + void populate_row (boost::shared_ptr, Gtk::TreeModel::Row const &); + void update_region_row (boost::shared_ptr); + bool update_region_subrows (boost::shared_ptr, Gtk::TreeModel::Row const &, int); + bool no_region_list_redisplay; void insert_into_tmp_regionlist(boost::shared_ptr); list > tmp_region_list; @@ -1004,11 +1116,11 @@ class Editor : public PublicEditor void cut_copy (Editing::CutCopyOp); bool can_cut_copy () const; void cut_copy_points (Editing::CutCopyOp); - void cut_copy_regions (Editing::CutCopyOp); + void cut_copy_regions (Editing::CutCopyOp, RegionSelection&); void cut_copy_ranges (Editing::CutCopyOp); void mouse_paste (); - void paste_internal (nframes_t position, float times); + void paste_internal (nframes64_t position, float times); /* EDITING OPERATIONS */ @@ -1016,23 +1128,25 @@ class Editor : public PublicEditor void toggle_region_mute (); void toggle_region_lock (); void toggle_region_opaque (); - void toggle_region_position_lock (); + void set_region_lock_style (ARDOUR::Region::PositionLockStyle); void raise_region (); void raise_region_to_top (); void lower_region (); void lower_region_to_bottom (); void split_region (); - void split_region_at (nframes_t); - void split_regions_at (nframes_t, RegionSelection&); + void split_region_at (nframes64_t); + void split_regions_at (nframes64_t, RegionSelection&); + void split_region_at_transients (); + void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret); void crop_region_to_selection (); - void crop_region_to (nframes_t start, nframes_t end); + void crop_region_to (nframes64_t start, nframes64_t end); void set_sync_point (nframes64_t, const RegionSelection&); void set_region_sync_from_edit_point (); void remove_region_sync(); - void align_selection (ARDOUR::RegionPoint, nframes_t position, const RegionSelection&); - void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position, const RegionSelection&); - void align_region (boost::shared_ptr, ARDOUR::RegionPoint point, nframes_t position); - void align_region_internal (boost::shared_ptr, ARDOUR::RegionPoint point, nframes_t position); + void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&); + void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&); + void align_region (boost::shared_ptr, ARDOUR::RegionPoint point, nframes64_t position); + void align_region_internal (boost::shared_ptr, ARDOUR::RegionPoint point, nframes64_t position); void remove_selected_regions (); void remove_clicked_region (); void edit_region (); @@ -1048,8 +1162,19 @@ class Editor : public PublicEditor void reverse_region (); void normalize_region (); void denormalize_region (); + void adjust_region_scale_amplitude (bool up); void quantize_region (); + void do_insert_time (); + void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too); + + void tab_to_transient (bool forward); + + void use_region_as_bar (); + void use_range_as_bar (); + + void define_one_bar (nframes64_t start, nframes64_t end); + void audition_region_from_region_list (); void hide_region_from_region_list (); void remove_region_from_region_list (); @@ -1072,7 +1197,7 @@ class Editor : public PublicEditor void keyboard_insert_region_list_selection (); void region_from_selection (); - void create_region_from_selection (std::vector >&); + void create_region_from_selection (std::vector >&); void play_from_start (); void play_from_edit_point (); @@ -1084,13 +1209,13 @@ class Editor : public PublicEditor void loop_location (ARDOUR::Location&); void temporal_zoom_selection (); - void temporal_zoom_region (); - void toggle_zoom_region (); + void temporal_zoom_region (bool both_axes); + void toggle_zoom_region (bool both_axes); bool zoomed_to_region; void temporal_zoom_session (); void temporal_zoom (gdouble scale); - void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op); - void temporal_zoom_to_frame (bool coarser, nframes_t frame); + void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op); + void temporal_zoom_to_frame (bool coarser, nframes64_t frame); void amplitude_zoom (gdouble scale); void amplitude_zoom_step (bool in); @@ -1098,32 +1223,41 @@ class Editor : public PublicEditor void insert_region_list_drag (boost::shared_ptr, int x, int y); void insert_region_list_selection (float times); + void insert_route_list_drag (boost::shared_ptr, int x, int y); + /* import & embed */ void add_external_audio_action (Editing::ImportMode); void external_audio_dialog (); + void session_import_dialog (); + + int check_whether_and_how_to_import(string, bool all_or_nothing = true); bool check_multichannel_status (const std::vector& paths); SoundFileOmega* sfbrowser; void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos); + + void _do_import (vector paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&); void do_import (vector paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&); + bool idle_do_import (vector paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&); void _do_embed (vector paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&); void do_embed (vector paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&); bool idle_do_embed (vector paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&); int import_sndfiles (vector paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos, - int target_regions, int target_tracks, boost::shared_ptr&); + int target_regions, int target_tracks, boost::shared_ptr&, bool); int embed_sndfiles (vector paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, - nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr&); + nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr&); int add_sources (vector paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode, - int target_regions, int target_tracks, boost::shared_ptr&, bool add_channel_suffix); - int finish_bringing_in_audio (boost::shared_ptr region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode, - boost::shared_ptr& existing_track); + int target_regions, int target_tracks, boost::shared_ptr&, bool add_channel_suffix); + int finish_bringing_in_material (boost::shared_ptr region, uint32_t, uint32_t, nframes64_t& pos, Editing::ImportMode mode, + boost::shared_ptr& existing_track); boost::shared_ptr get_nth_selected_audio_track (int nth) const; + boost::shared_ptr get_nth_selected_midi_track (int nth) const; /* generic interthread progress window */ @@ -1161,6 +1295,8 @@ class Editor : public PublicEditor void center_edit_point (); void edit_cursor_backward (); void edit_cursor_forward (); + void playhead_forward_to_grid (); + void playhead_backward_to_grid (); void playhead_backward (); void playhead_forward (); void scroll_playhead (bool forward); @@ -1203,8 +1339,8 @@ class Editor : public PublicEditor void set_loop_from_region (bool play); void set_punch_from_edit_range (); - void set_loop_range (nframes_t start, nframes_t end, std::string cmd); - void set_punch_range (nframes_t start, nframes_t end, std::string cmd); + void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd); + void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd); void add_location_from_playhead_cursor (); bool select_new_marker; @@ -1220,11 +1356,12 @@ class Editor : public PublicEditor int scrubbing_direction; int scrub_reversals; int scrub_reverse_distance; + void scrub (); void keyboard_selection_begin (); void keyboard_selection_finish (bool add); bool have_pending_keyboard_selection; - nframes_t pending_keyboard_selection_start; + nframes64_t pending_keyboard_selection_start; boost::shared_ptr select_region_for_operation (int dir, TimeAxisView **tv); void extend_selection_to_end_of_region (bool next); @@ -1246,6 +1383,8 @@ class Editor : public PublicEditor void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0); bool end_grab (ArdourCanvas::Item*, GdkEvent*); void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time); + void break_drag (); + void finalize_drag (); Gtk::Menu fade_context_menu; void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType); @@ -1316,11 +1455,13 @@ class Editor : public PublicEditor void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*); void remove_control_point (ArdourCanvas::Item*, GdkEvent*); - void mouse_brush_insert_region (RegionView*, nframes_t pos); - void brush (nframes_t); + void mouse_brush_insert_region (RegionView*, nframes64_t pos); + void brush (nframes64_t); - void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1); - void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1); + void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1); + void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1); + double clamp_verbose_cursor_x (double); + double clamp_verbose_cursor_y (double); /* Canvas event handlers */ @@ -1334,6 +1475,14 @@ class Editor : public PublicEditor bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); + + + // These variables are used to detect a feedback loop and break it to avoid a gui hang +private: + ArdourCanvas::Item *last_item_entered; + int last_item_entered_n; +public: + bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*); bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*); bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*); @@ -1364,17 +1513,13 @@ class Editor : public PublicEditor bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*); bool track_canvas_scroll (GdkEventScroll* event); - bool time_canvas_scroll (GdkEventScroll* event); bool track_canvas_scroll_event (GdkEventScroll* event); bool track_canvas_button_press_event (GdkEventButton* event); bool track_canvas_button_release_event (GdkEventButton* event); bool track_canvas_motion_notify_event (GdkEventMotion* event); - bool time_canvas_scroll_event (GdkEventScroll* event); - Gtk::Allocation canvas_allocation; - bool canvas_idle_queued; void track_canvas_allocate (Gtk::Allocation alloc); bool track_canvas_size_allocated (); @@ -1389,9 +1534,6 @@ class Editor : public PublicEditor void handle_new_duration (); void initialize_canvas (); - int canvas_hroizontally_scrolled_handler_id; - void reset_horizontally_scrolling_region (Gtk::Allocation* alloc = 0); - void reset_scrolling_region (Gtk::Allocation* alloc = 0); /* display control */ @@ -1405,11 +1547,9 @@ class Editor : public PublicEditor ARDOUR::TempoMap::BBTPointList *current_bbt_points; - ArdourCanvas::Group* time_line_group; - ArdourCanvas::Group* marker_time_line_group; - TempoLines* tempo_lines; - TempoLines* marker_tempo_lines; + + ArdourCanvas::Group* time_line_group; void hide_measures (); void draw_measures (); @@ -1417,8 +1557,8 @@ class Editor : public PublicEditor void new_tempo_section (); - void mouse_add_new_tempo_event (nframes_t where); - void mouse_add_new_meter_event (nframes_t where); + void mouse_add_new_tempo_event (nframes64_t where); + void mouse_add_new_meter_event (nframes64_t where); void remove_tempo_marker (ArdourCanvas::Item*); void remove_meter_marker (ArdourCanvas::Item*); @@ -1444,6 +1584,7 @@ class Editor : public PublicEditor void marker_menu_set_playhead (); void marker_menu_set_from_playhead (); void marker_menu_set_from_selection (); + void marker_menu_range_to_next (); void new_transport_marker_menu_set_loop (); void new_transport_marker_menu_set_punch (); void update_loop_range_view (bool visibility=false); @@ -1474,19 +1615,12 @@ class Editor : public PublicEditor void draw_metric_marks (const ARDOUR::Metrics& metrics); void compute_current_bbt_points (nframes_t left, nframes_t right); - int tempo_map_change_idle_handler_id; void tempo_map_changed (ARDOUR::Change); void redisplay_tempo (bool immediate_redraw); void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false); - void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) { - /* XXX remove this function when everything moves to 64 bit frame counts */ - nframes64_t first64 = first; - snap_to (first64, direction, for_mark); - first = (nframes_t) first64; - } - double snap_length_beats (nframes_t start); + double snap_length_beats (nframes64_t start); uint32_t bbt_beat_subdivision; @@ -1580,6 +1714,7 @@ class Editor : public PublicEditor Gtkmm2ext::TearOff* midi_tool_tearoff; Gtk::ToggleButton midi_tool_pencil_button; Gtk::ToggleButton midi_tool_select_button; + Gtk::ToggleButton midi_tool_resize_button; Gtk::ToggleButton midi_tool_erase_button; GroupedButtons *midi_tool_button_set; void midi_edit_mode_toggled (Editing::MidiEditMode m); @@ -1600,6 +1735,7 @@ class Editor : public PublicEditor void time_selection_changed (); void track_selection_changed (); void region_selection_changed (); + void sensitize_the_right_region_actions (bool have_selected_regions); void point_selection_changed (); void marker_selection_changed (); @@ -1619,7 +1755,7 @@ class Editor : public PublicEditor void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*); void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool); - bool audio_region_selection_covers (nframes_t where); + bool audio_region_selection_covers (nframes64_t where); /* transport range select process */ enum RangeMarkerOp { @@ -1632,6 +1768,7 @@ class Editor : public PublicEditor void drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event); void end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event); + ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect; ArdourCanvas::SimpleRect* range_bar_drag_rect; ArdourCanvas::SimpleRect* transport_bar_drag_rect; ArdourCanvas::Line* marker_drag_line; @@ -1661,7 +1798,7 @@ class Editor : public PublicEditor void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event); void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event); - bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op); + bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op); ArdourCanvas::SimpleRect *rubberband_rect; @@ -1672,7 +1809,7 @@ class Editor : public PublicEditor void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event); ArdourCanvas::SimpleRect *zoom_rect; - void reposition_zoom_rect (nframes_t start, nframes_t end); + void reposition_zoom_rect (nframes64_t start, nframes64_t end); /* diskstream/route display management */ @@ -1680,11 +1817,13 @@ class Editor : public PublicEditor RouteDisplayModelColumns() { add (text); add (visible); + add (temporary_visible); add (tv); add (route); } Gtk::TreeModelColumn text; Gtk::TreeModelColumn visible; + Gtk::TreeModelColumn temporary_visible; Gtk::TreeModelColumn tv; Gtk::TreeModelColumn > route; }; @@ -1697,6 +1836,8 @@ class Editor : public PublicEditor Gtk::ScrolledWindow route_list_scroller; Gtk::Menu* route_list_menu; + void update_route_visibility (); + void sync_order_keys (); bool ignore_route_order_sync; @@ -1777,15 +1918,21 @@ class Editor : public PublicEditor bool autoscroll_active; int autoscroll_timeout_tag; - int autoscroll_direction; + int autoscroll_x; + int autoscroll_y; + int last_autoscroll_x; + int last_autoscroll_y; uint32_t autoscroll_cnt; - nframes_t autoscroll_distance; - + nframes64_t autoscroll_x_distance; + double autoscroll_y_distance; + static gint _autoscroll_canvas (void *); bool autoscroll_canvas (); - void start_canvas_autoscroll (int direction); + void start_canvas_autoscroll (int x, int y); void stop_canvas_autoscroll (); - void maybe_autoscroll (GdkEvent*); + void maybe_autoscroll (GdkEventMotion*); + void maybe_autoscroll_horizontally (GdkEventMotion*); + bool allow_vertical_scroll; /* trimming */ enum TrimOp { @@ -1797,9 +1944,9 @@ class Editor : public PublicEditor void start_trim (ArdourCanvas::Item*, GdkEvent*); void point_trim (GdkEvent*); void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*); - void single_contents_trim (RegionView&, nframes_t, bool, bool, bool); - void single_start_trim (RegionView&, nframes_t, bool, bool); - void single_end_trim (RegionView&, nframes_t, bool, bool); + void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool); + void single_start_trim (RegionView&, nframes64_t, bool, bool); + void single_end_trim (RegionView&, nframes64_t, bool, bool); void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*); void thaw_region_after_trim (RegionView& rv); @@ -1855,19 +2002,19 @@ class Editor : public PublicEditor guint info, guint time); - /* audio export */ + void drop_routes (const Glib::RefPtr& context, + gint x, + gint y, + const Gtk::SelectionData& data, + guint info, + guint time); - ExportDialog *export_dialog; - ExportDialog *export_range_markers_dialog; - - void export_range (nframes_t start, nframes_t end); - void export_range_markers (); + /* audio export */ int write_region_selection(RegionSelection&); bool write_region (string path, boost::shared_ptr); - void export_region (); void bounce_region_selection (); - void bounce_range_selection (); + void bounce_range_selection (bool replace); void external_edit_region (); int write_audio_selection (TimeSelection&); @@ -1884,12 +2031,6 @@ class Editor : public PublicEditor void begin_reversible_command (string cmd_name); void commit_reversible_command (); - /* visual history */ - - UndoHistory visual_history; - UndoTransaction current_visual_command; - - void update_title (); void update_title_s (const string & snapshot_name); @@ -2068,7 +2209,10 @@ class Editor : public PublicEditor Gtk::VBox nudge_vbox; AudioClock nudge_clock; - nframes_t get_nudge_distance (nframes_t pos, nframes_t& next); + nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next); + + bool nudge_forward_release (GdkEventButton*); + bool nudge_backward_release (GdkEventButton*); /* audio filters */ @@ -2083,34 +2227,25 @@ class Editor : public PublicEditor /* tracking step changes of track height */ TimeAxisView* current_stepping_trackview; - struct timeval last_track_height_step_timestamp; + ARDOUR::microseconds_t last_track_height_step_timestamp; gint track_height_step_timeout(); sigc::connection step_timeout; TimeAxisView* entered_track; RegionView* entered_regionview; - class ExclusiveRegionSelection { - public: - ExclusiveRegionSelection (Editor&, RegionView*); - ~ExclusiveRegionSelection (); - private: - Editor& editor; - RegionView* regionview; - bool remove; - }; - - void ensure_entered_region_selected (bool op_acts_on_objects = false); void ensure_entered_track_selected (bool op_acts_on_objects = false); bool clear_entered_track; - gint left_track_canvas (GdkEventCrossing*); + bool left_track_canvas (GdkEventCrossing*); + bool entered_track_canvas (GdkEventCrossing*); void set_entered_track (TimeAxisView*); void set_entered_regionview (RegionView*); gint left_automation_track (); bool _new_regionviews_show_envelope; + void reset_canvas_action_sensitivity (bool); void toggle_gain_envelope_visibility (); void toggle_gain_envelope_active (); void reset_region_gain_envelopes (); @@ -2131,7 +2266,7 @@ class Editor : public PublicEditor Gtk::ComboBoxText edit_point_selector; - void set_edit_point_preference (Editing::EditPoint ep); + void set_edit_point_preference (Editing::EditPoint ep, bool force = false); void cycle_edit_point (bool with_marker); void set_edit_point (); void edit_point_selection_done (); @@ -2145,12 +2280,10 @@ class Editor : public PublicEditor bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const; - RegionSelection get_regions_at (nframes64_t where, const TrackSelection& ts) const; - RegionSelection get_regions_after (nframes64_t where, const TrackSelection& ts) const; - - RegionSelection tmp_regions; + void get_regions_at (RegionSelection&, nframes64_t where, const TrackSelection& ts) const; + void get_regions_after (RegionSelection&, nframes64_t where, const TrackSelection& ts) const; - RegionSelection& get_regions_for_action (); + void get_regions_for_action (RegionSelection&, bool allowed_entered_regionview = false); sigc::connection fast_screen_update_connection; gint start_updating (); @@ -2160,6 +2293,30 @@ class Editor : public PublicEditor void select_next_route (); void select_prev_route (); + + void snap_to_internal (nframes64_t& first, int32_t direction = 0, bool for_mark = false); + + RhythmFerret* rhythm_ferret; + + void fit_tracks (); + void set_track_height (uint32_t h); + void set_track_height_largest (); + void set_track_height_large (); + void set_track_height_larger (); + void set_track_height_normal (); + void set_track_height_smaller (); + void set_track_height_small (); + + void remove_tracks (); + void toggle_tracks_active (); + void waveform_scale_chosen (Editing::WaveformScale); + + bool _have_idled; + int resize_idle_id; + int32_t resize_idle_target; + bool idle_resize(); + friend gboolean _idle_resize (gpointer); + std::vector pending_resizes; }; #endif /* __ardour_editor_h__ */