Merged with trunk R992.
[ardour.git] / gtk2_ardour / editor.h
index db94038438beb84847ac2b7227fa008e7636a694..c26248c1e70d02086574cbb765c85464138f1799 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <cmath>
 
-#include <sndfile.h>
-
 #include <gtkmm/layout.h>
 #include <gtkmm/comboboxtext.h>
 
@@ -42,7 +40,7 @@
 #include <gtkmm2ext/click_box.h>
 #include <gtkmm2ext/dndtreeview.h>
 
-#include <ardour/stateful.h>
+#include <pbd/stateful.h>
 #include <ardour/session.h>
 #include <ardour/tempo.h>
 #include <ardour/location.h>
 #include "public_editor.h"
 #include "editing.h"
 #include "enums.h"
+#include "editor_items.h"
 #include "region_selection.h"
 #include "canvas.h"
+#include "draginfo.h"
 
 namespace Gtkmm2ext {
        class TearOff;
@@ -66,10 +66,10 @@ namespace LinuxAudioSystems {
 }
 
 namespace ARDOUR {
-       class DiskStream;
+       class AudioDiskstream;
        class RouteGroup;
-       class Source;
        class Playlist;
+       class AudioPlaylist;
        class Region;
        class Location;
        class TempoSection;
@@ -77,6 +77,7 @@ namespace ARDOUR {
        class Session;
        class AudioFilter;
        class Crossfade;
+       class ChanCount;
 }
 
 namespace LADSPA {
@@ -101,7 +102,11 @@ class TrackSelection;
 class AutomationSelection;
 class MixerStrip;
 class StreamView;
+class AudioStreamView;
 class ControlPoint;
+#ifdef FFT_ANALYSIS
+class AnalysisWindow;
+#endif
 
 /* <CMT Additions> */
 class ImageFrameView;
@@ -123,9 +128,9 @@ class Editor : public PublicEditor
        void             connect_to_session (ARDOUR::Session *);
        ARDOUR::Session* current_session() const { return session; }
 
-       jack_nframes_t leftmost_position() const { return leftmost_frame; }
-       jack_nframes_t current_page_frames() const {
-               return (jack_nframes_t) floor (canvas_width * frames_per_unit);
+       nframes_t leftmost_position() const { return leftmost_frame; }
+       nframes_t current_page_frames() const {
+               return (nframes_t) floor (canvas_width * frames_per_unit);
        }
 
        void set_snap_to (Editing::SnapType);
@@ -147,11 +152,10 @@ class Editor : public PublicEditor
        void connect_to_image_compositor() ;
        void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
        TimeAxisView* get_named_time_axis(const string & name) ;
-       /* </CMT Additions> */
 
-       void consider_auditioning (ARDOUR::Region&);
-       void hide_a_region (ARDOUR::Region&);
-       void remove_a_region (ARDOUR::Region&);
+       void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
+       void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
+       void remove_a_region (boost::shared_ptr<ARDOUR::Region>);
 
        /* option editor-access */
 
@@ -165,17 +169,18 @@ class Editor : public PublicEditor
 
        void new_region_from_selection ();
        void separate_region_from_selection ();
+       void separate_regions_using_location (ARDOUR::Location&);
        void toggle_playback (bool with_abort);
 
        /* undo related */
 
        void set_edit_menu (Gtk::Menu&);
 
-       jack_nframes_t unit_to_frame (double unit) {
-               return (jack_nframes_t) rint (unit * frames_per_unit);
+       nframes_t unit_to_frame (double unit) {
+               return (nframes_t) rint (unit * frames_per_unit);
        }
        
-       double frame_to_unit (jack_nframes_t frame) {
+       double frame_to_unit (nframes_t frame) {
                return rint ((double) frame / (double) frames_per_unit);
        }
 
@@ -190,7 +195,7 @@ class Editor : public PublicEditor
           xscroll_adjustment.  
        */
 
-       jack_nframes_t pixel_to_frame (double pixel) {
+       nframes_t pixel_to_frame (double pixel) {
                
                /* pixel can be less than zero when motion events
                   are processed. since we've already run the world->canvas
@@ -199,13 +204,13 @@ class Editor : public PublicEditor
                */
 
                if (pixel >= 0) {
-                       return (jack_nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
+                       return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit);
                } else {
                        return 0;
                }
        }
 
-       gulong frame_to_pixel (jack_nframes_t frame) {
+       gulong frame_to_pixel (nframes_t frame) {
                return (gulong) rint ((frame / (frames_per_unit *  GNOME_CANVAS(track_canvas.gobj())->pixels_per_unit)));
        }
 
@@ -215,8 +220,8 @@ class Editor : public PublicEditor
        Selection& get_cut_buffer() const { return *cut_buffer; }
 
        void play_selection ();
-       void select_all_in_track (bool add);
-       void select_all (bool add);
+       void select_all_in_track (Selection::Operation op);
+       void select_all (Selection::Operation op);
        void invert_selection_in_track ();
        void invert_selection ();
 
@@ -224,6 +229,13 @@ 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 */
+       void analyze_region_selection();
+       void analyze_range_selection();
+#endif
 
        /* export */
 
@@ -251,9 +263,13 @@ class Editor : public PublicEditor
        PlaylistSelector& playlist_selector() const;
        void route_name_changed (TimeAxisView *);
        gdouble        frames_per_unit;
-       jack_nframes_t leftmost_frame;
+       nframes_t leftmost_frame;
        void clear_playlist (ARDOUR::Playlist&);
 
+       void new_playlists ();
+       void copy_playlists ();
+       void clear_playlists ();
+
        TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
 
        Width editor_mixer_strip_width;
@@ -282,15 +298,26 @@ class Editor : public PublicEditor
        void toggle_waveforms_while_recording ();
        void toggle_measure_visibility ();
 
-       void set_meter_falloff (float);
-       void set_meter_hold (int32_t);
+       /* SMPTE timecode & video sync */
+
+       void smpte_fps_chosen (ARDOUR::Session::SmpteFormat format);
+       void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
+
+       void update_smpte_mode();
+       void update_video_pullup();
 
        /* xfades */
 
-       void toggle_xfades_active();
+       void toggle_auto_xfade ();
+       void toggle_xfades_active ();
        void toggle_xfade_visibility ();
-       void set_xfade_visibility (bool yn);
        bool xfade_visibility() const { return _xfade_visibility; }
+       void update_crossfade_model ();
+       void set_crossfade_model (ARDOUR::CrossfadeModel);
+
+       /* layers */
+       void set_layer_model (ARDOUR::LayerModel);
+       void update_layering_model ();
 
        /* redirect shared ops menu. caller must free returned menu */
 
@@ -301,21 +328,21 @@ class Editor : public PublicEditor
        void ensure_float (Gtk::Window&);
 
        void show_window ();
-       
+
        void scroll_tracks_down_line ();
        void scroll_tracks_up_line ();
 
        bool new_regionviews_display_gain () { return _new_regionviews_show_envelope; }
        void prepare_for_cleanup ();
 
-       void reposition_x_origin (jack_nframes_t sample);
+       void reposition_x_origin (nframes_t sample);
 
        void maximise_editing_space();
        void restore_editing_space();
 
   protected:
        void map_transport_state ();
-       void map_position_change (jack_nframes_t);
+       void map_position_change (nframes_t);
 
        void on_realize();
 
@@ -327,56 +354,6 @@ class Editor : public PublicEditor
 
        PlaylistSelector* _playlist_selector;
 
-       enum ItemType {
-               RegionItem,
-               StreamItem,
-               PlayheadCursorItem,
-               EditCursorItem,
-               MarkerItem,
-               MarkerBarItem,
-               RangeMarkerBarItem,
-               TransportMarkerBarItem,
-               SelectionItem,
-               GainControlPointItem,
-               GainLineItem,
-               GainAutomationControlPointItem,
-               GainAutomationLineItem,
-               PanAutomationControlPointItem,
-               PanAutomationLineItem,
-               RedirectAutomationControlPointItem,
-               RedirectAutomationLineItem,
-               MeterMarkerItem,
-               TempoMarkerItem,
-               MeterBarItem,
-               TempoBarItem,
-               AudioRegionViewNameHighlight,
-               AudioRegionViewName,
-               StartSelectionTrimItem,
-               EndSelectionTrimItem,
-               AutomationTrackItem,
-               FadeInItem,
-               FadeInHandleItem,
-               FadeOutItem,
-               FadeOutHandleItem,
-
-               /* <CMT Additions> */
-               MarkerViewItem,
-               MarkerTimeAxisItem,
-               MarkerViewHandleStartItem,
-               MarkerViewHandleEndItem,
-               ImageFrameItem,
-               ImageFrameTimeAxisItem,
-               ImageFrameHandleStartItem,
-               ImageFrameHandleEndItem,
-               /* </CMT Additions> */
-
-               CrossfadeViewItem,
-               
-               /* don't remove this */
-
-               NoItem
-       };
-
        void          set_frames_per_unit (double);
        void          frames_per_unit_modified ();
 
@@ -420,7 +397,7 @@ class Editor : public PublicEditor
            void hide();
            void show ();
            void set_name (const string&);
-           void set_position (jack_nframes_t start, jack_nframes_t end = 0);
+           void set_position (nframes_t start, nframes_t end = 0);
            void set_color_rgba (uint32_t);
        };
 
@@ -432,23 +409,40 @@ class Editor : public PublicEditor
 
        void hide_marker (ArdourCanvas::Item*, GdkEvent*);
        void clear_marker_display ();
-       void mouse_add_new_marker (jack_nframes_t where);
+       void mouse_add_new_marker (nframes_t where);
 
-       TimeAxisView*      clicked_trackview;
-       AudioTimeAxisView* clicked_audio_trackview;
-       AudioRegionView*   clicked_regionview;
-       AudioRegionView*   latest_regionview;
+       TimeAxisView*      clicked_axisview;
+       RouteTimeAxisView* clicked_routeview;
+       RegionView*        clicked_regionview;
+       RegionView*        latest_regionview;
        uint32_t           clicked_selection;
        CrossfadeView*     clicked_crossfadeview;
        ControlPoint*      clicked_control_point;
 
-       void catch_vanishing_audio_regionview (AudioRegionView *);
-       void set_selected_control_point_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
-       void set_selected_track_from_click (bool add = false, bool with_undo = true, bool no_remove=false);
-       void set_selected_regionview_from_click (bool add = false, bool no_track_remove=false);
-       void set_selected_regionview_from_region_list (ARDOUR::Region& region, bool add = false);
-       bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, ARDOUR::Region*);
-       void collect_new_region_view (AudioRegionView *);
+       void get_relevant_tracks (RouteTimeAxisView& base, std::set<RouteTimeAxisView*>& relevant_tracks);
+       void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl);
+
+       /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
+
+       void mapped_set_selected_regionview_from_click (RouteTimeAxisView&, uint32_t, RegionView*, vector<RegionView*>*);
+       void mapped_use_new_playlist (RouteTimeAxisView&, uint32_t);
+       void mapped_use_copy_playlist (RouteTimeAxisView&, uint32_t);
+       void mapped_clear_playlist (RouteTimeAxisView&, uint32_t);
+
+       /* end */
+
+       void button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type);
+       bool button_release_can_deselect;
+
+       void catch_vanishing_regionview (RegionView *);
+
+       bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
+       bool set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool with_undo = true, bool no_remove=false);
+       bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set, bool no_track_remove=false);
+
+       void set_selected_regionview_from_region_list (boost::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set);
+       bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, boost::shared_ptr<ARDOUR::Region>);
+       void collect_new_region_view (RegionView *);
 
        Gtk::Menu track_context_menu;
        Gtk::Menu track_region_context_menu;
@@ -461,20 +455,19 @@ 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, jack_nframes_t);
-       Gtk::Menu* build_track_context_menu (jack_nframes_t);
-       Gtk::Menu* build_track_bus_context_menu (jack_nframes_t);
-       Gtk::Menu* build_track_region_context_menu (jack_nframes_t frame);
-       Gtk::Menu* build_track_crossfade_context_menu (jack_nframes_t);
-       Gtk::Menu* build_track_selection_context_menu (jack_nframes_t);
+       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 add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
        void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
