Merge branch 'master' into cairocanvas
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 26 Jun 2013 02:24:47 +0000 (22:24 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 26 Jun 2013 02:24:47 +0000 (22:24 -0400)
1  2 
gtk2_ardour/ardev_common.sh.in
gtk2_ardour/ardour_ui.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/editor_summary.cc
gtk2_ardour/editor_videotimeline.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/time_axis_view.cc
wscript

index 30f3194cf037b8c909dcd36b1b1ae9c9d4f33a5a,897bfcf7c216e39ebf791b11dbc0bcc686a0f927..716dd5a6d9bd67e72d31317b0037fe4b5e30b6a2
@@@ -29,9 -29,10 +29,10 @@@ export ARDOUR_DLL_PATH=$lib
  export GTK_PATH=~/.ardour3:$libs/clearlooks-newer
  export VAMP_PATH=$libs/vamp-plugins${VAMP_PATH:+:$VAMP_PATH}
  
 -export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
 +export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  
  # DYLD_LIBRARY_PATH is for darwin.
  export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH
  
+ ARDOURVERSION=@VERSION@
  EXECUTABLE=@EXECUTABLE@
diff --combined gtk2_ardour/ardour_ui.cc
index d97dc880c4854844767e2a8dc5574f542430bfaa,c664f870ce4d212979448b5d5b2ea804b66a5ea2..099854688885b354b2227a09e6f9a66a1080863f
@@@ -210,9 -210,6 +210,9 @@@ ARDOUR_UI::ARDOUR_UI (int *argcp, char 
        }
  
        ui_config = new UIConfiguration();
 +      ui_config->ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
 +      boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
 +      ui_config->map_parameters (pc);
  
        editor = 0;
        mixer = 0;
@@@ -3477,8 -3474,12 +3477,12 @@@ ARDOUR_UI::add_video (Gtk::Window* floa
        add_video_dialog->hide();
        if (r != RESPONSE_ACCEPT) { return; }
  
-       bool local_file;
+       bool local_file, orig_local_file;
        std::string path = add_video_dialog->file_name(local_file);
+       std::string orig_path = path;
+       orig_local_file = local_file;
        bool auto_set_session_fps = add_video_dialog->auto_set_session_fps();
  
        if (local_file && !Glib::file_test(path, Glib::FILE_TEST_EXISTS)) {
                node->add_property (X_("Filename"), path);
                node->add_property (X_("AutoFPS"), auto_set_session_fps?X_("1"):X_("0"));
                node->add_property (X_("LocalFile"), local_file?X_("1"):X_("0"));
+               if (orig_local_file) {
+                       node->add_property (X_("OriginalVideoFile"), orig_path);
+               } else {
+                       node->remove_property (X_("OriginalVideoFile"));
+               }
                _session->add_extra_xml (*node);
                _session->set_dirty ();
  
diff --combined gtk2_ardour/editor.cc
index ab2b96439a824e83bc78ad29d00f98bd20fde5b7,d3e3ae98281d455920778d8c219607ecd1f66f06..26e57b59e661cfefdc68858ffb7865050dec4f12
@@@ -70,9 -70,6 +70,9 @@@
  #include "ardour/tempo.h"
  #include "ardour/utils.h"
  
 +#include "canvas/debug.h"
 +#include "canvas/text.h"
 +
  #include "control_protocol/control_protocol.h"
  
  #include "actions.h"
@@@ -84,6 -81,8 +84,6 @@@
  #include "audio_time_axis.h"
  #include "automation_time_axis.h"
  #include "bundle_manager.h"
 -#include "canvas-noevent-text.h"
 -#include "canvas_impl.h"
  #include "crossfade_edit.h"
  #include "debug.h"
  #include "editing.h"
  #include "rhythm_ferret.h"
  #include "selection.h"
  #include "sfdb_ui.h"
 -#include "simpleline.h"
  #include "tempo_lines.h"
  #include "time_axis_view.h"
  #include "utils.h"
@@@ -250,10 -250,6 +250,10 @@@ Editor::Editor (
          */
  
        , vertical_adjustment (0.0, 0.0, 10.0, 400.0)
 +      , horizontal_adjustment (0.0, 0.0, 1e16)
 +      , unused_adjustment (0.0, 0.0, 10.0, 400.0)
 +
 +      , controls_layout (unused_adjustment, vertical_adjustment)
  
          /* tool bar related */
  
  
        snap_threshold = 5.0;
        bbt_beat_subdivision = 4;
 -      _canvas_width = 0;
 -      _canvas_height = 0;
 +      _visible_canvas_width = 0;
 +      _visible_canvas_height = 0;
        last_autoscroll_x = 0;
        last_autoscroll_y = 0;
        autoscroll_active = false;
  
        sfbrowser = 0;
  
 -      location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
 -      location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
 -      location_cd_marker_color = ARDOUR_UI::config()->canvasvar_LocationCDMarker.get();
 -      location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
 -      location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
 +      location_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationMarker();
 +      location_range_color = ARDOUR_UI::config()->get_canvasvar_LocationRange();
 +      location_cd_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationCDMarker();
 +      location_loop_color = ARDOUR_UI::config()->get_canvasvar_LocationLoop();
 +      location_punch_color = ARDOUR_UI::config()->get_canvasvar_LocationPunch();
  
        _edit_point = EditAtMouse;
        _internal_editing = false;
        current_canvas_cursor = 0;
  
 -      frames_per_unit = 2048; /* too early to use reset_zoom () */
 +      samples_per_pixel = 2048; /* too early to use reset_zoom () */
  
        _scroll_callbacks = 0;
  
  
        edit_controls_vbox.set_spacing (0);
        vertical_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &Editor::tie_vertical_scrolling), true);
 -      track_canvas->signal_map_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_map_handler));
 +      _track_canvas->signal_map_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_map_handler));
  
        HBox* h = manage (new HBox);
        _group_tabs = new EditorGroupTabs (this);
  
        _cursors = new MouseCursors;
  
 -      ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
 -      ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(),
 -                      0.0, 1.0, 100.0, 1.0));
 +      ArdourCanvas::GtkCanvas* time_pad = manage (new ArdourCanvas::GtkCanvas ());
  
 -      pad_line_1->property_color_rgba() = 0xFF0000FF;
 +      ArdourCanvas::Line* pad_line_1 = new ArdourCanvas::Line (time_pad->root());
 +      pad_line_1->set (ArdourCanvas::Duple (0.0, 1.0), ArdourCanvas::Duple (100.0, 1.0));
 +      pad_line_1->set_outline_color (0xFF0000FF);
        pad_line_1->show();
  
 +      // CAIROCANVAS
        time_pad->show();
  
        time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2);
        ruler_label_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
        ruler_label_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
  
 -      time_button_event_box.add (time_button_vbox);
 -      time_button_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
 -      time_button_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
 -
 -      /* these enable us to have a dedicated window (for cursor setting, etc.)
 -         for the canvas areas.
 -      */
 -
 -      track_canvas_event_box.add (*track_canvas);
 +      time_bars_event_box.add (time_bars_vbox);
 +      time_bars_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
 +      time_bars_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
  
        time_canvas_event_box.add (time_canvas_vbox);
        time_canvas_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
  
        /* labels for the rulers */
        edit_packer.attach (ruler_label_event_box,   1, 2, 0, 1,    FILL,        SHRINK, 0, 0);
 -      /* labels for the marker "tracks" */
 -      edit_packer.attach (time_button_event_box,   1, 2, 1, 2,    FILL,        SHRINK, 0, 0);
 +      /* labels for the marker "tracks" (time bars) */
 +      edit_packer.attach (time_bars_event_box,     1, 2, 1, 2,    FILL,        SHRINK, 0, 0);
        /* the rulers */
        edit_packer.attach (time_canvas_event_box,   2, 3, 0, 1,    FILL|EXPAND, FILL, 0, 0);
        /* track controls */
        edit_packer.attach (controls_layout,         0, 2, 2, 3,    FILL,        FILL|EXPAND, 0, 0);
 -      /* main canvas */
 -      edit_packer.attach (track_canvas_event_box,  2, 3, 1, 3,    FILL|EXPAND, FILL|EXPAND, 0, 0);
 +      /* time bars canvas */
 +      edit_packer.attach (*_time_bars_canvas_viewport, 2, 3, 1, 2,    FILL,    FILL, 0, 0);
 +      /* track canvas */
 +      edit_packer.attach (*_track_canvas_viewport,  2, 3, 2, 3,    FILL|EXPAND, FILL|EXPAND, 0, 0);
  
        bottom_hbox.set_border_width (2);
        bottom_hbox.set_spacing (3);
