Fix some bugs I introduced with the last commit.
[ardour.git] / gtk2_ardour / editor.h
index 8cbccefabda2b22ba7634bc302035150f0dd7f05..9fa45ba85dac5e5c98d6b6251654a751ac3ab07c 100644 (file)
@@ -25,7 +25,6 @@
 #include <set>
 #include <string>
 #include <sys/time.h>
-#include <bitset>
 
 #include <boost/optional.hpp>
 
@@ -42,6 +41,8 @@
 #include "gtkmm2ext/selector.h"
 #include "gtkmm2ext/click_box.h"
 #include "gtkmm2ext/dndtreeview.h"
+#include "gtkmm2ext/stateful_button.h"
+#include "gtkmm2ext/bindings.h"
 
 #include "pbd/stateful.h"
 #include "pbd/signals.h"
 #include "ardour/import_status.h"
 #include "ardour/tempo.h"
 #include "ardour/location.h"
-#include "ardour/audioregion.h"
-#include "ardour/track.h"
 #include "ardour/types.h"
-#include "ardour/route_group.h"
 
-#include "audio_clock.h"
 #include "gtk-custom-ruler.h"
+#include "ardour_button.h"
 #include "ardour_dialog.h"
 #include "public_editor.h"
 #include "editing.h"
@@ -71,12 +69,14 @@ namespace Gnome { namespace Canvas {
 
 namespace Gtkmm2ext {
        class TearOff;
+       class Bindings;
 }
 
 namespace ARDOUR {
        class RouteGroup;
        class Playlist;
        class AudioPlaylist;
+       class AudioRegion;
        class Region;
        class Location;
        class TempoSection;
@@ -86,6 +86,7 @@ namespace ARDOUR {
        class Crossfade;
        class ChanCount;
        class MidiOperator;
+       class Track;
        class MidiTrack;
        class AudioTrack;
 }
@@ -95,6 +96,7 @@ namespace LADSPA {
 }
 
 class AnalysisWindow;
+class AudioClock;
 class AudioRegionView;
 class AudioStreamView;
 class AudioTimeAxisView;
@@ -106,6 +108,7 @@ class ControlPoint;
 class CrossfadeView;
 class DragManager;
 class GroupedButtons;
+class GUIObjectState;
 class Marker;
 class MidiRegionView;
 class MixerStrip;
@@ -130,6 +133,7 @@ class RegionLayeringOrderEditor;
 class ProgressReporter;
 class EditorCursor;
 class MouseCursors;
+class VerboseCursor;
 
 /* <CMT Additions> */
 class ImageFrameView;
@@ -198,7 +202,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
        void add_to_idle_resize (TimeAxisView*, int32_t);
 
-       RouteTimeAxisView* get_route_view_by_route_id (PBD::ID& id) const;
+       RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const;
 
        void consider_auditioning (boost::shared_ptr<ARDOUR::Region>);
        void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
@@ -266,6 +270,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Selection& get_selection() const { return *selection; }
        Selection& get_cut_buffer() const { return *cut_buffer; }
+       void track_mixer_selection ();
 
        bool extend_selection_to_track (TimeAxisView&);
 
@@ -324,7 +329,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void show_editor_list (bool yn);
        void set_selected_mixer_strip (TimeAxisView&);
        void mixer_strip_width_changed ();
-       void hide_track_in_display (TimeAxisView* tv, bool temporary = false);
+       void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false);
 
        /* nudge is initiated by transport controls owned by ARDOUR_UI */
 
@@ -341,10 +346,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        /* playhead/screen stuff */
 
-        void set_stationary_playhead (bool yn);
-        void toggle_stationary_playhead ();
-        bool stationary_playhead() const { return _stationary_playhead; }
-        
+       void set_stationary_playhead (bool yn);
+       void toggle_stationary_playhead ();
+       bool stationary_playhead() const { return _stationary_playhead; }
+
        void set_follow_playhead (bool yn, bool catch_up = true);
        void toggle_follow_playhead ();
        bool follow_playhead() const { return _follow_playhead; }
@@ -373,6 +378,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void show_window ();
 
+       void ensure_time_axis_view_is_visible (const TimeAxisView& tav);
        void scroll_tracks_down_line ();
        void scroll_tracks_up_line ();
 
@@ -415,9 +421,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void get_regions_corresponding_to (boost::shared_ptr<ARDOUR::Region> region, std::vector<RegionView*>& regions);
 
-       void show_verbose_canvas_cursor_with (const std::string& txt, int32_t xoffset = 0, int32_t yoffset = 0);
-       void hide_verbose_canvas_cursor();
-
        void center_screen (framepos_t);
 
        TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
@@ -429,6 +432,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void snap_to (framepos_t& first, framepos_t& last, int32_t direction = 0, bool for_mark = false);
 
        void begin_reversible_command (std::string cmd_name);
+       void begin_reversible_command (GQuark);
        void commit_reversible_command ();
 
        DragManager* drags () const {
@@ -436,16 +440,22 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        }
 
        void maybe_autoscroll (bool, bool);
-       
-        Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
-        void set_canvas_cursor (Gdk::Cursor*, bool save=false);
-        void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
-        void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
+
+       Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; }
+       void set_canvas_cursor (Gdk::Cursor*, bool save=false);
+       void set_current_trimmable (boost::shared_ptr<ARDOUR::Trimmable>);
+       void set_current_movable (boost::shared_ptr<ARDOUR::Movable>);
 
        MouseCursors const * cursors () const {
                return _cursors;
        }
 
+       VerboseCursor* verbose_cursor () const {
+               return _verbose_cursor;
+       }
+
+       void get_pointer_position (double &, double &) const;
+
   protected:
        void map_transport_state ();
        void map_position_change (framepos_t);
@@ -466,11 +476,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        typedef std::pair<TimeAxisView*,XMLNode*> TAVState;
 
        struct VisualState {
+           VisualState();
+           ~VisualState ();
            double              y_position;
            double              frames_per_unit;
-           framepos_t         leftmost_frame;
+           framepos_t          leftmost_frame;
            Editing::ZoomFocus  zoom_focus;
-           std::list<TAVState> track_states;
+           GUIObjectState*     gui_state;
        };
 
        std::list<VisualState*> undo_visual_stack;
@@ -496,6 +508,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void post_zoom ();
 
        Editing::MouseMode mouse_mode;
+       Editing::MouseMode pre_internal_mouse_mode;
        bool _internal_editing;
        Editing::MouseMode effective_mouse_mode () const;
 
@@ -525,10 +538,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool _notebook_shrunk;
        void add_notebook_page (std::string const &, Gtk::Widget &);
        bool notebook_tab_clicked (GdkEventButton *, Gtk::Widget *);
-       
+
        Gtk::HPaned   edit_pane;
        Gtk::VPaned   editor_summary_pane;
 
+       bool idle_reset_vertical_pane_position (int);
+
        Gtk::EventBox meter_base;
        Gtk::HBox     meter_box;
        Gtk::EventBox marker_base;
@@ -538,9 +553,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void location_changed (ARDOUR::Location *);
        void location_flags_changed (ARDOUR::Location *, void *);
        void refresh_location_display ();
-       void refresh_location_display_s (const PBD::PropertyChange&);
        void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
        void add_new_location (ARDOUR::Location *);
+       ArdourCanvas::Group* add_new_location_internal (ARDOUR::Location *);
        void location_gone (ARDOUR::Location *);
        void remove_marker (ArdourCanvas::Item&, GdkEvent*);
        gint really_remove_marker (ARDOUR::Location* loc);
@@ -558,11 +573,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                Marker* start;
                Marker* end;
                bool    valid;
-               
+
                LocationMarkers () : start(0), end(0), valid (true) {}
-               
+
                ~LocationMarkers ();
-               
+
                void hide ();
                void show ();
 
@@ -570,7 +585,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                void set_selected (bool);
                void canvas_height_set (double);
                void setup_lines ();
-               
+
                void set_name (const std::string&);
                void set_position (framepos_t start, framepos_t end = 0);
                void set_color_rgba (uint32_t);
@@ -578,6 +593,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        LocationMarkers  *find_location_markers (ARDOUR::Location *) const;
        ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
+       Marker* find_marker_from_location_id (PBD::ID const &, bool) const;
        Marker* entered_marker;
        bool _show_marker_lines;
 
@@ -616,11 +632,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        CrossfadeView*     clicked_crossfadeview;
        ControlPoint*      clicked_control_point;
 
-       void sort_track_selection (TrackViewList* sel = 0);
+       void sort_track_selection (TrackViewList&);
 
        void get_equivalent_regions (RegionView* rv, std::vector<RegionView*> &, PBD::PropertyID) const;
        RegionSelection get_equivalent_regions (RegionSelection &, PBD::PropertyID) const;
        void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
+       void mapover_tracks_with_unique_playlists (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*, PBD::PropertyID) const;
 
        /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */
 
@@ -638,6 +655,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false);
        void select_all_tracks ();