-       void add_region_context_items (StreamView*, ARDOUR::Region*, Gtk::Menu_Helpers::MenuList&);
-       void add_crossfade_context_items (StreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
+       void add_region_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Region>, Gtk::Menu_Helpers::MenuList&);
+       void add_crossfade_context_items (AudioStreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many);
        void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
 
-       void handle_new_route (ARDOUR::Route&);
-       void handle_new_route_p (ARDOUR::Route*);
+       void handle_new_route (ARDOUR::Session::RouteList&);
        void remove_route (TimeAxisView *);
        bool route_removal;
 
@@ -491,9 +484,7 @@ class Editor : public PublicEditor
        ArdourCanvas::Text* verbose_canvas_cursor;
        bool                 verbose_cursor_visible;
 
-       void session_control_changed (ARDOUR::Session::ControlType);
-       void queue_session_control_changed (ARDOUR::Session::ControlType);
-
+       void parameter_changed (const char *);
        
        bool track_canvas_motion (GdkEvent*);
 
@@ -549,7 +540,7 @@ class Editor : public PublicEditor
        void update_just_smpte ();
        void update_fixed_rulers ();
        void update_tempo_based_rulers (); 
-       void popup_ruler_menu (jack_nframes_t where = 0, ItemType type = RegionItem);
+       void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem);
        void update_ruler_visibility ();
        void ruler_toggled (int);
        gint ruler_label_button_release (GdkEventButton*);
