add JAG to author list
[ardour.git] / gtk2_ardour / editor.h
index 6122807fb69ef7bcbf118a63e6409fdef8512a7b..3a246e2f2d54b7be01e659496b3338753d91bd93 100644 (file)
@@ -98,6 +98,7 @@ class AutomationLine;
 class UIExportSpecification;
 class ExportDialog;
 class Selection;
+class TempoLines;
 class TimeSelection;
 class TrackSelection;
 class AutomationSelection;
@@ -133,9 +134,9 @@ class Editor : public PublicEditor
        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 ();
@@ -160,6 +161,7 @@ class Editor : public PublicEditor
        void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
        TimeAxisView* get_named_time_axis(const std::string & name) ;
        void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
+       void add_to_idle_resize (TimeAxisView*, uint32_t);
 
        void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
        void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
@@ -169,16 +171,21 @@ class Editor : public PublicEditor
        std::vector<std::string> rb_opt_strings;
 #endif
 
-       /* option editor-access */
+       //global waveform options
 
        void set_show_waveforms (bool yn);
        bool show_waveforms() const { return _show_waveforms; }
 
-       void set_waveform_scale (Editing::WaveformScale);
+       void set_show_waveforms_rectified (bool yn);
+       bool show_waveforms_rectified() const { return _show_waveforms_rectified; }
 
        void set_show_waveforms_recording (bool yn);
        bool show_waveforms_recording() const { return _show_waveforms_recording; }
        
+       //per-track waveform options
+       
+       void set_waveform_scale (Editing::WaveformScale);
+
        /* things that need to be public to be used in the main menubar */
 
        void new_region_from_selection ();
@@ -187,16 +194,15 @@ class Editor : public PublicEditor
        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);
        }
 
@@ -220,7 +226,7 @@ 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;
                }
@@ -250,7 +256,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 */
@@ -285,12 +290,14 @@ class Editor : public PublicEditor
        void clear_playlists (TimeAxisView*);
 
        TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
+       void get_onscreen_tracks (TrackViewList&);
 
        Width editor_mixer_strip_width;
        void maybe_add_mixer_strip_width (XMLNode&);
        void show_editor_mixer (bool yn);
+       void create_editor_mixer ();
        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 */
@@ -305,16 +312,26 @@ class Editor : public PublicEditor
 
        /* playhead/screen stuff */
        
+       void set_stationary_playhead (bool yn);
+       void toggle_stationary_playhead ();
+       bool stationary_playhead() const { return _stationary_playhead; }
+
        void set_follow_playhead (bool yn);
        void toggle_follow_playhead ();
        bool follow_playhead() const { return _follow_playhead; }
        bool dragging_playhead () const { return _dragging_playhead; }
 
        void toggle_waveform_visibility ();
+       void toggle_waveform_rectified ();
        void toggle_waveforms_while_recording ();
+       
        void toggle_measure_visibility ();
        void toggle_logo_visibility ();
 
+       double get_physical_screen_width () const { return physical_screen_width; };
+       double physical_screen_width;
+       double physical_screen_height;
+
        /* SMPTE timecode & video sync */
 
        void smpte_fps_chosen (ARDOUR::SmpteFormat format);
@@ -324,7 +341,13 @@ class Editor : public PublicEditor
        void update_smpte_mode();
        void update_video_pullup();
        void update_subframes_per_frame ();
-       /* xfades */
+
+       /* fades & xfades */
+
+       void toggle_region_fades ();
+       void toggle_region_fades_visible ();
+       void toggle_selected_region_fades (int dir);
+       void update_region_fade_visibility ();
 
        void toggle_auto_xfade ();
        void toggle_xfades_active ();
@@ -353,15 +376,18 @@ class Editor : public PublicEditor
        void scroll_tracks_down_line ();
        void scroll_tracks_up_line ();
 
+       void move_selected_tracks (bool up);
+
        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);
 