+       void select_all_internal_edit (Selection::Operation);
 
        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);
@@ -669,11 +687,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::Menu* build_track_selection_context_menu ();
        void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&);
        void add_bus_context_items (Gtk::Menu_Helpers::MenuList&);
-       void add_region_context_items (Gtk::Menu_Helpers::MenuList&, bool);
+       void add_region_context_items (Gtk::Menu_Helpers::MenuList&, boost::shared_ptr<ARDOUR::Track>);
        void add_crossfade_context_items (AudioStreamView*, boost::shared_ptr<ARDOUR::Crossfade>, Gtk::Menu_Helpers::MenuList&, bool many);
        void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
        Gtk::MenuItem* _popup_region_menu_item;
 
+       void popup_control_point_context_menu (ArdourCanvas::Item *, GdkEvent *);
+       Gtk::Menu _control_point_context_menu;
+
        void handle_new_route (ARDOUR::RouteList&);
        void timeaxisview_deleted (TimeAxisView *);
 
@@ -687,19 +708,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        ArdourCanvas::Canvas* track_canvas;
 
-       ArdourCanvas::NoEventText* verbose_canvas_cursor;
-       bool                 verbose_cursor_visible;
+       friend class VerboseCursor;
+       VerboseCursor* _verbose_cursor;
 
        void parameter_changed (std::string);
 
        bool track_canvas_motion (GdkEvent*);
 