@@ -611,13 +602,13 @@ class Editor : public PublicEditor
            Editor&               editor;
            ArdourCanvas::Points  points;
            ArdourCanvas::Line    canvas_item;
-           jack_nframes_t        current_frame;
+           nframes_t        current_frame;
            double                length;
 
            Cursor (Editor&, const string& color, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
            ~Cursor ();
 
-           void set_position (jack_nframes_t);
+           void set_position (nframes_t);
            void set_length (double units);
            void set_y_axis (double position);
        };
@@ -635,10 +626,12 @@ class Editor : public PublicEditor
        void    cursor_to_region_point (Cursor*, ARDOUR::RegionPoint, int32_t dir);
        void    cursor_to_selection_start (Cursor *);
        void    cursor_to_selection_end   (Cursor *);
+       void    select_all_selectables_using_cursor (Cursor *, bool);
+       void    select_all_selectables_between_cursors (Cursor *, Cursor *);
 
-       ARDOUR::Region* find_next_region (jack_nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
+       boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
 
-       vector<jack_nframes_t> region_boundary_cache;
+       vector<nframes_t> region_boundary_cache;
        void build_region_boundary_cache ();
 
        Gtk::VBox           trackview_vpacker;
@@ -647,7 +640,6 @@ class Editor : public PublicEditor
        Gtk::HBox           bottom_hbox;
        
        Gtk::Table          edit_packer;
-       Gtk::Frame          edit_frame;
        Gtk::VScrollbar     edit_vscrollbar;
 
        Gtk::Adjustment     vertical_adjustment;
@@ -658,7 +650,8 @@ class Editor : public PublicEditor
        void controls_layout_size_request (Gtk::Requisition*);
 
        Gtk::HScrollbar     edit_hscrollbar;
-       bool                edit_hscroll_dragging;
+
+       void reset_hscrollbar_stepping ();
        
        bool hscrollbar_button_press (GdkEventButton*);
        bool hscrollbar_button_release (GdkEventButton*);
@@ -666,6 +659,7 @@ class Editor : public PublicEditor
 
        double canvas_width;
        double canvas_height;
+       nframes_t last_canvas_frame;
 
        bool track_canvas_map_handler (GdkEventAny*);
        bool time_canvas_map_handler (GdkEventAny*);
@@ -682,14 +676,17 @@ class Editor : public PublicEditor
        Gtk::VBox           edit_controls_vbox;
        Gtk::HBox           edit_controls_hbox;
 
+       void control_scroll (float);
+       bool deferred_control_scroll (nframes_t);
+       sigc::connection control_scroll_connection;
+
        void tie_vertical_scrolling ();
        void canvas_horizontally_scrolled ();
-       void reposition_and_zoom (jack_nframes_t sample, double fpu);
-       gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
+
+       void reposition_and_zoom (nframes_t sample, double fpu);
+       gint deferred_reposition_and_zoom (nframes_t sample, double fpu);
        void end_location_changed (ARDOUR::Location*);
        bool repos_zoom_queued;
-       bool no_zoom_repos_update;
-       bool no_tempo_map_update;
 
        struct RegionListDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
            RegionListDisplayModelColumns() {
@@ -698,15 +695,16 @@ class Editor : public PublicEditor
                    add (color_);
            }
            Gtk::TreeModelColumn<Glib::ustring> name;
-           Gtk::TreeModelColumn<ARDOUR::Region*> region;
-               Gtk::TreeModelColumn<Gdk::Color> color_;
+           Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
+           Gtk::TreeModelColumn<Gdk::Color> color_;
        };
            