@@@ -762,8 -761,7 +762,8 @@@ Editor::~Editor(
          delete button_bindings;
        delete _routes;
        delete _route_groups;
 -      delete track_canvas;
 +      delete _time_bars_canvas_viewport;
 +      delete _track_canvas_viewport;
        delete _drags;
  }
  
@@@ -912,11 -910,11 +912,11 @@@ Editor::zoom_adjustment_changed (
                return;
        }
  
 -      double fpu = zoom_range_clock->current_duration() / _canvas_width;
 -      bool clamped = clamp_frames_per_unit (fpu);
 +      framecnt_t fpu = llrintf (zoom_range_clock->current_duration() / _visible_canvas_width);
 +      bool clamped = clamp_samples_per_pixel (fpu);
        
        if (clamped) {
 -              zoom_range_clock->set ((framepos_t) floor (fpu * _canvas_width));
 +              zoom_range_clock->set ((framepos_t) floor (fpu * _visible_canvas_width));
        }
  
        temporal_zoom (fpu);
@@@ -1017,7 -1015,7 +1017,7 @@@ Editor::control_scroll (float fraction
                return;
        }
  
 -      double step = fraction * current_page_frames();
 +      double step = fraction * current_page_samples();
  
        /*
                _control_scroll_target is an optional<T>
        if ((fraction < 0.0f) && (*_control_scroll_target < (framepos_t) fabs(step))) {
                *_control_scroll_target = 0;
        } else if ((fraction > 0.0f) && (max_framepos - *_control_scroll_target < step)) {
 -              *_control_scroll_target = max_framepos - (current_page_frames()*2); // allow room for slop in where the PH is on the screen
 +              *_control_scroll_target = max_framepos - (current_page_samples()*2); // allow room for slop in where the PH is on the screen
        } else {
                *_control_scroll_target += (framepos_t) floor (step);
        }
        playhead_cursor->set_position (*_control_scroll_target);
        UpdateAllTransportClocks (*_control_scroll_target);
  
 -      if (*_control_scroll_target > (current_page_frames() / 2)) {
 +      if (*_control_scroll_target > (current_page_samples() / 2)) {
                /* try to center PH in window */
 -              reset_x_origin (*_control_scroll_target - (current_page_frames()/2));
 +              reset_x_origin (*_control_scroll_target - (current_page_samples()/2));
        } else {
                reset_x_origin (0);
        }