-       void set_verbose_canvas_cursor (const std::string &, double x, double y);
-       void set_verbose_canvas_cursor_text (const std::string &);
-       void show_verbose_canvas_cursor();
-
-       bool verbose_cursor_on; // so far unused
-
        Gtk::EventBox             time_canvas_event_box;
        Gtk::EventBox             track_canvas_event_box;
        Gtk::EventBox             time_button_event_box;
@@ -746,7 +761,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        enum RulerType {
                ruler_metric_timecode = 0,
                ruler_metric_bbt = 1,
-               ruler_metric_frames = 2,
+               ruler_metric_samples = 2,
                ruler_metric_minsec = 3,
 
                ruler_time_tempo = 4,
@@ -770,9 +785,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
        bool                            no_ruler_shown_update;
 
-       gint ruler_button_press (GdkEventButton*);
-       gint ruler_button_release (GdkEventButton*);
-       gint ruler_mouse_motion (GdkEventMotion*);
+       bool ruler_button_press (GdkEventButton*);
+       bool ruler_button_release (GdkEventButton*);
+       bool ruler_mouse_motion (GdkEventMotion*);
        bool ruler_scroll (GdkEventScroll* event);
 
        Gtk::Widget * ruler_grabbed_widget;
@@ -787,13 +802,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_ruler_visible (RulerType, bool);
        void toggle_ruler_visibility (RulerType rt);
        void ruler_toggled (int);
-       gint ruler_label_button_release (GdkEventButton*);
+       bool ruler_label_button_release (GdkEventButton*);
        void store_ruler_visibility ();
        void restore_ruler_visibility ();
 
        static gint _metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
        static gint _metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       static gint _metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       static gint _metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
        static gint _metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
 
        enum MinsecRulerScale {
@@ -808,7 +823,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        framecnt_t minsec_mark_interval;
        gint minsec_mark_modulo;
        gint minsec_nmarks;
-       void set_minsec_ruler_scale (gdouble lower, gdouble upper);
+       void set_minsec_ruler_scale (framepos_t, framepos_t);
 
        enum TimecodeRulerScale {
                timecode_show_bits,
@@ -820,10 +835,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        TimecodeRulerScale timecode_ruler_scale;
 
-       framecnt_t timecode_mark_interval;
        gint timecode_mark_modulo;
        gint timecode_nmarks;
-       void set_timecode_ruler_scale (gdouble lower, gdouble upper);
+       void set_timecode_ruler_scale (framepos_t, framepos_t);
+
+       framecnt_t _samples_ruler_interval;
+       void set_samples_ruler_scale (framepos_t, framepos_t);
 
        enum BBTRulerScale {
                bbt_over,
@@ -839,7 +856,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        BBTRulerScale bbt_ruler_scale;
 
-        uint32_t bbt_bars;
+       uint32_t bbt_bars;
        gint bbt_nmarks;
        uint32_t bbt_bar_helper_on;
        uint32_t bbt_accent_modulo;
@@ -847,17 +864,17 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        gint metric_get_timecode (GtkCustomRulerMark **, gdouble, gdouble, gint);
        gint metric_get_bbt (GtkCustomRulerMark **, gdouble, gdouble, gint);
-       gint metric_get_frames (GtkCustomRulerMark **, gdouble, gdouble, gint);
+       gint metric_get_samples (GtkCustomRulerMark **, gdouble, gdouble, gint);
        gint metric_get_minsec (GtkCustomRulerMark **, gdouble, gdouble, gint);
 
        Gtk::Widget        *_ruler_separator;
        GtkWidget          *_timecode_ruler;
        GtkWidget          *_bbt_ruler;
-       GtkWidget          *_frames_ruler;
+       GtkWidget          *_samples_ruler;
        GtkWidget          *_minsec_ruler;
        Gtk::Widget        *timecode_ruler;
        Gtk::Widget        *bbt_ruler;
-       Gtk::Widget        *frames_ruler;
+       Gtk::Widget        *samples_ruler;
        Gtk::Widget        *minsec_ruler;
        static Editor      *ruler_editor;
 
@@ -877,7 +894,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::Label  minsec_label;
        Gtk::Label  bbt_label;
        Gtk::Label  timecode_label;
-       Gtk::Label  frame_label;
+       Gtk::Label  samples_label;
        Gtk::Label  tempo_label;
        Gtk::Label  meter_label;
        Gtk::Label  mark_label;
@@ -919,7 +936,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void    select_range_between ();
 
        boost::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::framepos_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0);
-        ARDOUR::framepos_t find_next_region_boundary (ARDOUR::framepos_t, int32_t dir, const TrackViewList&);
+       ARDOUR::framepos_t find_next_region_boundary (ARDOUR::framepos_t, int32_t dir, const TrackViewList&);
 
        std::vector<ARDOUR::framepos_t> region_boundary_cache;
        void build_region_boundary_cache ();
@@ -933,13 +950,18 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Gtk::Layout         controls_layout;
        bool control_layout_scroll (GdkEventScroll* ev);
-       void controls_layout_size_request (Gtk::Requisition*);
-       sigc::connection controls_layout_size_request_connection;
+       void reset_controls_layout_width ();
+       void reset_controls_layout_height (int32_t height);
+
+       enum Direction {
+               LEFT,
+               RIGHT,
+               UP,
+               DOWN
+       };
 
-       bool horizontal_scroll_left_press ();
-       void horizontal_scroll_left_release ();
-       bool horizontal_scroll_right_press ();
-       void horizontal_scroll_right_release ();
+       bool scroll_press (Direction);
+       void scroll_release ();
        sigc::connection _scroll_connection;
        int _scroll_callbacks;
 
@@ -949,7 +971,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        bool track_canvas_map_handler (GdkEventAny*);
 
-       gint edit_controls_button_release (GdkEventButton*);
+       bool edit_controls_button_release (GdkEventButton*);
        Gtk::Menu *edit_controls_left_menu;
        Gtk::Menu *edit_controls_right_menu;
 
@@ -960,6 +982,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::HBox           edit_controls_hbox;
 
        void control_scroll (float);
+       void control_select (uint32_t rid);
        void access_action (std::string,std::string);
        bool deferred_control_scroll (framepos_t);
        sigc::connection control_scroll_connection;
@@ -1023,24 +1046,35 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        framepos_t cut_buffer_start;
        framecnt_t cut_buffer_length;
 
-        Gdk::Cursor* pre_press_cursor;
-        boost::weak_ptr<ARDOUR::Trimmable> _trimmable;
-        boost::weak_ptr<ARDOUR::Movable> _movable;
+       Gdk::Cursor* pre_press_cursor;
+       boost::weak_ptr<ARDOUR::Trimmable> _trimmable;
+       boost::weak_ptr<ARDOUR::Movable> _movable;
 
        bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool button_press_handler_1 (ArdourCanvas::Item *, GdkEvent *, ItemType);
        bool button_press_handler_2 (ArdourCanvas::Item *, GdkEvent *, ItemType);
        bool button_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool button_press_dispatch (GdkEventButton*);
+       bool button_release_dispatch (GdkEventButton*);
        bool motion_handler (ArdourCanvas::Item*, GdkEvent*, bool from_autoscroll = false);
        bool enter_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
        bool leave_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool key_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+       bool key_release_handler (ArdourCanvas::Item*, GdkEvent*, ItemType);
+
+       Gtkmm2ext::Bindings* button_bindings;
+       XMLNode* button_settings () const;
 
        /* KEYMAP HANDLING */
 
        void register_actions ();
        void register_region_actions ();
 
+        void load_bindings ();
+        Gtkmm2ext::ActionMap editor_action_map;
+        Gtkmm2ext::Bindings  key_bindings;
+
        int ensure_cursor (framepos_t* pos);
 
        void cut_copy (Editing::CutCopyOp);
@@ -1059,15 +1093,18 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void toggle_region_lock ();
        void toggle_opaque_region ();
        void toggle_record_enable ();
+       void toggle_solo ();
+       void toggle_solo_isolate ();
+       void toggle_mute ();
        void toggle_region_lock_style ();
        void raise_region ();
        void raise_region_to_top ();
-        void change_region_layering_order ();
+       void change_region_layering_order ();
        void lower_region ();
        void lower_region_to_bottom ();
        void split_regions_at (framepos_t, RegionSelection&);
        void split_region_at_transients ();
-       void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret);
+       void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
        void crop_region_to_selection ();
        void crop_region_to (framepos_t start, framepos_t end);
        void set_sync_point (framepos_t, const RegionSelection&);
@@ -1085,6 +1122,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void duplicate_some_regions (RegionSelection&, float times);
        void duplicate_selection (float times);
        void region_fill_selection ();
+       void combine_regions ();
+       void uncombine_regions ();
 
        void region_fill_track ();
        void audition_playlist_region_standalone (boost::shared_ptr<ARDOUR::Region>);
@@ -1100,7 +1139,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void fork_region ();
 
        void do_insert_time ();
-       void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool);
+       void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool, bool);
 
        void tab_to_transient (bool forward);
 