-       RegionListDisplayModelColumns    region_list_columns;
-       Gtkmm2ext::DnDTreeView           region_list_display;
-       Glib::RefPtr<Gtk::TreeStore>     region_list_model;
-       Glib::RefPtr<Gtk::ToggleAction>  toggle_full_region_list_action;
-       Glib::RefPtr<Gtk::ToggleAction>  toggle_show_auto_regions_action;
+       RegionListDisplayModelColumns          region_list_columns;
+       Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > region_list_display;
+
+       Glib::RefPtr<Gtk::TreeStore>           region_list_model;
+       Glib::RefPtr<Gtk::ToggleAction>        toggle_full_region_list_action;
+       Glib::RefPtr<Gtk::ToggleAction>        toggle_show_auto_regions_action;
 
        void region_list_selection_changed ();
        bool region_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
@@ -720,7 +718,7 @@ class Editor : public PublicEditor
        bool region_list_display_button_press (GdkEventButton *);
        bool region_list_display_button_release (GdkEventButton *);
        void region_list_clear ();
-       void region_list_selection_mapover (sigc::slot<void,ARDOUR::Region&>);
+       void region_list_selection_mapover (sigc::slot<void,boost::shared_ptr<ARDOUR::Region> >);
        void build_region_list_menu ();
        void show_region_list_display_context_menu (int button, int time);
 
@@ -769,7 +767,7 @@ class Editor : public PublicEditor
        NamedSelectionDisplayModelColumns named_selection_columns;
        Glib::RefPtr<Gtk::TreeStore>     named_selection_model;
 
-       Gtkmm2ext::DnDTreeView named_selection_display;
+       Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
        Gtk::ScrolledWindow    named_selection_scroller;
 
        void name_selection();
@@ -803,26 +801,24 @@ class Editor : public PublicEditor
        static void build_cursors ();
 
        sigc::connection scroll_connection;
-       jack_nframes_t last_update_frame;
-       void center_screen (jack_nframes_t);
-       void center_screen_internal (jack_nframes_t, float);
+       nframes_t last_update_frame;
+       void center_screen (nframes_t);
+       void center_screen_internal (nframes_t, float);
        
        void update_current_screen ();
-       sigc::connection slower_update_connection;
-       void update_slower ();
        
        gint show_track_context_menu (GdkEventButton *);
        void hide_track_context_menu ();
 
        void session_going_away ();
 
-       jack_nframes_t cut_buffer_start;
-       jack_nframes_t cut_buffer_length;
+       nframes_t cut_buffer_start;
+       nframes_t cut_buffer_length;
 
        bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
-       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool motion_handler (ArdourCanvas::Item*, GdkEvent*, ItemType, bool from_autoscroll = false);
        bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        
@@ -830,18 +826,16 @@ class Editor : public PublicEditor
 
        void register_actions ();
 
-       int ensure_cursor (jack_nframes_t* pos);
+       int ensure_cursor (nframes_t* pos);
 
-       void fake_handle_new_audio_region (ARDOUR::AudioRegion *);
-       void handle_new_audio_region (ARDOUR::AudioRegion *);
-       void fake_handle_audio_region_removed (ARDOUR::AudioRegion *);
-       void handle_audio_region_removed (ARDOUR::AudioRegion *);
-       void add_audio_region_to_region_display (ARDOUR::AudioRegion *);
-       void region_hidden (ARDOUR::Region*);
+       void handle_new_region (boost::shared_ptr<ARDOUR::Region>);
+       void handle_region_removed (boost::shared_ptr<ARDOUR::Region>);
+       void add_region_to_region_display (boost::shared_ptr<ARDOUR::Region>);
+       void region_hidden (boost::shared_ptr<ARDOUR::Region>);
        void redisplay_regions ();
-       void insert_into_tmp_audio_regionlist(ARDOUR::AudioRegion *);
+       void insert_into_tmp_regionlist(boost::shared_ptr<ARDOUR::Region>);
 
-       list<ARDOUR::AudioRegion *> tmp_audio_region_list;
+       list<boost::shared_ptr<ARDOUR::Region> > tmp_region_list;
 
        void cut_copy (Editing::CutCopyOp);
        void cut_copy_points (Editing::CutCopyOp);
@@ -849,10 +843,11 @@ class Editor : public PublicEditor
        void cut_copy_ranges (Editing::CutCopyOp);
 
        void mouse_paste ();
-       void paste_internal (jack_nframes_t position, float times);
+       void paste_internal (nframes_t position, float times);
 
        /* EDITING OPERATIONS */
        
+       void reset_point_selection ();
        void toggle_region_mute ();
        void toggle_region_opaque ();
        void raise_region ();
@@ -860,26 +855,27 @@ class Editor : public PublicEditor
        void lower_region ();
        void lower_region_to_bottom ();
        void split_region ();
-       void split_region_at (jack_nframes_t);
-       void split_regions_at (jack_nframes_t, AudioRegionSelection&);
+       void split_region_at (nframes_t);
+       void split_regions_at (nframes_t, RegionSelection&);
        void crop_region_to_selection ();
