correctly (?) indicate muted status of audio regions
[ardour.git] / gtk2_ardour / editor.h
index 6c0a52fa4278270928e5ad06dc9db7e3b5962233..29e3ac2bef2939dd5281ce4a2620e205e2e8e606 100644 (file)
 #include <set>
 #include <string>
 #include <sys/time.h>
+#include <cmath>
 
 #include <boost/optional.hpp>
 
-#include <libgnomecanvasmm/canvas.h>
-#include <libgnomecanvasmm/group.h>
-#include <libgnomecanvasmm/line.h>
-#include <libgnomecanvasmm/pixbuf.h>
-
-#include <cmath>
-
 #include <gtkmm/comboboxtext.h>
 #include <gtkmm/layout.h>
 
@@ -43,7 +37,6 @@
 #include "gtkmm2ext/dndtreeview.h"
 #include "gtkmm2ext/stateful_button.h"
 #include "gtkmm2ext/bindings.h"
-#include "gtkmm2ext/visibility_tracker.h"
 
 #include "pbd/stateful.h"
 #include "pbd/signals.h"
@@ -53,6 +46,8 @@
 #include "ardour/location.h"
 #include "ardour/types.h"
 
+#include "canvas/fwd.h"
+
 #include "gtk-custom-ruler.h"
 #include "ardour_button.h"
 #include "ardour_dialog.h"
 #include "enums.h"
 #include "editor_items.h"
 #include "region_selection.h"