@@ -372,11 +398,19 @@ class Editor : public PublicEditor
 
        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:
        
@@ -384,25 +418,40 @@ class Editor : public PublicEditor
        bool                 constructed;
   
        // to keep track of the playhead position for control_scroll
-       boost::optional<nframes_t> _control_scroll_target;
+       boost::optional<nframes64_t> _control_scroll_target;
 
        PlaylistSelector* _playlist_selector;
 
+       typedef std::pair<TimeAxisView*,XMLNode*> 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;
+           std::list<TAVState> track_states;
        };
        
-       VisualState last_visual_state;
+       std::list<VisualState*> undo_visual_stack;
+       std::list<VisualState*> 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<VisualState*> 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;
@@ -451,7 +500,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);
        };
 
@@ -464,7 +513,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, bool is_xrun=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);
 
@@ -485,8 +535,8 @@ class Editor : public PublicEditor
        /* functions to be passed to mapover_audio_tracks(), possibly with sigc::bind()-supplied arguments */
 
        void mapped_get_equivalent_regions (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
-       void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t);
-       void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t);
+       void mapped_use_new_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
+       void mapped_use_copy_playlist (AudioTimeAxisView&, uint32_t, vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
        void mapped_clear_playlist (AudioTimeAxisView&, uint32_t);
 
        /* end */
@@ -498,7 +548,7 @@ class Editor : public PublicEditor
 
        void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
        void select_all_tracks ();
-
+       
        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);
@@ -519,12 +569,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 (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
@@ -539,14 +589,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::Canvas* track_canvas;
-       ArdourCanvas::Canvas* time_canvas;
-
-       ArdourCanvas::Text* first_action_message;
        ArdourCanvas::Text* verbose_canvas_cursor;
        bool                 verbose_cursor_visible;
 
@@ -564,7 +615,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::Pixbuf*     logo_item;
        ArdourCanvas::Group*      minsec_group;
@@ -577,6 +628,35 @@ 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;
+
+       ArdourCanvas::Group* _background_group;
+       /* 
+          The _master_group is the group containing all items
+          that require horizontal scrolling..
+          It is primarily used to separate canvas items 
+          that require horizontal scrolling from those that do not. 
+       */
+       ArdourCanvas::Group* _master_group;
+       /* 
+          The _trackview_group is the group containing all trackviews.
+          It is only scrolled vertically.
+       */
+       ArdourCanvas::Group* _trackview_group;
+       /* 
+          This canvas group is used for region motion.
+          It sits on top of the _trackview_group 
+       */
+       ArdourCanvas::Group* _region_motion_group;
        
        enum RulerType {
                ruler_metric_smpte = 0,
@@ -617,7 +697,7 @@ class Editor : public PublicEditor
        void update_just_smpte ();
        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);
@@ -649,6 +729,8 @@ class Editor : public PublicEditor
 
        static const double timebar_height;
        guint32 visible_timebars;
+       gdouble canvas_timebars_vsize;
+       gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
        Gtk::Menu          *editor_ruler_menu;
        
        ArdourCanvas::SimpleRect* tempo_bar;
@@ -685,13 +767,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);
        };
@@ -703,18 +785,20 @@ class Editor : public PublicEditor
        Cursor* playhead_cursor;
        ArdourCanvas::Group* cursor_group;
 
-       void    cursor_to_region_boundary (Cursor*, int32_t dir);
-       void    cursor_to_next_region_boundary (Cursor*);
-       void    cursor_to_previous_region_boundary (Cursor*);
+       nframes64_t get_region_boundary (nframes64_t pos, int32_t dir, bool with_selection, bool only_onscreen);
+
+       void    cursor_to_region_boundary (bool with_selection, int32_t dir);
+       void    cursor_to_next_region_boundary (bool with_selection);
+       void    cursor_to_previous_region_boundary (bool with_selection);
        void    cursor_to_next_region_point (Cursor*, ARDOUR::RegionPoint);
        void    cursor_to_previous_region_point (Cursor*, ARDOUR::RegionPoint);
        void    cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
        void    cursor_to_selection_start (Cursor *);
        void    cursor_to_selection_end   (Cursor *);
 