+       void set_a_regions_sync_position (boost::shared_ptr<ARDOUR::Region>, nframes_t);
        void set_region_sync_from_edit_cursor ();
        void remove_region_sync();
-       void align_selection (ARDOUR::RegionPoint, jack_nframes_t position);
-       void align_selection_relative (ARDOUR::RegionPoint point, jack_nframes_t position);
-       void align_region (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
-       void align_region_internal (ARDOUR::Region&, ARDOUR::RegionPoint point, jack_nframes_t position);
+       void align_selection (ARDOUR::RegionPoint, nframes_t position);
+       void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position);
+       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 remove_some_regions ();
        void remove_clicked_region ();
        void destroy_clicked_region ();
        void edit_region ();
-       void duplicate_some_regions (AudioRegionSelection&, float times);
+       void duplicate_some_regions (RegionSelection&, float times);
        void duplicate_selection (float times);
        void region_fill_selection ();
 
        void region_fill_track ();
-       void audition_playlist_region_standalone (ARDOUR::AudioRegion&);
-       void audition_playlist_region_via_route (ARDOUR::AudioRegion&, ARDOUR::Route&);
+       void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
+       void audition_playlist_region_via_route (boost::shared_ptr<ARDOUR::Region>, ARDOUR::Route&);
        void split_multichannel_region();
        void reverse_region ();
        void normalize_region ();
@@ -906,7 +902,7 @@ class Editor : public PublicEditor
        void keyboard_insert_region_list_selection ();
 
        void region_from_selection ();
-       void create_region_from_selection (std::vector<ARDOUR::AudioRegion*>&);
+       void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
 
        bool region_renamed;
        void rename_region ();
@@ -926,27 +922,24 @@ class Editor : public PublicEditor
        void temporal_zoom_selection ();
        void temporal_zoom_session ();
        void temporal_zoom (gdouble scale);
-       void temporal_zoom_by_frame (jack_nframes_t start, jack_nframes_t end, const string & op);
-       void temporal_zoom_to_frame (bool coarser, jack_nframes_t frame);
+       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 amplitude_zoom (gdouble scale);
        void amplitude_zoom_step (bool in);
 
-       void insert_region_list_drag (ARDOUR::AudioRegion&, int x, int y);
+       void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
        void insert_region_list_selection (float times);
 
-       void insert_sndfile (bool as_tracks);
-       void embed_audio ();    // inserts into region list
-       int  reject_because_rate_differs (const string & path, SF_INFO& finfo, const string & action, bool multiple_pending);
-
-       void do_embed_sndfiles (vector<string> paths, bool split);
-       void embed_sndfile (string path, bool split, bool multiple_files, bool& check_sr);
+       void add_external_audio_action (Editing::ImportMode);
 
-       void do_insert_sndfile (vector<string> path, bool multi, jack_nframes_t frame);
-       void insert_paths_as_new_tracks (std::vector<std::string> paths, bool multi); // inserts files as new tracks
-       void insert_sndfile_into (const string & path, bool multi, AudioTimeAxisView* tv, jack_nframes_t& frame, bool prompt=true);
-       static void* _insert_sndfile_thread (void*);
-       void*  insert_sndfile_thread (void*);
+       void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t& pos, bool prompt);
+       void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
+       void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&, bool);
+       int  import_sndfile (Glib::ustring path, Editing::ImportMode mode, ARDOUR::AudioTrack* track, nframes_t& pos);
+       int  embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode, 
+                           ARDOUR::AudioTrack* track, nframes_t& pos, bool prompt);
+       int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, nframes_t& pos, Editing::ImportMode mode);
 
        /* generic interthread progress window */
        
@@ -961,14 +954,16 @@ class Editor : public PublicEditor
        void build_interthread_progress_window ();
        ARDOUR::InterThreadInfo* current_interthread_info;
 
+#ifdef FFT_ANALYSIS
+       AnalysisWindow* analysis_window;
+#endif
+
        /* import specific info */
 
        ARDOUR::Session::import_status import_status;
        gint import_progress_timeout (void *);
        static void *_import_thread (void *);
        void* import_thread ();
-       void catch_new_audio_region (ARDOUR::AudioRegion*);
-       ARDOUR::AudioRegion* last_audio_region;
 
        /* to support this ... */
 
@@ -1002,11 +997,15 @@ class Editor : public PublicEditor
        void cursor_align (bool playhead_to_edit);
 
        void remove_last_capture ();
-
+       void select_all_selectables_using_time_selection ();
+       void select_all_selectables_using_loop();
+       void select_all_selectables_using_punch();
        void set_selection_from_range (ARDOUR::Location&);
        void set_selection_from_punch ();
        void set_selection_from_loop ();
+       void set_selection_from_audio_region ();
 
+       void add_location_from_audio_region ();
        void add_location_from_selection ();
        void set_route_loop_selection ();
 
@@ -1021,9 +1020,9 @@ class Editor : public PublicEditor
        void keyboard_selection_begin ();
        void keyboard_selection_finish (bool add);
        bool have_pending_keyboard_selection;
-       jack_nframes_t pending_keyboard_selection_start;
+       nframes_t pending_keyboard_selection_start;
 
-       ARDOUR::AudioRegion* select_region_for_operation (int dir, TimeAxisView **tv);
+       boost::shared_ptr<ARDOUR::Region> select_region_for_operation (int dir, TimeAxisView **tv);
        void extend_selection_to_end_of_region (bool next);
        void extend_selection_to_start_of_region (bool previous);
 
@@ -1039,41 +1038,12 @@ class Editor : public PublicEditor
 
        void    hide_all_tracks (bool with_select);
 