@@ -1119,17 +1158,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void split_region ();
 
+       void delete_ ();
        void cut ();
        void copy ();
        void paste (float times);
-       
+
        void place_transient ();
        void remove_transient (ArdourCanvas::Item* item);
        void snap_regions_to_grid ();
        void close_region_gaps ();
 
-       int  get_prefix (float&, bool&);
-
        void keyboard_paste ();
 
        void region_from_selection ();
@@ -1151,9 +1189,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void temporal_zoom_by_frame (framepos_t start, framepos_t end, const std::string & op);
        void temporal_zoom_to_frame (bool coarser, framepos_t frame);
 
-       void amplitude_zoom (gdouble scale);
-       void amplitude_zoom_step (bool in);
-
        void insert_region_list_drag (boost::shared_ptr<ARDOUR::Region>, int x, int y);
        void insert_region_list_selection (float times);
 
@@ -1215,25 +1250,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void move_to_start ();
        void move_to_end ();
-       void goto_frame ();
        void center_playhead ();
        void center_edit_point ();
-       void edit_cursor_backward ();
-       void edit_cursor_forward ();
        void playhead_forward_to_grid ();
        void playhead_backward_to_grid ();
-       void playhead_backward ();
-       void playhead_forward ();
        void scroll_playhead (bool forward);
        void scroll_backward (float pages=0.8f);
        void scroll_forward (float pages=0.8f);
        void scroll_tracks_down ();
        void scroll_tracks_up ();