-#include "canvas.h"
-
-namespace Gnome {
-       namespace Canvas {
-               class NoEventText;
-               class CanvasNoteEvent;
-       }
-}
 
 namespace Gtkmm2ext {
        class TearOff;
@@ -123,6 +110,7 @@ class Marker;
 class MidiRegionView;
 class MixerStrip;
 class MouseCursors;
+class NoteBase;
 class PlaylistSelector;
 class PluginSelector;
 class ProgressReporter;
@@ -137,7 +125,7 @@ class TimeSelection;
 class RegionLayeringOrderEditor;
 class VerboseCursor;
 
-class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public Gtkmm2ext::VisibilityTracker
+class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
 {
   public:
        Editor ();
@@ -149,14 +137,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void             first_idle ();
        virtual bool     have_idled () const { return _have_idled; }
 
-       framepos_t leftmost_position() const { return leftmost_frame; }
+       framepos_t leftmost_sample() const { return leftmost_frame; }
 
-       framecnt_t current_page_frames() const {
-               return (framecnt_t) floor (_canvas_width * frames_per_unit);
+       framecnt_t current_page_samples() const {
+               return (framecnt_t) _visible_canvas_width * samples_per_pixel;
        }
 
-       double canvas_height () const {
-               return _canvas_height;
+       double visible_canvas_height () const {
+               return _visible_canvas_height;
        }
 
        void cycle_snap_mode ();
@@ -189,14 +177,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void set_internal_edit (bool yn);
        bool toggle_internal_editing_from_double_click (GdkEvent*);
 
-#ifdef WITH_CMT
-       void add_imageframe_time_axis(const std::string & track_name, void*) ;
-       void add_imageframe_marker_time_axis(const std::string & track_name, TimeAxisView* marked_track, void*) ;
-       void connect_to_image_compositor() ;
-       void scroll_timeaxis_to_imageframe_item(const TimeAxisViewItem* item) ;
-       TimeAxisView* get_named_time_axis(const std::string & name) ;
-#endif /* WITH_CMT */
-
        void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
        void add_to_idle_resize (TimeAxisView*, int32_t);
 
@@ -222,32 +202,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void separate_regions_using_location (ARDOUR::Location&);
        void transition_to_rolling (bool forward);
 
-       /* undo related */
-
-       framepos_t unit_to_frame (double unit) const {
-               return (framepos_t) rint (unit * frames_per_unit);
-       }
-
-       double frame_to_unit (framepos_t frame) const {
-               return rint ((double) frame / (double) frames_per_unit);
-       }
-
-       double frame_to_unit_unrounded (framepos_t frame) const {
-               return frame / frames_per_unit;
-       }
-       
-       double frame_to_unit (double frame) const {
-               return rint (frame / frames_per_unit);
-       }
-
        /* NOTE: these functions assume that the "pixel" coordinate is
-          the result of using the world->canvas affine transform on a
-          world coordinate. These coordinates already take into
-          account any scrolling carried out by adjusting the
-          xscroll_adjustment.
+          in canvas coordinates. These coordinates already take into
+          account any scrolling offsets.
        */
 
-       framepos_t pixel_to_frame (double pixel) const {
+       framepos_t pixel_to_sample (double pixel) const {
 
                /* pixel can be less than zero when motion events
                   are processed. since we've already run the world->canvas
@@ -256,17 +216,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                */
 
                if (pixel >= 0) {
-                       return (framepos_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
+                       return pixel * samples_per_pixel;
                } else {
                        return 0;
                }
        }
 
-       gulong frame_to_pixel (framepos_t frame) const {
-               return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
+        double sample_to_pixel (framepos_t sample) const {
+               return sample / samples_per_pixel;
        }
 
-       void flush_canvas ();
+       double sample_to_pixel_unrounded (framepos_t sample) const {
+               return sample / (double) samples_per_pixel;
+       }
 
        /* selection */
 
@@ -312,7 +274,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void               set_zoom_focus (Editing::ZoomFocus);
        Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
-       double             get_current_zoom () const { return frames_per_unit; }
+       framecnt_t         get_current_zoom () const { return samples_per_pixel; }
         void               cycle_zoom_focus ();
        void temporal_zoom_step (bool coarser);
        void tav_zoom_step (bool coarser);
@@ -398,7 +360,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void reset_x_origin (framepos_t);
        void reset_x_origin_to_follow_playhead ();
        void reset_y_origin (double);
-       void reset_zoom (double);
+       void reset_zoom (framecnt_t);
        void reposition_and_zoom (framepos_t, double);
 
        framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool use_context_click = false);
@@ -461,6 +423,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                return _verbose_cursor;
        }
 
+       double clamp_verbose_cursor_x (double);
+       double clamp_verbose_cursor_y (double);
+
        void get_pointer_position (double &, double &) const;
 
        TimeAxisView* stepping_axis_view () {
@@ -471,6 +436,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                _stepping_axis_view = v;
        }
 
+       ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
+        ArdourCanvas::Group* get_time_bars_group () const;
+        ArdourCanvas::Group* get_track_canvas_group () const;
+        ArdourCanvas::GtkCanvasViewport* get_time_bars_canvas () const;
+        ArdourCanvas::GtkCanvasViewport* get_track_canvas () const;
+
+
   protected:
        void map_transport_state ();
        void map_position_change (framepos_t);
@@ -494,7 +466,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
            VisualState (bool with_tracks);
            ~VisualState ();
            double              y_position;
-           double              frames_per_unit;
+           framecnt_t          samples_per_pixel;
            framepos_t          leftmost_frame;
            Editing::ZoomFocus  zoom_focus;
            GUIObjectState*     gui_state;
@@ -513,12 +485,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void start_visual_state_op (uint32_t n);
        void cancel_visual_state_op (uint32_t n);
 
-       framepos_t leftmost_frame;
-       double      frames_per_unit;
+       framepos_t         leftmost_frame;
+        framecnt_t         samples_per_pixel;
        Editing::ZoomFocus zoom_focus;
 
-       void set_frames_per_unit (double);
-       bool clamp_frames_per_unit (double &) const;
+       void set_samples_per_pixel (framecnt_t);
+        bool clamp_samples_per_pixel (framecnt_t &) const;
 
        Editing::MouseMode mouse_mode;
        Editing::MouseMode pre_internal_mouse_mode;
@@ -709,7 +681,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gdk::Cursor* which_grabber_cursor ();
        void set_canvas_cursor ();
 
-       ArdourCanvas::Canvas* track_canvas;
+       ArdourCanvas::GtkCanvas* _track_canvas;
+       ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport;
+
+        ArdourCanvas::GtkCanvas* _time_bars_canvas;
+        ArdourCanvas::GtkCanvasViewport* _time_bars_canvas_viewport;
+
        bool within_track_canvas;
 
        friend class VerboseCursor;
@@ -720,8 +697,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool track_canvas_motion (GdkEvent*);
 
        Gtk::EventBox             time_canvas_event_box;
-       Gtk::EventBox             track_canvas_event_box;
-       Gtk::EventBox             time_button_event_box;
+       Gtk::EventBox             time_bars_event_box;
        Gtk::EventBox             ruler_label_event_box;
 
        ArdourCanvas::Group      *minsec_group;
@@ -736,9 +712,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        ArdourCanvas::Group      *transport_marker_group;
        ArdourCanvas::Group*      cd_marker_group;
 
-       ArdourCanvas::Group*      timebar_group;
+       /* parent for groups which themselves contain time markers */
+       ArdourCanvas::Group*     _time_markers_group;
 
-       /* These bars never need to be scrolled */
        ArdourCanvas::Group*      meter_bar_group;
        ArdourCanvas::Group*      tempo_bar_group;
        ArdourCanvas::Group*      marker_bar_group;
@@ -746,16 +722,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        ArdourCanvas::Group*      transport_marker_bar_group;
        ArdourCanvas::Group*      cd_marker_bar_group;
 
-       /** The group containing all items that require horizontal scrolling. */
-       ArdourCanvas::Group* _background_group;
-       /*
-          The _master_group is the group containing all items
-          that require horizontal scrolling..
-          It is primarily used to separate canvas items
-          that require horizontal scrolling from those that do not.
-       */
-       ArdourCanvas::Group* _master_group;
-
        /* The group containing all trackviews.  Only scrolled vertically. */
        ArdourCanvas::Group* _trackview_group;
 
@@ -888,16 +854,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        static const double timebar_height;
        guint32 visible_timebars;
-       gdouble canvas_timebars_vsize;
-       gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
        Gtk::Menu          *editor_ruler_menu;
 
-       ArdourCanvas::SimpleRect* tempo_bar;
-       ArdourCanvas::SimpleRect* meter_bar;
-       ArdourCanvas::SimpleRect* marker_bar;
-       ArdourCanvas::SimpleRect* range_marker_bar;
-       ArdourCanvas::SimpleRect* transport_marker_bar;
-       ArdourCanvas::SimpleRect* cd_marker_bar;
+       ArdourCanvas::Rectangle* tempo_bar;
+       ArdourCanvas::Rectangle* meter_bar;
+       ArdourCanvas::Rectangle* marker_bar;
+       ArdourCanvas::Rectangle* range_marker_bar;
+       ArdourCanvas::Rectangle* transport_marker_bar;
+       ArdourCanvas::Rectangle* cd_marker_bar;
 
        Gtk::Label  minsec_label;
        Gtk::Label  bbt_label;
@@ -911,9 +875,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Gtk::Label  cd_mark_label;
 
        /* videtimline related actions */
-       ArdourCanvas::SimpleRect* videotl_bar;
        Gtk::Label                videotl_label;
-       ArdourCanvas::Group*      videotl_bar_group;
        ArdourCanvas::Group*      videotl_group;
        Glib::RefPtr<Gtk::ToggleAction> ruler_video_action;
        Glib::RefPtr<Gtk::ToggleAction> xjadeo_proc_action;
@@ -926,22 +888,21 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        Glib::RefPtr<Gtk::Action> xjadeo_zoom_100;
        void set_xjadeo_proc ();
        void toggle_xjadeo_proc (int state=-1);
+       void set_close_video_sensitive (bool onoff);
        void set_xjadeo_sensitive (bool onoff);
        void set_xjadeo_viewoption (int);
        void toggle_xjadeo_viewoption (int what, int state=-1);
        void toggle_ruler_video (bool onoff) {ruler_video_action->set_active(onoff);}
        int videotl_bar_height; /* in units of timebar_height; default: 4 */
        int get_videotl_bar_height () const { return videotl_bar_height; }
-       void export_video ();
+       void export_video (bool range = false);
        void toggle_region_video_lock ();
 
-       Gtk::VBox          time_button_vbox;
-       Gtk::HBox          time_button_hbox;
+       Gtk::VBox          time_bars_vbox;
 
        friend class EditorCursor;
 
        EditorCursor*        playhead_cursor;
-       ArdourCanvas::Group* cursor_group;
 
        framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
 
@@ -979,8 +940,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Gtk::Table          edit_packer;
 
+       /** the adjustment that controls the overall editor vertical scroll position */
        Gtk::Adjustment     vertical_adjustment;
+        Gtk::Adjustment     horizontal_adjustment;
 
+        Gtk::Adjustment     unused_adjustment; // yes, really; Gtk::Layout constructor requires refs
        Gtk::Layout         controls_layout;
        bool control_layout_scroll (GdkEventScroll* ev);
        void reset_controls_layout_width ();
@@ -998,9 +962,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        sigc::connection _scroll_connection;
        int _scroll_callbacks;
 
-       double _canvas_width;
-       double _canvas_height; ///< height of the visible area of the track canvas
-       double full_canvas_height; ///< full height of the canvas
+       double _visible_canvas_width;
+       double _visible_canvas_height; ///< height of the visible area of the track canvas
+       double _full_canvas_height;    ///< full height of the canvas
 
        bool track_canvas_map_handler (GdkEventAny*);
 
@@ -1028,15 +992,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool deferred_control_scroll (framepos_t);
        sigc::connection control_scroll_connection;
 
-       gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
-
-       ArdourCanvas::Group* get_background_group () const { return _background_group; }
-       ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
-       double last_trackview_group_vertical_offset;
        void tie_vertical_scrolling ();
        void set_horizontal_position (double);
        double horizontal_position () const;
-       void scroll_canvas_vertically ();
 
        struct VisualChange {
                enum Type {
@@ -1045,16 +1003,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
                        YOrigin = 0x4
                };
 
-               Type pending;
+               Type       pending;
                framepos_t time_origin;
-               double frames_per_unit;
-               double y_origin;
+               framecnt_t samples_per_pixel;
+               double     y_origin;
 
                int idle_handler_id;
                /** true if we are currently in the idle handler */
                bool being_handled;
 
-               VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1), being_handled (false) {}
+               VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), samples_per_pixel (0), idle_handler_id (-1), being_handled (false) {}
                void add (Type t) {
                        pending = Type (pending | t);
                }
@@ -1093,6 +1051,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        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_double_click_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);
@@ -1232,7 +1191,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void temporal_zoom_region (bool both_axes);
        void zoom_to_region (bool both_axes);
        void temporal_zoom_session ();
-       void temporal_zoom (double scale);
+       void temporal_zoom (framecnt_t samples_per_pixel);
        void temporal_zoom_by_frame (framepos_t start, framepos_t end);
        void temporal_zoom_to_frame (bool coarser, framepos_t frame);
 
@@ -1257,13 +1216,17 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool  idle_drop_paths  (std::vector<std::string> paths, framepos_t frame, double ypos, bool copy);
        void  drop_paths_part_two  (const std::vector<std::string>& paths, framepos_t frame, double ypos, bool copy);
 
-       int  import_sndfiles (std::vector<std::string> paths, Editing::ImportMode mode,  ARDOUR::SrcQuality, framepos_t& pos,
+        int  import_sndfiles (std::vector<std::string> paths, Editing::ImportDisposition, Editing::ImportMode mode,  
+                             ARDOUR::SrcQuality, framepos_t& pos,
                              int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);
-       int  embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
+       int  embed_sndfiles (std::vector<std::string> paths, bool multiple_files, bool& check_sample_rate, 
+                            Editing::ImportDisposition disposition, Editing::ImportMode mode,
                             framepos_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&);
 
-       int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, framepos_t& pos, Editing::ImportMode,
+       int add_sources (std::vector<std::string> paths, ARDOUR::SourceList& sources, framepos_t& pos, 
+                        Editing::ImportDisposition, Editing::ImportMode,
                         int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool add_channel_suffix);
+
        int finish_bringing_in_material (boost::shared_ptr<ARDOUR::Region> region, uint32_t, uint32_t,  framepos_t& pos, Editing::ImportMode mode,
                                      boost::shared_ptr<ARDOUR::Track>& existing_track);
 
@@ -1435,8 +1398,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
        bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
        bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
-       bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
-       bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*);
+       bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*);
+       bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item *);
 
        bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
        bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
@@ -1452,16 +1415,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void toggle_video_timeline_locked ();
        void set_video_timeline_locked (const bool);
        void queue_visual_videotimeline_update ();
-       void embed_audio_from_video (std::string, framepos_t n = 0);
-
-       bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
-       bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*);
-       bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
-       bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*);
-       bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*);
-       bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
-       bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
-       bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*);
+       void embed_audio_from_video (std::string, framepos_t n = 0, bool lock_position_to_video = true);
 
        PBD::Signal0<void> EditorFreeze;
        PBD::Signal0<void> EditorThaw;