-       void    selected_marker_to_region_boundary (int32_t dir);
-       void    selected_marker_to_next_region_boundary ();
-       void    selected_marker_to_previous_region_boundary ();
+       void    selected_marker_to_region_boundary (bool with_selection, int32_t dir);
+       void    selected_marker_to_next_region_boundary (bool with_selection);
+       void    selected_marker_to_previous_region_boundary (bool with_selection);
        void    selected_marker_to_next_region_point (ARDOUR::RegionPoint);
        void    selected_marker_to_previous_region_point (ARDOUR::RegionPoint);
        void    selected_marker_to_region_point (ARDOUR::RegionPoint, int32_t dir);
@@ -726,14 +810,12 @@ class Editor : public PublicEditor
        void    select_all_selectables_between (bool within);
        void    select_range_between ();
 
-       boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
+       boost::shared_ptr<ARDOUR::Region> 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<nframes_t> region_boundary_cache;
+       vector<nframes64_t> region_boundary_cache;
        void build_region_boundary_cache ();
 
-       Gtk::VBox           trackview_vpacker;
-
        Gtk::HBox           top_hbox;
        Gtk::HBox           bottom_hbox;
        
@@ -746,6 +828,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;
@@ -759,27 +842,32 @@ class Editor : public PublicEditor
        double canvas_width;
        double canvas_height;
        double full_canvas_height;
-       nframes_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_background_group () const { return _background_group; }
+       ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
+       double last_trackview_group_vertical_offset;
        void tie_vertical_scrolling ();
-       void canvas_horizontally_scrolled ();
-       void canvas_scroll_to (nframes64_t);
+       void scroll_canvas_horizontally ();
+       void scroll_canvas_vertically ();
 
        struct VisualChange {
            enum Type { 
@@ -788,7 +876,7 @@ class Editor : public PublicEditor
            };
 
            Type pending;
-           nframes_t time_origin;
+           nframes64_t time_origin;
            double frames_per_unit;
 
            int idle_handler_id;
@@ -802,7 +890,7 @@ 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*);
@@ -927,16 +1015,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);
@@ -949,7 +1037,7 @@ class Editor : public PublicEditor
 
        void register_actions ();
 
-       int ensure_cursor (nframes_t* pos);
+       int ensure_cursor (nframes64_t* pos);
 
        void handle_new_audio_region (boost::weak_ptr<ARDOUR::AudioRegion>);
        void handle_new_audio_regions (vector<boost::weak_ptr<ARDOUR::AudioRegion> >& );
@@ -958,6 +1046,7 @@ class Editor : public PublicEditor
        void add_audio_regions_to_region_display (std::vector<boost::weak_ptr<ARDOUR::AudioRegion> > & );
        void region_hidden (boost::shared_ptr<ARDOUR::Region>);
        void redisplay_regions ();
+       bool no_region_list_redisplay;
        void insert_into_tmp_audio_regionlist(boost::shared_ptr<ARDOUR::AudioRegion>);
 
        list<boost::shared_ptr<ARDOUR::AudioRegion> > tmp_audio_region_list;
@@ -968,7 +1057,7 @@ class Editor : public PublicEditor
        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 */
        
@@ -976,27 +1065,28 @@ class Editor : public PublicEditor
        void toggle_region_mute ();
        void toggle_region_lock ();
        void toggle_region_opaque ();
+       void toggle_record_enable ();
        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::Region>, 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::Region>, ARDOUR::RegionPoint point, nframes_t position);
-       void align_region_internal (boost::shared_ptr<ARDOUR::Region>, 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::Region>, ARDOUR::RegionPoint point, nframes64_t position);
+       void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, nframes64_t position);
+       void remove_region ();
        void remove_clicked_region ();