-       struct DragInfo {
-         ArdourCanvas::Item* item;
-           void* data;
-           jack_nframes_t last_frame_position;
-           int32_t pointer_frame_offset;
-           jack_nframes_t grab_frame;
-           jack_nframes_t last_pointer_frame;
-           jack_nframes_t current_pointer_frame;
-           double grab_x, grab_y;
-           double cumulative_x_drag;
-           double cumulative_y_drag;
-           double current_pointer_x;
-           double current_pointer_y;
-         void (Editor::*motion_callback)(ArdourCanvas::Item*, GdkEvent*);
-         void (Editor::*finished_callback)(ArdourCanvas::Item*, GdkEvent*);
-           TimeAxisView* last_trackview;
-           bool x_constrained;
-           bool copy;
-           bool was_rolling;
-           bool first_move;
-           bool move_threshold_passsed;
-           bool want_move_threshold;
-           bool brushing;
-           ARDOUR::Location* copied_location;
-       } drag_info;
-
-       struct LineDragInfo {
-           uint32_t before;
-           uint32_t after;
-       };
-
+       DragInfo drag_info;
        LineDragInfo current_line_drag_info;
 
        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);
 
        Gtk::Menu fade_context_menu;
        void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
@@ -1117,18 +1087,20 @@ class Editor : public PublicEditor
        void start_line_grab_from_line (ArdourCanvas::Item*, GdkEvent*);
        void start_line_grab (AutomationLine *, GdkEvent*);
        void start_tempo_marker_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_tempo_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
        void start_meter_marker_grab (ArdourCanvas::Item*, GdkEvent*);
+       void start_meter_marker_copy_grab (ArdourCanvas::Item*, GdkEvent*);
 
        void region_view_item_click (AudioRegionView&, GdkEventButton*);
 
        void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
        void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
 
-       void mouse_brush_insert_region (AudioRegionView*, jack_nframes_t pos);
-       void brush (jack_nframes_t);
+       void mouse_brush_insert_region (RegionView*, nframes_t pos);
+       void brush (nframes_t);
 
-       void show_verbose_time_cursor (jack_nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1);
-       void show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end, double offset = 0, double xpos=-1, double ypos=-1);
+       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);
 
        /* Canvas event handlers */
 
@@ -1142,10 +1114,10 @@ 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*);
-       bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
-       bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
-       bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
-       bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, AudioTimeAxisView*);
+       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*);
+       bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
        bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
        bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
        bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
@@ -1186,6 +1158,7 @@ class Editor : public PublicEditor
        void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
        void kbd_set_playhead_cursor ();
        void kbd_set_edit_cursor ();
+       void kbd_mute_unmute_region ();
        void kbd_split ();
        void kbd_set_sync_position ();
        void kbd_align (ARDOUR::RegionPoint);
@@ -1200,7 +1173,6 @@ class Editor : public PublicEditor
        void kbd_do_brush (GdkEvent*);
        void kbd_do_audition (GdkEvent*);
 
-       void fake_handle_new_duration ();
        void handle_new_duration ();
        void initialize_canvas ();
        void reset_scrolling_region (Gtk::Allocation* alloc = 0);
@@ -1213,8 +1185,6 @@ class Editor : public PublicEditor
        bool _follow_playhead;
        bool _show_waveforms_recording;
        
-       void add_bbt_marks (ARDOUR::TempoMap::BBTPointList&);
-
        ARDOUR::TempoMap::BBTPointList *current_bbt_points;
        
        typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
@@ -1225,12 +1195,12 @@ class Editor : public PublicEditor
        ArdourCanvas::SimpleLine* get_time_line ();
        void hide_measures ();
        void draw_measures ();
-       void draw_time_bars ();
+       bool lazy_hide_and_draw_measures ();
 
        void new_tempo_section ();
 
-       void mouse_add_new_tempo_event (jack_nframes_t where);
-       void mouse_add_new_meter_event (jack_nframes_t where);
+       void mouse_add_new_tempo_event (nframes_t where);
+       void mouse_add_new_meter_event (nframes_t where);
 
        void remove_tempo_marker (ArdourCanvas::Item*);
        void remove_meter_marker (ArdourCanvas::Item*);
@@ -1247,6 +1217,8 @@ class Editor : public PublicEditor
        void marker_menu_rename ();
        void marker_menu_hide ();
        void marker_menu_loop_range ();
+       void marker_menu_select_all_selectables_using_range ();
+       void marker_menu_separate_regions_using_location ();
        void marker_menu_play_from ();
        void marker_menu_set_playhead ();
        void marker_menu_set_from_playhead ();
@@ -1260,6 +1232,7 @@ class Editor : public PublicEditor
        void tm_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void new_transport_marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
+       void build_range_marker_menu ();
        void build_marker_menu ();
        void build_tm_marker_menu ();
        void build_transport_marker_menu ();
@@ -1267,6 +1240,7 @@ class Editor : public PublicEditor
 
        Gtk::Menu* tm_marker_menu;
        Gtk::Menu* marker_menu;
+       Gtk::Menu* range_marker_menu;
        Gtk::Menu* transport_marker_menu;
        Gtk::Menu* new_transport_marker_menu;
        ArdourCanvas::Item* marker_menu_item;
@@ -1280,7 +1254,7 @@ class Editor : public PublicEditor
        void tempo_map_changed (ARDOUR::Change);
        void redisplay_tempo ();
        
-       void snap_to (jack_nframes_t& first, int32_t direction = 0, bool for_mark = false);
+       void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false);
        uint32_t bbt_beat_subdivision;
 
        /* toolbar */
@@ -1289,12 +1263,7 @@ class Editor : public PublicEditor
 
        void editor_mixer_button_toggled ();
 