@@ -1484,9 +1438,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool track_canvas_button_release_event (GdkEventButton* event);
        bool track_canvas_motion_notify_event (GdkEventMotion* event);
 
-       Gtk::Allocation canvas_allocation;
-       void track_canvas_allocate (Gtk::Allocation alloc);
-       bool track_canvas_size_allocated ();
+       Gtk::Allocation _canvas_viewport_allocation;
+       void track_canvas_viewport_allocate (Gtk::Allocation alloc);
+       bool track_canvas_viewport_size_allocated ();
        bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
        bool track_canvas_key_press (GdkEventKey *);
        bool track_canvas_key_release (GdkEventKey *);
@@ -1509,12 +1463,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        TempoLines* tempo_lines;
 
+       ArdourCanvas::Group* global_rect_group;
        ArdourCanvas::Group* time_line_group;
 
        void hide_measures ();
         void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
                            ARDOUR::TempoMap::BBTPointList::const_iterator& end);
-       bool redraw_measures ();
 
        void new_tempo_section ();
 
@@ -1536,6 +1490,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void marker_menu_edit ();
        void marker_menu_remove ();
        void marker_menu_rename ();
+       void rename_marker (Marker *marker);
        void toggle_marker_menu_lock ();
        void toggle_marker_menu_glue ();
        void marker_menu_hide ();