-       void destroy_clicked_region ();
        void edit_region ();
        void rename_region ();
        void duplicate_some_regions (RegionSelection&, float times);
@@ -1012,6 +1102,9 @@ class Editor : public PublicEditor
        void denormalize_region ();
        void adjust_region_scale_amplitude (bool up);
 
+       void do_insert_time ();
+       void insert_time (nframes64_t pos, nframes64_t distance, Editing::InsertTimeOption opt, bool ignore_music_glue, bool markers_too, bool tempo_too);
+
        void tab_to_transient (bool forward);
 
        void use_region_as_bar ();
@@ -1053,13 +1146,12 @@ class Editor : public PublicEditor
        void loop_location (ARDOUR::Location&);
 
        void temporal_zoom_selection ();
-       void temporal_zoom_region ();
-       void toggle_zoom_region ();
-       bool zoomed_to_region;
+       void temporal_zoom_region (bool both_axes);
+       void toggle_zoom_region (bool both_axes);
        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);
@@ -1077,18 +1169,16 @@ class Editor : public PublicEditor
        
        void bring_in_external_audio (Editing::ImportMode mode,  nframes64_t& pos);
 
-       void _do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
+       bool  idle_drop_paths  (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
+       void  drop_paths_part_two  (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
+       
        void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
-       bool idle_do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
-
-       void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode,  nframes64_t&);
        void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode,  nframes64_t&);
-       bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode,  nframes64_t&);
 
        int  import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode,  ARDOUR::SrcQuality, nframes64_t& pos,
-                             int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool);
+                             int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>, bool, uint32_t total);
        int  embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, 
-                            nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
+                            nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>);
 
        int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
                         int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
@@ -1116,10 +1206,20 @@ class Editor : public PublicEditor
 
        /* import specific info */
 
-       ARDOUR::Session::import_status import_status;
+       struct EditorImportStatus : public ARDOUR::Session::import_status {
+           Editing::ImportMode mode;
+           nframes64_t pos;
+           int target_tracks;
+           int target_regions;
+           boost::shared_ptr<ARDOUR::AudioTrack> track;
+           bool replace;
+       };
+
+       EditorImportStatus import_status;
        gint import_progress_timeout (void *);
        static void *_import_thread (void *);
        void* import_thread ();
+       void finish_import ();
 
        /* to support this ... */
 
@@ -1168,6 +1268,7 @@ class Editor : public PublicEditor
 
        void add_location_mark (nframes64_t where);
        void add_location_from_audio_region ();
+       void add_locations_from_audio_region ();
        void add_location_from_selection ();
        void set_loop_from_selection (bool play);
        void set_punch_from_selection ();
@@ -1177,8 +1278,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;
@@ -1199,7 +1300,7 @@ class Editor : public PublicEditor
        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<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
        void extend_selection_to_end_of_region (bool next);
@@ -1210,6 +1311,7 @@ class Editor : public PublicEditor
        double snap_threshold;
 
        void handle_gui_changes (const string &, void *);
+       bool ignore_gui_changes;
 
        void    hide_all_tracks (bool with_select);
 
@@ -1225,6 +1327,8 @@ class Editor : public PublicEditor
        Gtk::Menu fade_context_menu;
        void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
 
+       void region_gain_motion_callback (ArdourCanvas::Item*, GdkEvent*);
+
        void start_fade_in_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_fade_out_grab (ArdourCanvas::Item*, GdkEvent*);
        void fade_in_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
@@ -1254,6 +1358,7 @@ class Editor : public PublicEditor
 
        void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
+       void cursor_drag_finished_ensure_locate_callback (ArdourCanvas::Item*, GdkEvent*);
        void marker_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void marker_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
        void control_point_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
@@ -1273,6 +1378,7 @@ class Editor : public PublicEditor
        void start_region_brush_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_selection_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_cursor_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_cursor_grab_no_stop (ArdourCanvas::Item*, GdkEvent*);
        void start_marker_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_control_point_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_line_grab_from_regionview (ArdourCanvas::Item*, GdkEvent*);