-       AudioClock               selection_start_clock;
-       Gtk::Label               selection_start_clock_label;
-       AudioClock               selection_end_clock;
-       Gtk::Label               selection_end_clock_label;
        AudioClock               edit_cursor_clock;
-       Gtk::Label               edit_cursor_clock_label;
        AudioClock               zoom_range_clock;
        Gtk::Button              zoom_in_button;
        Gtk::Button              zoom_out_button;
@@ -1306,8 +1275,8 @@ class Editor : public PublicEditor
        Gtk::Table               toolbar_selection_clock_table;
        Gtk::Label               toolbar_selection_cursor_label;
        
-       Gtk::Table               mouse_mode_button_table;
-       Gtkmm2ext::TearOff*       mouse_mode_tearoff;
+       Gtk::HBox                mouse_mode_button_box;
+       Gtkmm2ext::TearOff*      mouse_mode_tearoff;
        Gtk::ToggleButton        mouse_select_button;
        Gtk::ToggleButton        mouse_move_button;
        Gtk::ToggleButton        mouse_gain_button;
@@ -1325,32 +1294,23 @@ class Editor : public PublicEditor
        Gtk::ToggleButton        global_automation_button;
 
        Gtk::ComboBoxText edit_mode_selector;
-       Gtk::Label               edit_mode_label;
-       Gtk::VBox                edit_mode_box;
+       Gtk::VBox         edit_mode_box;
 
        void edit_mode_selection_done ();
 
        Gtk::ComboBoxText snap_type_selector;
-       Gtk::Label               snap_type_label;
-       Gtk::VBox                snap_type_box;
+       Gtk::ComboBoxText snap_mode_selector;
+       Gtk::HBox         snap_box;
 
        void snap_type_selection_done ();
-
-       Gtk::ComboBoxText               snap_mode_selector;
-       Gtk::Label               snap_mode_label;
-       Gtk::VBox                snap_mode_box;
-
        void snap_mode_selection_done ();
        
        Gtk::ComboBoxText zoom_focus_selector;
-       Gtk::Label               zoom_focus_label;
        Gtk::VBox                zoom_focus_box;
        
        void zoom_focus_selection_done ();
 
-       Gtk::Label          zoom_indicator_label;
-       Gtk::HBox           zoom_indicator_box;
-       Gtk::VBox           zoom_indicator_vbox;
+       Gtk::HBox           zoom_box;
 
        void                update_zoom_indicator ();
        void                zoom_adjustment_changed();
@@ -1392,7 +1352,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 (jack_nframes_t where);
+       bool audio_region_selection_covers (nframes_t where);
 
        /* transport range select process */
        enum RangeMarkerOp {
@@ -1433,7 +1393,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 (jack_nframes_t start, jack_nframes_t end, gdouble topy, gdouble boty, bool add);
+       bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, Selection::Operation op);
        
        ArdourCanvas::SimpleRect   *rubberband_rect;
        
@@ -1444,7 +1404,7 @@ class Editor : public PublicEditor
        void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event);
 
        ArdourCanvas::SimpleRect   *zoom_rect;
-       void reposition_zoom_rect (jack_nframes_t start, jack_nframes_t end);
+       void reposition_zoom_rect (nframes_t start, nframes_t end);
        
        /* diskstream/route display management */
 
@@ -1464,9 +1424,9 @@ class Editor : public PublicEditor
        Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
 
        gint route_list_compare_func (Gtk::TreeModel::iterator, Gtk::TreeModel::iterator);
-       Gtkmm2ext::DnDTreeView   route_list_display; 
-       Gtk::ScrolledWindow      route_list_scroller;
-       Gtk::Menu*               route_list_menu;
+       Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Route> > route_list_display; 
+       Gtk::ScrolledWindow                   route_list_scroller;
+       Gtk::Menu*                            route_list_menu;
 
        bool route_list_display_button_press (GdkEventButton*);
        bool route_list_selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
@@ -1520,27 +1480,32 @@ class Editor : public PublicEditor
        void activate_all_edit_groups ();
        void disable_all_edit_groups ();
 
+       bool in_edit_group_row_change;
        void edit_group_row_change (const Gtk::TreeModel::Path&,const Gtk::TreeModel::iterator&);
-       
+       void edit_group_name_edit (const Glib::ustring&, const Glib::ustring&);
        void new_edit_group ();
        void edit_group_list_button_clicked ();
        gint edit_group_list_button_press_event (GdkEventButton* ev);
        void edit_group_selection_changed ();
        void fake_add_edit_group (ARDOUR::RouteGroup* group);
+       void fake_remove_edit_group (ARDOUR::RouteGroup* group);
        void add_edit_group (ARDOUR::RouteGroup* group);
+       void remove_selected_edit_group ();
+       void edit_groups_changed ();
        void group_flags_changed (void*, ARDOUR::RouteGroup*);
 
        Gtk::VBox           list_vpacker;
 
        /* autoscrolling */
 
+       bool autoscroll_active;
        int autoscroll_timeout_tag;
        int autoscroll_direction;
        uint32_t autoscroll_cnt;
-       jack_nframes_t autoscroll_distance;
+       nframes_t autoscroll_distance;
      
        static gint _autoscroll_canvas (void *);
-       gint autoscroll_canvas ();
+       bool autoscroll_canvas ();
        void start_canvas_autoscroll (int direction);
        void stop_canvas_autoscroll ();
        void maybe_autoscroll (GdkEvent*);