@@ -1715,22 +1670,22 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        /* transport range select process */
 
-       ArdourCanvas::SimpleRect*  cd_marker_bar_drag_rect;
-       ArdourCanvas::SimpleRect*  range_bar_drag_rect;
-       ArdourCanvas::SimpleRect*  transport_bar_drag_rect;
+       ArdourCanvas::Rectangle*  cd_marker_bar_drag_rect;
+       ArdourCanvas::Rectangle*  range_bar_drag_rect;
+       ArdourCanvas::Rectangle*  transport_bar_drag_rect;
 
 #ifdef GTKOSX
-       ArdourCanvas::SimpleRect     *bogus_background_rect;
+       ArdourCanvas::Rectangle     *bogus_background_rect;
 #endif
-       ArdourCanvas::SimpleRect     *transport_bar_range_rect;
-       ArdourCanvas::SimpleRect     *transport_bar_preroll_rect;
-       ArdourCanvas::SimpleRect     *transport_bar_postroll_rect;
-       ArdourCanvas::SimpleRect     *transport_loop_range_rect;
-       ArdourCanvas::SimpleRect     *transport_punch_range_rect;
-       ArdourCanvas::SimpleLine     *transport_punchin_line;
-       ArdourCanvas::SimpleLine     *transport_punchout_line;
-       ArdourCanvas::SimpleRect     *transport_preroll_rect;
-       ArdourCanvas::SimpleRect     *transport_postroll_rect;
+       ArdourCanvas::Rectangle     *transport_bar_range_rect;
+       ArdourCanvas::Rectangle     *transport_bar_preroll_rect;
+       ArdourCanvas::Rectangle     *transport_bar_postroll_rect;
+       ArdourCanvas::Rectangle     *transport_loop_range_rect;
+       ArdourCanvas::Rectangle     *transport_punch_range_rect;
+       ArdourCanvas::Line     *transport_punchin_line;
+       ArdourCanvas::Line     *transport_punchout_line;
+       ArdourCanvas::Rectangle     *transport_preroll_rect;
+       ArdourCanvas::Rectangle     *transport_postroll_rect;
 
        ARDOUR::Location*  transport_loop_location();
        ARDOUR::Location*  transport_punch_location();