@@ -1288,11 +1394,11 @@ 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);
 
@@ -1346,17 +1452,13 @@ public:
 
        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 ();
 
@@ -1371,31 +1473,32 @@ public:
 
        void handle_new_duration ();
        void initialize_canvas ();
-       void reset_scrolling_region (Gtk::Allocation* alloc = 0);
 
        /* display control */
        
        bool _show_measures;
+
        bool _show_waveforms;
-       bool _follow_playhead;
+       bool _show_waveforms_rectified;
        bool _show_waveforms_recording;
+
+       bool _stationary_playhead;
+       bool _follow_playhead;
        
        ARDOUR::TempoMap::BBTPointList *current_bbt_points;
        
-       typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
-       TimeLineList free_measure_lines;
-       TimeLineList used_measure_lines;
-
+       TempoLines* tempo_lines;
+       
        ArdourCanvas::Group* time_line_group;
        ArdourCanvas::SimpleLine* get_time_line ();
        void hide_measures ();
        void draw_measures ();
-       bool lazy_hide_and_draw_measures ();
+       bool redraw_measures ();
 
        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*);
@@ -1421,11 +1524,13 @@ public:
        void marker_menu_set_playhead ();
        void marker_menu_set_from_playhead ();
        void marker_menu_set_from_selection ();
+       void marker_menu_range_to_next ();
+       void marker_menu_export_range ();
        void new_transport_marker_menu_set_loop ();
        void new_transport_marker_menu_set_punch ();
        void update_loop_range_view (bool visibility=false);
        void update_punch_range_view (bool visibility=false);
-        gint new_transport_marker_menu_popdown (GdkEventAny*);
+        void new_transport_marker_menu_popdown ();
        void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
@@ -1450,22 +1555,15 @@ public:
        void remove_metric_marks ();
        void draw_metric_marks (const ARDOUR::Metrics& metrics);
 
+       void compute_current_bbt_points (nframes_t left, nframes_t right);
        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;
-       }
 
        uint32_t bbt_beat_subdivision;
 
        /* toolbar */
-       
-       Gtk::ToggleButton        editor_mixer_button;
 
        void editor_mixer_button_toggled ();
 
@@ -1572,7 +1670,7 @@ public:
        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 {
@@ -1593,7 +1691,9 @@ public:
        ArdourCanvas::SimpleRect*  range_marker_drag_rect;
 
        void update_marker_drag_item (ARDOUR::Location *);
-       
+#ifdef GTKOSX
+       ArdourCanvas::SimpleRect     *bogus_background_rect;
+#endif
        ArdourCanvas::SimpleRect     *transport_bar_range_rect;
        ArdourCanvas::SimpleRect     *transport_bar_preroll_rect;
        ArdourCanvas::SimpleRect     *transport_bar_postroll_rect;
@@ -1615,7 +1715,7 @@ public:
        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;
        
@@ -1626,7 +1726,7 @@ public:
        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 */
 
@@ -1634,11 +1734,13 @@ public:
            RouteDisplayModelColumns() { 
                    add (text);
                    add (visible);
+                   add (temporary_visible);
                    add (tv);
                    add (route);
            }
            Gtk::TreeModelColumn<Glib::ustring>  text;
            Gtk::TreeModelColumn<bool>           visible;
+           Gtk::TreeModelColumn<bool>           temporary_visible;
            Gtk::TreeModelColumn<TimeAxisView*>  tv;
            Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> >  route;
        };
@@ -1651,8 +1753,11 @@ public:
        Gtk::ScrolledWindow                   route_list_scroller;
        Gtk::Menu*                            route_list_menu;
 