@@ -1555,12 +1520,12 @@ 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 (AudioRegionView&, jack_nframes_t, bool, bool, bool);
-       void single_start_trim (AudioRegionView&, jack_nframes_t, bool, bool);
-       void single_end_trim (AudioRegionView&, jack_nframes_t, bool, bool);
+       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 trim_finished_callback (ArdourCanvas::Item*, GdkEvent*);
-       void thaw_region_after_trim (AudioRegionView& rv);
+       void thaw_region_after_trim (RegionView& rv);
        
        void trim_region_to_edit_cursor ();
        void trim_region_from_edit_cursor ();
@@ -1569,7 +1534,7 @@ class Editor : public PublicEditor
 
        /* Drag-n-Drop */
 
-       int convert_drop_to_paths (std::vector<std::string>& paths,
+       int convert_drop_to_paths (std::vector<Glib::ustring>& paths,
                                   const Glib::RefPtr<Gdk::DragContext>& context,
                                   gint                x,
                                   gint                y,
@@ -1609,17 +1574,20 @@ class Editor : public PublicEditor
        /* audio export */
 
        ExportDialog *export_dialog;
-       void export_range (jack_nframes_t start, jack_nframes_t end);
+       ExportDialog *export_range_markers_dialog;
+       
+       void export_range (nframes_t start, nframes_t end);
+       void export_range_markers ();
 
-       int  write_region_selection(AudioRegionSelection&);
-       bool write_region (string path, ARDOUR::AudioRegion&);
+       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 external_edit_region ();
 
        int write_audio_selection (TimeSelection&);
-       bool write_audio_range (ARDOUR::Playlist&, uint32_t channels, list<ARDOUR::AudioRange>&);
+       bool write_audio_range (ARDOUR::AudioPlaylist&, const ARDOUR::ChanCount& channels, list<ARDOUR::AudioRange>&);
 
        void write_selection ();
 
@@ -1627,13 +1595,15 @@ class Editor : public PublicEditor
 
        UndoAction get_memento() const;
 
+       XMLNode *before; /* used in *_reversible_command */
+
        void begin_reversible_command (string cmd_name);
        void commit_reversible_command ();
 
        /* visual history */
 
        UndoHistory visual_history;
-       UndoCommand current_visual_command;
+       UndoTransaction current_visual_command;
 
        void begin_reversible_visual_command (const string & cmd_name);
        void commit_reversible_visual_command ();
@@ -1654,7 +1624,7 @@ class Editor : public PublicEditor
 
        void instant_save ();
 
-       ARDOUR::AudioRegion* last_audition_region;
+       boost::shared_ptr<ARDOUR::AudioRegion> last_audition_region;
        
        /* freeze operations */
 
@@ -1680,7 +1650,7 @@ class Editor : public PublicEditor
        Gtk::Menu* edit_menu;
        bool edit_menu_map_handler (GdkEventAny*);
 
-       jack_nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
+       nframes_t event_frame (GdkEvent*, double* px = 0, double* py = 0);
 
        void time_fx_motion (ArdourCanvas::Item*, GdkEvent*);
        void start_time_fx (ArdourCanvas::Item*, GdkEvent*);
@@ -1689,13 +1659,12 @@ class Editor : public PublicEditor
        struct TimeStretchDialog : public ArdourDialog {
            ARDOUR::Session::TimeStretchRequest request;
            Editor&               editor;
-           AudioRegionSelection  regions;
+           RegionSelection       regions;
            Gtk::ProgressBar      progress_bar;
            Gtk::ToggleButton     quick_button;
            Gtk::ToggleButton     antialias_button;
-           Gtk::Button           cancel_button;
-           Gtk::Button           action_button;
-           Gtk::HBox             lower_button_box;
+           Gtk::Button*          cancel_button;
+           Gtk::Button*          action_button;
            Gtk::HBox             upper_button_box;
            Gtk::VBox             packer;
            int                   status;
@@ -1716,7 +1685,7 @@ class Editor : public PublicEditor
        TimeStretchDialog* current_timestretch;
 
        static void* timestretch_thread (void *arg);
-       int run_timestretch (AudioRegionSelection&, float fraction);
+       int run_timestretch (RegionSelection&, float fraction);
        void do_timestretch (TimeStretchDialog&);
 
        /* editor-mixer strip */
@@ -1795,10 +1764,9 @@ class Editor : public PublicEditor
        Gtk::Button      nudge_backward_button;
        Gtk::HBox        nudge_hbox;
        Gtk::VBox        nudge_vbox;
-       Gtk::Label       nudge_label;
        AudioClock       nudge_clock;
 
-       jack_nframes_t get_nudge_distance (jack_nframes_t pos, jack_nframes_t& next);
+       nframes_t get_nudge_distance (nframes_t pos, nframes_t& next);
        
        /* audio filters */
 
@@ -1818,11 +1786,11 @@ class Editor : public PublicEditor
        sigc::connection step_timeout;
 
        TimeAxisView* entered_track;
-       AudioRegionView* entered_regionview;
+       RegionView*   entered_regionview;
        bool clear_entered_track;
        gint left_track_canvas (GdkEventCrossing*);
        void set_entered_track (TimeAxisView*);
-       void set_entered_regionview (AudioRegionView*);
+       void set_entered_regionview (RegionView*);
        gint left_automation_track ();
 
        bool _new_regionviews_show_envelope;
@@ -1830,9 +1798,6 @@ class Editor : public PublicEditor
        void toggle_gain_envelope_visibility ();
        void toggle_gain_envelope_active ();
        
-       typedef std::map<Editing::ColorID,std::string> ColorStyleMap;
-       void init_colormap ();
-
        bool on_key_press_event (GdkEventKey*);
 
        void session_state_saved (string);