@@@ -1123,7 -1121,7 +1123,7 @@@ Editor::map_position_change (framepos_
  void
  Editor::center_screen (framepos_t frame)
  {
 -      double page = _canvas_width * frames_per_unit;
 +      framecnt_t const page = _visible_canvas_width * samples_per_pixel;
  
        /* if we're off the page, then scroll.
         */
@@@ -1253,7 -1251,7 +1253,7 @@@ Editor::set_session (Session *t
  
        /* catch up with the playhead */
  
 -      _session->request_locate (playhead_cursor->current_frame);
 +      _session->request_locate (playhead_cursor->current_frame ());
        _pending_initial_locate = true;
  
        update_title ();
        _session->locations()->StateChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context());
        _session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
  
 -      playhead_cursor->canvas_item.show ();
 +      playhead_cursor->show ();
  
        boost::function<void (string)> pc (boost::bind (&Editor::parameter_changed, this, _1));
        Config->map_parameters (pc);
        _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
  
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
 -              (static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
 +              (static_cast<TimeAxisView*>(*i))->set_samples_per_pixel (samples_per_pixel);
        }
  
        super_rapid_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
@@@ -2105,9 -2103,9 +2105,9 @@@ Editor::set_snap_to (SnapType st
                ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
                ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
                
 -              compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(),
 +              compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(),
                                            current_bbt_points_begin, current_bbt_points_end);
 -              compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames(),
 +              compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples(),
                                         current_bbt_points_begin, current_bbt_points_end);
                update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
                break;
@@@ -2263,11 -2261,9 +2263,11 @@@ Editor::set_state (const XMLNode& node
        }
  
        if ((prop = node.property ("zoom"))) {
 -              reset_zoom (PBD::atof (prop->value()));
 +              /* older versions of ardour used floating point samples_per_pixel */
 +              double f = PBD::atof (prop->value());
 +              reset_zoom (llrintf (f));
        } else {
 -              reset_zoom (frames_per_unit);
 +              reset_zoom (samples_per_pixel);
        }
  
        if ((prop = node.property ("snap-to"))) {
@@@ -2487,8 -2483,7 +2487,8 @@@ Editor::get_state (
        maybe_add_mixer_strip_width (*node);
  
        node->add_property ("zoom-focus", enum_2_string (zoom_focus));
 -      snprintf (buf, sizeof(buf), "%f", frames_per_unit);
 +
 +      snprintf (buf, sizeof(buf), "%" PRId64, samples_per_pixel);
        node->add_property ("zoom", buf);
        node->add_property ("snap-to", enum_2_string (_snap_type));
        node->add_property ("snap-mode", enum_2_string (_snap_mode));
        node->add_property ("pre-internal-snap-mode", enum_2_string (pre_internal_snap_mode));
        node->add_property ("edit-point", enum_2_string (_edit_point));
  
 -      snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame);
 +      snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame ());
        node->add_property ("playhead", buf);
        snprintf (buf, sizeof (buf), "%" PRIi64, leftmost_frame);
        node->add_property ("left-frame", buf);
@@@ -2820,12 -2815,12 +2820,12 @@@ Editor::snap_to_internal (framepos_t& s
        case SnapMagnetic:
  
                if (presnap > start) {
 -                      if (presnap > (start + unit_to_frame(snap_threshold))) {
 +                      if (presnap > (start + pixel_to_sample(snap_threshold))) {
                                start = presnap;
                        }
  
                } else if (presnap < start) {
 -                      if (presnap < (start - unit_to_frame(snap_threshold))) {
 +                      if (presnap < (start - pixel_to_sample(snap_threshold))) {
                                start = presnap;
                        }
                }
@@@ -3130,12 -3125,12 +3130,12 @@@ Editor::convert_drop_to_paths 
                */
  
                string txt = data.get_text();
-               const char* p;
+               char* p;
                const char* q;
  
-               p = (const char *) malloc (txt.length() + 1);
-               txt.copy (const_cast<char *> (p), txt.length(), 0);
-               const_cast<char*>(p)[txt.length()] = '\0';
+               p = (char *) malloc (txt.length() + 1);
+               txt.copy (p, txt.length(), 0);
+               p[txt.length()] = '\0';
  
                while (p)
                {
@@@ -3706,14 -3701,8 +3706,14 @@@ Editor::set_show_measures (bool yn
                        if (tempo_lines) {
                                tempo_lines->show();
                        }
 -                      (void) redraw_measures ();
 -              }
 +
 +                      ARDOUR::TempoMap::BBTPointList::const_iterator begin;
 +                      ARDOUR::TempoMap::BBTPointList::const_iterator end;
 +                      
 +                      compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end);
 +                      draw_measures (begin, end);
 +              } 
 +
                instant_save ();
        }
  }
@@@ -4118,16 -4107,16 +4118,16 @@@ Editor::reset_y_origin (double y
  }
  
  void
 -Editor::reset_zoom (double fpu)
 +Editor::reset_zoom (framecnt_t spp)
  {
 -      clamp_frames_per_unit (fpu);
 +      clamp_samples_per_pixel (spp);
  
 -      if (fpu == frames_per_unit) {
 +      if (spp == samples_per_pixel) {
                return;
        }
  
        pending_visual_change.add (VisualChange::ZoomLevel);
 -      pending_visual_change.frames_per_unit = fpu;
 +      pending_visual_change.samples_per_pixel = spp;
        ensure_visual_change_idle_handler ();
  }
  
@@@ -4157,7 -4146,7 +4157,7 @@@ Editor::current_visual_state (bool with
  {
        VisualState* vs = new VisualState (with_tracks);
        vs->y_position = vertical_adjustment.get_value();
 -      vs->frames_per_unit = frames_per_unit;
 +      vs->samples_per_pixel = samples_per_pixel;
        vs->leftmost_frame = leftmost_frame;
        vs->zoom_focus = zoom_focus;
  
@@@ -4219,7 -4208,7 +4219,7 @@@ Editor::use_visual_state (VisualState& 
        vertical_adjustment.set_value (vs.y_position);
  
        set_zoom_focus (vs.zoom_focus);
 -      reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit);
 +      reposition_and_zoom (vs.leftmost_frame, vs.samples_per_pixel);
        
        if (vs.gui_state) {
                *ARDOUR_UI::instance()->gui_object_state = *vs.gui_state;
   *  @param fpu New frames per unit; should already have been clamped so that it is sensible.
   */
  void
 -Editor::set_frames_per_unit (double fpu)
 +Editor::set_samples_per_pixel (framecnt_t spp)
  {
 +      clamp_samples_per_pixel (spp);
 +      samples_per_pixel = spp;
 +
        if (tempo_lines) {
                tempo_lines->tempo_map_changed();
        }
  
 -      frames_per_unit = fpu;
 -
        /* convert fpu to frame count */
  
 -      framepos_t frames = (framepos_t) floor (frames_per_unit * _canvas_width);
 +      framepos_t frames = samples_per_pixel * _visible_canvas_width;
  
 -      if (frames_per_unit != zoom_range_clock->current_duration()) {
 +      if (samples_per_pixel != zoom_range_clock->current_duration()) {
                zoom_range_clock->set (frames);
        }
  
        //reset_scrolling_region ();
  
        if (playhead_cursor) {
 -              playhead_cursor->set_position (playhead_cursor->current_frame);
 +              playhead_cursor->set_position (playhead_cursor->current_frame ());
        }
  
        refresh_location_display();
@@@ -4297,7 -4285,6 +4297,7 @@@ Editor::ensure_visual_change_idle_handl
  {
        if (pending_visual_change.idle_handler_id < 0) {
                pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
 +              pending_visual_change.being_handled = false;
        }
  }
  
@@@ -4328,26 -4315,27 +4328,26 @@@ Editor::idle_visual_changer (
  
        double const last_time_origin = horizontal_position ();
  
 +
        if (p & VisualChange::ZoomLevel) {
 -              set_frames_per_unit (pending_visual_change.frames_per_unit);
 +              set_samples_per_pixel (pending_visual_change.samples_per_pixel);
  
                compute_fixed_ruler_scale ();
  
                ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
                ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
                
 -              compute_current_bbt_points (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames(),
 +              compute_current_bbt_points (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
                                            current_bbt_points_begin, current_bbt_points_end);
 -              compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames(),
 +              compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
                                         current_bbt_points_begin, current_bbt_points_end);
                update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
 -      }
  
 -      if (p & VisualChange::ZoomLevel) {
                update_video_timeline();
        }
  
        if (p & VisualChange::TimeOrigin) {
 -              set_horizontal_position (pending_visual_change.time_origin / frames_per_unit);
 +              set_horizontal_position (pending_visual_change.time_origin / samples_per_pixel);
        }
  
        if (p & VisualChange::YOrigin) {
@@@ -4391,7 -4379,7 +4391,7 @@@ Editor::get_preferred_edit_position (bo
        EditPoint ep = _edit_point;
  
        if (from_context_menu && (ep == EditAtMouse)) {
 -              return  event_frame (&context_click_event, 0, 0);
 +              return  window_event_frame (&context_click_event, 0, 0);
        }
  
        if (entered_marker) {
@@@ -4771,6 -4759,7 +4771,6 @@@ Editor::idle_resize (
        }
  
        _pending_resize_amount = 0;
 -      flush_canvas ();
        _group_tabs->set_dirty ();
        resize_idle_id = -1;
  
@@@ -4854,10 -4843,10 +4854,10 @@@ Editor::add_routes (RouteList& routes
                DataType dt = route->input()->default_type();
  
                if (dt == ARDOUR::DataType::AUDIO) {
 -                      rtv = new AudioTimeAxisView (*this, _session, *track_canvas);
 +                      rtv = new AudioTimeAxisView (*this, _session, *_track_canvas);
                        rtv->set_route (route);
                } else if (dt == ARDOUR::DataType::MIDI) {
 -                      rtv = new MidiTimeAxisView (*this, _session, *track_canvas);
 +                      rtv = new MidiTimeAxisView (*this, _session, *_track_canvas);
                        rtv->set_route (route);
                } else {
                        throw unknown_type();
@@@ -5160,16 -5149,16 +5160,16 @@@ Editor::scroll_release (
  void
  Editor::reset_x_origin_to_follow_playhead ()
  {
 -      framepos_t const frame = playhead_cursor->current_frame;
 +      framepos_t const frame = playhead_cursor->current_frame ();
  
 -      if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
 +      if (frame < leftmost_frame || frame > leftmost_frame + current_page_samples()) {
  
                if (_session->transport_speed() < 0) {
  
 -                      if (frame > (current_page_frames() / 2)) {
 -                              center_screen (frame-(current_page_frames()/2));
 +                      if (frame > (current_page_samples() / 2)) {
 +                              center_screen (frame-(current_page_samples()/2));
                        } else {
 -                              center_screen (current_page_frames()/2);
 +                              center_screen (current_page_samples()/2);
                        }
  
                } else {
                                /* moving left */
                                if (_session->transport_rolling()) {
                                        /* rolling; end up with the playhead at the right of the page */
 -                                      l = frame - current_page_frames ();
 +                                      l = frame - current_page_samples ();
                                } else {
                                        /* not rolling: end up with the playhead 1/4 of the way along the page */
 -                                      l = frame - current_page_frames() / 4;
 +                                      l = frame - current_page_samples() / 4;
                                }
                        } else {
                                /* moving right */
                                        l = frame;
                                } else {
                                        /* not rolling: end up with the playhead 3/4 of the way along the page */
 -                                      l = frame - 3 * current_page_frames() / 4;
 +                                      l = frame - 3 * current_page_samples() / 4;
                                }
                        }
  
                                l = 0;
                        }
                        
 -                      center_screen_internal (l + (current_page_frames() / 2), current_page_frames ());
 +                      center_screen_internal (l + (current_page_samples() / 2), current_page_samples ());
                }
        }
  }
@@@ -5271,11 -5260,11 +5271,11 @@@ Editor::super_rapid_screen_update (
                        */
  #if 0
                        // FIXME DO SOMETHING THAT WORKS HERE - this is 2.X code
 -                      double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit;
 +                      double target = ((double)frame - (double)current_page_samples()/2.0) / samples_per_pixel;
                        if (target <= 0.0) {
                                target = 0.0;
                        }
 -                      if (fabs(target - current) < current_page_frames() / frames_per_unit) {
 +                      if (fabs(target - current) < current_page_samples() / samples_per_pixel) {
                                target = (target * 0.15) + (current * 0.85);
                        } else {
                                /* relax */
@@@ -5310,7 -5299,7 +5310,7 @@@ Editor::session_going_away (
        last_update_frame = 0;
        _drags->abort ();
  
 -      playhead_cursor->canvas_item.hide ();
 +      playhead_cursor->hide ();
  
        /* rip everything out of the list displays */
  
index 4acd04a318e86f4422d45f5483114b615d6d5855,79cc1e066fcacbc0b8f5c87a5a6ca6d71e6ca89a..5bd0060d231d8eda915d4ec02464a1319bc2d0d9
  #include "ardour/region_factory.h"
  #include "ardour/profile.h"
  
 +#include "canvas/canvas.h"
 +#include "canvas/text.h"
 +
  #include "editor.h"
  #include "keyboard.h"
  #include "public_editor.h"
  #include "audio_region_view.h"
  #include "audio_streamview.h"
 -#include "canvas-noevent-text.h"
  #include "audio_time_axis.h"
  #include "region_gain_line.h"
  #include "automation_line.h"
  #include "automation_time_axis.h"
  #include "automation_line.h"
  #include "control_point.h"
 -#include "canvas_impl.h"
 -#include "simplerect.h"
  #include "editor_drag.h"
  #include "midi_time_axis.h"
  #include "editor_regions.h"
@@@ -63,29 -63,23 +63,29 @@@ Editor::track_canvas_scroll (GdkEventSc
        framepos_t xdelta;
        int direction = ev->direction;
  
 +      /* this event arrives without transformation by the canvas, so we have
 +       * to transform the coordinates to be able to look things up.
 +       */
 +
 +      Duple event_coords = _track_canvas->window_to_canvas (Duple (ev->x, ev->y));
 +      
    retry:
        switch (direction) {
        case GDK_SCROLL_UP:
-               if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
                        //for mouse-wheel zoom, force zoom-focus to mouse
                        Editing::ZoomFocus temp_focus = zoom_focus;
                        zoom_focus = Editing::ZoomFocusMouse;
                        temporal_zoom_step (false);
                        zoom_focus = temp_focus;
                        return true;
-               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
+               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
                        direction = GDK_SCROLL_LEFT;
                        goto retry;
-               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
+               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
                        if (!current_stepping_trackview) {
                                step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
 -                              std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize);
 +                              std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
                                current_stepping_trackview = p.first;
                                if (!current_stepping_trackview) {
                                        return false;
                break;
  
        case GDK_SCROLL_DOWN:
-               if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
                        //for mouse-wheel zoom, force zoom-focus to mouse
                        Editing::ZoomFocus temp_focus = zoom_focus;
                        zoom_focus = Editing::ZoomFocusMouse;
                        temporal_zoom_step (true);
                        zoom_focus = temp_focus;
                        return true;
-               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
+               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
                        direction = GDK_SCROLL_RIGHT;
                        goto retry;
-               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
+               } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
                        if (!current_stepping_trackview) {
                                step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
 -                              std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize);
 +                              std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
                                current_stepping_trackview = p.first;
                                if (!current_stepping_trackview) {
                                        return false;
                break;
  
        case GDK_SCROLL_LEFT:
 -              xdelta = (current_page_frames() / 8);
 +              xdelta = (current_page_samples() / 8);
                if (leftmost_frame > xdelta) {
                        reset_x_origin (leftmost_frame - xdelta);
                } else {
                break;
  
        case GDK_SCROLL_RIGHT:
 -              xdelta = (current_page_frames() / 8);
 +              xdelta = (current_page_samples() / 8);
                if (max_framepos - xdelta > leftmost_frame) {
                        reset_x_origin (leftmost_frame + xdelta);
                } else {
 -                      reset_x_origin (max_framepos - current_page_frames());
 +                      reset_x_origin (max_framepos - current_page_samples());
                }
                break;
  
  bool
  Editor::track_canvas_scroll_event (GdkEventScroll *event)
  {
 -      track_canvas->grab_focus();
 +      _track_canvas->grab_focus();
        return track_canvas_scroll (event);
  }
  
@@@ -166,7 -160,7 +166,7 @@@ boo
  Editor::track_canvas_button_press_event (GdkEventButton */*event*/)
  {
        selection->clear ();
 -      track_canvas->grab_focus();
 +      _track_canvas->grab_focus();
        return false;
  }
  
@@@ -184,7 -178,7 +184,7 @@@ Editor::track_canvas_motion_notify_even
  {
        int x, y;
        /* keep those motion events coming */
 -      track_canvas->get_pointer (x, y);
 +      _track_canvas->get_pointer (x, y);
        return false;
  }
  
@@@ -1009,6 -1003,8 +1009,6 @@@ Editor::canvas_note_event (GdkEvent *ev
  bool
  Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int x, int y, guint time)
  {
 -      double wx;
 -      double wy;
        boost::shared_ptr<Region> region;
        boost::shared_ptr<Region> region_copy;
        RouteTimeAxisView* rtav;
        double px;
        double py;
  
 -      string target = track_canvas->drag_dest_find_target (context, track_canvas->drag_dest_get_target_list());
 +      string target = _track_canvas->drag_dest_find_target (context, _track_canvas->drag_dest_get_target_list());
  
        if (target.empty()) {
                return false;
        }
  
 -      track_canvas->window_to_world (x, y, wx, wy);
 -
        event.type = GDK_MOTION_NOTIFY;
 -      event.button.x = wx;
 -      event.button.y = wy;
 +      event.button.x = x;
 +      event.button.y = y;
        /* assume we're dragging with button 1 */
        event.motion.state = Gdk::BUTTON1_MASK;
  
 -      (void) event_frame (&event, &px, &py);
 +      (void) window_event_frame (&event, &px, &py);
  
        std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
        bool can_drop = false;
@@@ -1098,6 -1096,8 +1098,6 @@@ Editor::drop_regions (const Glib::RefPt
                      const SelectionData& /*data*/,
                      guint /*info*/, guint /*time*/)
  {
 -      double wx;
 -      double wy;
        boost::shared_ptr<Region> region;
        boost::shared_ptr<Region> region_copy;
        RouteTimeAxisView* rtav;
        double px;
        double py;
  
 -      track_canvas->window_to_world (x, y, wx, wy);
 -
        event.type = GDK_MOTION_NOTIFY;
 -      event.button.x = wx;
 -      event.button.y = wy;
 +      event.button.x = x;
 +      event.button.y = y;
        /* assume we're dragging with button 1 */
        event.motion.state = Gdk::BUTTON1_MASK;
  
 -      framepos_t const pos = event_frame (&event, &px, &py);
 +      framepos_t const pos = window_event_frame (&event, &px, &py);
  
        std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
  
index 557636dbf76e423e684504d913f7379fba89d4b6,0dc728d18e26e837e6b3e15ad87c63d63be5c85e..1c30df4f3af17fe9ef19ed5e4ee4f2baebd699b1
@@@ -19,8 -19,6 +19,8 @@@
  
  #include "ardour/session.h"
  
 +#include "canvas/debug.h"
 +
  #include "time_axis_view.h"
  #include "streamview.h"
  #include "editor_summary.h"
@@@ -202,7 -200,7 +202,7 @@@ EditorSummary::render (cairo_t* cr
        /* XXX: colour should be set from configuration file */
        cairo_set_source_rgba (cr, 1, 0, 0, 1);
  
 -      const double ph= playhead_frame_to_position (_editor->playhead_cursor->current_frame);
 +      const double ph= playhead_frame_to_position (_editor->playhead_cursor->current_frame());
        cairo_move_to (cr, ph, 0);
        cairo_line_to (cr, ph, get_height());
        cairo_stroke (cr);
@@@ -399,8 -397,6 +399,8 @@@ EditorSummary::on_button_press_event (G
                        _moved = false;
                        _editor->_dragging_playhead = true;
                        _editor->set_follow_playhead (false);
 +
 +                      ArdourCanvas::checkpoint ("sum", "------------------ summary move drag starts.\n");
                }
        }
  
@@@ -436,11 -432,11 +436,11 @@@ EditorSummary::get_editor (pair<double
  
                /* Otherwise query the editor for its actual position */
  
 -              x->first = (_editor->leftmost_position () - _start) * _x_scale;
 -              x->second = x->first + _editor->current_page_frames() * _x_scale;
 +              x->first = (_editor->leftmost_sample () - _start) * _x_scale;
 +              x->second = x->first + _editor->current_page_samples() * _x_scale;
                
                y->first = editor_y_to_summary (_editor->vertical_adjustment.get_value ());
 -              y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->canvas_height() - _editor->get_canvas_timebars_vsize());
 +              y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->visible_canvas_height());
        }
  }
  
@@@ -627,45 -623,55 +627,55 @@@ EditorSummary::on_scroll_event (GdkEven
        double x = xr.first;
        double y = yr.first;
  
-       double amount = 8;
-       if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
-               amount = 64;
-       } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
-               amount = 1;
-       }
-       if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
-               /* secondary-wheel == left-right scrolling */
-               if (ev->direction == GDK_SCROLL_UP) {
-                       x -= amount;
-               } else if (ev->direction == GDK_SCROLL_DOWN) {
-                       x += amount;
-               }
-       } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
-               /* primary-wheel == zoom */
-               
-               if (ev->direction == GDK_SCROLL_UP) {
-                       _editor->temporal_zoom_step (false);
-               } else {
-                       _editor->temporal_zoom_step (true);
-               }
-       } else {
-               if (ev->direction == GDK_SCROLL_DOWN) {
-                       y += amount;
-               } else if (ev->direction == GDK_SCROLL_UP) {
-                       y -= amount;
-               } else if (ev->direction == GDK_SCROLL_LEFT) {
-                       x -= amount;
-               } else if (ev->direction == GDK_SCROLL_RIGHT) {
-                       x += amount;
-               }
+       switch (ev->direction) {
+               case GDK_SCROLL_UP:
+                       if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
+                               x -= 64;
+                       } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
+                               _editor->temporal_zoom_step (false);
+                       } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
+                               yr.first  += 4;
+                               yr.second -= 4;
+                               set_editor (xr, yr);
+                               return true;
+                       } else {
+                               y -= 8;
+                       }
+                       break;
+               case GDK_SCROLL_DOWN:
+                       if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollHorizontalModifier)) {
+                               x += 64;
+                       } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomHorizontalModifier)) {
+                               _editor->temporal_zoom_step (true);
+                       } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
+                               yr.first  -= 4;
+                               yr.second += 4;
+                               set_editor (xr, yr);
+                               return true;
+                       } else {
+                               y += 8;
+                       }
+                       break;
+               case GDK_SCROLL_LEFT:
+                       if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
+                               x -= 64;
+                       } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
+                               x -= 1;
+                       } else {
+                               x -= 8;
+                       }
+                       break;
+               case GDK_SCROLL_RIGHT:
+                       if (Keyboard::modifier_state_contains (ev->state, Keyboard::SecondaryModifier)) {
+                               x += 64;
+                       } else if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
+                               x += 1;
+                       } else {
+                               x += 8;
+                       }
+                       break;
+               default:
+                       break;
        }
  
        set_editor (x, y);
  void
  EditorSummary::set_editor (double const x, double const y)
  {
 -      if (_editor->pending_visual_change.idle_handler_id >= 0) {
 +      if (_editor->pending_visual_change.idle_handler_id >= 0 && _editor->pending_visual_change.being_handled == true) {
  
                /* As a side-effect, the Editor's visual change idle handler processes
                   pending GTK events.  Hence this motion notify handler can be called
@@@ -778,7 -784,7 +788,7 @@@ EditorSummary::set_editor_x (pair<doubl
                
                double const nx = (
                        ((x.second - x.first) / _x_scale) /
 -                      _editor->frame_to_unit (_editor->current_page_frames())
 +                      _editor->sample_to_pixel (_editor->current_page_samples())
                        );
                
                if (nx != _editor->get_current_zoom ()) {
@@@ -795,10 -801,10 +805,10 @@@ voi
  EditorSummary::set_editor_y (double const y)
  {
        double y1 = summary_y_to_editor (y);
 -      double const eh = _editor->canvas_height() - _editor->get_canvas_timebars_vsize ();
 +      double const eh = _editor->visible_canvas_height();
        double y2 = y1 + eh;
  
 -      double const full_editor_height = _editor->full_canvas_height - _editor->get_canvas_timebars_vsize();
 +      double const full_editor_height = _editor->_full_canvas_height;
  
        if (y2 > full_editor_height) {
                y1 -= y2 - full_editor_height;
@@@ -875,7 -881,7 +885,7 @@@ EditorSummary::set_editor_y (pair<doubl
        /* Height that we will use for scaling; use the whole editor height unless there are not
           enough tracks to fill it.
        */
 -      double const ch = min (total_height, _editor->canvas_height() - _editor->get_canvas_timebars_vsize());
 +      double const ch = min (total_height, _editor->visible_canvas_height());
  
        /* hence required scale factor of the complete tracks to fit the required y range;
           the amount of space they should take up divided by the amount they currently take up.
index fcb1d31ba07df482bfe5a66d70e4e9c2c9c91f53,7395d767c77083c7697d177e0792b8a561d956b4..f392b238373b88b169812323dd77fcb748c87494
@@@ -27,7 -27,8 +27,7 @@@
  
  #include "ardour_ui.h"
  #include "editor.h"
 -#include "simplerect.h"
 -#include "canvas_impl.h"
 +#include "canvas/rectangle.h"
  #include "editing.h"
  #include "audio_time_axis.h"
  #include "video_image_frame.h"
@@@ -35,6 -36,7 +35,7 @@@
  #include "export_video_infobox.h"
  #include "interthread_progress_window.h"
  
+ #include "pbd/openuri.h"
  #include "i18n.h"
  
  using namespace std;
@@@ -45,7 -47,9 +46,7 @@@ Editor::set_video_timeline_height (cons
        if (videotl_bar_height == h) { return; }
        if (h < 2 || h > 8) { return; }
    videotl_bar_height = h;
 -      const double nh = (videotl_bar_height * timebar_height - ((ARDOUR::Profile->get_sae())?1.0:0.0));
        videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
 -      videotl_bar->property_y2().set_value(nh);
        ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
        update_ruler_visibility();
  }
  void
  Editor::update_video_timeline (bool flush)
  {
 -#if DEBUG
 -      framepos_t rightmost_frame = leftmost_frame + current_page_frames();
 -      std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl;
 -      std::cout << "SCROLL UNITS: " << frame_to_unit(leftmost_frame) << " -- " << frame_to_unit(rightmost_frame)
 -                << " = " << frame_to_unit(rightmost_frame) - frame_to_unit(leftmost_frame)
 -                      << std::endl;
 -#endif
 -
 -      // TODO later: make this a list for mult. video tracks
 -      // also modify  ardour_ui_dialogs.cc : set_session()
        if (flush) {
                ARDOUR_UI::instance()->video_timeline->flush_local_cache();
        }
@@@ -112,12 -126,24 +113,19 @@@ Editor::export_video (
  {
        if (ARDOUR::Config->get_show_video_export_info()) {
                ExportVideoInfobox infobox (_session);
-               infobox.run();
+               Gtk::ResponseType rv = (Gtk::ResponseType) infobox.run();
                if (infobox.show_again()) {
                        ARDOUR::Config->set_show_video_export_info(false);
                }
+               switch (rv) {
+                       case GTK_RESPONSE_YES:
+                               PBD::open_uri (ARDOUR::Config->get_reference_manual_url() + "/video-timeline/operations/#export");
+                               break;
+                       default:
+                               break;
+               }
        }
        ExportVideoDialog dialog (*this, _session);
 -      Gtk::ResponseType r = (Gtk::ResponseType) dialog.run();
 +      dialog.run();
        dialog.hide();
 -#if 0
 -      if (r == Gtk::RESPONSE_ACCEPT) {
 -              ARDOUR_UI::instance()->popup_error(string_compose(_("Export Successful: %1"),dialog.get_exported_filename()));
 -      }
 -#endif
  }
index 3ec90d8508ca7aa824e40753c4e0cb008e88b8b5,99f1f75f0e8f2a7ac0255287b1c96c9190deaaf1..b3ce711c45bec3beed5703a9c35a0dd97955a112
@@@ -48,6 -48,8 +48,8 @@@
  #include "ardour/session.h"
  #include "ardour/route.h"
  #include "ardour/meter.h"
+ #include "ardour/audio_track.h"
+ #include "ardour/midi_track.h"
  
  #include "i18n.h"
  
@@@ -146,7 -148,7 +148,7 @@@ voi
  GainMeterBase::set_flat_buttons ()
  {
  printf("set_flat_butt\n");
 -//    gain_slider->set_flat_buttons( ARDOUR_UI::config()->flat_buttons.get() );
 +//    gain_slider->set_flat_buttons( ARDOUR_UI::config()->get_flat_buttons() );
  }
  
  GainMeterBase::~GainMeterBase ()
@@@ -1151,11 -1153,43 +1153,43 @@@ GainMeterBase::level_meter_button_pres
  void
  GainMeter::meter_configuration_changed (ChanCount c)
  {
+       int type = 0;
        _types.clear ();
  
        for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
                if (c.get (*i) > 0) {
                        _types.push_back (*i);
+                       type |= 1 << (*i);
+               }
+       }
+       if (boost::dynamic_pointer_cast<AudioTrack>(_route) == 0
+                       && boost::dynamic_pointer_cast<MidiTrack>(_route) == 0
+                       ) {
+               if (_route->active()) {
+                       set_meter_strip_name ("AudioBusMetrics");
+               } else {
+                       set_meter_strip_name ("AudioBusMetricsInactive");
+               }
+       }
+       else if (type == (1 << DataType::AUDIO)) {
+               if (_route->active()) {
+                       set_meter_strip_name ("AudioTrackMetrics");
+               } else {
+                       set_meter_strip_name ("AudioTrackMetricsInactive");
+               }
+       }
+       else if (type == (1 << DataType::MIDI)) {
+               if (_route->active()) {
+                       set_meter_strip_name ("MidiTrackMetrics");
+               } else {
+                       set_meter_strip_name ("MidiTrackMetricsInactive");
+               }
+       } else {
+               if (_route->active()) {
+                       set_meter_strip_name ("AudioMidiTrackMetrics");
+               } else {
+                       set_meter_strip_name ("AudioMidiTrackMetricsInactive");
                }
        }
  
index 7957a591f887ee8d259bf56e653f70ff73c64ca4,08b00ec7fa4fc47a071349a213b0b5961ea65ddb..8aa3e53639bd29427b6fccb8b3a306746cd2573d
@@@ -23,6 -23,9 +23,6 @@@
  #include <string>
  #include <list>
  
 -#include <libgnomecanvasmm.h>
 -#include <libgnomecanvasmm/canvas.h>
 -#include <libgnomecanvasmm/item.h>
  
  #include "pbd/error.h"
  #include "pbd/convert.h"
@@@ -31,9 -34,6 +31,9 @@@
  #include <gtkmm2ext/utils.h>
  #include <gtkmm2ext/selector.h>
  
 +#include "canvas/rectangle.h"
 +#include "canvas/debug.h"
 +
  #include "ardour_ui.h"
  #include "ardour_dialog.h"
  #include "global_signals.h"
@@@ -42,6 -42,8 +42,6 @@@
  #include "time_axis_view.h"
  #include "region_view.h"
  #include "ghostregion.h"
 -#include "simplerect.h"
 -#include "simpleline.h"
  #include "selection.h"
  #include "keyboard.h"
  #include "rgb_macros.h"
@@@ -95,14 -97,15 +95,14 @@@ TimeAxisView::TimeAxisView (ARDOUR::Ses
                compute_heights ();
        }
  
 -      _canvas_background = new Group (*ed.get_background_group (), 0.0, 0.0);
 -      _canvas_display = new Group (*ed.get_trackview_group (), 0.0, 0.0);
 +      _canvas_display = new Group (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0));
        _canvas_display->hide(); // reveal as needed
  
 -      selection_group = new Group (*_canvas_display);
 +      selection_group = new Group (_canvas_display);
        selection_group->set_data (X_("timeselection"), (void *) 1);
        selection_group->hide();
  
 -      _ghost_group = new Group (*_canvas_display);
 +      _ghost_group = new Group (_canvas_display);
        _ghost_group->lower_to_bottom();
        _ghost_group->show();
  
@@@ -174,7 -177,7 +174,7 @@@ TimeAxisView::~TimeAxisView(
        }
  
        for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
 -              delete (*i)->rect;
 + delete (*i)->rect;
                delete (*i)->start_trim;
                delete (*i)->end_trim;
  
        delete selection_group;
        selection_group = 0;
  
 -      delete _canvas_background;
 -      _canvas_background = 0;
 -
        delete _canvas_display;
        _canvas_display = 0;
  
@@@ -206,6 -212,7 +206,6 @@@ TimeAxisView::hide (
        }
  
        _canvas_display->hide ();
 -      _canvas_background->hide ();
  
        if (control_parent) {
                control_parent->remove (time_axis_vbox);
@@@ -250,12 -257,19 +250,12 @@@ TimeAxisView::show_at (double y, int& n
        _order = nth;
  
        if (_y_position != y) {
 -              _canvas_display->property_y () = y;
 -              _canvas_background->property_y () = y;
 -              /* silly canvas */
 -              _canvas_display->move (0.0, 0.0);
 -              _canvas_background->move (0.0, 0.0);
 +              _canvas_display->set_y_position (y);
                _y_position = y;
  
        }
  
 -      _canvas_background->raise_to_top ();
        _canvas_display->raise_to_top ();
 -
 -      _canvas_background->show ();
        _canvas_display->show ();
  
        _hidden = false;
        return _effective_height;
  }
  
 -void
 -TimeAxisView::clip_to_viewport ()
 -{
 -      if (marked_for_display()) {
 -              if (_y_position + _effective_height < _editor.get_trackview_group_vertical_offset () || _y_position > _editor.get_trackview_group_vertical_offset () + _canvas_display->get_canvas()->get_height()) {
 -                      _canvas_background->hide ();
 -                      _canvas_display->hide ();
 -                      return;
 -              }
 -              _canvas_background->show ();
 -              _canvas_display->show ();
 -      }
 -      return;
 -}
 -
  bool
  TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
  {
        switch (ev->direction) {
        case GDK_SCROLL_UP:
-               if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
                        /* See Editor::_stepping_axis_view for notes on this hack */
                        Editor& e = dynamic_cast<Editor&> (_editor);
                        if (!e.stepping_axis_view ()) {
                break;
  
        case GDK_SCROLL_DOWN:
-               if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
+               if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
                        /* See Editor::_stepping_axis_view for notes on this hack */
                        Editor& e = dynamic_cast<Editor&> (_editor);
                        if (!e.stepping_axis_view ()) {
@@@ -365,7 -394,7 +365,7 @@@ TimeAxisView::controls_ebox_motion (Gdk
                */
                int tx, ty;
                controls_ebox.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
 -              ev->y = ty - _editor.get_trackview_group_vertical_offset();
 +              ev->y = ty;
                _editor.drags()->motion_handler ((GdkEvent *) ev, false);
                _editor.maybe_autoscroll (false, true, false, ev->y_root < _resize_drag_start);
  
@@@ -514,7 -543,7 +514,7 @@@ TimeAxisView::set_height (uint32_t h
                (*i)->set_height ();
        }
  
 -      if (canvas_item_visible (selection_group)) {
 +      if (selection_group->visible ()) {
                /* resize the selection rect */
                show_selection (_editor.get_selection().time);
        }
@@@ -776,11 -805,14 +776,11 @@@ TimeAxisView::build_display_menu (
  }
  
  void
 -TimeAxisView::set_samples_per_unit (double spu)
 +TimeAxisView::set_samples_per_pixel (double fpp)
  {
        for (Children::iterator i = children.begin(); i != children.end(); ++i) {
 -              (*i)->set_samples_per_unit (spu);
 +              (*i)->set_samples_per_pixel (fpp);
        }
 -
 -      AnalysisFeatureList::const_iterator i;
 -      list<ArdourCanvas::SimpleLine*>::iterator l;
  }
  
  void
@@@ -811,7 -843,7 +811,7 @@@ TimeAxisView::show_selection (TimeSelec
                (*i)->show_selection (ts);
        }
  
 -      if (canvas_item_visible (selection_group)) {
 +      if (selection_group->visible ()) {
                while (!used_selection_rects.empty()) {
                        free_selection_rects.push_front (used_selection_rects.front());
                        used_selection_rects.pop_front();
  
                rect = get_selection_rect ((*i).id);
  
 -              x1 = _editor.frame_to_unit (start);
 -              x2 = _editor.frame_to_unit (start + cnt - 1);
 +              x1 = _editor.sample_to_pixel (start);
 +              x2 = _editor.sample_to_pixel (start + cnt - 1);
                y2 = current_height();
  
 -              rect->rect->property_x1() = x1;
 -              rect->rect->property_y1() = 1.0;
 -              rect->rect->property_x2() = x2;
 -              rect->rect->property_y2() = y2;
 +              rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2));
  
                // trim boxes are at the top for selections
  
                if (x2 > x1) {
 -                      rect->start_trim->property_x1() = x1;
 -                      rect->start_trim->property_y1() = 1.0;
 -                      rect->start_trim->property_x2() = x1 + trim_handle_size;
 -                      rect->start_trim->property_y2() = y2;
 -
 -                      rect->end_trim->property_x1() = x2 - trim_handle_size;
 -                      rect->end_trim->property_y1() = 1.0;
 -                      rect->end_trim->property_x2() = x2;
 -                      rect->end_trim->property_y2() = y2;
 +                      rect->start_trim->set (ArdourCanvas::Rect (x1, 1, x1 + trim_handle_size, y2));
 +                      rect->end_trim->set (ArdourCanvas::Rect (x2 - trim_handle_size, 1, x2, y2));
  
                        rect->start_trim->show();
                        rect->end_trim->show();
@@@ -872,7 -914,7 +872,7 @@@ TimeAxisView::reshow_selection (TimeSel
  void
  TimeAxisView::hide_selection ()
  {
 -      if (canvas_item_visible (selection_group)) {
 +      if (selection_group->visible ()) {
                while (!used_selection_rects.empty()) {
                        free_selection_rects.push_front (used_selection_rects.front());
                        used_selection_rects.pop_front();
@@@ -940,26 -982,29 +940,26 @@@ TimeAxisView::get_selection_rect (uint3
  
                rect = new SelectionRect;
  
 -              rect->rect = new SimpleRect (*selection_group);
 -              rect->rect->property_outline_what() = 0x0;
 -              rect->rect->property_x1() = 0.0;
 -              rect->rect->property_y1() = 0.0;
 -              rect->rect->property_x2() = 0.0;
 -              rect->rect->property_y2() = 0.0;
 -              rect->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
 +              rect->rect = new ArdourCanvas::Rectangle (selection_group);
 +              CANVAS_DEBUG_NAME (rect->rect, "selection rect");
 +              rect->rect->set_outline (false);
 +              rect->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
  
 -              rect->start_trim = new SimpleRect (*selection_group);
 -              rect->start_trim->property_outline_what() = 0x0;
 -              rect->start_trim->property_x1() = 0.0;
 -              rect->start_trim->property_x2() = 0.0;
 +              rect->start_trim = new ArdourCanvas::Rectangle (selection_group);
 +              CANVAS_DEBUG_NAME (rect->rect, "selection rect start trim");
 +              rect->start_trim->set_outline (false);
 +              rect->start_trim->set_fill (false);
  
 -              rect->end_trim = new SimpleRect (*selection_group);
 -              rect->end_trim->property_outline_what() = 0x0;
 -              rect->end_trim->property_x1() = 0.0;
 -              rect->end_trim->property_x2() = 0.0;
 +              rect->end_trim = new ArdourCanvas::Rectangle (selection_group);
 +              CANVAS_DEBUG_NAME (rect->rect, "selection rect end trim");
 +              rect->end_trim->set_outline (false);
 +              rect->end_trim->set_fill (false);
  
                free_selection_rects.push_front (rect);
  
 -              rect->rect->signal_event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
 -              rect->start_trim->signal_event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
 -              rect->end_trim->signal_event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
 +              rect->rect->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
 +              rect->start_trim->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
 +              rect->end_trim->Event.connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
        }
  
        rect = free_selection_rects.front();
@@@ -1119,26 -1164,26 +1119,26 @@@ TimeAxisView::color_handler (
  
        for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
  
 -              (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
 -              (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -
 -              (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -              (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 +              (*i)->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
 +              (*i)->rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
  
 -              (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -              (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 +              (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              
 +              (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
        }
 -
 +      
        for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
 -
 -              (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
 -              (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -
 -              (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -              (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -
 -              (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 -              (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
 +              
 +              (*i)->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
 +              (*i)->rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              
 +              (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              
 +              (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
 +              (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
        }
  }
  
diff --combined wscript
index 27db93b18c99cf7710580c540d04adefa771eb2d,6e51d3d24d18ea472cce4090cc27af2b9617745f..dc9c37525f003cb3a9b04bbc3929d8ec5a1294ce
+++ b/wscript
@@@ -34,7 -34,6 +34,7 @@@ children = 
          'libs/gtkmm2ext',
          'libs/clearlooks-newer',
          'libs/audiographer',
 +        'libs/canvas',
          'gtk2_ardour',
          'export',
          'midi_maps',
@@@ -365,8 -364,6 +365,8 @@@ def set_compiler_flags (conf,opt)
  
      conf.env.append_value('CXXFLAGS', '-D__STDC_LIMIT_MACROS')
      conf.env.append_value('CXXFLAGS', '-D__STDC_FORMAT_MACROS')
 +    conf.env.append_value('CXXFLAGS', '-DCANVAS_COMPATIBILITY')
 +    conf.env.append_value('CXXFLAGS', '-DCANVAS_DEBUG')
  
      if opt.nls:
          conf.env.append_value('CXXFLAGS', '-DENABLE_NLS')
@@@ -519,6 -516,7 +519,7 @@@ def configure(conf)
      if Options.options.freebie:
          conf.env.append_value ('CFLAGS', '-DNO_PLUGIN_STATE')
          conf.env.append_value ('CXXFLAGS', '-DNO_PLUGIN_STATE')
+         conf.define ('NO_PLUGIN_STATE', 1)
  
      if sys.platform == 'darwin':
  
          conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'AudioToolbox', '-framework', 'AudioUnit'])
          conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Cocoa'])
  
-         if not Options.options.freebie:
-             conf.env.append_value('CXXFLAGS_AUDIOUNITS')
          if re.search ("^[1-9][0-9]\.", os.uname()[2]) == None and not Options.options.nocarbon:
              conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DWITH_CARBON")
              conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Carbon'])
@@@ -688,7 -683,7 +686,7 @@@ const char* const ardour_config_info = 
      write_config_text('Architecture flags',    opts.arch)
      write_config_text('Aubio',                 conf.is_defined('HAVE_AUBIO'))
      write_config_text('AudioUnits',            conf.is_defined('AUDIOUNIT_SUPPORT'))
-     write_config_text('AU state support',      conf.is_defined('AU_STATE_SUPPORT'))
+     write_config_text('No plugin state',       conf.is_defined('NO_PLUGIN_STATE'))
      write_config_text('Build target',          conf.env['build_target'])
      write_config_text('CoreAudio',             conf.is_defined('HAVE_COREAUDIO'))
      write_config_text('Debug RT allocations',  conf.is_defined('DEBUG_RT_ALLOC'))