@@ -1741,11 +1696,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
 
-       ArdourCanvas::SimpleRect   *rubberband_rect;
+       ArdourCanvas::Rectangle   *rubberband_rect;
 
        /* mouse zoom process */
 
-       ArdourCanvas::SimpleRect   *zoom_rect;
+       ArdourCanvas::Rectangle   *zoom_rect;
        void reposition_zoom_rect (framepos_t start, framepos_t end);
 
        EditorRouteGroups* _route_groups;
@@ -1879,7 +1834,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void duplicate_range (bool with_dialog);
 
-       framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
+        /** computes the timeline frame (sample) of an event whose coordinates
+        * are in canvas units (pixels, scroll offset included).
+        */
+       framepos_t canvas_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
+
+        /** computes the timeline frame (sample) of an event whose coordinates
+        * are in window units (pixels, no scroll offset).
+        */
+       framepos_t window_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
 
        /* returns false if mouse pointer is not in track or marker canvas
         */
@@ -1912,47 +1875,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        void nudge_track (bool use_edit_point, bool forwards);
 
-#ifdef WITH_CMT
-       void handle_new_imageframe_time_axis_view(const std::string & track_name, void* src) ;
-       void handle_new_imageframe_marker_time_axis_view(const std::string & track_name, TimeAxisView* marked_track) ;
-
-       void start_imageframe_grab(ArdourCanvas::Item*, GdkEvent*) ;
-       void start_markerview_grab(ArdourCanvas::Item*, GdkEvent*) ;
-
-       void imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
-       void markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent*) ;
-       void timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent*) ;
-
-       gint canvas_imageframe_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
-       gint canvas_imageframe_view_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameTimeAxis* ifta);
-       gint canvas_imageframe_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
-       gint canvas_imageframe_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, ImageFrameView* ifv);
-
-       gint canvas_marker_time_axis_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerTimeAxis* mta);
-       gint canvas_markerview_item_view_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
-       gint canvas_markerview_start_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
-       gint canvas_markerview_end_handle_event(ArdourCanvas::Item* item, GdkEvent* event, MarkerView* mv);
-
-       void imageframe_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void imageframe_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void imageframe_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
-
-       void markerview_item_start_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void markerview_item_end_handle_op(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* event) ;
-       void markerview_end_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* event) ;
-
-       void popup_imageframe_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
-       void popup_marker_time_axis_edit_menu(int button, int32_t time, ArdourCanvas::Item* ifv, bool with_frame) ;
-
-       ImageFrameSocketHandler* image_socket_listener ;
-#endif
-
        static const int32_t default_width = 995;
        static const int32_t default_height = 765;
 