-       void delete_sample_forward ();
-       void delete_sample_backward ();
-       void delete_screen ();
-       void search_backwards ();
-       void search_forwards ();
        void set_mark ();
        void clear_markers ();
        void clear_ranges ();
@@ -1285,9 +1310,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool have_pending_keyboard_selection;
        framepos_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);
-       void extend_selection_to_start_of_region (bool previous);
+       void move_range_selection_start_or_end_to_region_boundary (bool, bool);
 
        Editing::SnapType _snap_type;
        Editing::SnapMode _snap_mode;
@@ -1329,16 +1352,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void region_view_item_click (AudioRegionView&, GdkEventButton*);
 
-       void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*);
-       void remove_control_point (ArdourCanvas::Item*, GdkEvent*);
+       bool can_remove_control_point (ArdourCanvas::Item *);
+       void remove_control_point (ArdourCanvas::Item *);
 
        void mouse_brush_insert_region (RegionView*, framepos_t pos);
-       void brush (framepos_t);
-
-       void show_verbose_time_cursor (framepos_t frame, double offset = 0, double xpos=-1, double ypos=-1);
-       void show_verbose_duration_cursor (framepos_t start, framepos_t end, double offset = 0, double xpos=-1, double ypos=-1);
-       double clamp_verbose_cursor_x (double);
-       double clamp_verbose_cursor_y (double);
 
        /* Canvas event handlers */
 