-       void sync_order_keys ();
-       bool ignore_route_order_sync;
+       void update_route_visibility ();
+
+       void sync_order_keys (const char*);
+       bool route_redisplay_does_not_sync_order_keys;
+       bool route_redisplay_does_not_reset_order_keys;
 
        bool route_list_display_button_press (GdkEventButton*);
        void route_list_display_drag_data_received  (const Glib::RefPtr<Gdk::DragContext>& context,
@@ -1672,6 +1777,7 @@ public:
        void redisplay_route_list();
        bool ignore_route_list_reorder;
        bool no_route_list_redisplay;
+       bool sync_track_view_list_and_route_list ();
 
        void build_route_list_menu ();
        void show_route_list_menu ();
@@ -1712,6 +1818,8 @@ public:
        void build_edit_group_list_menu ();
        void activate_all_edit_groups ();
        void disable_all_edit_groups ();
+       void show_all_edit_groups ();
+       void hide_all_edit_groups ();
 
        bool in_edit_group_row_change;
        void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
@@ -1735,14 +1843,16 @@ public:
        int last_autoscroll_x;
        int last_autoscroll_y;
        uint32_t autoscroll_cnt;
-       nframes_t autoscroll_x_distance;
+       nframes64_t autoscroll_x_distance;
        double autoscroll_y_distance;
-     
+
        static gint _autoscroll_canvas (void *);
        bool autoscroll_canvas ();
        void start_canvas_autoscroll (int x, int y);
        void stop_canvas_autoscroll ();
        void maybe_autoscroll (GdkEventMotion*);
+       void maybe_autoscroll_horizontally (GdkEventMotion*);
+       bool allow_vertical_scroll;
 
        /* trimming */
        enum TrimOp {
@@ -1754,9 +1864,9 @@ public:
        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);
@@ -1797,7 +1907,6 @@ public:
                                                       guint               info,
                                                       guint               time);
 
-
        void  drop_paths  (const Glib::RefPtr<Gdk::DragContext>& context,
                           gint                x,
                           gint                y,
@@ -1817,14 +1926,14 @@ public:
        ExportDialog *export_dialog;
        ExportDialog *export_range_markers_dialog;
        
-       void export_range (nframes_t start, nframes_t end);
+       void export_range (nframes64_t start, nframes64_t end);
        void export_range_markers ();
 
        int  write_region_selection(RegionSelection&);
        bool write_region (string path, boost::shared_ptr<ARDOUR::AudioRegion>);
        void export_region ();
        void bounce_region_selection ();
-       void bounce_range_selection ();
+       void bounce_range_selection (bool replace, bool enable_processing = true);
        void external_edit_region ();
 
        int write_audio_selection (TimeSelection&);
@@ -1840,12 +1949,6 @@ public:
        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);
 
@@ -1915,6 +2018,7 @@ public:
            Gtk::ComboBoxText     stretch_opts_selector;
            Gtk::Label            stretch_opts_label;
            Gtk::ToggleButton     precise_button;
+           Gtk::ToggleButton     preserve_formants_button;
            Gtk::HBox             opts_box;
 
            Gtk::Button*          cancel_button;
@@ -1956,7 +2060,9 @@ public:
 
        void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
        void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);
-
+#ifdef GTKOSX
+       void ensure_all_elements_drawn ();
+#endif
        /* nudging tracks */
 
        void nudge_track (bool use_edit_point, bool forwards);
@@ -2023,7 +2129,7 @@ public:
        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*);
@@ -2041,7 +2147,7 @@ public:
        /* 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;
 
@@ -2051,13 +2157,16 @@ public:
 
        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*);
+       void ensure_track_visible (TimeAxisView*);
        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 ();
@@ -2111,7 +2220,8 @@ public:
 
        RhythmFerret* rhythm_ferret;
 
-       void set_track_height (TimeAxisView::TrackHeight h);
+       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 ();
@@ -2121,9 +2231,13 @@ public:
 
        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<TimeAxisView*> pending_resizes;
 };
 
 #endif /* __ardour_editor_h__ */