@@ -2086,8 +2008,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        void region_view_added (RegionView *);
        void region_view_removed ();
 
-       void update_canvas_now ();
-
        EditorGroupTabs* _group_tabs;
        void fit_route_group (ARDOUR::RouteGroup *);
 
@@ -2136,15 +2056,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
        bool _control_point_toggled_on_press;
 
        /** This is used by TimeAxisView to keep a track of the TimeAxisView that is currently being
-           stepped in height using Shift-Scrollwheel.  When a scroll event occurs, we do the step on
-           this _stepping_axis_view if it is non-0 (and we set up this _stepping_axis_view with the
-           TimeAxisView underneath the mouse if it is 0).  Then Editor resets _stepping_axis_view when
-           the shift key is released.  In this (hacky) way, pushing shift and moving the scroll wheel
-           will operate on the same track until shift is released (rather than skipping about to whatever
-           happens to be underneath the mouse at the time).
+           stepped in height using ScrollZoomVerticalModifier+Scrollwheel.  When a scroll event
+           occurs, we do the step on this _stepping_axis_view if it is non-0 (and we set up this
+           _stepping_axis_view with the TimeAxisView underneath the mouse if it is 0).  Then Editor
+           resets _stepping_axis_view when the modifier key is released.  In this (hacky) way,
+           pushing the modifier key and moving the scroll wheel will operate on the same track
+           until the key is released (rather than skipping about to whatever happens to be
+           underneath the mouse at the time).
        */
        TimeAxisView* _stepping_axis_view;
-       void shift_key_released ();
+       void zoom_vertical_modifier_released();
 
        friend class Drag;
        friend class RegionDrag;