@@ -1381,12 +1398,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
        bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
 
+       PBD::Signal0<void> EditorFreeze;
+       PBD::Signal0<void> EditorThaw;
+
   private:
-        friend class DragManager;
-        friend class EditorRouteGroups;
-        friend class EditorRegions;
+       friend class DragManager;
+       friend class EditorRouteGroups;
+       friend class EditorRegions;
 
-       ArdourCanvas::Item *last_item_entered;
        /** true if the mouse is over a place where region trim can happen */
        bool _over_region_trim_target;
 
@@ -1409,12 +1428,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void set_playhead_cursor ();
 
-       void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
        void toggle_region_mute ();
-       void kbd_brush ();
-
-       void kbd_do_brush (GdkEvent*);
-       void kbd_do_audition (GdkEvent*);
 
        void initialize_canvas ();
 
@@ -1423,8 +1437,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool _show_measures;
        /// true if the editor should follow the playhead, otherwise false
        bool _follow_playhead;
-        /// true if we scroll the tracks rather than the playhead
-        bool _stationary_playhead;
+       /// true if we scroll the tracks rather than the playhead
+       bool _stationary_playhead;
 
        ARDOUR::TempoMap::BBTPointList *current_bbt_points;
 
@@ -1473,12 +1487,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void new_transport_marker_menu_set_punch ();
        void update_loop_range_view (bool visibility=false);
        void update_punch_range_view (bool visibility=false);
-        void new_transport_marker_menu_popdown ();
+       void new_transport_marker_menu_popdown ();
        void marker_context_menu (GdkEventButton*, ArdourCanvas::Item*);
        void tempo_or_meter_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 (bool);
+       void build_range_marker_menu (bool, bool);
        void build_marker_menu (ARDOUR::Location *);
        void build_tempo_or_meter_marker_menu (bool);
        void build_new_transport_marker_menu ();
@@ -1511,11 +1524,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void editor_mixer_button_toggled ();
        void editor_list_button_toggled ();
 
-       AudioClock               zoom_range_clock;
-       Gtk::Button              zoom_in_button;
-       Gtk::Button              zoom_out_button;
-       Gtk::Button              zoom_out_full_button;
-       Gtk::Button              zoom_onetoone_button;
+       AudioClock*               zoom_range_clock;
+       ArdourButton              zoom_in_button;
+       ArdourButton              zoom_out_button;
+       ArdourButton              zoom_out_full_button;
 
        Gtk::Button              tav_expand_button;
        Gtk::Button              tav_shrink_button;
@@ -1526,30 +1538,29 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::Label               toolbar_selection_cursor_label;
 
        Gtkmm2ext::TearOff*      _mouse_mode_tearoff;
-       Gtk::ToggleButton         mouse_select_button;
-       Gtk::ToggleButton         mouse_move_button;
-       Gtk::ToggleButton         mouse_gain_button;
-       Gtk::ToggleButton         mouse_zoom_button;
-       Gtk::ToggleButton         mouse_timefx_button;
-       Gtk::ToggleButton         mouse_audition_button;
-       Gtk::ToggleButton         join_object_range_button;
+       ArdourButton mouse_select_button;
+       ArdourButton mouse_move_button;
+       ArdourButton mouse_gain_button;
+       ArdourButton mouse_zoom_button;
+       ArdourButton mouse_timefx_button;
+       ArdourButton mouse_audition_button;
+       ArdourButton join_object_range_button;
 
        void                     mouse_mode_toggled (Editing::MouseMode m);
        void                     mouse_mode_object_range_toggled () {}
        bool                     ignore_mouse_mode_toggle;
 
-       Gtk::ToggleButton        internal_edit_button;
-       void                     toggle_internal_editing ();
+       ArdourButton internal_edit_button;
+       void         toggle_internal_editing ();
 
-       gint                     mouse_select_button_release (GdkEventButton*);
+       bool                     mouse_select_button_release (GdkEventButton*);
 
        Gtk::VBox                automation_box;
        Gtk::Button              automation_mode_button;
-       Gtk::ToggleButton        global_automation_button;
 
        Gtk::ComboBoxText edit_mode_selector;
        Gtk::VBox         edit_mode_box;
-        std::vector<std::string> edit_mode_strings;
+       std::vector<std::string> edit_mode_strings;
 
        void set_edit_mode (ARDOUR::EditMode);
        void cycle_edit_mode ();
@@ -1593,14 +1604,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::EventBox            toolbar_base;
        Gtk::Frame               toolbar_frame;
        Gtk::Viewport           _toolbar_viewport;
-       
+
        /* midi toolbar */
 
        Gtk::HBox                panic_box;
-       Gtk::Button              midi_panic_button;
-       Gtk::ToggleButton        midi_sound_notes;
-       void                     midi_panic ();
-       bool                     sound_notes () const { return midi_sound_notes.get_active(); }
 
        void setup_midi_toolbar ();
 
@@ -1655,7 +1662,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        /* object rubberband select process */
 
-       bool select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
+       void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
 
        ArdourCanvas::SimpleRect   *rubberband_rect;
 
@@ -1692,6 +1699,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        framecnt_t autoscroll_x_distance;
        double autoscroll_y_distance;
 
+       bool _autoscroll_fudging;
+       int autoscroll_fudge_threshold () const;
+
        static gint _autoscroll_canvas (void *);
        bool autoscroll_canvas ();
        void start_canvas_autoscroll (int x, int y);
@@ -1724,7 +1734,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                 const Gtk::SelectionData&             data,
                 guint                                 info,
                 guint                                 time);
-        
+
        void track_canvas_drag_data_received (
                 const Glib::RefPtr<Gdk::DragContext>& context,
                 gint                                  x,
@@ -1732,7 +1742,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                 const Gtk::SelectionData&             data,
                 guint                                 info,
                 guint                                 time);
-        
+
        void drop_paths (
                 const Glib::RefPtr<Gdk::DragContext>& context,
                 gint                                  x,
@@ -1740,7 +1750,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                 const Gtk::SelectionData&             data,
                 guint                                 info,
                 guint                                 time);
-        
+
        void drop_regions (
                 const Glib::RefPtr<Gdk::DragContext>& context,
                 gint                                  x,
@@ -1748,7 +1758,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                 const Gtk::SelectionData&             data,
                 guint                                 info,
                 guint                                 time);
-        
+
        void drop_routes (
                 const Glib::RefPtr<Gdk::DragContext>& context,
                 gint                x,
@@ -1756,12 +1766,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                 const Gtk::SelectionData& data,
                 guint               info,
                 guint               time);
-        
+
        /* audio export */
 
        int  write_region_selection(RegionSelection&);
        bool write_region (std::string path, boost::shared_ptr<ARDOUR::AudioRegion>);
-       void bounce_region_selection ();
+       void bounce_region_selection (bool with_processing);
        void bounce_range_selection (bool replace, bool enable_processing);
        void external_edit_region ();
 
@@ -1796,11 +1806,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void freeze_route ();
        void unfreeze_route ();
 
-       /* route-group solo + mute */
-
-       void set_route_group_solo (ARDOUR::Route&, bool);
-       void set_route_group_mute (ARDOUR::Route&, bool);
-
        /* duplication */
 
        void duplicate_dialog (bool with_dialog);
@@ -1823,6 +1828,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void pitch_shift_region ();
        int time_fx (RegionSelection&, float val, bool pitching);
 
+       void transpose_region ();
+
        /* editor-mixer strip */
 
        MixerStrip *current_mixer_strip;
@@ -1900,7 +1907,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::Button      nudge_backward_button;
        Gtk::HBox        nudge_hbox;
        Gtk::VBox        nudge_vbox;
-       AudioClock       nudge_clock;
+       AudioClock*       nudge_clock;
 
        bool nudge_forward_release (GdkEventButton*);
        bool nudge_backward_release (GdkEventButton*);
@@ -1977,9 +1984,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void get_regions_at (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
        void get_regions_after (RegionSelection&, framepos_t where, const TrackViewList& ts) const;
 
+       RegionSelection get_regions_from_selection ();
        RegionSelection get_regions_from_selection_and_edit_point ();
        RegionSelection get_regions_from_selection_and_entered ();
-       
+
        void start_updating_meters ();
        void stop_updating_meters ();
        bool meters_running;
@@ -1991,7 +1999,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void timecode_snap_to_internal (framepos_t& first, int32_t direction = 0, bool for_mark = false);
 
        RhythmFerret* rhythm_ferret;
-       BundleManager* _bundle_manager;
 
        void fit_tracks (TrackViewList &);
        void fit_selected_tracks ();
@@ -2010,10 +2017,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void visible_order_range (int*, int*) const;
 
        void located ();
-       
+
        /** true if we've made a locate request that hasn't yet been processed */
        bool _pending_locate_request;
-       
+
        /** if true, there is a pending Session locate which is the initial one when loading a session;
            we need to know this so that we don't (necessarily) set the viewport to show the playhead
            initially.
@@ -2022,14 +2029,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Gtk::HBox _summary_hbox;
        EditorSummary* _summary;
+
        void region_view_added (RegionView *);
+       void region_view_removed ();
 
        void update_canvas_now ();
 
        EditorGroupTabs* _group_tabs;
        void fit_route_group (ARDOUR::RouteGroup *);
 
-        void step_edit_status_change (bool);
+       void step_edit_status_change (bool);
        void start_step_editing ();
        void stop_step_editing ();
        bool check_step_edit ();
@@ -2037,8 +2046,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        double _last_motion_y;
 
-        RegionLayeringOrderEditor* layering_order_editor;
-        void update_region_layering_order_editor ();
+       RegionLayeringOrderEditor* layering_order_editor;
+       void update_region_layering_order_editor ();
 
        /** Track that was the source for the last cut/copy operation.  Used as a place
            to paste things iff there is no selected track.
@@ -2057,12 +2066,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::MenuItem& action_menu_item (std::string const &);
        void action_pre_activated (Glib::RefPtr<Gtk::Action> const &);
 
-        void set_canvas_cursor_for_region_view (double, RegionView *);
+       void set_canvas_cursor_for_region_view (double, RegionView *);
 
        MouseCursors* _cursors;
 
-        void resize_text_widgets ();
-       
+       void follow_mixer_selection ();
+       bool _following_mixer_selection;
+
        friend class Drag;
        friend class RegionDrag;
        friend class RegionMoveDrag;
@@ -2078,8 +2088,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        friend class ControlPointDrag;
        friend class LineDrag;
        friend class RubberbandSelectDrag;
-        friend class TimeFXDrag;
-        friend class ScrubDrag;
+       friend class EditorRubberbandSelectDrag;
+       friend class TimeFXDrag;
+       friend class ScrubDrag;
        friend class SelectionDrag;
        friend class RangeMarkerBarDrag;
        friend class MouseZoomDrag;