changeset 811:c4ef666721bf

Merge from branch warnfix_no_size_t
author Chris Cannam
date Wed, 18 Jun 2014 13:51:27 +0100
parents ddae586bc47b (current diff) 40c6c9344ff6 (diff)
children 6c52314b31b0 f82dece35d21
files
diffstat 61 files changed, 1011 insertions(+), 862 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -41,7 +41,6 @@
     m_model(0),
     m_cache(0),
     m_peaksCache(0),
-    m_peakResolution(256),
     m_cacheValidStart(0),
     m_cacheValidEnd(0),
     m_colourScale(LinearScale),
@@ -55,6 +54,7 @@
     m_invertVertical(false),
     m_opaque(false),
     m_smooth(false),
+    m_peakResolution(256),
     m_miny(0),
     m_maxy(0)
 {
@@ -78,8 +78,8 @@
     connectSignals(m_model);
 
     connect(m_model, SIGNAL(modelChanged()), this, SLOT(modelChanged()));
-    connect(m_model, SIGNAL(modelChanged(size_t, size_t)),
-	    this, SLOT(modelChanged(size_t, size_t)));
+    connect(m_model, SIGNAL(modelChanged(int, int)),
+	    this, SLOT(modelChanged(int, int)));
 
     m_peakResolution = 256;
     if (model->getResolution() > 512) {
@@ -107,13 +107,13 @@
 }
 
 void
-Colour3DPlotLayer::cacheInvalid(size_t startFrame, size_t endFrame)
+Colour3DPlotLayer::cacheInvalid(int startFrame, int endFrame)
 {
     if (!m_cache) return;
 
-    size_t modelResolution = m_model->getResolution();
-    size_t start = startFrame / modelResolution;
-    size_t end = endFrame / modelResolution + 1;
+    int modelResolution = m_model->getResolution();
+    int start = startFrame / modelResolution;
+    int end = endFrame / modelResolution + 1;
     if (m_cacheValidStart < end) m_cacheValidStart = end;
     if (m_cacheValidEnd > start) m_cacheValidEnd = start;
     if (m_cacheValidStart > m_cacheValidEnd) m_cacheValidEnd = m_cacheValidStart;
@@ -135,7 +135,7 @@
 }
 
 void
-Colour3DPlotLayer::modelChanged(size_t startFrame, size_t endFrame)
+Colour3DPlotLayer::modelChanged(int startFrame, int endFrame)
 {
     if (!m_colourScaleSet && m_colourScale == LinearScale) {
         if (m_model && m_model->getWidth() > 50) {
@@ -580,8 +580,8 @@
 }
 
 bool
-Colour3DPlotLayer::getYScaleValue(const View *v, int y,
-                                  float &value, QString &unit) const
+Colour3DPlotLayer::getYScaleValue(const View *, int,
+                                  float &, QString &) const
 {
     return false;//!!!
 }
@@ -679,8 +679,8 @@
     int x = pos.x();
     int y = pos.y();
 
-    size_t modelStart = m_model->getStartFrame();
-    size_t modelResolution = m_model->getResolution();
+    int modelStart = m_model->getStartFrame();
+    int modelResolution = m_model->getResolution();
 
     float srRatio =
         float(v->getViewManager()->getMainModelSampleRate()) /
@@ -745,7 +745,7 @@
     int tw = paint.fontMetrics().width(sampleText);
     bool another = false;
 
-    for (size_t i = 0; i < m_model->getHeight(); ++i) {
+    for (int i = 0; i < m_model->getHeight(); ++i) {
 	if (m_model->getBinName(i).length() > sampleText.length()) {
 	    sampleText = m_model->getBinName(i);
             another = true;
@@ -857,7 +857,7 @@
 
     int py = h;
 
-    for (size_t i = symin; i <= symax; ++i) {
+    for (int i = symin; i <= symax; ++i) {
 
         int y0;
 
@@ -884,7 +884,7 @@
 
         if (i > symin) {
 
-            size_t idx = i - 1;
+            int idx = i - 1;
             if (m_invertVertical) idx = m_model->getHeight() - idx - 1;
 
             QString text = m_model->getBinName(idx);
@@ -901,7 +901,7 @@
 }
 
 DenseThreeDimensionalModel::Column
-Colour3DPlotLayer::getColumn(size_t col) const
+Colour3DPlotLayer::getColumn(int col) const
 {
     DenseThreeDimensionalModel::Column values = m_model->getColumn(col);
     while (values.size() < m_model->getHeight()) values.push_back(0.f);
@@ -913,13 +913,13 @@
     min = m_model->getMinimumLevel();
     max = m_model->getMaximumLevel();
 
-    for (size_t y = 0; y < values.size(); ++y) {
+    for (int y = 0; y < values.size(); ++y) {
         if (y == 0 || values.at(y) > colMax) colMax = values.at(y);
         if (y == 0 || values.at(y) < colMin) colMin = values.at(y);
     }
     if (colMin == colMax) colMax = colMin + 1;
     
-    for (size_t y = 0; y < values.size(); ++y) {
+    for (int y = 0; y < values.size(); ++y) {
     
         float value = values.at(y);
         float norm = (value - colMin) / (colMax - colMin);
@@ -930,7 +930,7 @@
 
     if (m_normalizeHybrid && (colMax > 0.0)) {
         float logmax = log10(colMax);
-        for (size_t y = 0; y < values.size(); ++y) {
+        for (int y = 0; y < values.size(); ++y) {
             values[y] *= logmax;
         }
     }
@@ -939,24 +939,24 @@
 }
     
 void
-Colour3DPlotLayer::fillCache(size_t firstBin, size_t lastBin) const
+Colour3DPlotLayer::fillCache(int firstBin, int lastBin) const
 {
     Profiler profiler("Colour3DPlotLayer::fillCache");
 
-    size_t modelStart = m_model->getStartFrame();
-    size_t modelEnd = m_model->getEndFrame();
-    size_t modelResolution = m_model->getResolution();
+    int modelStart = m_model->getStartFrame();
+    int modelEnd = m_model->getEndFrame();
+    int modelResolution = m_model->getResolution();
 
 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
     SVDEBUG << "Colour3DPlotLayer::fillCache: " << firstBin << " -> " << lastBin << endl;
 #endif
 
-    size_t modelStartBin = modelStart / modelResolution;
-    size_t modelEndBin = modelEnd / modelResolution;
+    int modelStartBin = modelStart / modelResolution;
+    int modelEndBin = modelEnd / modelResolution;
 
-    size_t cacheWidth = modelEndBin - modelStartBin + 1;
+    int cacheWidth = modelEndBin - modelStartBin + 1;
     if (lastBin > modelEndBin) cacheWidth = lastBin - modelStartBin + 1;
-    size_t cacheHeight = m_model->getHeight();
+    int cacheHeight = m_model->getHeight();
 
     if (m_cache && (m_cache->height() != int(cacheHeight))) {
         // height has changed: delete everything rather than resizing
@@ -1010,8 +1010,8 @@
         return;
     }
     
-    size_t fillStart = firstBin;
-    size_t fillEnd = lastBin;
+    int fillStart = firstBin;
+    int fillEnd = lastBin;
 
     if (fillStart < modelStartBin) fillStart = modelStartBin;
     if (fillStart > modelEndBin) fillStart = modelEndBin;
@@ -1083,13 +1083,13 @@
 
     if (normalizeVisible) {
         
-        for (size_t c = fillStart; c <= fillEnd; ++c) {
+        for (int c = fillStart; c <= fillEnd; ++c) {
 	
             values = getColumn(c);
 
             float colMax = 0.f, colMin = 0.f;
 
-            for (size_t y = 0; y < cacheHeight; ++y) {
+            for (int y = 0; y < cacheHeight; ++y) {
                 if (y >= values.size()) break;
                 if (y == 0 || values[y] > colMax) colMax = values[y];
                 if (y == 0 || values[y] < colMin) colMin = values[y];
@@ -1125,7 +1125,7 @@
         }
     }
 
-    for (size_t c = fillStart; c <= fillEnd; ++c) {
+    for (int c = fillStart; c <= fillEnd; ++c) {
 	
         values = getColumn(c);
 
@@ -1135,7 +1135,7 @@
             continue;
         }
 
-        for (size_t y = 0; y < cacheHeight; ++y) {
+        for (int y = 0; y < cacheHeight; ++y) {
 
             float value = min;
             if (y < values.size()) {
@@ -1172,16 +1172,16 @@
         }
 
         if (peaks) {
-            size_t notch = (c % m_peakResolution);
+            int notch = (c % m_peakResolution);
             if (notch == m_peakResolution-1 || c == fillEnd) {
-                size_t pc = c / m_peakResolution;
+                int pc = c / m_peakResolution;
                 if (pc >= m_peaksCache->width()) {
                     cerr << "ERROR: peak column " << pc
                          << " (from col " << c << ") >= peaks cache width "
                          << m_peaksCache->width() << endl;
                     continue;
                 }
-                for (size_t y = 0; y < cacheHeight; ++y) {
+                for (int y = 0; y < cacheHeight; ++y) {
                     if (m_invertVertical) {
                         m_peaksCache->setPixel(pc, cacheHeight - y - 1, peaks[y]);
                     } else {
@@ -1228,9 +1228,9 @@
 
     if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->rect();
 
-    size_t modelStart = m_model->getStartFrame();
-    size_t modelEnd = m_model->getEndFrame();
-    size_t modelResolution = m_model->getResolution();
+    int modelStart = m_model->getStartFrame();
+    int modelEnd = m_model->getEndFrame();
+    int modelResolution = m_model->getResolution();
 
     // The cache is from the model's start frame to the model's end
     // frame at the model's window increment frames per pixel.  We
@@ -1585,7 +1585,7 @@
 
 bool
 Colour3DPlotLayer::snapToFeatureFrame(View *v, int &frame,
-				      size_t &resolution,
+				      int &resolution,
 				      SnapType snap) const
 {
     if (!m_model) {
--- a/layer/Colour3DPlotLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/Colour3DPlotLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -57,7 +57,7 @@
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame, 
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
 
     virtual void setLayerDormant(const View *v, bool dormant);
@@ -166,17 +166,17 @@
 
 protected slots:
     void cacheInvalid();
-    void cacheInvalid(size_t startFrame, size_t endFrame);
+    void cacheInvalid(int startFrame, int endFrame);
     void modelChanged();
-    void modelChanged(size_t, size_t);
+    void modelChanged(int, int);
 
 protected:
     const DenseThreeDimensionalModel *m_model; // I do not own this
     
     mutable QImage *m_cache;
     mutable QImage *m_peaksCache;
-    mutable size_t m_cacheValidStart;
-    mutable size_t m_cacheValidEnd;
+    mutable int m_cacheValidStart;
+    mutable int m_cacheValidEnd;
 
     ColourScale m_colourScale;
     bool        m_colourScaleSet;
@@ -189,7 +189,7 @@
     bool        m_invertVertical;
     bool        m_opaque;
     bool        m_smooth;
-    size_t      m_peakResolution;
+    int         m_peakResolution;
 
     // Minimum and maximum bin numbers visible within the view. We
     // always snap to whole bins at view edges.
@@ -212,10 +212,10 @@
      */
     float getBinForY(View *, float y) const;
     
-    DenseThreeDimensionalModel::Column getColumn(size_t col) const;
+    DenseThreeDimensionalModel::Column getColumn(int col) const;
 
     int getColourScaleWidth(QPainter &) const;
-    void fillCache(size_t firstBin, size_t lastBin) const;
+    void fillCache(int firstBin, int lastBin) const;
     void paintDense(View *v, QPainter &paint, QRect rect) const;
 };
 
--- a/layer/ColourMapper.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/ColourMapper.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -278,6 +278,16 @@
     case HighGain:
         return true;
 
+    case DefaultColours:
+    case Sunset:
+    case WhiteOnBlack:
+    case RedOnBlue:
+    case YellowOnBlack:
+    case BlueOnBlack:
+    case FruitSalad:
+    case Banded:
+    case Highlight:
+        
     default:
         return false;
     }
--- a/layer/FlexiNoteLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/FlexiNoteLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -61,14 +61,14 @@
 
     m_model(0),
     m_editing(false),
+    m_intelligentActions(true),
     m_originalPoint(0, 0.0, 0, 1.f, tr("New Point")),
     m_editingPoint(0, 0.0, 0, 1.f, tr("New Point")),
     m_editingCommand(0),
     m_verticalScale(AutoAlignScale),
     m_editMode(DragNote),
     m_scaleMinimum(34), 
-    m_scaleMaximum(77),
-    m_intelligentActions(true)
+    m_scaleMaximum(77)
 {
 }
 
@@ -403,7 +403,7 @@
 {
     if (!m_model) return FlexiNoteModel::PointList();
 
-    long frame = v->getFrameForX(x);
+    int frame = v->getFrameForX(x);
 
     FlexiNoteModel::PointList onPoints =
         m_model->getPoints(frame);
@@ -421,11 +421,11 @@
 
     if (prevPoints.empty()) {
         usePoints = nextPoints;
-    } else if (long(prevPoints.begin()->frame) < v->getStartFrame() &&
+    } else if (prevPoints.begin()->frame < v->getStartFrame() &&
                !(nextPoints.begin()->frame > v->getEndFrame())) {
         usePoints = nextPoints;
-    } else if (long(nextPoints.begin()->frame) - frame <
-               frame - long(prevPoints.begin()->frame)) {
+    } else if (nextPoints.begin()->frame - frame <
+               frame - prevPoints.begin()->frame) {
         usePoints = nextPoints;
     }
 
@@ -446,7 +446,7 @@
 {
     if (!m_model) return false;
 
-    long frame = v->getFrameForX(x);
+    int frame = v->getFrameForX(x);
 
     FlexiNoteModel::PointList onPoints = m_model->getPoints(frame);
     if (onPoints.empty()) return false;
@@ -475,7 +475,7 @@
     // GF: find the note that is closest to the cursor
     if (!m_model) return false;
 
-    long frame = v->getFrameForX(x);
+    int frame = v->getFrameForX(x);
 
     FlexiNoteModel::PointList onPoints = m_model->getPoints(frame);
     if (onPoints.empty()) return false;
@@ -588,7 +588,7 @@
 
 bool
 FlexiNoteLayer::snapToFeatureFrame(View *v, int &frame,
-                                   size_t &resolution,
+                                   int &resolution,
                                    SnapType snap) const
 {
     if (!m_model) {
@@ -798,8 +798,8 @@
 //    Profiler profiler("FlexiNoteLayer::paint", true);
 
     int x0 = rect.left(), x1 = rect.right();
-    long frame0 = v->getFrameForX(x0);
-    long frame1 = v->getFrameForX(x1);
+    int frame0 = v->getFrameForX(x0);
+    int frame1 = v->getFrameForX(x1);
 
     FlexiNoteModel::PointList points(m_model->getPoints(frame0, frame1));
     if (points.empty()) return;
@@ -847,28 +847,42 @@
         paint.setPen(getBaseQColor());
         paint.setBrush(brushColour);
 
-        // if (shouldIlluminate &&
-        //         // "illuminatePoint == p"
-        //         !FlexiNoteModel::Point::Comparator()(illuminatePoint, p) &&
-        //         !FlexiNoteModel::Point::Comparator()(p, illuminatePoint)) {
-        // 
-        //         paint.setPen(v->getForeground());
-        //         paint.setBrush(v->getForeground());
-        // 
-        //         QString vlabel = QString("%1%2").arg(p.value).arg(m_model->getScaleUnits());
-        //         v->drawVisibleText(paint, 
-        //                            x - paint.fontMetrics().width(vlabel) - 2,
-        //                            y + paint.fontMetrics().height()/2
-        //                              - paint.fontMetrics().descent(), 
-        //                            vlabel, View::OutlinedText);
-        // 
-        //         QString hlabel = RealTime::frame2RealTime
-        //             (p.frame, m_model->getSampleRate()).toText(true).c_str();
-        //         v->drawVisibleText(paint, 
-        //                            x,
-        //                            y - h/2 - paint.fontMetrics().descent() - 2,
-        //                            hlabel, View::OutlinedText);
-        // }
+        if (shouldIlluminate &&
+                // "illuminatePoint == p"
+                !FlexiNoteModel::Point::Comparator()(illuminatePoint, p) &&
+                !FlexiNoteModel::Point::Comparator()(p, illuminatePoint)) {
+
+                paint.drawLine(x, -1, x, v->height() + 1);
+                paint.drawLine(x+w, -1, x+w, v->height() + 1);
+        
+                paint.setPen(v->getForeground());
+                // paint.setBrush(v->getForeground());
+        
+                QString vlabel = QString("freq: %1%2").arg(p.value).arg(m_model->getScaleUnits());
+                // v->drawVisibleText(paint, 
+                //                    x - paint.fontMetrics().width(vlabel) - 2,
+                //                    y + paint.fontMetrics().height()/2
+                //                      - paint.fontMetrics().descent(), 
+                //                    vlabel, View::OutlinedText);
+                v->drawVisibleText(paint, 
+                                   x,
+                                   y - h/2 - 2 - paint.fontMetrics().height()
+                                     - paint.fontMetrics().descent(), 
+                                   vlabel, View::OutlinedText);
+
+                QString hlabel = "dur: " + QString(RealTime::frame2RealTime
+                    (p.duration, m_model->getSampleRate()).toText(true).c_str());
+                v->drawVisibleText(paint, 
+                                   x,
+                                   y - h/2 - paint.fontMetrics().descent() - 2,
+                                   hlabel, View::OutlinedText);
+
+                QString llabel = QString("%1").arg(p.label);
+                v->drawVisibleText(paint, 
+                                   x,
+                                   y + h + 2 + paint.fontMetrics().descent(),
+                                   llabel, View::OutlinedText);
+        }
     
         paint.drawRect(x, y - h/2, w, h);
     }
@@ -935,7 +949,7 @@
 
     if (!m_model) return;
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
@@ -959,14 +973,14 @@
 
     if (!m_model || !m_editing) return;
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
     float newValue = getValueForY(v, e->y());
 
-    long newFrame = m_editingPoint.frame;
-    long newDuration = frame - newFrame;
+    int newFrame = m_editingPoint.frame;
+    int newDuration = frame - newFrame;
     if (newDuration < 0) {
         newFrame = frame;
         newDuration = -newDuration;
@@ -1007,7 +1021,7 @@
 }
 
 void
-FlexiNoteLayer::eraseDrag(View *v, QMouseEvent *e)
+FlexiNoteLayer::eraseDrag(View *, QMouseEvent *)
 {
 }
 
@@ -1058,11 +1072,11 @@
     m_dragStartX = e->x();
     m_dragStartY = e->y();
     
-    long onset = m_originalPoint.frame;
-    long offset = m_originalPoint.frame + m_originalPoint.duration - 1;
+    int onset = m_originalPoint.frame;
+    int offset = m_originalPoint.frame + m_originalPoint.duration - 1;
     
     m_greatestLeftNeighbourFrame = -1;
-    m_smallestRightNeighbourFrame = std::numeric_limits<long>::max();
+    m_smallestRightNeighbourFrame = std::numeric_limits<int>::max();
     
     for (FlexiNoteModel::PointList::const_iterator i = m_model->getPoints().begin();
          i != m_model->getPoints().end(); ++i) {
@@ -1095,7 +1109,7 @@
     int newx = m_dragPointX + xdist;
     int newy = m_dragPointY + ydist;
 
-    long dragFrame = v->getFrameForX(newx);
+    int dragFrame = v->getFrameForX(newx);
     if (dragFrame < 0) dragFrame = 0;
     dragFrame = dragFrame / m_model->getResolution() * m_model->getResolution();
     
@@ -1140,6 +1154,8 @@
         m_editingPoint.value = value;
         break;
     }
+    case SplitNote: // nothing
+        break;
     }
     updateNoteValue(v, m_editingPoint);
     m_editingCommand->addPoint(m_editingPoint);
@@ -1148,7 +1164,7 @@
 }
 
 void
-FlexiNoteLayer::editEnd(View *v, QMouseEvent *e)
+FlexiNoteLayer::editEnd(View *, QMouseEvent *e)
 {
 //    SVDEBUG << "FlexiNoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << endl;
     std::cerr << "FlexiNoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl;
@@ -1215,7 +1231,7 @@
         return; 
     }
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
 
     splitNotesAt(v, frame, e);
 }
@@ -1272,24 +1288,27 @@
     std::cerr << "addNote" << std::endl;
     if (!m_model) return;
 
-    long duration = 10000;
+    int duration = 10000;
     
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     float value = getValueForY(v, e->y());
     
+    FlexiNoteModel::PointList noteList = m_model->getPoints();
+
     if (m_intelligentActions) {
-        long smallestRightNeighbourFrame = 0;
-        for (FlexiNoteModel::PointList::const_iterator i = m_model->getPoints().begin();
-             i != m_model->getPoints().end(); ++i) {
+        int smallestRightNeighbourFrame = 0;
+        for (FlexiNoteModel::PointList::const_iterator i = noteList.begin();
+             i != noteList.end(); ++i) {
             FlexiNote currentNote = *i;
             if (currentNote.frame > frame) {
                 smallestRightNeighbourFrame = currentNote.frame;
                 break;
             }
         }
-        
-        duration = std::min(smallestRightNeighbourFrame - frame + 1, duration);
-        duration = (duration > 0) ? duration : 0;
+        if (smallestRightNeighbourFrame > 0) {
+            duration = std::min(smallestRightNeighbourFrame - frame + 1, duration);
+            duration = (duration > 0) ? duration : 0;
+        }
     }
 
     if (!m_intelligentActions || 
@@ -1311,7 +1330,7 @@
 
     for (int i = 0; i < v->getLayerCount(); ++i) {
         Layer *layer = v->getLayer(i);
-        if (layer && !layer->isLayerDormant(v) && 
+        if (layer &&
             layer->getLayerPresentationName() != "candidate") {
             cerr << "FlexiNoteLayer::getAssociatedPitchModel: looks like our layer is " << layer << endl;
             SparseTimeValueModel *model = qobject_cast<SparseTimeValueModel *>
@@ -1435,7 +1454,7 @@
     if (pitchValues.empty()) return false;
 
     sort(pitchValues.begin(), pitchValues.end());
-    size_t size = pitchValues.size();
+    int size = pitchValues.size();
     double median;
 
     if (size % 2 == 0) {
@@ -1472,7 +1491,7 @@
 
     v->setCursor(Qt::ArrowCursor);
 
-    // std::cerr << "Mouse moved in edit mode over FlexiNoteLayer" << std::endl;
+    std::cerr << "Mouse moved in edit mode over FlexiNoteLayer" << std::endl;
     // v->setCursor(Qt::SizeHorCursor);
 
 }
@@ -1550,7 +1569,7 @@
 }
 
 void
-FlexiNoteLayer::moveSelection(Selection s, size_t newStartFrame)
+FlexiNoteLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -1636,6 +1655,31 @@
 }    
 
 void
+FlexiNoteLayer::deleteSelectionInclusive(Selection s)
+{
+    if (!m_model) return;
+
+    FlexiNoteModel::EditCommand *command =
+        new FlexiNoteModel::EditCommand(m_model, tr("Delete Selected Points"));
+
+    FlexiNoteModel::PointList points =
+        m_model->getPoints(s.getStartFrame(), s.getEndFrame());
+
+    for (FlexiNoteModel::PointList::iterator i = points.begin();
+         i != points.end(); ++i) {
+        bool overlap = !(
+            ((s.getStartFrame() <= i->frame) && (s.getEndFrame() <= i->frame)) || // selection is left of note
+            ((s.getStartFrame() >= (i->frame+i->duration)) && (s.getEndFrame() >= (i->frame+i->duration))) // selection is right of note
+            );
+        if (overlap) {
+            command->deletePoint(*i);
+        }
+    }
+
+    finish(command);
+}
+
+void
 FlexiNoteLayer::copy(View *v, Selection s, Clipboard &to)
 {
     if (!m_model) return;
@@ -1654,7 +1698,7 @@
 }
 
 bool
-FlexiNoteLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */)
+FlexiNoteLayer::paste(View *v, const Clipboard &from, int /*frameOffset */, bool /* interactive */)
 {
     if (!m_model) return false;
 
@@ -1686,7 +1730,7 @@
          i != points.end(); ++i) {
         
         if (!i->haveFrame()) continue;
-        size_t frame = 0;
+        int frame = 0;
 
         if (!realign) {
             
@@ -1711,7 +1755,7 @@
         if (i->haveLevel()) newPoint.level = i->getLevel();
         if (i->haveDuration()) newPoint.duration = i->getDuration();
         else {
-            size_t nextFrame = frame;
+            int nextFrame = frame;
             Clipboard::PointList::const_iterator j = i;
             for (; j != points.end(); ++j) {
                 if (!j->haveFrame()) continue;
@@ -1735,13 +1779,13 @@
 }
 
 void
-FlexiNoteLayer::addNoteOn(long frame, int pitch, int velocity)
+FlexiNoteLayer::addNoteOn(int frame, int pitch, int velocity)
 {
     m_pendingNoteOns.insert(FlexiNote(frame, pitch, 0, float(velocity) / 127.0, ""));
 }
 
 void
-FlexiNoteLayer::addNoteOff(long frame, int pitch)
+FlexiNoteLayer::addNoteOff(int frame, int pitch)
 {
     for (FlexiNoteSet::iterator i = m_pendingNoteOns.begin();
          i != m_pendingNoteOns.end(); ++i) {
@@ -1790,13 +1834,14 @@
 {
     SingleColourLayer::setProperties(attributes);
 
-    bool ok, alsoOk;
+    bool ok;
     VerticalScale scale = (VerticalScale)
         attributes.value("verticalScale").toInt(&ok);
     if (ok) setVerticalScale(scale);
 
-    float min = attributes.value("scaleMinimum").toFloat(&ok);
-    float max = attributes.value("scaleMaximum").toFloat(&alsoOk);
+//    bool alsoOk;
+//    float min = attributes.value("scaleMinimum").toFloat(&ok);
+//    float max = attributes.value("scaleMaximum").toFloat(&alsoOk);
 //    if (ok && alsoOk && min != max) setDisplayExtents(min, max);
 }
 
--- a/layer/FlexiNoteLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/FlexiNoteLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -46,7 +46,7 @@
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-                    size_t &resolution,
+                    int &resolution,
                     SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -70,9 +70,10 @@
 
     virtual bool editOpen(View *v, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
+    virtual void deleteSelectionInclusive(Selection s);
 
     virtual void copy(View *v, Selection s, Clipboard &to);
     virtual bool paste(View *v, const Clipboard &from, int frameOffset,
@@ -137,13 +138,13 @@
      * not be finally added to the layer until the corresponding
      * note-off.
      */
-    void addNoteOn(long frame, int pitch, int velocity);
+    void addNoteOn(int frame, int pitch, int velocity);
     
     /**
      * Add a note-off.  This will cause a note to appear, if and only
      * if there is a matching pending note-on.
      */
-    void addNoteOff(long frame, int pitch);
+    void addNoteOff(int frame, int pitch);
 
     /**
      * Abandon all pending note-on events.
@@ -186,8 +187,8 @@
     int m_dragStartY;
     FlexiNoteModel::Point m_originalPoint;
     FlexiNoteModel::Point m_editingPoint;
-    long m_greatestLeftNeighbourFrame;
-    long m_smallestRightNeighbourFrame;
+    int m_greatestLeftNeighbourFrame;
+    int m_smallestRightNeighbourFrame;
     FlexiNoteModel::EditCommand *m_editingCommand;
     VerticalScale m_verticalScale;
     EditMode m_editMode;
--- a/layer/ImageLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/ImageLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -78,7 +78,7 @@
 }
 
 QString
-ImageLayer::getPropertyLabel(const PropertyName &name) const
+ImageLayer::getPropertyLabel(const PropertyName &) const
 {
     return "";
 }
@@ -116,14 +116,14 @@
 }
 
 bool
-ImageLayer::isLayerScrollable(const View *v) const
+ImageLayer::isLayerScrollable(const View *) const
 {
     return true;
 }
 
 
 ImageModel::PointList
-ImageLayer::getLocalPoints(View *v, int x, int y) const
+ImageLayer::getLocalPoints(View *v, int x, int ) const
 {
     if (!m_model) return ImageModel::PointList();
 
@@ -185,9 +185,9 @@
 	}
     }
 
-    long useFrame = points.begin()->frame;
+//    int useFrame = points.begin()->frame;
 
-    RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate());
+//    RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate());
 
     QString text;
 /*    
@@ -209,7 +209,7 @@
 
 bool
 ImageLayer::snapToFeatureFrame(View *v, int &frame,
-			      size_t &resolution,
+			      int &resolution,
 			      SnapType snap) const
 {
     if (!m_model) {
@@ -292,8 +292,8 @@
 //    int x0 = rect.left(), x1 = rect.right();
     int x0 = 0, x1 = v->width();
 
-    long frame0 = v->getFrameForX(x0);
-    long frame1 = v->getFrameForX(x1);
+    int frame0 = v->getFrameForX(x0);
+    int frame1 = v->getFrameForX(x1);
 
     ImageModel::PointList points(m_model->getPoints(frame0, frame1));
     if (points.empty()) return;
@@ -519,8 +519,6 @@
 QImage 
 ImageLayer::getImage(View *v, QString name, QSize maxSize) const
 {
-    bool need = false;
-
 //    SVDEBUG << "ImageLayer::getImage(" << v << ", " << name << ", ("
 //              << maxSize.width() << "x" << maxSize.height() << "))" << endl;
 
@@ -565,7 +563,7 @@
 	return;
     }
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
@@ -586,7 +584,7 @@
 
     if (!m_model || !m_editing) return;
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
@@ -596,13 +594,11 @@
 }
 
 void
-ImageLayer::drawEnd(View *v, QMouseEvent *)
+ImageLayer::drawEnd(View *, QMouseEvent *)
 {
 //    SVDEBUG << "ImageLayer::drawEnd(" << e->x() << "," << e->y() << ")" << endl;
     if (!m_model || !m_editing) return;
 
-    bool ok = false;
-
     ImageDialog dialog(tr("Select image"), "", "");
 
     if (dialog.exec() == QDialog::Accepted) {
@@ -623,7 +619,7 @@
 }
 
 bool
-ImageLayer::addImage(long frame, QString url)
+ImageLayer::addImage(int frame, QString url)
 {
     QImage image(getLocalFilename(url));
     if (image.isNull()) {
@@ -668,8 +664,8 @@
 {
     if (!m_model || !m_editing) return;
 
-    long frameDiff = v->getFrameForX(e->x()) - v->getFrameForX(m_editOrigin.x());
-    long frame = m_originalPoint.frame + frameDiff;
+    int frameDiff = v->getFrameForX(e->x()) - v->getFrameForX(m_editOrigin.x());
+    int frame = m_originalPoint.frame + frameDiff;
 
     if (frame < 0) frame = 0;
     frame = (frame / m_model->getResolution()) * m_model->getResolution();
@@ -727,7 +723,7 @@
 }    
 
 void
-ImageLayer::moveSelection(Selection s, size_t newStartFrame)
+ImageLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -823,7 +819,7 @@
 }
 
 bool
-ImageLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */)
+ImageLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */)
 {
     if (!m_model) return false;
 
@@ -856,7 +852,7 @@
         
         if (!i->haveFrame()) continue;
 
-        size_t frame = 0;
+        int frame = 0;
 
         if (!realign) {
             
@@ -970,7 +966,7 @@
 }
 
 void
-ImageLayer::setProperties(const QXmlAttributes &attributes)
+ImageLayer::setProperties(const QXmlAttributes &)
 {
 }
 
--- a/layer/ImageLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/ImageLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -43,7 +43,7 @@
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -54,7 +54,7 @@
     virtual void editDrag(View *v, QMouseEvent *);
     virtual void editEnd(View *v, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
 
@@ -98,7 +98,7 @@
 
     void setProperties(const QXmlAttributes &attributes);
 
-    virtual bool addImage(long frame, QString url); // using a command
+    virtual bool addImage(int frame, QString url); // using a command
 
 protected slots:
     void checkAddSources();
--- a/layer/Layer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/Layer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -51,8 +51,8 @@
     connect(model, SIGNAL(modelChanged()),
             this, SIGNAL(modelChanged()));
 
-    connect(model, SIGNAL(modelChanged(size_t, size_t)),
-	    this, SIGNAL(modelChanged(size_t, size_t)));
+    connect(model, SIGNAL(modelChangedWithin(int, int)),
+	    this, SIGNAL(modelChangedWithin(int, int)));
 
     connect(model, SIGNAL(completionChanged()),
 	    this, SIGNAL(modelCompletionChanged()));
@@ -165,8 +165,8 @@
     return true;
 }
 
-size_t
-Layer::alignToReference(View *v, size_t frame) const
+int
+Layer::alignToReference(View *v, int frame) const
 {
     const Model *m = getModel();
     SVDEBUG << "Layer::alignToReference(" << frame << "): model = " << m << ", alignment reference = " << (m ? m->getAlignmentReference() : 0) << endl;
@@ -177,8 +177,8 @@
     }
 }
 
-size_t
-Layer::alignFromReference(View *v, size_t frame) const
+int
+Layer::alignFromReference(View *v, int frame) const
 {
     const Model *m = getModel();
     SVDEBUG << "Layer::alignFromReference(" << frame << "): model = " << m << ", alignment reference = " << (m ? m->getAlignmentReference() : 0) << endl;
@@ -250,12 +250,12 @@
         // reference (i.e. having been copied from the reference
         // model).
         
-        long sourceFrame = i->getFrame();
-        long referenceFrame = sourceFrame;
+        int sourceFrame = i->getFrame();
+        int referenceFrame = sourceFrame;
         if (i->haveReferenceFrame()) {
             referenceFrame = i->getReferenceFrame();
         }
-        long myMappedFrame = alignToReference(v, sourceFrame);
+        int myMappedFrame = alignToReference(v, sourceFrame);
 
 //        cerr << "sourceFrame = " << sourceFrame << ", referenceFrame = " << referenceFrame << " (have = " << i->haveReferenceFrame() << "), myMappedFrame = " << myMappedFrame << endl;
 
@@ -320,8 +320,8 @@
     QString fs = attributes.value("startFrame");
     int x0 = 0, x1 = 0;
     if (fs != "") {
-        rect.startFrame = fs.toLong();
-        rect.endFrame = attributes.value("endFrame").toLong();
+        rect.startFrame = fs.toInt();
+        rect.endFrame = attributes.value("endFrame").toInt();
         rect.haveFrames = true;
     } else {
         x0 = attributes.value("startX").toInt();
@@ -405,7 +405,7 @@
 }
 
 void
-Layer::measureDoubleClick(View *v, QMouseEvent *e)
+Layer::measureDoubleClick(View *, QMouseEvent *)
 {
     // nothing, in the base class
 }
@@ -470,8 +470,8 @@
 void
 Layer::updateMeasurePixrects(View *v) const
 {
-    long sf = v->getStartFrame();
-    long ef = v->getEndFrame();
+    int sf = v->getStartFrame();
+    int ef = v->getEndFrame();
 
     for (MeasureRectSet::const_iterator i = m_measureRects.begin(); 
          i != m_measureRects.end(); ++i) {
@@ -495,7 +495,7 @@
             if (i->startFrame >= v->getStartFrame()) {
                 x0 = v->getXForFrame(i->startFrame);
             }
-            if (i->endFrame <= long(v->getEndFrame())) {
+            if (i->endFrame <= int(v->getEndFrame())) {
                 x1 = v->getXForFrame(i->endFrame);
             }
         }
@@ -577,7 +577,7 @@
         if (r.startFrame >= v->getStartFrame()) {
             x0 = v->getXForFrame(r.startFrame);
         }
-        if (r.endFrame <= long(v->getEndFrame())) {
+        if (r.endFrame <= v->getEndFrame()) {
             x1 = v->getXForFrame(r.endFrame);
         }
         
--- a/layer/Layer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/Layer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -150,7 +150,7 @@
 	return "";
     }
 
-    virtual QString getLabelPreceding(size_t /* frame */) const {
+    virtual QString getLabelPreceding(int /* frame */) const {
         return "";
     }
 
@@ -182,7 +182,7 @@
      */
     virtual bool snapToFeatureFrame(View *   /* v */,
 				    int &    /* frame */,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType /* snap */) const {
 	resolution = 1;
 	return false;
@@ -206,7 +206,7 @@
      */
     virtual bool snapToSimilarFeature(View *   /* v */,
                                       int &    /* source frame */,
-                                      size_t &resolution,
+                                      int &resolution,
                                       SnapType /* snap */) const {
 	resolution = 1;
 	return false;
@@ -254,7 +254,7 @@
      */
     virtual bool editOpen(View *, QMouseEvent *) { return false; }
 
-    virtual void moveSelection(Selection, size_t /* newStartFrame */) { }
+    virtual void moveSelection(Selection, int /* newStartFrame */) { }
     virtual void resizeSelection(Selection, Selection /* newSize */) { }
     virtual void deleteSelection(Selection) { }
 
@@ -525,7 +525,7 @@
     void modelChanged();
     void modelCompletionChanged();
     void modelAlignmentCompletionChanged();
-    void modelChanged(size_t startFrame, size_t endFrame);
+    void modelChangedWithin(int startFrame, int endFrame);
     void modelReplaced();
 
     void layerParametersChanged();
@@ -538,16 +538,16 @@
 protected:
     void connectSignals(const Model *);
 
-    virtual size_t alignToReference(View *v, size_t frame) const;
-    virtual size_t alignFromReference(View *v, size_t frame) const;
+    virtual int alignToReference(View *v, int frame) const;
+    virtual int alignFromReference(View *v, int frame) const;
     bool clipboardHasDifferentAlignment(View *v, const Clipboard &clip) const;
 
     struct MeasureRect {
 
         mutable QRect pixrect;
         bool haveFrames;
-        long startFrame; // only valid if haveFrames
-        long endFrame;   // ditto
+        int startFrame; // only valid if haveFrames
+        int endFrame;   // ditto
         double startY;
         double endY;
 
--- a/layer/LayerFactory.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/LayerFactory.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -93,10 +93,11 @@
 	// likewise
 	return Layer::tr("Spectrogram");
 
-    default: break;
+    case UnknownLayer:
+    default:
+        cerr << "WARNING: LayerFactory::getLayerPresentationName passed unknown layer" << endl;
+        return Layer::tr("Unknown Layer");
     }
-
-    return Layer::tr("Layer");
 }
 
 bool
@@ -244,7 +245,10 @@
     case Slice: return "spectrum";
     case MelodicRangeSpectrogram: return "spectrogram";
     case PeakFrequencySpectrogram: return "spectrogram";
-    default: return "unknown";
+    case UnknownLayer:
+    default:
+        cerr << "WARNING: LayerFactory::getLayerIconName passed unknown layer" << endl;
+        return "unknown";
     }
 }
 
@@ -267,7 +271,10 @@
     case Slice: return "slice";
     case MelodicRangeSpectrogram: return "melodicrange";
     case PeakFrequencySpectrogram: return "peakfrequency";
-    default: return "unknown";
+    case UnknownLayer:
+    default:
+        cerr << "WARNING: LayerFactory::getLayerTypeName passed unknown layer" << endl;
+        return "unknown";
     }
 }
 
@@ -460,11 +467,14 @@
 	layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks);
 	break;
 
-    default: break;
+    case UnknownLayer:
+    default:
+        cerr << "WARNING: LayerFactory::createLayer passed unknown layer" << endl;
+        break;
     }
 
     if (!layer) {
-	SVDEBUG << "LayerFactory::createLayer: Unknown layer type " 
+	cerr << "LayerFactory::createLayer: Unknown layer type " 
 		  << type << endl;
     } else {
 //	SVDEBUG << "LayerFactory::createLayer: Setting object name "
@@ -499,7 +509,7 @@
         QDomElement layerElt = docNew.firstChildElement("layer");
         QDomNamedNodeMap attrNodes = layerElt.attributes();
         
-        for (unsigned int i = 0; i < attrNodes.length(); ++i) {
+        for (int i = 0; i < attrNodes.length(); ++i) {
             QDomAttr attr = attrNodes.item(i).toAttr();
             if (attr.isNull()) continue;
 //            cerr << "append \"" << attr.name()
@@ -510,7 +520,7 @@
         
         layerElt = docOld.firstChildElement("layer");
         attrNodes = layerElt.attributes();
-        for (unsigned int i = 0; i < attrNodes.length(); ++i) {
+        for (int i = 0; i < attrNodes.length(); ++i) {
             QDomAttr attr = attrNodes.item(i).toAttr();
             if (attr.isNull()) continue;
             if (attrs.value(attr.name()) == "") {
--- a/layer/LinearColourScale.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/LinearColourScale.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -23,7 +23,7 @@
 #include "view/View.h"
 
 int
-LinearColourScale::getWidth(View *v,
+LinearColourScale::getWidth(View *,
 			    QPainter &paint)
 {
     return paint.fontMetrics().width("-000.00") + 15;
@@ -33,7 +33,7 @@
 LinearColourScale::paintVertical(View *v,
 				 const ColourScaleLayer *layer,
 				 QPainter &paint,
-				 int x0,
+				 int /* x0 */,
 				 float min,
 				 float max)
 {
@@ -46,8 +46,6 @@
 
     char buffer[40];
 
-    int w = getWidth(v, paint) + x0;
-
     int boxx = 5, boxy = 5;
     if (layer->getScaleUnits() != "") {
         boxy += paint.fontMetrics().height();
@@ -65,16 +63,16 @@
     }
     paint.restore();
 
-    float round = 1.f;
+//    float round = 1.f;
     int dp = 0;
     if (inc > 0) {
         int prec = trunc(log10f(inc));
         prec -= 1;
         if (prec < 0) dp = -prec;
-        round = powf(10.f, prec);
-#ifdef DEBUG_TIME_VALUE_LAYER
-        cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl;
-#endif
+//        round = powf(10.f, prec);
+//#ifdef DEBUG_TIME_VALUE_LAYER
+//        cerr << "inc = " << inc << ", round = " << round << ", dp = " << dp << endl;
+//#endif
     }
 
     for (int i = 0; i < n; ++i) {
--- a/layer/LinearNumericalScale.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/LinearNumericalScale.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -23,7 +23,7 @@
 #include "view/View.h"
 
 int
-LinearNumericalScale::getWidth(View *v,
+LinearNumericalScale::getWidth(View *,
 			       QPainter &paint)
 {
     return paint.fontMetrics().width("-000.00") + 10;
@@ -37,8 +37,6 @@
 				    float minf,
 				    float maxf)
 {
-    int h = v->height();
-
     int n = 10;
 
     float val = minf;
--- a/layer/LogColourScale.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/LogColourScale.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -25,7 +25,7 @@
 #include "view/View.h"
 
 int
-LogColourScale::getWidth(View *v,
+LogColourScale::getWidth(View *,
 			    QPainter &paint)
 {
     return paint.fontMetrics().width("-000.00") + 15;
@@ -35,7 +35,7 @@
 LogColourScale::paintVertical(View *v,
 			      const ColourScaleLayer *layer,
 			      QPainter &paint,
-			      int x0,
+			      int /* x0 */,
 			      float minlog,
 			      float maxlog)
 {
@@ -48,8 +48,6 @@
 
     char buffer[40];
 
-    int w = getWidth(v, paint) + x0;
-
     int boxx = 5, boxy = 5;
     if (layer->getScaleUnits() != "") {
         boxy += paint.fontMetrics().height();
--- a/layer/NoteLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/NoteLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -389,7 +389,7 @@
 {
     if (!m_model) return NoteModel::PointList();
 
-    long frame = v->getFrameForX(x);
+    int frame = v->getFrameForX(x);
 
     NoteModel::PointList onPoints =
 	m_model->getPoints(frame);
@@ -407,11 +407,11 @@
 
     if (prevPoints.empty()) {
 	usePoints = nextPoints;
-    } else if (long(prevPoints.begin()->frame) < v->getStartFrame() &&
+    } else if (int(prevPoints.begin()->frame) < v->getStartFrame() &&
 	       !(nextPoints.begin()->frame > v->getEndFrame())) {
 	usePoints = nextPoints;
-    } else if (long(nextPoints.begin()->frame) - frame <
-	       frame - long(prevPoints.begin()->frame)) {
+    } else if (int(nextPoints.begin()->frame) - frame <
+	       frame - int(prevPoints.begin()->frame)) {
 	usePoints = nextPoints;
     }
 
@@ -432,7 +432,7 @@
 {
     if (!m_model) return false;
 
-    long frame = v->getFrameForX(x);
+    int frame = v->getFrameForX(x);
 
     NoteModel::PointList onPoints = m_model->getPoints(frame);
     if (onPoints.empty()) return false;
@@ -544,7 +544,7 @@
 
 bool
 NoteLayer::snapToFeatureFrame(View *v, int &frame,
-			      size_t &resolution,
+			      int &resolution,
 			      SnapType snap) const
 {
     if (!m_model) {
@@ -747,8 +747,8 @@
 //    Profiler profiler("NoteLayer::paint", true);
 
     int x0 = rect.left(), x1 = rect.right();
-    long frame0 = v->getFrameForX(x0);
-    long frame1 = v->getFrameForX(x1);
+    int frame0 = v->getFrameForX(x0);
+    int frame1 = v->getFrameForX(x1);
 
     NoteModel::PointList points(m_model->getPoints(frame0, frame1));
     if (points.empty()) return;
@@ -884,7 +884,7 @@
 
     if (!m_model) return;
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
@@ -908,14 +908,14 @@
 
     if (!m_model || !m_editing) return;
 
-    long frame = v->getFrameForX(e->x());
+    int frame = v->getFrameForX(e->x());
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
     float newValue = getValueForY(v, e->y());
 
-    long newFrame = m_editingPoint.frame;
-    long newDuration = frame - newFrame;
+    int newFrame = m_editingPoint.frame;
+    int newDuration = frame - newFrame;
     if (newDuration < 0) {
         newFrame = frame;
         newDuration = -newDuration;
@@ -956,7 +956,7 @@
 }
 
 void
-NoteLayer::eraseDrag(View *v, QMouseEvent *e)
+NoteLayer::eraseDrag(View *, QMouseEvent *)
 {
 }
 
@@ -1015,7 +1015,7 @@
     int newx = m_dragPointX + xdist;
     int newy = m_dragPointY + ydist;
 
-    long frame = v->getFrameForX(newx);
+    int frame = v->getFrameForX(newx);
     if (frame < 0) frame = 0;
     frame = frame / m_model->getResolution() * m_model->getResolution();
 
@@ -1103,7 +1103,7 @@
 }
 
 void
-NoteLayer::moveSelection(Selection s, size_t newStartFrame)
+NoteLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -1207,7 +1207,7 @@
 }
 
 bool
-NoteLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */)
+NoteLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */)
 {
     if (!m_model) return false;
 
@@ -1239,7 +1239,7 @@
          i != points.end(); ++i) {
         
         if (!i->haveFrame()) continue;
-        size_t frame = 0;
+        int frame = 0;
 
         if (!realign) {
             
@@ -1264,7 +1264,7 @@
         if (i->haveLevel()) newPoint.level = i->getLevel();
         if (i->haveDuration()) newPoint.duration = i->getDuration();
         else {
-            size_t nextFrame = frame;
+            int nextFrame = frame;
             Clipboard::PointList::const_iterator j = i;
             for (; j != points.end(); ++j) {
                 if (!j->haveFrame()) continue;
@@ -1288,13 +1288,13 @@
 }
 
 void
-NoteLayer::addNoteOn(long frame, int pitch, int velocity)
+NoteLayer::addNoteOn(int frame, int pitch, int velocity)
 {
     m_pendingNoteOns.insert(Note(frame, pitch, 0, float(velocity) / 127.0, ""));
 }
 
 void
-NoteLayer::addNoteOff(long frame, int pitch)
+NoteLayer::addNoteOff(int frame, int pitch)
 {
     for (NoteSet::iterator i = m_pendingNoteOns.begin();
          i != m_pendingNoteOns.end(); ++i) {
--- a/layer/NoteLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/NoteLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -43,7 +43,7 @@
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -60,7 +60,7 @@
 
     virtual bool editOpen(View *v, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
 
@@ -113,13 +113,13 @@
      * not be finally added to the layer until the corresponding
      * note-off.
      */
-    void addNoteOn(long frame, int pitch, int velocity);
+    void addNoteOn(int frame, int pitch, int velocity);
     
     /**
      * Add a note-off.  This will cause a note to appear, if and only
      * if there is a matching pending note-on.
      */
-    void addNoteOff(long frame, int pitch);
+    void addNoteOff(int frame, int pitch);
 
     /**
      * Abandon all pending note-on events.
--- a/layer/RegionLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/RegionLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -367,7 +367,7 @@
 }
 
 QString
-RegionLayer::getLabelPreceding(size_t frame) const
+RegionLayer::getLabelPreceding(int frame) const
 {
     if (!m_model) return "";
     RegionModel::PointList points = m_model->getPreviousPoints(frame);
@@ -450,7 +450,7 @@
 
 bool
 RegionLayer::snapToFeatureFrame(View *v, int &frame,
-                                size_t &resolution,
+                                int &resolution,
                                 SnapType snap) const
 {
     if (!m_model) {
@@ -533,7 +533,7 @@
 
 bool
 RegionLayer::snapToSimilarFeature(View *v, int &frame,
-                                  size_t &resolution,
+                                  int &resolution,
                                   SnapType snap) const
 {
     if (!m_model) {
@@ -901,7 +901,6 @@
     //!!! coord is never completely flat on the top or bottom
 
     int fontHeight = paint.fontMetrics().height();
-    int fontAscent = paint.fontMetrics().ascent();
 
     for (RegionModel::PointList::const_iterator i = points.begin();
 	 i != points.end(); ++i) {
@@ -1076,7 +1075,6 @@
     bool logarithmic;
 
     int w = getVerticalScaleWidth(v, false, paint);
-    int h = v->height();
 
     if (m_plotStyle == PlotSegmentation) {
 
@@ -1192,7 +1190,7 @@
 }
 
 void
-RegionLayer::eraseDrag(View *v, QMouseEvent *e)
+RegionLayer::eraseDrag(View *, QMouseEvent *)
 {
 }
 
@@ -1279,7 +1277,7 @@
 }
 
 void
-RegionLayer::editEnd(View *, QMouseEvent *e)
+RegionLayer::editEnd(View *, QMouseEvent *)
 {
     if (!m_model || !m_editing) return;
 
@@ -1348,7 +1346,7 @@
 }
 
 void
-RegionLayer::moveSelection(Selection s, size_t newStartFrame)
+RegionLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -1455,7 +1453,7 @@
 }
 
 bool
-RegionLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */)
+RegionLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */)
 {
     if (!m_model) return false;
 
@@ -1487,7 +1485,7 @@
          i != points.end(); ++i) {
         
         if (!i->haveFrame()) continue;
-        size_t frame = 0;
+        int frame = 0;
 
         if (!realign) {
             
@@ -1511,7 +1509,7 @@
                                m_model->getValueMaximum()) / 2;
         if (i->haveDuration()) newPoint.duration = i->getDuration();
         else {
-            size_t nextFrame = frame;
+            int nextFrame = frame;
             Clipboard::PointList::const_iterator j = i;
             for (; j != points.end(); ++j) {
                 if (!j->haveFrame()) continue;
--- a/layer/RegionLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/RegionLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -45,13 +45,13 @@
     virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const;
 
     virtual QString getFeatureDescription(View *v, QPoint &) const;
-    virtual QString getLabelPreceding(size_t) const;
+    virtual QString getLabelPreceding(int) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
     virtual bool snapToSimilarFeature(View *v, int &frame,
-                                      size_t &resolution,
+                                      int &resolution,
                                       SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -68,7 +68,7 @@
 
     virtual bool editOpen(View *v, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
 
--- a/layer/SingleColourLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SingleColourLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -115,7 +115,7 @@
 {
     if (name == "Colour") {
         ColourDatabase *db = ColourDatabase::getInstance();
-        if (value >= 0 && size_t(value) < db->getColourCount()) {
+        if (value >= 0 && value < db->getColourCount()) {
             return db->getColourName(value);
         }
     }
--- a/layer/SliceLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SliceLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -95,13 +95,13 @@
 SliceLayer::getFeatureDescription(View *v, QPoint &p) const
 {
     int minbin, maxbin, range;
-    return getFeatureDescription(v, p, true, minbin, maxbin, range);
+    return getFeatureDescriptionAux(v, p, true, minbin, maxbin, range);
 }
 
 QString
-SliceLayer::getFeatureDescription(View *v, QPoint &p,
-                                  bool includeBinDescription,
-                                  int &minbin, int &maxbin, int &range) const
+SliceLayer::getFeatureDescriptionAux(View *v, QPoint &p,
+                                     bool includeBinDescription,
+                                     int &minbin, int &maxbin, int &range) const
 {
     minbin = 0;
     maxbin = 0;
@@ -121,8 +121,8 @@
     
     int sampleRate = m_sliceableModel->getSampleRate();
 
-    size_t f0 = m_currentf0;
-    size_t f1 = m_currentf1;
+    int f0 = m_currentf0;
+    int f1 = m_currentf1;
 
     RealTime rt0 = RealTime::frame2RealTime(f0, sampleRate);
     RealTime rt1 = RealTime::frame2RealTime(f1, sampleRate);
@@ -264,6 +264,7 @@
         value = fabsf(value);
         // and fall through
         
+    case LinearScale:
     default:
         norm = (value - m_threshold);
         if (norm < 0) norm = 0;
@@ -301,7 +302,9 @@
     case MeterScale:
         value = AudioLevel::preview_to_multiplier(lrintf(y), h);
         break;
-    
+
+    case LinearScale:
+    case AbsoluteScale:
     default:
         value = y / h + m_threshold;
     }
@@ -322,7 +325,7 @@
     if (v->getViewManager() && v->getViewManager()->shouldShowScaleGuides()) {
         if (!m_scalePoints.empty()) {
             paint.setPen(QColor(240, 240, 240)); //!!! and dark background?
-            for (size_t i = 0; i < m_scalePoints.size(); ++i) {
+            for (int i = 0; i < (int)m_scalePoints.size(); ++i) {
                 paint.drawLine(0, m_scalePoints[i], rect.width(), m_scalePoints[i]);
             }
         }
@@ -345,26 +348,26 @@
 
     QPainterPath path;
 
-    size_t mh = m_sliceableModel->getHeight();
+    int mh = m_sliceableModel->getHeight();
 
     int divisor = 0;
 
     m_values.clear();
-    for (size_t bin = 0; bin < mh; ++bin) {
+    for (int bin = 0; bin < mh; ++bin) {
         m_values.push_back(0.f);
     }
 
-    size_t f0 = v->getCentreFrame();
+    int f0 = v->getCentreFrame();
     int f0x = v->getXForFrame(f0);
     f0 = v->getFrameForX(f0x);
-    size_t f1 = v->getFrameForX(f0x + 1);
+    int f1 = v->getFrameForX(f0x + 1);
     if (f1 > f0) --f1;
 
 //    cerr << "centre frame " << v->getCentreFrame() << ", x " << f0x << ", f0 " << f0 << ", f1 " << f1 << endl;
 
-    size_t res = m_sliceableModel->getResolution();
-    size_t col0 = f0 / res;
-    size_t col1 = col0;
+    int res = m_sliceableModel->getResolution();
+    int col0 = f0 / res;
+    int col1 = col0;
     if (m_samplingMode != NearestSample) col1 = f1 / res;
     f0 = col0 * res;
     f1 = (col1 + 1) * res - 1;
@@ -376,10 +379,10 @@
 
     BiasCurve curve;
     getBiasCurve(curve);
-    size_t cs = curve.size();
+    int cs = curve.size();
 
-    for (size_t col = col0; col <= col1; ++col) {
-        for (size_t bin = 0; bin < mh; ++bin) {
+    for (int col = col0; col <= col1; ++col) {
+        for (int bin = 0; bin < mh; ++bin) {
             float value = m_sliceableModel->getValueAt(col, bin);
             if (bin < cs) value *= curve[bin];
             if (m_samplingMode == SamplePeak) {
@@ -392,22 +395,21 @@
     }
 
     float max = 0.f;
-    for (size_t bin = 0; bin < mh; ++bin) {
+    for (int bin = 0; bin < mh; ++bin) {
         if (m_samplingMode == SampleMean) m_values[bin] /= divisor;
         if (m_values[bin] > max) max = m_values[bin];
     }
     if (max != 0.f && m_normalize) {
-        for (size_t bin = 0; bin < mh; ++bin) {
+        for (int bin = 0; bin < mh; ++bin) {
             m_values[bin] /= max;
         }
     }
 
-    float py = 0;
     float nx = xorigin;
 
     ColourMapper mapper(m_colourMap, 0, 1);
 
-    for (size_t bin = 0; bin < mh; ++bin) {
+    for (int bin = 0; bin < mh; ++bin) {
 
         float x = nx;
         nx = xorigin + getXForBin(bin + 1, mh, w);
@@ -446,7 +448,6 @@
             paint.fillRect(QRectF(x, y, nx - x, yorigin - y), mapper.map(norm));
         }
 
-        py = y;
     }
 
     if (m_plotStyle != PlotFilledBlocks) {
--- a/layer/SliceLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SliceLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -115,10 +115,10 @@
     virtual float getYForValue(float value, const View *v, float &norm) const;
     virtual float getValueForY(float y, const View *v) const;
     
-    virtual QString getFeatureDescription(View *v, QPoint &,
-                                          bool includeBinDescription,
-                                          int &minbin, int &maxbin,
-                                          int &range) const;
+    virtual QString getFeatureDescriptionAux(View *v, QPoint &,
+                                             bool includeBinDescription,
+                                             int &minbin, int &maxbin,
+                                             int &range) const;
 
     // This curve may, of course, be flat -- the spectrum uses it for
     // normalizing the fft results by the fft size (with 1/(fftsize/2)
@@ -144,8 +144,8 @@
     mutable std::map<const View *, int> m_xorigins;
     mutable std::map<const View *, int> m_yorigins;
     mutable std::map<const View *, int> m_heights;
-    mutable size_t                    m_currentf0;
-    mutable size_t                    m_currentf1;
+    mutable int                    m_currentf0;
+    mutable int                    m_currentf1;
     mutable std::vector<float>        m_values;
 };
 
--- a/layer/SpectrogramLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SpectrogramLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -141,8 +141,8 @@
     connectSignals(m_model);
 
     connect(m_model, SIGNAL(modelChanged()), this, SLOT(cacheInvalid()));
-    connect(m_model, SIGNAL(modelChanged(size_t, size_t)),
-	    this, SLOT(cacheInvalid(size_t, size_t)));
+    connect(m_model, SIGNAL(modelChangedWithin(int, int)),
+	    this, SLOT(cacheInvalid(int, int)));
 
     emit modelReplaced();
 }
@@ -572,7 +572,7 @@
 }
 
 void
-SpectrogramLayer::invalidateImageCaches(size_t startFrame, size_t endFrame)
+SpectrogramLayer::invalidateImageCaches(int startFrame, int endFrame)
 {
     for (ViewImageCache::iterator i = m_imageCaches.begin();
          i != m_imageCaches.end(); ++i) {
@@ -592,7 +592,7 @@
                   << i->second.validArea.height() << endl;
 #endif
 
-        if (long(startFrame) > v->getStartFrame()) {
+        if (int(startFrame) > v->getStartFrame()) {
             if (startFrame >= v->getEndFrame()) {
 #ifdef DEBUG_SPECTROGRAM_REPAINT
                 cerr << "Modified start frame is off right of view" << endl;
@@ -610,7 +610,7 @@
                 i->second.validArea = QRect();
             }
         } else {
-            if (long(endFrame) < v->getStartFrame()) {
+            if (int(endFrame) < v->getStartFrame()) {
 #ifdef DEBUG_SPECTROGRAM_REPAINT
                 cerr << "Modified end frame is off left of view" << endl;
 #endif
@@ -681,7 +681,7 @@
 }
 
 void
-SpectrogramLayer::setWindowSize(size_t ws)
+SpectrogramLayer::setWindowSize(int ws)
 {
     if (m_windowSize == ws) return;
 
@@ -695,14 +695,14 @@
     emit layerParametersChanged();
 }
 
-size_t
+int
 SpectrogramLayer::getWindowSize() const
 {
     return m_windowSize;
 }
 
 void
-SpectrogramLayer::setWindowHopLevel(size_t v)
+SpectrogramLayer::setWindowHopLevel(int v)
 {
     if (m_windowHopLevel == v) return;
 
@@ -717,14 +717,14 @@
 //    fillCache();
 }
 
-size_t
+int
 SpectrogramLayer::getWindowHopLevel() const
 {
     return m_windowHopLevel;
 }
 
 void
-SpectrogramLayer::setZeroPadLevel(size_t v)
+SpectrogramLayer::setZeroPadLevel(int v)
 {
     if (m_zeroPadLevel == v) return;
 
@@ -738,7 +738,7 @@
     emit layerParametersChanged();
 }
 
-size_t
+int
 SpectrogramLayer::getZeroPadLevel() const
 {
     return m_zeroPadLevel;
@@ -804,7 +804,7 @@
 }
 
 void
-SpectrogramLayer::setMinFrequency(size_t mf)
+SpectrogramLayer::setMinFrequency(int mf)
 {
     if (m_minFrequency == mf) return;
 
@@ -818,14 +818,14 @@
     emit layerParametersChanged();
 }
 
-size_t
+int
 SpectrogramLayer::getMinFrequency() const
 {
     return m_minFrequency;
 }
 
 void
-SpectrogramLayer::setMaxFrequency(size_t mf)
+SpectrogramLayer::setMaxFrequency(int mf)
 {
     if (m_maxFrequency == mf) return;
 
@@ -839,7 +839,7 @@
     emit layerParametersChanged();
 }
 
-size_t
+int
 SpectrogramLayer::getMaxFrequency() const
 {
     return m_maxFrequency;
@@ -1049,7 +1049,7 @@
 }
 
 void
-SpectrogramLayer::cacheInvalid(size_t from, size_t to)
+SpectrogramLayer::cacheInvalid(int from, int to)
 {
 #ifdef DEBUG_SPECTROGRAM_REPAINT
     SVDEBUG << "SpectrogramLayer::cacheInvalid(" << from << ", " << to << ")" << endl;
@@ -1074,11 +1074,11 @@
          i != m_fftModels.end(); ++i) {
 
         const FFTModel *model = i->second.first;
-        size_t lastFill = i->second.second;
+        int lastFill = i->second.second;
 
         if (model) {
 
-            size_t fill = model->getFillExtent();
+            int fill = model->getFillExtent();
 
 #ifdef DEBUG_SPECTROGRAM_REPAINT
             SVDEBUG << "SpectrogramLayer::fillTimerTimedOut: extent for " << model << ": " << fill << ", last " << lastFill << ", total " << m_model->getEndFrame() << endl;
@@ -1100,7 +1100,7 @@
 #endif
                     invalidateImageCaches(lastFill, fill);
                     i->second.second = fill;
-                    emit modelChanged(lastFill, fill);
+                    emit modelChangedWithin(lastFill, fill);
                 }
             } else {
 #ifdef DEBUG_SPECTROGRAM_REPAINT
@@ -1109,7 +1109,7 @@
 #endif
                 invalidateImageCaches();
                 i->second.second = fill;
-                emit modelChanged(m_model->getStartFrame(), m_model->getEndFrame());
+                emit modelChangedWithin(m_model->getStartFrame(), m_model->getEndFrame());
             }
 
             if (i->second.second >= 0) {
@@ -1270,7 +1270,7 @@
     float minf = float(sr) / m_fftSize;
 
     if (m_minFrequency > 0.0) {
-	size_t minbin = size_t((double(m_minFrequency) * m_fftSize) / sr + 0.01);
+	int minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.01);
 	if (minbin < 1) minbin = 1;
 	minf = minbin * sr / m_fftSize;
     }
@@ -1285,7 +1285,7 @@
     float maxf = float(sr) / 2;
 
     if (m_maxFrequency > 0.0) {
-	size_t maxbin = size_t((double(m_maxFrequency) * m_fftSize) / sr + 0.1);
+	int maxbin = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1);
 	if (maxbin > m_fftSize / 2) maxbin = m_fftSize / 2;
 	maxf = maxbin * sr / m_fftSize;
     }
@@ -1348,8 +1348,8 @@
 bool
 SpectrogramLayer::getXBinRange(View *v, int x, float &s0, float &s1) const
 {
-    size_t modelStart = m_model->getStartFrame();
-    size_t modelEnd = m_model->getEndFrame();
+    int modelStart = m_model->getStartFrame();
+    int modelEnd = m_model->getEndFrame();
 
     // Each pixel column covers an exact range of sample frames:
     int f0 = v->getFrameForX(x) - modelStart;
@@ -1362,7 +1362,7 @@
     // And that range may be drawn from a possibly non-integral
     // range of spectrogram windows:
 
-    size_t windowIncrement = getWindowIncrement();
+    int windowIncrement = getWindowIncrement();
     s0 = float(f0) / windowIncrement;
     s1 = float(f1) / windowIncrement;
 
@@ -1434,9 +1434,6 @@
 
     int sr = m_model->getSampleRate();
 
-    size_t windowSize = m_windowSize;
-    size_t windowIncrement = getWindowIncrement();
-
     bool haveAdj = false;
 
     bool peaksOnly = (m_binDisplay == PeakBins ||
@@ -1457,7 +1454,6 @@
 	    if (!fft->isOverThreshold(s, q, m_threshold * (m_fftSize/2))) continue;
 
 	    float freq = binfreq;
-	    bool steady = false;
 	    
 	    if (s < int(fft->getWidth()) - 1) {
 
@@ -1501,7 +1497,7 @@
 
     bool rv = false;
 
-    size_t zp = getZeroPadLevel(v);
+    int zp = getZeroPadLevel(v);
     q0i *= zp + 1;
     q1i *= zp + 1;
 
@@ -1547,7 +1543,7 @@
     return rv;
 }
    
-size_t
+int
 SpectrogramLayer::getZeroPadLevel(const View *v) const
 {
     //!!! tidy all this stuff
@@ -1564,13 +1560,13 @@
 
     int sr = m_model->getSampleRate();
     
-    size_t maxbin = m_fftSize / 2;
+    int maxbin = m_fftSize / 2;
     if (m_maxFrequency > 0) {
 	maxbin = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1);
 	if (maxbin > m_fftSize / 2) maxbin = m_fftSize / 2;
     }
 
-    size_t minbin = 1;
+    int minbin = 1;
     if (m_minFrequency > 0) {
 	minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.1);
 	if (minbin < 1) minbin = 1;
@@ -1590,7 +1586,7 @@
     }
 }
 
-size_t
+int
 SpectrogramLayer::getFFTSize(const View *v) const
 {
     return m_fftSize * (getZeroPadLevel(v) + 1);
@@ -1601,7 +1597,7 @@
 {
     if (!m_model) return 0;
 
-    size_t fftSize = getFFTSize(v);
+    int fftSize = getFFTSize(v);
 
     if (m_fftModels.find(v) != m_fftModels.end()) {
         if (m_fftModels[v].first == 0) {
@@ -1784,7 +1780,7 @@
     cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << endl;
 #endif
 
-    long startFrame = v->getStartFrame();
+    int startFrame = v->getStartFrame();
     if (startFrame < 0) m_candidateFillStartFrame = 0;
     else m_candidateFillStartFrame = startFrame;
 
@@ -1800,10 +1796,10 @@
     // is not in the dormancy map at all -- we need it to be present
     // and accountable for when determining whether we need the cache
     // in the cache-fill thread above.
-    //!!! no longer use cache-fill thread
+    //!!! no inter use cache-fill thread
     const_cast<SpectrogramLayer *>(this)->Layer::setLayerDormant(v, false);
 
-    size_t fftSize = getFFTSize(v);
+    int fftSize = getFFTSize(v);
 /*
     FFTModel *fft = getFFTModel(v);
     if (!fft) {
@@ -2123,13 +2119,13 @@
     // Note fftSize is the actual zero-padded fft size, m_fftSize the
     // nominal fft size.
     
-    size_t maxbin = m_fftSize / 2;
+    int maxbin = m_fftSize / 2;
     if (m_maxFrequency > 0) {
 	maxbin = int((double(m_maxFrequency) * m_fftSize) / sr + 0.001);
 	if (maxbin > m_fftSize / 2) maxbin = m_fftSize / 2;
     }
 
-    size_t minbin = 1;
+    int minbin = 1;
     if (m_minFrequency > 0) {
 	minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.001);
 //        cerr << "m_minFrequency = " << m_minFrequency << " -> minbin = " << minbin << endl;
@@ -2160,7 +2156,7 @@
 /*
     float yforbin[maxbin - minbin + 1];
 
-    for (size_t q = minbin; q <= maxbin; ++q) {
+    for (int q = minbin; q <= maxbin; ++q) {
         float f0 = (float(q) * sr) / fftSize;
         yforbin[q - minbin] =
             v->getYForFrequency(f0, displayMinFreq, displayMaxFreq,
@@ -2170,20 +2166,16 @@
     MagnitudeRange overallMag = m_viewMags[v];
     bool overallMagChanged = false;
 
-    bool fftSuspended = false;
-
 #ifdef DEBUG_SPECTROGRAM_REPAINT
     cerr << ((float(v->getFrameForX(1) - v->getFrameForX(0))) / increment) << " bin(s) per pixel" << endl;
 #endif
 
-    bool runOutOfData = false;
-
     if (w == 0) {
         SVDEBUG << "*** NOTE: w == 0" << endl;
     }
 
 #ifdef DEBUG_SPECTROGRAM_REPAINT
-    size_t pixels = 0;
+    int pixels = 0;
 #endif
 
     Profiler outerprof("SpectrogramLayer::paint: all cols");
@@ -2204,22 +2196,22 @@
     bool bufferBinResolution = false;
     if (increment > zoomLevel) bufferBinResolution = true;
 
-    long leftBoundaryFrame = -1, leftCropFrame = -1;
-    long rightBoundaryFrame = -1, rightCropFrame = -1;
+    int leftBoundaryFrame = -1, leftCropFrame = -1;
+    int rightBoundaryFrame = -1, rightCropFrame = -1;
 
     int bufwid;
 
     if (bufferBinResolution) {
 
         for (int x = x0; ; --x) {
-            long f = v->getFrameForX(x);
+            int f = v->getFrameForX(x);
             if ((f / increment) * increment == f) {
                 if (leftCropFrame == -1) leftCropFrame = f;
                 else if (x < x0 - 2) { leftBoundaryFrame = f; break; }
             }
         }
         for (int x = x0 + w; ; ++x) {
-            long f = v->getFrameForX(x);
+            int f = v->getFrameForX(x);
             if ((f / increment) * increment == f) {
                 if (rightCropFrame == -1) rightCropFrame = f;
                 else if (x > x0 + w + 2) { rightBoundaryFrame = f; break; }
@@ -2499,8 +2491,6 @@
         
         if (binforx[x] < 0) continue;
 
-        float columnMax = 0.f;
-
         int sx0 = binforx[x];
         int sx1 = sx0;
         if (x+1 < w) sx1 = binforx[x+1];
@@ -2894,7 +2884,7 @@
     if (m_updateTimer == 0) return 100;
     if (m_fftModels.find(v) == m_fftModels.end()) return 100;
 
-    size_t completion = m_fftModels[v].first->getCompletion();
+    int completion = m_fftModels[v].first->getCompletion();
 #ifdef DEBUG_SPECTROGRAM_REPAINT
     SVDEBUG << "SpectrogramLayer::getCompletion: completion = " << completion << endl;
 #endif
@@ -2943,8 +2933,8 @@
     if (min < 0) min = 0;
     if (max > m_model->getSampleRate()/2) max = m_model->getSampleRate()/2;
     
-    size_t minf = lrintf(min);
-    size_t maxf = lrintf(max);
+    int minf = lrintf(min);
+    int maxf = lrintf(max);
 
     if (m_minFrequency == minf && m_maxFrequency == maxf) return true;
 
@@ -2976,7 +2966,7 @@
 
 bool
 SpectrogramLayer::snapToFeatureFrame(View *, int &frame,
-				     size_t &resolution,
+				     int &resolution,
 				     SnapType snap) const
 {
     resolution = getWindowIncrement();
@@ -3090,7 +3080,7 @@
                            View::OutlinedText);
     }
 
-    long frame = v->getFrameForX(cursorPos.x());
+    int frame = v->getFrameForX(cursorPos.x());
     RealTime rt = RealTime::frame2RealTime(frame, m_model->getSampleRate());
     QString rtLabel = QString("%1 s").arg(rt.toText(true).c_str());
     QString frameLabel = QString("%1").arg(frame);
@@ -3292,7 +3282,7 @@
     int tickw = (m_frequencyScale == LogFrequencyScale ? 10 : 4);
     int pkw = (m_frequencyScale == LogFrequencyScale ? 10 : 0);
 
-    size_t bins = m_fftSize / 2;
+    int bins = m_fftSize / 2;
     int sr = m_model->getSampleRate();
 
     if (m_maxFrequency > 0) {
@@ -3508,7 +3498,7 @@
     int maxStep = mapper.getPositionForValue(0);
     int minStep = mapper.getPositionForValue(float(sr) / 2);
 
-    size_t initialMax = m_initialMaxFrequency;
+    int initialMax = m_initialMaxFrequency;
     if (initialMax == 0) initialMax = sr / 2;
 
     defaultStep = mapper.getPositionForValue(initialMax) - minStep;
@@ -3684,13 +3674,13 @@
     int channel = attributes.value("channel").toInt(&ok);
     if (ok) setChannel(channel);
 
-    size_t windowSize = attributes.value("windowSize").toUInt(&ok);
+    int windowSize = attributes.value("windowSize").toUInt(&ok);
     if (ok) setWindowSize(windowSize);
 
-    size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok);
+    int windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok);
     if (ok) setWindowHopLevel(windowHopLevel);
     else {
-        size_t windowOverlap = attributes.value("windowOverlap").toUInt(&ok);
+        int windowOverlap = attributes.value("windowOverlap").toUInt(&ok);
         // a percentage value
         if (ok) {
             if (windowOverlap == 0) setWindowHopLevel(0);
@@ -3707,13 +3697,13 @@
     float threshold = attributes.value("threshold").toFloat(&ok);
     if (ok) setThreshold(threshold);
 
-    size_t minFrequency = attributes.value("minFrequency").toUInt(&ok);
+    int minFrequency = attributes.value("minFrequency").toUInt(&ok);
     if (ok) {
         SVDEBUG << "SpectrogramLayer::setProperties: setting min freq to " << minFrequency << endl;
         setMinFrequency(minFrequency);
     }
 
-    size_t maxFrequency = attributes.value("maxFrequency").toUInt(&ok);
+    int maxFrequency = attributes.value("maxFrequency").toUInt(&ok);
     if (ok) {
         SVDEBUG << "SpectrogramLayer::setProperties: setting max freq to " << maxFrequency << endl;
         setMaxFrequency(maxFrequency);
--- a/layer/SpectrogramLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SpectrogramLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -70,7 +70,7 @@
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
 
     virtual void measureDoubleClick(View *, QMouseEvent *);
@@ -99,17 +99,17 @@
     void setChannel(int);
     int getChannel() const;
 
-    void setWindowSize(size_t);
-    size_t getWindowSize() const;
+    void setWindowSize(int);
+    int getWindowSize() const;
     
-    void setWindowHopLevel(size_t level);
-    size_t getWindowHopLevel() const;
+    void setWindowHopLevel(int level);
+    int getWindowHopLevel() const;
 
     void setWindowType(WindowType type);
     WindowType getWindowType() const;
 
-    void setZeroPadLevel(size_t level);
-    size_t getZeroPadLevel() const;
+    void setZeroPadLevel(int level);
+    int getZeroPadLevel() const;
 
     /**
      * Set the gain multiplier for sample values in this view.
@@ -127,11 +127,11 @@
     void setThreshold(float threshold);
     float getThreshold() const;
 
-    void setMinFrequency(size_t);
-    size_t getMinFrequency() const;
+    void setMinFrequency(int);
+    int getMinFrequency() const;
 
-    void setMaxFrequency(size_t); // 0 -> no maximum
-    size_t getMaxFrequency() const;
+    void setMaxFrequency(int); // 0 -> no maximum
+    int getMaxFrequency() const;
 
     enum ColourScale {
 	LinearColourScale,
@@ -243,7 +243,7 @@
 
 protected slots:
     void cacheInvalid();
-    void cacheInvalid(size_t startFrame, size_t endFrame);
+    void cacheInvalid(int startFrame, int endFrame);
     
     void preferenceChanged(PropertyContainer::PropertyName name);
 
@@ -253,20 +253,20 @@
     const DenseTimeValueModel *m_model; // I do not own this
 
     int                 m_channel;
-    size_t              m_windowSize;
+    int              m_windowSize;
     WindowType          m_windowType;
-    size_t              m_windowHopLevel;
-    size_t              m_zeroPadLevel;
-    size_t              m_fftSize;
+    int              m_windowHopLevel;
+    int              m_zeroPadLevel;
+    int              m_fftSize;
     float               m_gain;
     float               m_initialGain;
     float               m_threshold;
     float               m_initialThreshold;
     int                 m_colourRotation;
     int                 m_initialRotation;
-    size_t              m_minFrequency;
-    size_t              m_maxFrequency;
-    size_t              m_initialMaxFrequency;
+    int              m_minFrequency;
+    int              m_maxFrequency;
+    int              m_initialMaxFrequency;
     ColourScale         m_colourScale;
     int                 m_colourMap;
     QColor              m_crosshairColour;
@@ -310,12 +310,12 @@
     {
         QImage image;
         QRect validArea;
-        long startFrame;
-        size_t zoomLevel;
+        int startFrame;
+        int zoomLevel;
     };
     typedef std::map<const View *, ImageCache> ViewImageCache;
     void invalidateImageCaches();
-    void invalidateImageCaches(size_t startFrame, size_t endFrame);
+    void invalidateImageCaches(int startFrame, int endFrame);
     mutable ViewImageCache m_imageCaches;
 
     /**
@@ -328,7 +328,7 @@
 
     mutable QTimer *m_updateTimer;
 
-    mutable size_t m_candidateFillStartFrame;
+    mutable int m_candidateFillStartFrame;
     bool m_exiting;
 
     void initialisePalette();
@@ -344,10 +344,10 @@
     float getEffectiveMaxFrequency() const;
 
     struct LayerRange {
-	long   startFrame;
+	int   startFrame;
 	int    zoomLevel;
-	size_t modelStart;
-	size_t modelEnd;
+	int modelStart;
+	int modelEnd;
     };
 
     // Note that the getYBin... methods return the nominal bin in the
@@ -368,14 +368,14 @@
     bool getXYBinSourceRange(View *v, int x, int y, float &min, float &max,
 			     float &phaseMin, float &phaseMax) const;
 
-    size_t getWindowIncrement() const {
+    int getWindowIncrement() const {
         if (m_windowHopLevel == 0) return m_windowSize;
         else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4;
         else return m_windowSize / (1 << (m_windowHopLevel - 1));
     }
 
-    size_t getZeroPadLevel(const View *v) const;
-    size_t getFFTSize(const View *v) const;
+    int getZeroPadLevel(const View *v) const;
+    int getFFTSize(const View *v) const;
     FFTModel *getFFTModel(const View *v) const;
     Dense3DModelPeakCache *getPeakCache(const View *v) const;
     void invalidateFFTModels();
--- a/layer/SpectrumLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SpectrumLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -121,7 +121,7 @@
     setSliceableModel(newFFT);
 
     m_biasCurve.clear();
-    for (size_t i = 0; i < m_windowSize; ++i) {
+    for (int i = 0; i < m_windowSize; ++i) {
         m_biasCurve.push_back(1.f / (float(m_windowSize)/2.f));
     }
 
@@ -257,7 +257,7 @@
 }
 
 void
-SpectrumLayer::setWindowSize(size_t ws)
+SpectrumLayer::setWindowSize(int ws)
 {
     if (m_windowSize == ws) return;
     m_windowSize = ws;
@@ -266,7 +266,7 @@
 }
 
 void
-SpectrumLayer::setWindowHopLevel(size_t v)
+SpectrumLayer::setWindowHopLevel(int v)
 {
     if (m_windowHopLevel == v) return;
     m_windowHopLevel = v;
@@ -566,7 +566,7 @@
     if (!m_sliceableModel) return "";
 
     int minbin = 0, maxbin = 0, range = 0;
-    QString genericDesc = SliceLayer::getFeatureDescription
+    QString genericDesc = SliceLayer::getFeatureDescriptionAux
         (v, p, false, minbin, maxbin, range);
 
     if (genericDesc == "") return "";
@@ -684,7 +684,7 @@
 
 //        SVDEBUG << "Showing peaks..." << endl;
 
-        size_t col = v->getCentreFrame() / fft->getResolution();
+        int col = v->getCentreFrame() / fft->getResolution();
 
         paint.save();
         paint.setRenderHint(QPainter::Antialiasing, false);
@@ -702,11 +702,11 @@
 
         BiasCurve curve;
         getBiasCurve(curve);
-        size_t cs = curve.size();
+        int cs = curve.size();
 
         std::vector<float> values;
         
-        for (size_t bin = 0; bin < fft->getHeight(); ++bin) {
+        for (int bin = 0; bin < fft->getHeight(); ++bin) {
             float value = m_sliceableModel->getValueAt(col, bin);
             if (bin < cs) value *= curve[bin];
             values.push_back(value);
@@ -715,7 +715,7 @@
         for (FFTModel::PeakSet::iterator i = peaks.begin();
              i != peaks.end(); ++i) {
 
-            size_t bin = i->first;
+            int bin = i->first;
             
 //            cerr << "bin = " << bin << ", thresh = " << thresh << ", value = " << fft->getMagnitudeAt(col, bin) << endl;
 
@@ -726,7 +726,7 @@
             int x = lrintf(getXForFrequency(freq, w));
 
             float norm = 0.f;
-            float y = getYForValue(values[bin], v, norm); // don't need y, need norm
+            (void)getYForValue(values[bin], v, norm); // don't need return value, need norm
 
             paint.setPen(mapper.map(norm));
             paint.drawLine(xorigin + x, 0, xorigin + x, v->height() - pkh - 1);
@@ -850,10 +850,10 @@
 
     bool ok = false;
 
-    size_t windowSize = attributes.value("windowSize").toUInt(&ok);
+    int windowSize = attributes.value("windowSize").toUInt(&ok);
     if (ok) setWindowSize(windowSize);
 
-    size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok);
+    int windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok);
     if (ok) setWindowHopLevel(windowHopLevel);
 
     bool showPeaks = (attributes.value("showPeaks").trimmed() == "true");
--- a/layer/SpectrumLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/SpectrumLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -81,11 +81,11 @@
     void setChannel(int);
     int getChannel() const { return m_channel; }
 
-    void setWindowSize(size_t);
-    size_t getWindowSize() const { return m_windowSize; }
+    void setWindowSize(int);
+    int getWindowSize() const { return m_windowSize; }
     
-    void setWindowHopLevel(size_t level);
-    size_t getWindowHopLevel() const { return m_windowHopLevel; }
+    void setWindowHopLevel(int level);
+    int getWindowHopLevel() const { return m_windowHopLevel; }
 
     void setWindowType(WindowType type);
     WindowType getWindowType() const { return m_windowType; }
@@ -110,9 +110,9 @@
     DenseTimeValueModel    *m_originModel;
     int                     m_channel;
     bool                    m_channelSet;
-    size_t                  m_windowSize;
+    int                  m_windowSize;
     WindowType              m_windowType;
-    size_t                  m_windowHopLevel;
+    int                  m_windowHopLevel;
     bool                    m_showPeaks;
     mutable bool            m_newFFTNeeded;
 
@@ -129,7 +129,7 @@
     float getFrequencyForX(float x, float w) const;
     float getXForFrequency(float freq, float w) const;
 
-    size_t getWindowIncrement() const {
+    int getWindowIncrement() const {
         if (m_windowHopLevel == 0) return m_windowSize;
         else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4;
         else return m_windowSize / (1 << (m_windowHopLevel - 1));
--- a/layer/TextLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TextLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -221,7 +221,7 @@
 
 bool
 TextLayer::snapToFeatureFrame(View *v, int &frame,
-			      size_t &resolution,
+			      int &resolution,
 			      SnapType snap) const
 {
     if (!m_model) {
@@ -495,7 +495,7 @@
 }
 
 void
-TextLayer::eraseDrag(View *v, QMouseEvent *e)
+TextLayer::eraseDrag(View *, QMouseEvent *)
 {
 }
 
@@ -621,7 +621,7 @@
 }    
 
 void
-TextLayer::moveSelection(Selection s, size_t newStartFrame)
+TextLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -717,7 +717,7 @@
 }
 
 bool
-TextLayer::paste(View *v, const Clipboard &from, int frameOffset, bool /* interactive */)
+TextLayer::paste(View *v, const Clipboard &from, int /* frameOffset */, bool /* interactive */)
 {
     if (!m_model) return false;
 
@@ -759,7 +759,7 @@
          i != points.end(); ++i) {
         
         if (!i->haveFrame()) continue;
-        size_t frame = 0;
+        int frame = 0;
         
         if (!realign) {
             
--- a/layer/TextLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TextLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -37,7 +37,7 @@
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -52,7 +52,7 @@
     virtual void editDrag(View *v, QMouseEvent *);
     virtual void editEnd(View *v, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
 
--- a/layer/TimeInstantLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TimeInstantLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -201,7 +201,7 @@
 }
 
 QString
-TimeInstantLayer::getLabelPreceding(size_t frame) const
+TimeInstantLayer::getLabelPreceding(int frame) const
 {
     if (!m_model) return "";
     SparseOneDimensionalModel::PointList points = m_model->getPreviousPoints(frame);
@@ -250,7 +250,7 @@
 
 bool
 TimeInstantLayer::snapToFeatureFrame(View *v, int &frame,
-				     size_t &resolution,
+				     int &resolution,
 				     SnapType snap) const
 {
     if (!m_model) {
@@ -506,7 +506,7 @@
 }
 
 void
-TimeInstantLayer::drawEnd(View *, QMouseEvent *e)
+TimeInstantLayer::drawEnd(View *, QMouseEvent *)
 {
 #ifdef DEBUG_TIME_INSTANT_LAYER
     cerr << "TimeInstantLayer::drawEnd(" << e->x() << ")" << endl;
@@ -541,7 +541,7 @@
 }
 
 void
-TimeInstantLayer::eraseDrag(View *v, QMouseEvent *e)
+TimeInstantLayer::eraseDrag(View *, QMouseEvent *)
 {
 }
 
@@ -612,7 +612,7 @@
 }
 
 void
-TimeInstantLayer::editEnd(View *, QMouseEvent *e)
+TimeInstantLayer::editEnd(View *, QMouseEvent *)
 {
 #ifdef DEBUG_TIME_INSTANT_LAYER
     cerr << "TimeInstantLayer::editEnd(" << e->x() << ")" << endl;
@@ -666,7 +666,7 @@
 }
 
 void
-TimeInstantLayer::moveSelection(Selection s, size_t newStartFrame)
+TimeInstantLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -798,7 +798,7 @@
         
         if (!i->haveFrame()) continue;
 
-        size_t frame = 0;
+        int frame = 0;
 
         if (!realign) {
             
--- a/layer/TimeInstantLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TimeInstantLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -35,11 +35,11 @@
 
     virtual void paint(View *v, QPainter &paint, QRect rect) const;
 
-    virtual QString getLabelPreceding(size_t) const;
+    virtual QString getLabelPreceding(int) const;
     virtual QString getFeatureDescription(View *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -56,7 +56,7 @@
 
     virtual bool editOpen(View *, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
 
--- a/layer/TimeRulerLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TimeRulerLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -50,7 +50,7 @@
 
 bool
 TimeRulerLayer::snapToFeatureFrame(View *v, int &frame,
-                                   size_t &resolution, SnapType snap) const
+                                   int &resolution, SnapType snap) const
 {
     if (!m_model) {
         resolution = 1;
--- a/layer/TimeRulerLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TimeRulerLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -41,7 +41,7 @@
     void setLabelHeight(LabelHeight h) { m_labelHeight = h; }
     LabelHeight getLabelHeight() const { return m_labelHeight; }
 
-    virtual bool snapToFeatureFrame(View *, int &, size_t &, SnapType) const;
+    virtual bool snapToFeatureFrame(View *, int &, int &, SnapType) const;
 
     virtual ColourSignificance getLayerColourSignificance() const {
         return ColourIrrelevant;
--- a/layer/TimeValueLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TimeValueLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -574,7 +574,7 @@
 }
 
 QString
-TimeValueLayer::getLabelPreceding(size_t frame) const
+TimeValueLayer::getLabelPreceding(int frame) const
 {
     if (!m_model) return "";
     SparseTimeValueModel::PointList points = m_model->getPreviousPoints(frame);
@@ -630,7 +630,7 @@
 
 bool
 TimeValueLayer::snapToFeatureFrame(View *v, int &frame,
-				   size_t &resolution,
+				   int &resolution,
 				   SnapType snap) const
 {
     if (!m_model) {
@@ -702,7 +702,7 @@
 
 bool
 TimeValueLayer::snapToSimilarFeature(View *v, int &frame,
-                                     size_t &resolution,
+                                     int &resolution,
                                      SnapType snap) const
 {
     if (!m_model) {
@@ -1435,7 +1435,7 @@
 }
 
 void
-TimeValueLayer::eraseDrag(View *v, QMouseEvent *e)
+TimeValueLayer::eraseDrag(View *, QMouseEvent *)
 {
 }
 
@@ -1580,7 +1580,7 @@
 }
 
 void
-TimeValueLayer::moveSelection(Selection s, size_t newStartFrame)
+TimeValueLayer::moveSelection(Selection s, int newStartFrame)
 {
     if (!m_model) return;
 
@@ -1682,7 +1682,7 @@
 }
 
 bool
-TimeValueLayer::paste(View *v, const Clipboard &from, int frameOffset,
+TimeValueLayer::paste(View *v, const Clipboard &from, int /* frameOffset */,
                       bool interactive)
 {
     if (!m_model) return false;
@@ -1721,7 +1721,6 @@
     Labeller::ValueType generation = Labeller::ValueNone;
 
     bool haveUsableLabels = false;
-    bool haveExistingItems = !(m_model->isEmpty());
     Labeller labeller;
     labeller.setSampleRate(m_model->getSampleRate());
 
@@ -1823,7 +1822,7 @@
         
         if (!i->haveFrame()) continue;
 
-        size_t frame = 0;
+        int frame = 0;
 
         if (!realign) {
             
--- a/layer/TimeValueLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/TimeValueLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -43,13 +43,13 @@
     virtual void paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const;
 
     virtual QString getFeatureDescription(View *v, QPoint &) const;
-    virtual QString getLabelPreceding(size_t) const;
+    virtual QString getLabelPreceding(int) const;
 
     virtual bool snapToFeatureFrame(View *v, int &frame,
-				    size_t &resolution,
+				    int &resolution,
 				    SnapType snap) const;
     virtual bool snapToSimilarFeature(View *v, int &frame,
-                                      size_t &resolution,
+                                      int &resolution,
                                       SnapType snap) const;
 
     virtual void drawStart(View *v, QMouseEvent *);
@@ -66,7 +66,7 @@
 
     virtual bool editOpen(View *v, QMouseEvent *);
 
-    virtual void moveSelection(Selection s, size_t newStartFrame);
+    virtual void moveSelection(Selection s, int newStartFrame);
     virtual void resizeSelection(Selection s, Selection newSize);
     virtual void deleteSelection(Selection s);
 
--- a/layer/WaveformLayer.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/WaveformLayer.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -361,17 +361,17 @@
     return int(((dB + 50.0) * m) / 50.0 + 0.1);
 }
 
-size_t
-WaveformLayer::getChannelArrangement(size_t &min, size_t &max,
+int
+WaveformLayer::getChannelArrangement(int &min, int &max,
                                      bool &merging, bool &mixing)
     const
 {
     if (!m_model || !m_model->isOK()) return 0;
 
-    size_t channels = m_model->getChannelCount();
+    int channels = m_model->getChannelCount();
     if (channels == 0) return 0;
 
-    size_t rawChannels = channels;
+    int rawChannels = channels;
 
     if (m_channel == -1) {
 	min = 0;
@@ -407,10 +407,10 @@
                             -5, -3, -2, -1, -0.5, 0 };
 
 bool
-WaveformLayer::getSourceFramesForX(View *v, int x, size_t modelZoomLevel,
-                                   size_t &f0, size_t &f1) const
+WaveformLayer::getSourceFramesForX(View *v, int x, int modelZoomLevel,
+                                   int &f0, int &f1) const
 {
-    long viewFrame = v->getFrameForX(x);
+    int viewFrame = v->getFrameForX(x);
     if (viewFrame < 0) {
         f0 = 0;
         f1 = 0;
@@ -434,15 +434,13 @@
 float
 WaveformLayer::getNormalizeGain(View *v, int channel) const
 {
-    long startFrame = v->getStartFrame();
-    long endFrame = v->getEndFrame();
+    int startFrame = v->getStartFrame();
+    int endFrame = v->getEndFrame();
 
-    // Although a long for purposes of comparison against the view
-    // start and end frames, these are known to be non-negative
-    long modelStart = long(m_model->getStartFrame());
-    long modelEnd = long(m_model->getEndFrame());
+    int modelStart = m_model->getStartFrame();
+    int modelEnd = m_model->getEndFrame();
     
-    size_t rangeStart, rangeEnd;
+    int rangeStart, rangeEnd;
             
     if (startFrame < modelStart) rangeStart = modelStart;
     else rangeStart = startFrame;
@@ -456,7 +454,7 @@
     RangeSummarisableTimeValueModel::Range range =
         m_model->getSummary(channel, rangeStart, rangeEnd - rangeStart);
 
-    size_t minChannel = 0, maxChannel = 0;
+    int minChannel = 0, maxChannel = 0;
     bool mergingChannels = false, mixingChannels = false;
 
     getChannelArrangement(minChannel, maxChannel,
@@ -488,7 +486,7 @@
 	      << ") [" << rect.width() << "x" << rect.height() << "]: zoom " << zoomLevel << endl;
 #endif
 
-    size_t channels = 0, minChannel = 0, maxChannel = 0;
+    int channels = 0, minChannel = 0, maxChannel = 0;
     bool mergingChannels = false, mixingChannels = false;
 
     channels = getChannelArrangement(minChannel, maxChannel,
@@ -571,11 +569,11 @@
     // must remain the same when we scroll one or more pixels left or
     // right.
             
-    size_t modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel);
+    int modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel);
 
-    size_t frame0;
-    size_t frame1;
-    size_t spare;
+    int frame0;
+    int frame1;
+    int spare;
 
     getSourceFramesForX(v, x0, modelZoomLevel, frame0, spare);
     getSourceFramesForX(v, x1, modelZoomLevel, spare, frame1);
@@ -602,11 +600,11 @@
 	midColour = midColour.light(50);
     }
 
-    while (m_effectiveGains.size() <= maxChannel) {
+    while ((int)m_effectiveGains.size() <= maxChannel) {
         m_effectiveGains.push_back(m_gain);
     }
 
-    for (size_t ch = minChannel; ch <= maxChannel; ++ch) {
+    for (int ch = minChannel; ch <= maxChannel; ++ch) {
 
 	int prevRangeBottom = -1, prevRangeTop = -1;
 	QColor prevRangeBottomColour = baseColour, prevRangeTopColour = baseColour;
@@ -711,7 +709,7 @@
 
 	    range = RangeSummarisableTimeValueModel::Range();
 
-            size_t f0, f1;
+            int f0, f1;
             if (!getSourceFramesForX(v, x, modelZoomLevel, f0, f1)) continue;
             f1 = f1 - 1;
 
@@ -720,8 +718,8 @@
                 continue;
             }
 
-            size_t i0 = (f0 - frame0) / modelZoomLevel;
-            size_t i1 = (f1 - frame0) / modelZoomLevel;
+            int i0 = (f0 - frame0) / modelZoomLevel;
+            int i1 = (f1 - frame0) / modelZoomLevel;
 
 #ifdef DEBUG_WAVEFORM_PAINT
             cerr << "WaveformLayer::paint: pixel " << x << ": i0 " << i0 << " (f " << f0 << "), i1 " << i1 << " (f " << f1 << ")" << endl;
@@ -731,11 +729,11 @@
                 cerr << "WaveformLayer::paint: ERROR: i1 " << i1 << " > i0 " << i0 << " plus one (zoom = " << zoomLevel << ", model zoom = " << modelZoomLevel << ")" << endl;
             }
 
-	    if (ranges && i0 < ranges->size()) {
+	    if (ranges && i0 < (int)ranges->size()) {
 
 		range = (*ranges)[i0];
 
-		if (i1 > i0 && i1 < ranges->size()) {
+		if (i1 > i0 && i1 < (int)ranges->size()) {
 		    range.setMax(std::max(range.max(), (*ranges)[i1].max()));
 		    range.setMin(std::min(range.min(), (*ranges)[i1].min()));
 		    range.setAbsmean((range.absmean() + (*ranges)[i1].absmean()) / 2);
@@ -752,7 +750,7 @@
 
 	    if (mergingChannels) {
 
-		if (otherChannelRanges && i0 < otherChannelRanges->size()) {
+		if (otherChannelRanges && i0 < (int)otherChannelRanges->size()) {
 
 		    range.setMax(fabsf(range.max()));
 		    range.setMin(-fabsf((*otherChannelRanges)[i0].max()));
@@ -760,7 +758,7 @@
                         ((range.absmean() +
                           (*otherChannelRanges)[i0].absmean()) / 2);
 
-		    if (i1 > i0 && i1 < otherChannelRanges->size()) {
+		    if (i1 > i0 && i1 < (int)otherChannelRanges->size()) {
 			// let's not concern ourselves about the mean
 			range.setMin
                             (std::min
@@ -771,7 +769,7 @@
 
 	    } else if (mixingChannels) {
 
-		if (otherChannelRanges && i0 < otherChannelRanges->size()) {
+		if (otherChannelRanges && i0 < (int)otherChannelRanges->size()) {
 
                     range.setMax((range.max() + (*otherChannelRanges)[i0].max()) / 2);
                     range.setMin((range.min() + (*otherChannelRanges)[i0].min()) / 2);
@@ -962,9 +960,9 @@
 
     int zoomLevel = v->getZoomLevel();
 
-    size_t modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel);
+    int modelZoomLevel = m_model->getSummaryBlockSize(zoomLevel);
 
-    size_t f0, f1;
+    int f0, f1;
     if (!getSourceFramesForX(v, x, modelZoomLevel, f0, f1)) return "";
     
     QString text;
@@ -981,16 +979,16 @@
 	    .arg(rt0.toText(true).c_str());
     }
 
-    size_t channels = 0, minChannel = 0, maxChannel = 0;
+    int channels = 0, minChannel = 0, maxChannel = 0;
     bool mergingChannels = false, mixingChannels = false;
 
     channels = getChannelArrangement(minChannel, maxChannel,
                                      mergingChannels, mixingChannels);
     if (channels == 0) return "";
 
-    for (size_t ch = minChannel; ch <= maxChannel; ++ch) {
+    for (int ch = minChannel; ch <= maxChannel; ++ch) {
 
-	size_t blockSize = v->getZoomLevel();
+	int blockSize = v->getZoomLevel();
 	RangeSummarisableTimeValueModel::RangeBlock ranges;
         m_model->getSummaries(ch, f0, f1 - f0, ranges, blockSize);
 
@@ -1037,9 +1035,9 @@
 }
 
 int
-WaveformLayer::getYForValue(const View *v, float value, size_t channel) const
+WaveformLayer::getYForValue(const View *v, float value, int channel) const
 {
-    size_t channels = 0, minChannel = 0, maxChannel = 0;
+    int channels = 0, minChannel = 0, maxChannel = 0;
     bool mergingChannels = false, mixingChannels = false;
 
     channels = getChannelArrangement(minChannel, maxChannel,
@@ -1080,9 +1078,9 @@
 }
 
 float
-WaveformLayer::getValueForY(const View *v, int y, size_t &channel) const
+WaveformLayer::getValueForY(const View *v, int y, int &channel) const
 {
-    size_t channels = 0, minChannel = 0, maxChannel = 0;
+    int channels = 0, minChannel = 0, maxChannel = 0;
     bool mergingChannels = false, mixingChannels = false;
 
     channels = getChannelArrangement(minChannel, maxChannel,
@@ -1129,7 +1127,7 @@
 WaveformLayer::getYScaleValue(const View *v, int y,
                               float &value, QString &unit) const
 {
-    size_t channel;
+    int channel;
 
     value = getValueForY(v, y, channel);
 
@@ -1155,7 +1153,7 @@
 WaveformLayer::getYScaleDifference(const View *v, int y0, int y1,
                                    float &diff, QString &unit) const
 {
-    size_t c0, c1;
+    int c0, c1;
     float v0 = getValueForY(v, y0, c0);
     float v1 = getValueForY(v, y1, c1);
 
@@ -1207,7 +1205,7 @@
 	return;
     }
 
-    size_t channels = 0, minChannel = 0, maxChannel = 0;
+    int channels = 0, minChannel = 0, maxChannel = 0;
     bool mergingChannels = false, mixingChannels = false;
 
     channels = getChannelArrangement(minChannel, maxChannel,
@@ -1220,11 +1218,11 @@
 
     float gain = m_gain;
 
-    for (size_t ch = minChannel; ch <= maxChannel; ++ch) {
+    for (int ch = minChannel; ch <= maxChannel; ++ch) {
 
 	int lastLabelledY = -1;
 
-        if (ch < m_effectiveGains.size()) gain = m_effectiveGains[ch];
+        if (ch < (int)m_effectiveGains.size()) gain = m_effectiveGains[ch];
 
         int n = 10;
 
--- a/layer/WaveformLayer.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/layer/WaveformLayer.h	Wed Jun 18 13:51:27 2014 +0100
@@ -208,15 +208,15 @@
     const RangeSummarisableTimeValueModel *m_model; // I do not own this
 
     /// Return value is number of channels displayed
-    size_t getChannelArrangement(size_t &min, size_t &max,
+    int getChannelArrangement(int &min, int &max,
                                  bool &merging, bool &mixing) const;
 
-    int getYForValue(const View *v, float value, size_t channel) const;
+    int getYForValue(const View *v, float value, int channel) const;
 
-    float getValueForY(const View *v, int y, size_t &channel) const;
+    float getValueForY(const View *v, int y, int &channel) const;
 
-    bool getSourceFramesForX(View *v, int x, size_t modelZoomLevel,
-                             size_t &f0, size_t &f1) const;
+    bool getSourceFramesForX(View *v, int x, int modelZoomLevel,
+                             int &f0, int &f1) const;
 
     float getNormalizeGain(View *v, int channel) const;
 
--- a/view/Overview.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/Overview.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -39,11 +39,11 @@
 }
 
 void
-Overview::modelChanged(size_t startFrame, size_t endFrame)
+Overview::modelChangedWithin(int startFrame, int endFrame)
 {
     bool zoomChanged = false;
 
-    size_t frameCount = getModelsEndFrame() - getModelsStartFrame();
+    int frameCount = getModelsEndFrame() - getModelsStartFrame();
     int zoomLevel = frameCount / width();
     if (zoomLevel < 1) zoomLevel = 1;
     zoomLevel = getZoomConstraintBlockSize(zoomLevel,
@@ -67,7 +67,7 @@
         }
     }
 
-    View::modelChanged(startFrame, endFrame);
+    View::modelChangedWithin(startFrame, endFrame);
 }
 
 void
@@ -92,7 +92,11 @@
 }
 
 void
-Overview::globalCentreFrameChanged(unsigned long f)
+Overview::globalCentreFrameChanged(int 
+#ifdef DEBUG_OVERVIEW
+                                   f
+#endif
+    )
 {
 #ifdef DEBUG_OVERVIEW
     cerr << "Overview::globalCentreFrameChanged: " << f << endl;
@@ -101,7 +105,11 @@
 }
 
 void
-Overview::viewCentreFrameChanged(View *v, unsigned long f)
+Overview::viewCentreFrameChanged(View *v, int
+#ifdef DEBUG_OVERVIEW
+                                 f
+#endif
+    )
 {
 #ifdef DEBUG_OVERVIEW
     cerr << "Overview[" << this << "]::viewCentreFrameChanged(" << v << "): " << f << endl;
@@ -112,7 +120,7 @@
 }    
 
 void
-Overview::viewZoomLevelChanged(View *v, unsigned long, bool)
+Overview::viewZoomLevelChanged(View *v, int, bool)
 {
     if (v == this) return;
     if (m_views.find(v) != m_views.end()) {
@@ -121,7 +129,7 @@
 }
 
 void
-Overview::viewManagerPlaybackFrameChanged(unsigned long f)
+Overview::viewManagerPlaybackFrameChanged(int f)
 {
 #ifdef DEBUG_OVERVIEW
     cerr << "Overview[" << this << "]::viewManagerPlaybackFrameChanged(" << f << "): " << f << endl;
@@ -146,8 +154,8 @@
     cerr << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << endl;
 #endif
 
-    size_t startFrame = getModelsStartFrame();
-    size_t frameCount = getModelsEndFrame() - getModelsStartFrame();
+    int startFrame = getModelsStartFrame();
+    int frameCount = getModelsEndFrame() - getModelsStartFrame();
     int zoomLevel = frameCount / width();
     if (zoomLevel < 1) zoomLevel = 1;
     zoomLevel = getZoomConstraintBlockSize(zoomLevel,
@@ -157,7 +165,7 @@
 	emit zoomLevelChanged(m_zoomLevel, m_followZoom);
     }
 
-    size_t centreFrame = startFrame + m_zoomLevel * (width() / 2);
+    int centreFrame = startFrame + m_zoomLevel * (width() / 2);
     if (centreFrame > (startFrame + getModelsEndFrame())/2) {
 	centreFrame = (startFrame + getModelsEndFrame())/2;
     }
@@ -197,15 +205,15 @@
 
 	View *w = (View *)*i;
 
-	long f0 = w->getFrameForX(0);
-	long f1 = w->getFrameForX(w->width());
+	int f0 = w->getFrameForX(0);
+	int f1 = w->getFrameForX(w->width());
 
         if (f0 >= 0) {
-            size_t rf0 = w->alignToReference(f0);
+            int rf0 = w->alignToReference(f0);
             f0 = alignFromReference(rf0);
         }
         if (f1 >= 0) {
-            size_t rf1 = w->alignToReference(f1);
+            int rf1 = w->alignToReference(f1);
             f1 = alignFromReference(rf1);
         }
 
@@ -230,7 +238,7 @@
 Overview::mousePressEvent(QMouseEvent *e)
 {
     m_clickPos = e->pos();
-    long clickFrame = getFrameForX(m_clickPos.x());
+    int clickFrame = getFrameForX(m_clickPos.x());
     if (clickFrame > 0) m_dragCentreFrame = clickFrame;
     else m_dragCentreFrame = 0;
     m_clickedInRange = true;
@@ -257,13 +265,13 @@
 {
     if (!m_clickedInRange) return;
 
-    long xoff = int(e->x()) - int(m_clickPos.x());
-    long frameOff = xoff * m_zoomLevel;
+    int xoff = int(e->x()) - int(m_clickPos.x());
+    int frameOff = xoff * m_zoomLevel;
     
-    size_t newCentreFrame = m_dragCentreFrame;
+    int newCentreFrame = m_dragCentreFrame;
     if (frameOff > 0) {
 	newCentreFrame += frameOff;
-    } else if (newCentreFrame >= size_t(-frameOff)) {
+    } else if (newCentreFrame >= int(-frameOff)) {
 	newCentreFrame += frameOff;
     } else {
 	newCentreFrame = 0;
@@ -275,8 +283,8 @@
     }
     
     if (std::max(m_centreFrame, newCentreFrame) -
-	std::min(m_centreFrame, newCentreFrame) > size_t(m_zoomLevel)) {
-        size_t rf = alignToReference(newCentreFrame);
+	std::min(m_centreFrame, newCentreFrame) > int(m_zoomLevel)) {
+        int rf = alignToReference(newCentreFrame);
 #ifdef DEBUG_OVERVIEW
         cerr << "Overview::mouseMoveEvent: x " << e->x() << " and click x " << m_clickPos.x() << " -> frame " << newCentreFrame << " -> rf " << rf << endl;
 #endif
@@ -287,8 +295,8 @@
 void
 Overview::mouseDoubleClickEvent(QMouseEvent *e)
 {
-    long frame = getFrameForX(e->x());
-    size_t rf = 0;
+    int frame = getFrameForX(e->x());
+    int rf = 0;
     if (frame > 0) rf = alignToReference(frame);
 #ifdef DEBUG_OVERVIEW
     cerr << "Overview::mouseDoubleClickEvent: frame " << frame << " -> rf " << rf << endl;
--- a/view/Overview.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/Overview.h	Wed Jun 18 13:51:27 2014 +0100
@@ -41,13 +41,13 @@
     virtual QString getPropertyContainerIconName() const { return "panner"; }
 
 public slots:
-    virtual void modelChanged(size_t startFrame, size_t endFrame);
+    virtual void modelChangedWithin(int startFrame, int endFrame);
     virtual void modelReplaced();
 
-    virtual void globalCentreFrameChanged(unsigned long);
-    virtual void viewCentreFrameChanged(View *, unsigned long);
-    virtual void viewZoomLevelChanged(View *, unsigned long, bool);
-    virtual void viewManagerPlaybackFrameChanged(unsigned long);
+    virtual void globalCentreFrameChanged(int);
+    virtual void viewCentreFrameChanged(View *, int);
+    virtual void viewZoomLevelChanged(View *, int, bool);
+    virtual void viewManagerPlaybackFrameChanged(int);
 
 protected:
     virtual void paintEvent(QPaintEvent *e);
@@ -62,7 +62,7 @@
     QPoint m_clickPos;
     QPoint m_mousePos;
     bool m_clickedInRange;
-    size_t m_dragCentreFrame;
+    int m_dragCentreFrame;
     QTime m_modelTestTime;
     
     typedef std::set<View *> ViewSet;
--- a/view/Pane.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/Pane.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -41,6 +41,7 @@
 #include <QCursor>
 #include <QTextStream>
 #include <QMimeData>
+#include <QApplication>
 
 #include <iostream>
 #include <cmath>
@@ -82,7 +83,9 @@
     m_hthumb(0),
     m_vthumb(0),
     m_reset(0),
-    m_mouseInWidget(false)
+    m_mouseInWidget(false),
+    m_playbackFrameMoveScheduled(false),
+    m_playbackFrameMoveTo(0)
 {
     setObjectName("Pane");
     setMouseTracking(true);
@@ -543,7 +546,7 @@
     paint.end();
 }
 
-size_t
+int
 Pane::getVerticalScaleWidth() const
 {
     if (m_scaleWidth > 0) return m_scaleWidth;
@@ -784,8 +787,6 @@
     int x0 = getXForFrame(model->getStartFrame());
     int x1 = getXForFrame(model->getEndFrame());
 
-    int lw = 10;
-
     paint.save();
 
     QBrush brush;
@@ -938,7 +939,7 @@
     
     if (r.x() + r.width() >= llx - fontAscent - 3) {
     
-        for (size_t i = 0; i < texts.size(); ++i) {
+        for (int i = 0; i < texts.size(); ++i) {
 
 //            cerr << "Pane "<< this << ": text " << i << ": " << texts[i] << endl;
             
@@ -966,7 +967,7 @@
 {
     int offset = m_mousePos.x() - m_clickPos.x();
 
-    long origStart = m_editingSelection.getStartFrame();
+    int origStart = m_editingSelection.getStartFrame();
 
     int p0 = getXForFrame(origStart) + offset;
     int p1 = getXForFrame(m_editingSelection.getEndFrame()) + offset;
@@ -977,8 +978,8 @@
         p0 = getXForFrame(m_editingSelection.getStartFrame());
     }
     
-    long newStart = getFrameForX(p0);
-    long newEnd = getFrameForX(p1);
+    int newStart = getFrameForX(p0);
+    int newEnd = getFrameForX(p1);
     
     paint.save();
     paint.setPen(QPen(getForeground(), 2));
@@ -1041,10 +1042,10 @@
 
     if (r.y() + r.height() < height() - fontHeight - 6) return;
 
-    size_t modelRate = waveformModel->getSampleRate();
-    size_t nativeRate = waveformModel->getNativeRate();
-    size_t playbackRate = m_manager->getPlaybackSampleRate();
-    size_t outputRate = m_manager->getOutputSampleRate();
+    int modelRate = waveformModel->getSampleRate();
+    int nativeRate = waveformModel->getNativeRate();
+    int playbackRate = m_manager->getPlaybackSampleRate();
+    int outputRate = m_manager->getOutputSampleRate();
         
     QString srNote = "";
 
@@ -1083,7 +1084,7 @@
 }
 
 bool
-Pane::render(QPainter &paint, int xorigin, size_t f0, size_t f1)
+Pane::render(QPainter &paint, int xorigin, int f0, int f1)
 {
     if (!View::render(paint, xorigin + m_scaleWidth, f0, f1)) {
         return false;
@@ -1114,10 +1115,10 @@
 }
 
 QImage *
-Pane::toNewImage(size_t f0, size_t f1)
+Pane::toNewImage(int f0, int f1)
 {
-    size_t x0 = f0 / getZoomLevel();
-    size_t x1 = f1 / getZoomLevel();
+    int x0 = f0 / getZoomLevel();
+    int x1 = f1 / getZoomLevel();
 
     QImage *image = new QImage(x1 - x0 + m_scaleWidth,
                                height(), QImage::Format_RGB32);
@@ -1154,7 +1155,7 @@
 }
 
 QSize
-Pane::getImageSize(size_t f0, size_t f1)
+Pane::getImageSize(int f0, int f1)
 {
     QSize s = View::getImageSize(f0, f1);
     QImage *image = new QImage(100, 100, QImage::Format_RGB32);
@@ -1173,11 +1174,11 @@
     return QSize(sw + s.width(), s.height());
 }
 
-size_t
+int
 Pane::getFirstVisibleFrame() const
 {
-    long f0 = getFrameForX(m_scaleWidth);
-    size_t f = View::getFirstVisibleFrame();
+    int f0 = getFrameForX(m_scaleWidth);
+    int f = View::getFirstVisibleFrame();
     if (f0 < 0 || f0 < long(f)) return f;
     return f0;
 }
@@ -1189,7 +1190,7 @@
 
     if (!m_manager) return Selection();
 
-    long testFrame = getFrameForX(x - 5);
+    int testFrame = getFrameForX(x - 5);
     if (testFrame < 0) {
     testFrame = getFrameForX(x);
     if (testFrame < 0) return Selection();
@@ -1331,6 +1332,11 @@
             m_dragStartMinValue = dmin;
         }
 
+        // Schedule a play-head move to the mouse frame location. This
+        // will happen only if nothing else of interest happens
+        // (double-click, drag) before the timeout.
+        schedulePlaybackFrameMove(getFrameForX(e->x()));
+
     } else if (mode == ViewManager::SelectMode) {
 
         if (!hasTopLayerTimeXAxis()) return;
@@ -1354,7 +1360,7 @@
         } else {
             
             int mouseFrame = getFrameForX(e->x());
-            size_t resolution = 1;
+            int resolution = 1;
             int snapFrame = mouseFrame;
     
             Layer *layer = getSelectedLayer();
@@ -1373,6 +1379,12 @@
             }
 
             m_resizing = false;
+
+            // Schedule a play-head move to the mouse frame
+            // location. This will happen only if nothing else of
+            // interest happens (double-click, drag) before the
+            // timeout.
+            schedulePlaybackFrameMove(mouseFrame);
         }
 
         update();
@@ -1416,6 +1428,24 @@
 }
 
 void
+Pane::schedulePlaybackFrameMove(int frame)
+{
+    m_playbackFrameMoveTo = frame;
+    m_playbackFrameMoveScheduled = true;
+    QTimer::singleShot(QApplication::doubleClickInterval() + 10, this,
+                       SLOT(playbackScheduleTimerElapsed()));
+}
+
+void
+Pane::playbackScheduleTimerElapsed()
+{
+    if (m_playbackFrameMoveScheduled) {
+        m_manager->setPlaybackFrame(m_playbackFrameMoveTo);
+        m_playbackFrameMoveScheduled = false;
+    }
+}
+
+void
 Pane::mouseReleaseEvent(QMouseEvent *e)
 {
     if (e->buttons() & Qt::RightButton) {
@@ -1433,6 +1463,9 @@
         mouseMoveEvent(e);
     }
 
+    int mouseFrame = e ? getFrameForX(e->x()) : 0;
+    if (mouseFrame < 0) mouseFrame = 0;
+
     if (m_navigating || mode == ViewManager::NavigateMode) {
 
         m_navigating = false;
@@ -1478,16 +1511,6 @@
                 m_manager->addSelection(selection);
             }
         }
-        else if (m_manager && !m_manager->haveInProgressSelection()) {
-            
-            //cerr << "JTEST: release without selection" << endl;
-            // Get frame location of mouse
-            int mouseFrame = getFrameForX(e->x());
-            //cerr << "JTEST: frame location of click is " << mouseFrame << endl;
-            // Move play head to that frame location
-            int playbackFrame = fmax(0,mouseFrame);
-            m_manager->setPlaybackFrame(playbackFrame);
-        }
     
         update();
 
@@ -1590,7 +1613,8 @@
             FlexiNoteLayer *layer = qobject_cast<FlexiNoteLayer *>(getTopFlexiNoteLayer());
             if (layer) {
                 layer->mouseMoveEvent(this, e); //!!! ew
-                return;
+                update();
+                // return;
             }
         }   
     
@@ -1810,6 +1834,10 @@
 
         update();
     }
+    
+    if (m_dragMode != UnresolvedDrag) {
+        m_playbackFrameMoveScheduled = false;
+    }
 }
 
 void
@@ -1822,9 +1850,9 @@
 
     int w = x1 - x0;
         
-    long newStartFrame = getFrameForX(x0);
+    int newStartFrame = getFrameForX(x0);
         
-    long visibleFrames = getEndFrame() - getStartFrame();
+    int visibleFrames = getEndFrame() - getStartFrame();
     if (newStartFrame <= -visibleFrames) {
         newStartFrame  = -visibleFrames + 1;
     }
@@ -1835,7 +1863,7 @@
         
     float ratio = float(w) / float(width());
 //	cerr << "ratio: " << ratio << endl;
-    size_t newZoomLevel = (size_t)nearbyint(m_zoomLevel * ratio);
+    int newZoomLevel = (int)nearbyint(m_zoomLevel * ratio);
     if (newZoomLevel < 1) newZoomLevel = 1;
 
 //	cerr << "start: " << m_startFrame << ", level " << m_zoomLevel << endl;
@@ -1914,13 +1942,12 @@
     if (m_dragMode == HorizontalDrag ||
         m_dragMode == FreeDrag) {
 
-        long frameOff = getFrameForX(e->x()) - getFrameForX(m_clickPos.x());
-
-        size_t newCentreFrame = m_dragCentreFrame;
+        int frameOff = getFrameForX(e->x()) - getFrameForX(m_clickPos.x());
+        int newCentreFrame = m_dragCentreFrame;
         
         if (frameOff < 0) {
             newCentreFrame -= frameOff;
-        } else if (newCentreFrame >= size_t(frameOff)) {
+        } else if (newCentreFrame >= frameOff) {
             newCentreFrame -= frameOff;
         } else {
             newCentreFrame = 0;
@@ -2042,7 +2069,7 @@
 Pane::dragExtendSelection(QMouseEvent *e)
 {
     int mouseFrame = getFrameForX(e->x());
-    size_t resolution = 1;
+    int resolution = 1;
     int snapFrameLeft = mouseFrame;
     int snapFrameRight = mouseFrame;
     
@@ -2059,12 +2086,12 @@
     if (snapFrameLeft < 0) snapFrameLeft = 0;
     if (snapFrameRight < 0) snapFrameRight = 0;
     
-    size_t min, max;
+    int min, max;
     
-    if (m_selectionStartFrame > size_t(snapFrameLeft)) {
+    if (m_selectionStartFrame > snapFrameLeft) {
         min = snapFrameLeft;
         max = m_selectionStartFrame;
-    } else if (size_t(snapFrameRight) > m_selectionStartFrame) {
+    } else if (snapFrameRight > m_selectionStartFrame) {
         min = m_selectionStartFrame;
         max = snapFrameRight;
     } else {
@@ -2081,6 +2108,10 @@
     edgeScrollMaybe(e->x());
 
     update();
+
+    if (min != max) {
+        m_playbackFrameMoveScheduled = false;
+    }
 }
 
 void
@@ -2117,7 +2148,7 @@
         return;
     }
 
-//    cerr << "mouseDoubleClickEvent" << endl;
+    cerr << "mouseDoubleClickEvent" << endl;
 
     m_clickPos = e->pos();
     m_clickedInRange = true;
@@ -2125,6 +2156,9 @@
     m_ctrlPressed = (e->modifiers() & Qt::ControlModifier);
     m_altPressed = (e->modifiers() & Qt::AltModifier);
 
+    // cancel any pending move that came from a single click
+    m_playbackFrameMoveScheduled = false;
+
     ViewManager::ToolMode mode = ViewManager::NavigateMode;
     if (m_manager) mode = m_manager->getToolModeFor(this);
 
@@ -2155,7 +2189,7 @@
 
     if (relocate) {
 
-        long f = getFrameForX(e->x());
+        int f = getFrameForX(e->x());
 
         setCentreFrame(f);
 
@@ -2226,11 +2260,11 @@
     if (getStartFrame() < 0 && 
         getEndFrame() >= getModelsEndFrame()) return;
 
-    long delta = ((width() / 2) * count * m_zoomLevel);
-
-    if (int(m_centreFrame) < delta) {
+    int delta = ((width() / 2) * count * m_zoomLevel);
+
+    if (m_centreFrame < delta) {
         setCentreFrame(0);
-    } else if (int(m_centreFrame) - delta >= int(getModelsEndFrame())) {
+    } else if (m_centreFrame - delta >= getModelsEndFrame()) {
         setCentreFrame(getModelsEndFrame());
     } else {
         setCentreFrame(m_centreFrame - delta);
@@ -2355,7 +2389,7 @@
 }    
 
 void
-Pane::verticalPannerMoved(float x0, float y0, float w, float h)
+Pane::verticalPannerMoved(float , float y0, float , float h)
 {
     float vmin, vmax, dmin, dmax;
     if (!getTopLayerDisplayExtents(vmin, vmax, dmin, dmax)) return;
@@ -2493,8 +2527,8 @@
     int p0 = getXForFrame(m_editingSelection.getStartFrame()) + offset;
     int p1 = getXForFrame(m_editingSelection.getEndFrame()) + offset;
 
-    long f0 = getFrameForX(p0);
-    long f1 = getFrameForX(p1);
+    int f0 = getFrameForX(p0);
+    int f1 = getFrameForX(p1);
 
     Selection newSelection(f0, f1);
     
@@ -2591,7 +2625,7 @@
 }
 
 void
-Pane::viewZoomLevelChanged(View *v, unsigned long z, bool locked)
+Pane::viewZoomLevelChanged(View *v, int z, bool locked)
 {
 //    cerr << "Pane[" << this << "]::zoomLevelChanged (global now "
 //              << (m_manager ? m_manager->getGlobalZoom() : 0) << ")" << endl;
--- a/view/Pane.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/Pane.h	Wed Jun 18 13:51:27 2014 +0100
@@ -48,13 +48,13 @@
     void setCentreLineVisible(bool visible);
     bool getCentreLineVisible() const { return m_centreLineVisible; }
 
-    virtual size_t getFirstVisibleFrame() const;
+    virtual int getFirstVisibleFrame() const;
 
-    virtual size_t getVerticalScaleWidth() const;
+    virtual int getVerticalScaleWidth() const;
 
-    virtual QImage *toNewImage(size_t f0, size_t f1);
+    virtual QImage *toNewImage(int f0, int f1);
     virtual QImage *toNewImage() { return View::toNewImage(); }
-    virtual QSize getImageSize(size_t f0, size_t f1);
+    virtual QSize getImageSize(int f0, int f1);
     virtual QSize getImageSize() { return View::getImageSize(); }
 
     virtual void toXml(QTextStream &stream, QString indent = "",
@@ -67,13 +67,13 @@
     void rightButtonMenuRequested(QPoint position);
     void dropAccepted(QStringList uriList);
     void dropAccepted(QString text);
-    void doubleClickSelectInvoked(size_t frame);
+    void doubleClickSelectInvoked(int frame);
     void regionOutlined(QRect rect);
 
 public slots:
     virtual void toolModeChanged();
     virtual void zoomWheelsEnabledChanged();
-    virtual void viewZoomLevelChanged(View *v, unsigned long z, bool locked);
+    virtual void viewZoomLevelChanged(View *v, int z, bool locked);
     virtual void modelAlignmentCompletionChanged();
 
     virtual void horizontalThumbwheelMoved(int value);
@@ -91,6 +91,9 @@
     void mouseEnteredWidget();
     void mouseLeftWidget();
 
+protected slots:
+    void playbackScheduleTimerElapsed();
+
 protected:
     virtual void paintEvent(QPaintEvent *e);
     virtual void mousePressEvent(QMouseEvent *e);
@@ -114,7 +117,7 @@
     void drawEditingSelection(QPainter &);
     void drawAlignmentStatus(QRect, QPainter &, const Model *, bool down);
 
-    virtual bool render(QPainter &paint, int x0, size_t f0, size_t f1);
+    virtual bool render(QPainter &paint, int x0, int f0, int f1);
 
     Selection getSelectionAt(int x, bool &closeToLeft, bool &closeToRight) const;
 
@@ -139,6 +142,8 @@
 
     Layer *getTopFlexiNoteLayer();
 
+    void schedulePlaybackFrameMove(int frame);
+
     bool m_identifyFeatures;
     QPoint m_identifyPoint;
     QPoint m_clickPos;
@@ -152,10 +157,10 @@
     bool m_resizing;
     bool m_editing;
     bool m_releasing;
-    size_t m_dragCentreFrame;
+    int m_dragCentreFrame;
     float m_dragStartMinValue;
     bool m_centreLineVisible;
-    size_t m_selectionStartFrame;
+    int m_selectionStartFrame;
     Selection m_editingSelection;
     int m_editingSelectionEdge;
     mutable int m_scaleWidth;
@@ -184,6 +189,9 @@
 
     bool m_mouseInWidget;
 
+    bool m_playbackFrameMoveScheduled;
+    int m_playbackFrameMoveTo;
+
     static QCursor *m_measureCursor1;
     static QCursor *m_measureCursor2;
 };
--- a/view/PaneStack.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/PaneStack.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -98,9 +98,9 @@
     currentIndicator->setScaledContents(true);
     currentIndicator->setVisible(m_showAccessories);
 
-    long initialCentreFrame = -1;
-    for (int i = 0; i < m_panes.size(); ++i) {
-        long f = m_panes[i].pane->getCentreFrame();
+    int initialCentreFrame = -1;
+    for (int i = 0; i < (int)m_panes.size(); ++i) {
+        int f = m_panes[i].pane->getCentreFrame();
         initialCentreFrame = f;
         break;
     }
@@ -158,8 +158,8 @@
             this, SLOT(paneDropAccepted(QStringList)));
     connect(pane, SIGNAL(dropAccepted(QString)),
             this, SLOT(paneDropAccepted(QString)));
-    connect(pane, SIGNAL(doubleClickSelectInvoked(size_t)),
-            this, SIGNAL(doubleClickSelectInvoked(size_t)));
+    connect(pane, SIGNAL(doubleClickSelectInvoked(int)),
+            this, SIGNAL(doubleClickSelectInvoked(int)));
 
     emit paneAdded(pane);
     emit paneAdded();
@@ -220,7 +220,7 @@
 Pane *
 PaneStack::getPane(int n)
 {
-    if (n < m_panes.size()) {
+    if (n < (int)m_panes.size()) {
         return m_panes[n].pane;
     } else {
         return 0;
@@ -532,7 +532,7 @@
 
     if (m_propertyStackMinWidth > 0) maxMinWidth = m_propertyStackMinWidth;
 
-    for (size_t i = 0; i < m_panes.size(); ++i) {
+    for (int i = 0; i < (int)m_panes.size(); ++i) {
 	if (!m_panes[i].propertyStack) continue;
 #ifdef DEBUG_PANE_STACK
 	SVDEBUG << "PaneStack::sizePropertyStacks: " << i << ": min " 
@@ -554,7 +554,7 @@
 
     m_propertyStackStack->setMaximumWidth(setWidth + 10);
 
-    for (size_t i = 0; i < m_panes.size(); ++i) {
+    for (int i = 0; i < (int)m_panes.size(); ++i) {
 	if (!m_panes[i].propertyStack) continue;
 	m_panes[i].propertyStack->setMinimumWidth(setWidth);
     }
@@ -581,7 +581,7 @@
 PaneStack::paneDeleteButtonClicked()
 {
     QObject *s = sender();
-    for (size_t i = 0; i < m_panes.size(); ++i) {
+    for (int i = 0; i < (int)m_panes.size(); ++i) {
 	if (m_panes[i].xButton == s) {
             emit paneDeleteButtonClicked(m_panes[i].pane);
         }
@@ -593,7 +593,7 @@
 {
     QObject *s = sender();
 
-    for (size_t i = 0; i < m_panes.size(); ++i) {
+    for (int i = 0; i < (int)m_panes.size(); ++i) {
 	if (m_panes[i].currentIndicator == s) {
             setCurrentPane(m_panes[i].pane);
             return;
--- a/view/PaneStack.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/PaneStack.h	Wed Jun 18 13:51:27 2014 +0100
@@ -93,7 +93,7 @@
 
     void paneDeleteButtonClicked(Pane *pane);
 
-    void doubleClickSelectInvoked(size_t frame);
+    void doubleClickSelectInvoked(int frame);
 
 public slots:
     void propertyContainerAdded(PropertyContainer *);
--- a/view/View.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/View.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -26,6 +26,8 @@
 #include "data/model/PowerOfSqrtTwoZoomConstraint.h"
 #include "data/model/RangeSummarisableTimeValueModel.h"
 
+#include "widgets/IconLoader.h"
+
 #include <QPainter>
 #include <QPaintEvent>
 #include <QRect>
@@ -34,6 +36,7 @@
 #include <QTextStream>
 #include <QFont>
 #include <QMessageBox>
+#include <QPushButton>
 
 #include <iostream>
 #include <cassert>
@@ -53,6 +56,7 @@
     m_followPan(true),
     m_followZoom(true),
     m_followPlay(PlaybackScrollPage),
+    m_followPlayIsDetached(false),
     m_playPointerFrame(0),
     m_showProgress(showProgress),
     m_cache(0),
@@ -154,21 +158,21 @@
     }
 }
 
-size_t
+int
 View::getPropertyContainerCount() const
 {
     return m_layers.size() + 1; // the 1 is for me
 }
 
 const PropertyContainer *
-View::getPropertyContainer(size_t i) const
+View::getPropertyContainer(int i) const
 {
     return (const PropertyContainer *)(((View *)this)->
 				       getPropertyContainer(i));
 }
 
 PropertyContainer *
-View::getPropertyContainer(size_t i)
+View::getPropertyContainer(int i)
 {
     if (i == 0) return m_propertyContainer;
     return m_layers[i-1];
@@ -291,26 +295,26 @@
     // subclass might override this
 }
 
-long
+int
 View::getStartFrame() const
 {
     return getFrameForX(0);
 }
 
-size_t
+int
 View::getEndFrame() const
 {
     return getFrameForX(width()) - 1;
 }
 
 void
-View::setStartFrame(long f)
+View::setStartFrame(int f)
 {
     setCentreFrame(f + m_zoomLevel * (width() / 2));
 }
 
 bool
-View::setCentreFrame(size_t f, bool e)
+View::setCentreFrame(int f, bool e)
 {
     bool changeVisible = false;
 
@@ -333,7 +337,7 @@
 	}
 
 	if (e) {
-            size_t rf = alignToReference(f);
+            int rf = alignToReference(f);
 #ifdef DEBUG_VIEW_WIDGET_PAINT
             cerr << "View[" << this << "]::setCentreFrame(" << f
                       << "): emitting centreFrameChanged("
@@ -347,16 +351,16 @@
 }
 
 int
-View::getXForFrame(long frame) const
+View::getXForFrame(int frame) const
 {
     return (frame - getStartFrame()) / m_zoomLevel;
 }
 
-long
+int
 View::getFrameForX(int x) const
 {
-    long z = (long)m_zoomLevel;
-    long frame = m_centreFrame - (width()/2) * z;
+    int z = m_zoomLevel;
+    int frame = m_centreFrame - (width()/2) * z;
 
 #ifdef DEBUG_VIEW_WIDGET_PAINT
     SVDEBUG << "View::getFrameForX(" << x << "): z = " << z << ", m_centreFrame = " << m_centreFrame << ", width() = " << width() << ", frame = " << frame << endl;
@@ -442,7 +446,7 @@
 }
 
 void
-View::setZoomLevel(size_t z)
+View::setZoomLevel(int z)
 {
     if (z < 1) z = 1;
     if (m_zoomLevel != int(z)) {
@@ -516,11 +520,6 @@
     else return Qt::white;
 }
 
-View::LayerProgressBar::LayerProgressBar(QWidget *parent) :
-    QProgressBar(parent)
-{
-}
-
 void
 View::addLayer(Layer *layer)
 {
@@ -538,7 +537,14 @@
     pb->setFixedWidth(80);
     pb->setTextVisible(false);
 
+    QPushButton *cancel = new QPushButton(this);
+    cancel->setIcon(IconLoader().load("fileclose"));
+    cancel->setFlat(true);
+    cancel->setFixedSize(QSize(20, 20));
+    connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
+    
     ProgressBarRec pbr;
+    pbr.cancel = cancel;
     pbr.bar = pb;
     pbr.lastCheck = 0;
     pbr.checkTimer = new QTimer();
@@ -551,6 +557,8 @@
     int fs = Preferences::getInstance()->getViewFontSize();
     f.setPointSize(std::min(fs, int(ceil(fs * 0.85))));
 
+    cancel->hide();
+
     pb->setFont(f);
     pb->hide();
     
@@ -568,8 +576,8 @@
 	    this,    SLOT(modelCompletionChanged()));
     connect(layer, SIGNAL(modelAlignmentCompletionChanged()),
 	    this,    SLOT(modelAlignmentCompletionChanged()));
-    connect(layer, SIGNAL(modelChanged(size_t, size_t)),
-	    this,    SLOT(modelChanged(size_t, size_t)));
+    connect(layer, SIGNAL(modelChangedWithin(int, int)),
+	    this,    SLOT(modelChangedWithin(int, int)));
     connect(layer, SIGNAL(modelReplaced()),
 	    this,    SLOT(modelReplaced()));
 
@@ -593,6 +601,7 @@
 	    m_layers.erase(i);
 	    if (m_progressBars.find(layer) != m_progressBars.end()) {
 		delete m_progressBars[layer].bar;
+                delete m_progressBars[layer].cancel;
 		delete m_progressBars[layer].checkTimer;
 		m_progressBars.erase(layer);
 	    }
@@ -612,8 +621,8 @@
                this,    SLOT(modelCompletionChanged()));
     disconnect(layer, SIGNAL(modelAlignmentCompletionChanged()),
                this,    SLOT(modelAlignmentCompletionChanged()));
-    disconnect(layer, SIGNAL(modelChanged(size_t, size_t)),
-               this,    SLOT(modelChanged(size_t, size_t)));
+    disconnect(layer, SIGNAL(modelChangedWithin(int, int)),
+               this,    SLOT(modelChangedWithin(int, int)));
     disconnect(layer, SIGNAL(modelReplaced()),
                this,    SLOT(modelReplaced()));
 
@@ -650,29 +659,29 @@
 View::setViewManager(ViewManager *manager)
 {
     if (m_manager) {
-	m_manager->disconnect(this, SLOT(globalCentreFrameChanged(unsigned long)));
-	m_manager->disconnect(this, SLOT(viewCentreFrameChanged(View *, unsigned long)));
-	m_manager->disconnect(this, SLOT(viewManagerPlaybackFrameChanged(unsigned long)));
-	m_manager->disconnect(this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
+	m_manager->disconnect(this, SLOT(globalCentreFrameChanged(int)));
+	m_manager->disconnect(this, SLOT(viewCentreFrameChanged(View *, int)));
+	m_manager->disconnect(this, SLOT(viewManagerPlaybackFrameChanged(int)));
+	m_manager->disconnect(this, SLOT(viewZoomLevelChanged(View *, int, bool)));
         m_manager->disconnect(this, SLOT(toolModeChanged()));
         m_manager->disconnect(this, SLOT(selectionChanged()));
         m_manager->disconnect(this, SLOT(overlayModeChanged()));
         m_manager->disconnect(this, SLOT(zoomWheelsEnabledChanged()));
-        disconnect(m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode)));
-	disconnect(m_manager, SLOT(zoomLevelChanged(unsigned long, bool)));
+        disconnect(m_manager, SLOT(viewCentreFrameChanged(int, bool, PlaybackFollowMode)));
+	disconnect(m_manager, SLOT(zoomLevelChanged(int, bool)));
     }
 
     m_manager = manager;
 
-    connect(m_manager, SIGNAL(globalCentreFrameChanged(unsigned long)),
-	    this, SLOT(globalCentreFrameChanged(unsigned long)));
-    connect(m_manager, SIGNAL(viewCentreFrameChanged(View *, unsigned long)),
-	    this, SLOT(viewCentreFrameChanged(View *, unsigned long)));
-    connect(m_manager, SIGNAL(playbackFrameChanged(unsigned long)),
-	    this, SLOT(viewManagerPlaybackFrameChanged(unsigned long)));
-
-    connect(m_manager, SIGNAL(viewZoomLevelChanged(View *, unsigned long, bool)),
-	    this, SLOT(viewZoomLevelChanged(View *, unsigned long, bool)));
+    connect(m_manager, SIGNAL(globalCentreFrameChanged(int)),
+	    this, SLOT(globalCentreFrameChanged(int)));
+    connect(m_manager, SIGNAL(viewCentreFrameChanged(View *, int)),
+	    this, SLOT(viewCentreFrameChanged(View *, int)));
+    connect(m_manager, SIGNAL(playbackFrameChanged(int)),
+	    this, SLOT(viewManagerPlaybackFrameChanged(int)));
+
+    connect(m_manager, SIGNAL(viewZoomLevelChanged(View *, int, bool)),
+	    this, SLOT(viewZoomLevelChanged(View *, int, bool)));
 
     connect(m_manager, SIGNAL(toolModeChanged()),
 	    this, SLOT(toolModeChanged()));
@@ -687,13 +696,13 @@
     connect(m_manager, SIGNAL(zoomWheelsEnabledChanged()),
             this, SLOT(zoomWheelsEnabledChanged()));
 
-    connect(this, SIGNAL(centreFrameChanged(unsigned long, bool,
+    connect(this, SIGNAL(centreFrameChanged(int, bool,
                                             PlaybackFollowMode)),
-            m_manager, SLOT(viewCentreFrameChanged(unsigned long, bool,
+            m_manager, SLOT(viewCentreFrameChanged(int, bool,
                                                    PlaybackFollowMode)));
 
-    connect(this, SIGNAL(zoomLevelChanged(unsigned long, bool)),
-	    m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool)));
+    connect(this, SIGNAL(zoomLevelChanged(int, bool)),
+	    m_manager, SLOT(viewZoomLevelChanged(int, bool)));
 
 //    setCentreFrame(m_manager->getViewInitialCentreFrame());
 
@@ -716,7 +725,7 @@
 }
 
 void
-View::setViewManager(ViewManager *vm, long initialCentreFrame)
+View::setViewManager(ViewManager *vm, int initialCentreFrame)
 {
     setViewManager(vm);
     setCentreFrame(initialCentreFrame, false);
@@ -830,18 +839,18 @@
 }
 
 void
-View::modelChanged(size_t startFrame, size_t endFrame)
+View::modelChangedWithin(int startFrame, int endFrame)
 {
     QObject *obj = sender();
 
-    long myStartFrame = getStartFrame();
-    size_t myEndFrame = getEndFrame();
+    int myStartFrame = getStartFrame();
+    int myEndFrame = getEndFrame();
 
 #ifdef DEBUG_VIEW_WIDGET_PAINT
-    cerr << "View(" << this << ")::modelChanged(" << startFrame << "," << endFrame << ") [me " << myStartFrame << "," << myEndFrame << "]" << endl;
+    cerr << "View(" << this << ")::modelChangedWithin(" << startFrame << "," << endFrame << ") [me " << myStartFrame << "," << myEndFrame << "]" << endl;
 #endif
 
-    if (myStartFrame > 0 && endFrame < size_t(myStartFrame)) {
+    if (myStartFrame > 0 && endFrame < int(myStartFrame)) {
 	checkProgress(obj);
 	return;
     }
@@ -870,7 +879,7 @@
 	m_cache = 0;
     }
 
-    if (long(startFrame) < myStartFrame) startFrame = myStartFrame;
+    if (startFrame < myStartFrame) startFrame = myStartFrame;
     if (endFrame > myEndFrame) endFrame = myEndFrame;
 
     checkProgress(obj);
@@ -948,10 +957,10 @@
 }
 
 void
-View::globalCentreFrameChanged(unsigned long rf)
+View::globalCentreFrameChanged(int rf)
 {
     if (m_followPan) {
-        size_t f = alignFromReference(rf);
+        int f = alignFromReference(rf);
 #ifdef DEBUG_VIEW_WIDGET_PAINT
         cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf
                   << "): setting centre frame to " << f << endl;
@@ -961,13 +970,13 @@
 }
 
 void
-View::viewCentreFrameChanged(View *, unsigned long )
+View::viewCentreFrameChanged(View *, int )
 {
     // We do nothing with this, but a subclass might
 }
 
 void
-View::viewManagerPlaybackFrameChanged(unsigned long f)
+View::viewManagerPlaybackFrameChanged(int f)
 {
     if (m_manager) {
 	if (sender() != m_manager) return;
@@ -979,12 +988,12 @@
 }
 
 void
-View::movePlayPointer(unsigned long newFrame)
+View::movePlayPointer(int newFrame)
 {
     if (m_playPointerFrame == newFrame) return;
     bool visibleChange =
         (getXForFrame(m_playPointerFrame) != getXForFrame(newFrame));
-    size_t oldPlayPointerFrame = m_playPointerFrame;
+    int oldPlayPointerFrame = m_playPointerFrame;
     m_playPointerFrame = newFrame;
     if (!visibleChange) return;
 
@@ -992,6 +1001,12 @@
         ((QApplication::mouseButtons() != Qt::NoButton) ||
          (QApplication::keyboardModifiers() & Qt::AltModifier));
 
+    bool pointerInVisibleArea =
+	long(m_playPointerFrame) >= getStartFrame() &&
+        (m_playPointerFrame < getEndFrame() ||
+         // include old pointer location so we know to refresh when moving out
+         oldPlayPointerFrame < getEndFrame());
+
     switch (m_followPlay) {
 
     case PlaybackScrollContinuous:
@@ -1001,59 +1016,78 @@
 	break;
 
     case PlaybackScrollPage:
-    { 
-	int xold = getXForFrame(oldPlayPointerFrame);
-	update(xold - 4, 0, 9, height());
-
-	long w = getEndFrame() - getStartFrame();
-	w -= w/5;
-	long sf = (m_playPointerFrame / w) * w - w/8;
-
-	if (m_manager &&
-	    m_manager->isPlaying() &&
-	    m_manager->getPlaySelectionMode()) {
-	    MultiSelection::SelectionList selections = m_manager->getSelections();
-	    if (!selections.empty()) {
-		size_t selectionStart = selections.begin()->getStartFrame();
-		if (sf < long(selectionStart) - w / 10) {
-		    sf = long(selectionStart) - w / 10;
-		}
-	    }
-	}
+
+        if (!pointerInVisibleArea && somethingGoingOn) {
+
+            m_followPlayIsDetached = true;
+
+        } else if (!pointerInVisibleArea && m_followPlayIsDetached) {
+
+            // do nothing; we aren't tracking until the pointer comes back in
+
+        } else {
+
+            int xold = getXForFrame(oldPlayPointerFrame);
+            update(xold - 4, 0, 9, height());
+
+            int w = getEndFrame() - getStartFrame();
+            w -= w/5;
+            int sf = (m_playPointerFrame / w) * w - w/8;
+
+            if (m_manager &&
+                m_manager->isPlaying() &&
+                m_manager->getPlaySelectionMode()) {
+                MultiSelection::SelectionList selections = m_manager->getSelections();
+                if (!selections.empty()) {
+                    int selectionStart = selections.begin()->getStartFrame();
+                    if (sf < selectionStart - w / 10) {
+                        sf = selectionStart - w / 10;
+                    }
+                }
+            }
 
 #ifdef DEBUG_VIEW_WIDGET_PAINT
-	cerr << "PlaybackScrollPage: f = " << m_playPointerFrame << ", sf = " << sf << ", start frame "
-		  << getStartFrame() << endl;
+            cerr << "PlaybackScrollPage: f = " << m_playPointerFrame << ", sf = " << sf << ", start frame "
+                 << getStartFrame() << endl;
 #endif
 
-	// We don't consider scrolling unless the pointer is outside
-	// the clearly visible range already
-
-	int xnew = getXForFrame(m_playPointerFrame);
+            // We don't consider scrolling unless the pointer is outside
+            // the central visible range already
+
+            int xnew = getXForFrame(m_playPointerFrame);
 
 #ifdef DEBUG_VIEW_WIDGET_PAINT
-	cerr << "xnew = " << xnew << ", width = " << width() << endl;
+            cerr << "xnew = " << xnew << ", width = " << width() << endl;
 #endif
 
-	if (xnew < width()/8 || xnew > (width()*7)/8) {
-	    if (!somethingGoingOn) {
-		long offset = getFrameForX(width()/2) - getStartFrame();
-		long newCentre = sf + offset;
-		bool changed = setCentreFrame(newCentre, false);
-		if (changed) {
-		    xold = getXForFrame(oldPlayPointerFrame);
-		    update(xold - 4, 0, 9, height());
-		}
-	    }
-	}
-
-	update(xnew - 4, 0, 9, height());
-
-	break;
-    }
+            bool shouldScroll = (xnew > (width() * 7) / 8);
+
+            if (!m_followPlayIsDetached && (xnew < width() / 8)) {
+                shouldScroll = true;
+            }
+
+            if (xnew > width() / 8) {
+                m_followPlayIsDetached = false;
+            } else if (somethingGoingOn) {
+                m_followPlayIsDetached = true;
+            }
+
+            if (!somethingGoingOn && shouldScroll) {
+                int offset = getFrameForX(width()/2) - getStartFrame();
+                int newCentre = sf + offset;
+                bool changed = setCentreFrame(newCentre, false);
+                if (changed) {
+                    xold = getXForFrame(oldPlayPointerFrame);
+                    update(xold - 4, 0, 9, height());
+                }
+            }
+
+            update(xnew - 4, 0, 9, height());
+        }
+        break;
 
     case PlaybackIgnore:
-	if (long(m_playPointerFrame) >= getStartFrame() &&
+	if (m_playPointerFrame >= getStartFrame() &&
             m_playPointerFrame < getEndFrame()) {
 	    update();
 	}
@@ -1062,7 +1096,7 @@
 }
 
 void
-View::viewZoomLevelChanged(View *p, unsigned long z, bool locked)
+View::viewZoomLevelChanged(View *p, int z, bool locked)
 {
 #ifdef DEBUG_VIEW_WIDGET_PAINT
     cerr  << "View[" << this << "]: viewZoomLevelChanged(" << p << ", " << z << ", " << locked << ")" << endl;
@@ -1083,35 +1117,35 @@
     update();
 }
 
-size_t
+int
 View::getFirstVisibleFrame() const
 {
-    long f0 = getStartFrame();
-    size_t f = getModelsStartFrame();
-    if (f0 < 0 || f0 < long(f)) return f;
+    int f0 = getStartFrame();
+    int f = getModelsStartFrame();
+    if (f0 < 0 || f0 < f) return f;
     return f0;
 }
 
-size_t 
+int 
 View::getLastVisibleFrame() const
 {
-    size_t f0 = getEndFrame();
-    size_t f = getModelsEndFrame();
+    int f0 = getEndFrame();
+    int f = getModelsEndFrame();
     if (f0 > f) return f;
     return f0;
 }
 
-size_t
+int
 View::getModelsStartFrame() const
 {
     bool first = true;
-    size_t startFrame = 0;
+    int startFrame = 0;
 
     for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
 
 	if ((*i)->getModel() && (*i)->getModel()->isOK()) {
 
-	    size_t thisStartFrame = (*i)->getModel()->getStartFrame();
+	    int thisStartFrame = (*i)->getModel()->getStartFrame();
 
 	    if (first || thisStartFrame < startFrame) {
 		startFrame = thisStartFrame;
@@ -1122,17 +1156,17 @@
     return startFrame;
 }
 
-size_t
+int
 View::getModelsEndFrame() const
 {
     bool first = true;
-    size_t endFrame = 0;
+    int endFrame = 0;
 
     for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
 
 	if ((*i)->getModel() && (*i)->getModel()->isOK()) {
 
-	    size_t thisEndFrame = (*i)->getModel()->getEndFrame();
+	    int thisEndFrame = (*i)->getModel()->getEndFrame();
 
 	    if (first || thisEndFrame > endFrame) {
 		endFrame = thisEndFrame;
@@ -1224,8 +1258,8 @@
     else return anyModel;
 }
 
-size_t
-View::alignFromReference(size_t f) const
+int
+View::alignFromReference(int f) const
 {
     if (!m_manager->getAlignMode()) return f;
     Model *aligningModel = getAligningModel();
@@ -1233,8 +1267,8 @@
     return aligningModel->alignFromReference(f);
 }
 
-size_t
-View::alignToReference(size_t f) const
+int
+View::alignToReference(int f) const
 {
     if (!m_manager->getAlignMode()) return f;
     Model *aligningModel = getAligningModel();
@@ -1344,12 +1378,12 @@
     return nonScrollables;
 }
 
-size_t
-View::getZoomConstraintBlockSize(size_t blockSize,
+int
+View::getZoomConstraintBlockSize(int blockSize,
 				 ZoomConstraint::RoundingDirection dir)
     const
 {
-    size_t candidate = blockSize;
+    int candidate = blockSize;
     bool haveCandidate = false;
 
     PowerOfSqrtTwoZoomConstraint defaultZoomConstraint;
@@ -1359,7 +1393,7 @@
 	const ZoomConstraint *zoomConstraint = (*i)->getZoomConstraint();
 	if (!zoomConstraint) zoomConstraint = &defaultZoomConstraint;
 
-	size_t thisBlockSize =
+	int thisBlockSize =
 	    zoomConstraint->getNearestBlockSize(blockSize, dir);
 
 	// Go for the block size that's furthest from the one
@@ -1416,7 +1450,7 @@
 void
 View::scroll(bool right, bool lots, bool e)
 {
-    long delta;
+    int delta;
     if (lots) {
 	delta = (getEndFrame() - getStartFrame()) / 2;
     } else {
@@ -1434,6 +1468,25 @@
 }
 
 void
+View::cancelClicked()
+{
+    QPushButton *cancel = qobject_cast<QPushButton *>(sender());
+    if (!cancel) return;
+
+    for (ProgressMap::iterator i = m_progressBars.begin();
+	 i != m_progressBars.end(); ++i) {
+
+        if (i->second.cancel == cancel) {
+
+            Layer *layer = i->first;
+            Model *model = layer->getModel();
+
+            if (model) model->abandon();
+        }
+    }
+}
+
+void
 View::checkProgress(void *object)
 {
     if (!m_showProgress) return;
@@ -1444,6 +1497,7 @@
 	 i != m_progressBars.end(); ++i) {
 
         QProgressBar *pb = i->second.bar;
+        QPushButton *cancel = i->second.cancel;
 
 	if (i->first == object) {
 
@@ -1490,6 +1544,7 @@
 	    if (completion >= 100) {
 
 		pb->hide();
+                cancel->hide();
                 timer->stop();
 
 	    } else {
@@ -1502,8 +1557,11 @@
                     timer->start();
                 }
 
+                cancel->move(0, ph - pb->height()/2 - 10);
+                cancel->show();
+
 		pb->setValue(completion);
-		pb->move(0, ph - pb->height());
+		pb->move(20, ph - pb->height());
 
 		pb->show();
 		pb->update();
@@ -1562,7 +1620,7 @@
 View::paintEvent(QPaintEvent *e)
 {
 //    Profiler prof("View::paintEvent", false);
-//    SVDEBUG << "View::paintEvent: centre frame is " << m_centreFrame << endl;
+//    cerr << "View::paintEvent: centre frame is " << m_centreFrame << endl;
 
     if (m_layers.empty()) {
 	QFrame::paintEvent(e);
@@ -1602,7 +1660,6 @@
     LayerList nonScrollables = getNonScrollableFrontLayers(true, layersChanged);
     bool selectionCacheable = nonScrollables.empty();
     bool haveSelections = m_manager && !m_manager->getSelections().empty();
-    bool selectionDrawn = false;
 
     // If all the non-scrollable layers are non-opaque, then we draw
     // the selection rectangle behind them and cache it.  If any are
@@ -1674,7 +1731,7 @@
 
 	} else if (m_cacheCentreFrame != m_centreFrame) {
 
-	    long dx =
+	    int dx =
 		getXForFrame(m_cacheCentreFrame) -
 		getXForFrame(m_centreFrame);
 
@@ -1766,7 +1823,6 @@
 	if (haveSelections && selectionCacheable) {
 	    drawSelections(paint);
 	    m_selectionCached = repaintCache;
-	    selectionDrawn = true;
 	}
 	
 	paint.end();
@@ -1815,12 +1871,15 @@
     bool showPlayPointer = true;
     if (m_followPlay == PlaybackScrollContinuous) {
         showPlayPointer = false;
-    } else if (long(m_playPointerFrame) <= getStartFrame() ||
+    } else if (m_playPointerFrame <= getStartFrame() ||
                m_playPointerFrame >= getEndFrame()) {
         showPlayPointer = false;
     } else if (m_manager && !m_manager->isPlaying()) {
         if (m_playPointerFrame == getCentreFrame() &&
+            m_manager->shouldShowCentreLine() &&
             m_followPlay != PlaybackIgnore) {
+            // Don't show the play pointer when it is redundant with
+            // the centre line
             showPlayPointer = false;
         }
     }
@@ -1876,7 +1935,7 @@
     int sampleRate = getModelsSampleRate();
 
     QPoint localPos;
-    long illuminateFrame = -1;
+    int illuminateFrame = -1;
     bool closeToLeft, closeToRight;
 
     if (shouldIlluminateLocalSelection(localPos, closeToLeft, closeToRight)) {
@@ -2232,14 +2291,14 @@
 }
 
 bool
-View::render(QPainter &paint, int xorigin, size_t f0, size_t f1)
+View::render(QPainter &paint, int xorigin, int f0, int f1)
 {
-    size_t x0 = f0 / m_zoomLevel;
-    size_t x1 = f1 / m_zoomLevel;
-
-    size_t w = x1 - x0;
-
-    size_t origCentreFrame = m_centreFrame;
+    int x0 = f0 / m_zoomLevel;
+    int x1 = f1 / m_zoomLevel;
+
+    int w = x1 - x0;
+
+    int origCentreFrame = m_centreFrame;
 
     bool someLayersIncomplete = false;
 
@@ -2287,7 +2346,7 @@
     QProgressDialog progress(tr("Rendering image..."),
                              tr("Cancel"), 0, w / width(), this);
 
-    for (size_t x = 0; x < w; x += width()) {
+    for (int x = 0; x < w; x += width()) {
 
         progress.setValue(x / width());
         qApp->processEvents();
@@ -2339,17 +2398,17 @@
 QImage *
 View::toNewImage()
 {
-    size_t f0 = getModelsStartFrame();
-    size_t f1 = getModelsEndFrame();
+    int f0 = getModelsStartFrame();
+    int f1 = getModelsEndFrame();
 
     return toNewImage(f0, f1);
 }
 
 QImage *
-View::toNewImage(size_t f0, size_t f1)
+View::toNewImage(int f0, int f1)
 {
-    size_t x0 = f0 / getZoomLevel();
-    size_t x1 = f1 / getZoomLevel();
+    int x0 = f0 / getZoomLevel();
+    int x1 = f1 / getZoomLevel();
     
     QImage *image = new QImage(x1 - x0, height(), QImage::Format_RGB32);
 
@@ -2367,17 +2426,17 @@
 QSize
 View::getImageSize()
 {
-    size_t f0 = getModelsStartFrame();
-    size_t f1 = getModelsEndFrame();
+    int f0 = getModelsStartFrame();
+    int f1 = getModelsEndFrame();
 
     return getImageSize(f0, f1);
 }
     
 QSize
-View::getImageSize(size_t f0, size_t f1)
+View::getImageSize(int f0, int f1)
 {
-    size_t x0 = f0 / getZoomLevel();
-    size_t x1 = f1 / getZoomLevel();
+    int x0 = f0 / getZoomLevel();
+    int x1 = f1 / getZoomLevel();
 
     return QSize(x1 - x0, height());
 }
@@ -2403,7 +2462,7 @@
 	     m_followPlay == PlaybackScrollPage ? "page" : "ignore")
 	.arg(extraAttributes);
 
-    for (size_t i = 0; i < m_layers.size(); ++i) {
+    for (int i = 0; i < (int)m_layers.size(); ++i) {
         bool visible = !m_layers[i]->isLayerDormant(this);
         m_layers[i]->toBriefXml(stream, indent + "  ",
                                 QString("visible=\"%1\"")
--- a/view/View.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/View.h	Wed Jun 18 13:51:27 2014 +0100
@@ -29,6 +29,8 @@
 class Layer;
 class ViewPropertyContainer;
 
+class QPushButton;
+
 #include <map>
 #include <set>
 
@@ -62,13 +64,13 @@
      * This is a calculated value based on the centre-frame, widget
      * width and zoom level.  The result may be negative.
      */
-    long getStartFrame() const;
+    int getStartFrame() const;
 
     /**
      * Set the widget pan based on the given first visible frame.  The
      * frame value may be negative.
      */
-    void setStartFrame(long);
+    void setStartFrame(int);
 
     /**
      * Return the centre frame of the visible widget.  This is an
@@ -76,30 +78,30 @@
      * frame values (start, end) are calculated from this based on the
      * zoom and other factors.
      */
-    size_t getCentreFrame() const { return m_centreFrame; }
+    int getCentreFrame() const { return m_centreFrame; }
 
     /**
      * Set the centre frame of the visible widget.
      */
-    void setCentreFrame(size_t f) { setCentreFrame(f, true); }
+    void setCentreFrame(int f) { setCentreFrame(f, true); }
 
     /**
      * Retrieve the last visible sample frame on the widget.
      * This is a calculated value based on the centre-frame, widget
      * width and zoom level.
      */
-    size_t getEndFrame() const;
+    int getEndFrame() const;
 
     /**
      * Return the pixel x-coordinate corresponding to a given sample
      * frame (which may be negative).
      */
-    int getXForFrame(long frame) const;
+    int getXForFrame(int frame) const;
 
     /**
      * Return the closest frame to the given pixel x-coordinate.
      */
-    long getFrameForX(int x) const;
+    int getFrameForX(int x) const;
 
     /**
      * Return the pixel y-coordinate corresponding to a given
@@ -131,7 +133,7 @@
      * centre frame will be unchanged; the start and end frames will
      * change.
      */
-    virtual void setZoomLevel(size_t z);
+    virtual void setZoomLevel(int z);
 
     /**
      * Zoom in or out.
@@ -175,7 +177,7 @@
     virtual const Layer *getSelectedLayer() const;
 
     virtual void setViewManager(ViewManager *m);
-    virtual void setViewManager(ViewManager *m, long initialFrame);
+    virtual void setViewManager(ViewManager *m, int initialFrame);
     virtual ViewManager *getViewManager() const { return m_manager; }
 
     virtual void setFollowGlobalPan(bool f);
@@ -232,15 +234,15 @@
     }
     virtual QString getPropertyContainerIconName() const = 0;
 
-    virtual size_t getPropertyContainerCount() const;
+    virtual int getPropertyContainerCount() const;
 
-    virtual const PropertyContainer *getPropertyContainer(size_t i) const;
-    virtual PropertyContainer *getPropertyContainer(size_t i);
+    virtual const PropertyContainer *getPropertyContainer(int i) const;
+    virtual PropertyContainer *getPropertyContainer(int i);
 
     // Render the contents on a wide canvas
-    virtual QImage *toNewImage(size_t f0, size_t f1);
+    virtual QImage *toNewImage(int f0, int f1);
     virtual QImage *toNewImage();
-    virtual QSize getImageSize(size_t f0, size_t f1);
+    virtual QSize getImageSize(int f0, int f1);
     virtual QSize getImageSize();
 
     virtual int getTextLabelHeight(const Layer *layer, QPainter &) const;
@@ -252,19 +254,19 @@
                        QString extraAttributes = "") const;
 
     // First frame actually in model, to right of scale, if present
-    virtual size_t getFirstVisibleFrame() const;
-    virtual size_t getLastVisibleFrame() const;
+    virtual int getFirstVisibleFrame() const;
+    virtual int getLastVisibleFrame() const;
 
-    size_t getModelsStartFrame() const;
-    size_t getModelsEndFrame() const;
+    int getModelsStartFrame() const;
+    int getModelsEndFrame() const;
 
     typedef std::set<Model *> ModelSet;
     ModelSet getModels();
 
     //!!!
     Model *getAligningModel() const;
-    size_t alignFromReference(size_t) const;
-    size_t alignToReference(size_t) const;
+    int alignFromReference(int) const;
+    int alignToReference(int) const;
     int getAlignedPlaybackFrame() const;
 
 signals:
@@ -278,17 +280,17 @@
 
     void layerModelChanged();
 
-    void centreFrameChanged(unsigned long frame,
+    void centreFrameChanged(int frame,
                             bool globalScroll,
                             PlaybackFollowMode followMode);
 
-    void zoomLevelChanged(unsigned long, bool);
+    void zoomLevelChanged(int, bool);
 
     void contextHelpChanged(const QString &);
 
 public slots:
     virtual void modelChanged();
-    virtual void modelChanged(size_t startFrame, size_t endFrame);
+    virtual void modelChangedWithin(int startFrame, int endFrame);
     virtual void modelCompletionChanged();
     virtual void modelAlignmentCompletionChanged();
     virtual void modelReplaced();
@@ -297,10 +299,10 @@
     virtual void layerMeasurementRectsChanged();
     virtual void layerNameChanged();
 
-    virtual void globalCentreFrameChanged(unsigned long);
-    virtual void viewCentreFrameChanged(View *, unsigned long);
-    virtual void viewManagerPlaybackFrameChanged(unsigned long);
-    virtual void viewZoomLevelChanged(View *, unsigned long, bool);
+    virtual void globalCentreFrameChanged(int);
+    virtual void viewCentreFrameChanged(View *, int);
+    virtual void viewManagerPlaybackFrameChanged(int);
+    virtual void viewZoomLevelChanged(View *, int, bool);
 
     virtual void propertyContainerSelected(View *, PropertyContainer *pc);
 
@@ -309,6 +311,8 @@
     virtual void overlayModeChanged();
     virtual void zoomWheelsEnabledChanged();
 
+    virtual void cancelClicked();
+
     virtual void progressCheckStalledTimerElapsed();
 
 protected:
@@ -316,7 +320,7 @@
     virtual void paintEvent(QPaintEvent *e);
     virtual void drawSelections(QPainter &);
     virtual bool shouldLabelSelections() const { return true; }
-    virtual bool render(QPainter &paint, int x0, size_t f0, size_t f1);
+    virtual bool render(QPainter &paint, int x0, int f0, int f1);
     virtual void setPaintFont(QPainter &paint);
     
     typedef std::vector<Layer *> LayerList;
@@ -325,7 +329,7 @@
     bool areLayersScrollable() const;
     LayerList getScrollableBackLayers(bool testChanged, bool &changed) const;
     LayerList getNonScrollableFrontLayers(bool testChanged, bool &changed) const;
-    size_t getZoomConstraintBlockSize(size_t blockSize,
+    int getZoomConstraintBlockSize(int blockSize,
 				      ZoomConstraint::RoundingDirection dir =
 				      ZoomConstraint::RoundNearest) const;
 
@@ -340,24 +344,25 @@
     // false.
     bool hasTopLayerTimeXAxis() const;
 
-    bool setCentreFrame(size_t f, bool doEmit);
+    bool setCentreFrame(int f, bool doEmit);
 
-    void movePlayPointer(unsigned long f);
+    void movePlayPointer(int f);
 
     void checkProgress(void *object);
     int getProgressBarWidth() const; // if visible
 
-    size_t              m_centreFrame;
+    int              m_centreFrame;
     int                 m_zoomLevel;
     bool                m_followPan;
     bool                m_followZoom;
     PlaybackFollowMode  m_followPlay;
-    size_t              m_playPointerFrame;
+    bool                m_followPlayIsDetached;
+    int                 m_playPointerFrame;
     bool                m_lightBackground;
     bool                m_showProgress;
 
     QPixmap            *m_cache;
-    size_t              m_cacheCentreFrame;
+    int                 m_cacheCentreFrame;
     int                 m_cacheZoomLevel;
     bool                m_selectionCached;
 
@@ -372,16 +377,8 @@
     mutable LayerList m_lastScrollableBackLayers;
     mutable LayerList m_lastNonScrollableBackLayers;
 
-    class LayerProgressBar : public QProgressBar {
-    public:
-	LayerProgressBar(QWidget *parent);
-	virtual QString text() const { return m_text; }
-	virtual void setText(QString text) { m_text = text; }
-    protected:
-	QString m_text;
-    };
-
     struct ProgressBarRec {
+        QPushButton *cancel;
         QProgressBar *bar;
         int lastCheck;
         QTimer *checkTimer;
--- a/view/ViewManager.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/ViewManager.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -125,7 +125,7 @@
 {
 }
 
-unsigned long
+int
 ViewManager::getGlobalCentreFrame() const
 {
 #ifdef DEBUG_VIEW_MANAGER
@@ -135,7 +135,7 @@
 }
 
 void
-ViewManager::setGlobalCentreFrame(unsigned long f)
+ViewManager::setGlobalCentreFrame(int f)
 {
 #ifdef DEBUG_VIEW_MANAGER
     cerr << "ViewManager::setGlobalCentreFrame to " << f << endl;
@@ -144,7 +144,7 @@
     emit globalCentreFrameChanged(f);
 }
 
-unsigned long
+int
 ViewManager::getGlobalZoom() const
 {
 #ifdef DEBUG_VIEW_MANAGER
@@ -153,7 +153,7 @@
     return m_globalZoom;
 }
 
-unsigned long
+int
 ViewManager::getPlaybackFrame() const
 {
     if (m_playSource && m_playSource->isPlaying()) {
@@ -163,7 +163,7 @@
 }
 
 void
-ViewManager::setPlaybackFrame(unsigned long f)
+ViewManager::setPlaybackFrame(int f)
 {
     if (m_playbackFrame != f) {
 	m_playbackFrame = f;
@@ -186,15 +186,15 @@
     m_playbackModel = model;
 }
 
-size_t
-ViewManager::alignPlaybackFrameToReference(size_t frame) const
+int
+ViewManager::alignPlaybackFrameToReference(int frame) const
 {
     if (!m_playbackModel) return frame;
     else return m_playbackModel->alignToReference(frame);
 }
 
-size_t
-ViewManager::alignReferenceToPlaybackFrame(size_t frame) const
+int
+ViewManager::alignReferenceToPlaybackFrame(int frame) const
 {
     if (!m_playbackModel) return frame;
     else return m_playbackModel->alignFromReference(frame);
@@ -292,8 +292,8 @@
     }
 }
 
-size_t
-ViewManager::constrainFrameToSelection(size_t frame) const
+int
+ViewManager::constrainFrameToSelection(int frame) const
 {
     MultiSelection::SelectionList sl = getSelections();
     if (sl.empty()) return frame;
@@ -352,7 +352,7 @@
 }
 
 Selection
-ViewManager::getContainingSelection(size_t frame, bool defaultToFollowing) const
+ViewManager::getContainingSelection(int frame, bool defaultToFollowing) const
 {
     return m_selections.getContainingSelection(frame, defaultToFollowing);
 }
@@ -457,7 +457,7 @@
     }
 }
 
-size_t 
+int 
 ViewManager::getPlaybackSampleRate() const
 {
     if (m_playSource) {
@@ -466,7 +466,7 @@
     return 0;
 }
 
-size_t
+int
 ViewManager::getOutputSampleRate() const
 {
     if (m_playSource) {
@@ -538,7 +538,7 @@
 }
 
 void
-ViewManager::viewCentreFrameChanged(unsigned long f, bool locked,
+ViewManager::viewCentreFrameChanged(int f, bool locked,
                                     PlaybackFollowMode mode)
 {
     View *v = dynamic_cast<View *>(sender());
@@ -554,7 +554,7 @@
         if (v) emit viewCentreFrameChanged(v, f);
     }
 
-    if (!dynamic_cast<Overview *>(v) || (mode != PlaybackIgnore)) {
+    if (!dynamic_cast<Overview *>(v) || (mode == PlaybackScrollContinuous)) {
         if (m_mainModelSampleRate != 0) {
             emit activity(tr("Scroll to %1")
                           .arg(RealTime::frame2RealTime
@@ -562,7 +562,7 @@
         }
     }
 
-    if (mode == PlaybackIgnore) {
+    if (mode != PlaybackScrollContinuous) {
         return;
     }
 
@@ -570,15 +570,15 @@
 }
 
 void
-ViewManager::seek(unsigned long f)
+ViewManager::seek(int f)
 {
 #ifdef DEBUG_VIEW_MANAGER 
     cerr << "ViewManager::seek(" << f << ")" << endl;
 #endif
 
     if (m_playSource && m_playSource->isPlaying()) {
-	unsigned long playFrame = m_playSource->getCurrentPlayingFrame();
-	unsigned long diff = std::max(f, playFrame) - std::min(f, playFrame);
+	int playFrame = m_playSource->getCurrentPlayingFrame();
+	int diff = std::max(f, playFrame) - std::min(f, playFrame);
 	if (diff > 20000) {
 	    m_playbackFrame = f;
 	    m_playSource->play(f);
@@ -596,7 +596,7 @@
 }
 
 void
-ViewManager::viewZoomLevelChanged(unsigned long z, bool locked)
+ViewManager::viewZoomLevelChanged(int z, bool locked)
 {
     View *v = dynamic_cast<View *>(sender());
 
--- a/view/ViewManager.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/view/ViewManager.h	Wed Jun 18 13:51:27 2014 +0100
@@ -59,17 +59,17 @@
 
     bool isPlaying() const;
 
-    unsigned long getGlobalCentreFrame() const; // the set method is a slot
-    unsigned long getGlobalZoom() const;
+    int getGlobalCentreFrame() const; // the set method is a slot
+    int getGlobalZoom() const;
 
-    unsigned long getPlaybackFrame() const; // the set method is a slot
+    int getPlaybackFrame() const; // the set method is a slot
 
     // Only meaningful in solo mode, and used for optional alignment feature
     Model *getPlaybackModel() const;
     void setPlaybackModel(Model *);
 
-    size_t alignPlaybackFrameToReference(size_t) const;
-    size_t alignReferenceToPlaybackFrame(size_t) const;
+    int alignPlaybackFrameToReference(int) const;
+    int alignReferenceToPlaybackFrame(int) const;
 
     bool haveInProgressSelection() const;
     const Selection &getInProgressSelection(bool &exclusive) const;
@@ -83,7 +83,7 @@
     void addSelection(const Selection &selection);
     void removeSelection(const Selection &selection);
     void clearSelections();
-    size_t constrainFrameToSelection(size_t frame) const;
+    int constrainFrameToSelection(int frame) const;
 
     /**
      * Adding a selection normally emits the selectionChangedByUser
@@ -98,7 +98,7 @@
      * selected area, return the next selection after the given frame.
      * Return the empty selection if no appropriate selection is found.
      */
-    Selection getContainingSelection(size_t frame, bool defaultToFollowing) const;
+    Selection getContainingSelection(int frame, bool defaultToFollowing) const;
 
     Clipboard &getClipboard() { return m_clipboard; }
 
@@ -142,23 +142,23 @@
      * differ from this will play back at the wrong speed -- there is
      * no per-model resampler.
      */
-    size_t getPlaybackSampleRate() const;
+    int getPlaybackSampleRate() const;
 
     /**
      * The sample rate of the audio output device.  If the playback
      * sample rate differs from this, everything will be resampled at
      * the output stage.
      */
-    size_t getOutputSampleRate() const;
+    int getOutputSampleRate() const;
 
     /**
      * The sample rate of the current main model.  This may in theory
      * differ from the playback sample rate, in which case even the
      * main model will play at the wrong speed.
      */
-    size_t getMainModelSampleRate() const { return m_mainModelSampleRate; }
+    int getMainModelSampleRate() const { return m_mainModelSampleRate; }
 
-    void setMainModelSampleRate(size_t sr) { m_mainModelSampleRate = sr; }
+    void setMainModelSampleRate(int sr) { m_mainModelSampleRate = sr; }
 
     enum OverlayMode {
         NoOverlays,
@@ -211,16 +211,16 @@
 
 signals:
     /** Emitted when user causes the global centre frame to change. */
-    void globalCentreFrameChanged(unsigned long frame);
+    void globalCentreFrameChanged(int frame);
 
     /** Emitted when user scrolls a view, but doesn't affect global centre. */
-    void viewCentreFrameChanged(View *v, unsigned long frame);
+    void viewCentreFrameChanged(View *v, int frame);
 
     /** Emitted when a view zooms. */
-    void viewZoomLevelChanged(View *v, unsigned long zoom, bool locked);
+    void viewZoomLevelChanged(View *v, int zoom, bool locked);
 
     /** Emitted when the playback frame changes. */
-    void playbackFrameChanged(unsigned long frame);
+    void playbackFrameChanged(int frame);
 
     /** Emitted when the output levels change. Values in range 0.0 -> 1.0. */
     void outputLevelsChanged(float left, float right);
@@ -268,24 +268,24 @@
     void activity(QString);
 
 public slots:
-    void viewCentreFrameChanged(unsigned long, bool, PlaybackFollowMode);
-    void viewZoomLevelChanged(unsigned long, bool);
-    void setGlobalCentreFrame(unsigned long);
-    void setPlaybackFrame(unsigned long);
+    void viewCentreFrameChanged(int, bool, PlaybackFollowMode);
+    void viewZoomLevelChanged(int, bool);
+    void setGlobalCentreFrame(int);
+    void setPlaybackFrame(int);
     void playStatusChanged(bool playing);
 
 protected slots:
     void checkPlayStatus();
-    void seek(unsigned long);
-//!!!    void considerZoomChange(void *, unsigned long, bool);
+    void seek(int);
+//!!!    void considerZoomChange(void *, int, bool);
 
 protected:
     AudioPlaySource *m_playSource;
-    unsigned long m_globalCentreFrame;
-    unsigned long m_globalZoom;
-    mutable unsigned long m_playbackFrame;
+    int m_globalCentreFrame;
+    int m_globalZoom;
+    mutable int m_playbackFrame;
     Model *m_playbackModel; //!!!
-    size_t m_mainModelSampleRate;
+    int m_mainModelSampleRate;
 
     float m_lastLeft;
     float m_lastRight;
--- a/widgets/CSVFormatDialog.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/CSVFormatDialog.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -130,13 +130,13 @@
     m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):"));
     layout->addWidget(m_sampleRateLabel, row, 0);
     
-    size_t sampleRates[] = {
+    int sampleRates[] = {
 	8000, 11025, 12000, 22050, 24000, 32000,
 	44100, 48000, 88200, 96000, 176400, 192000
     };
 
     m_sampleRateCombo = new QComboBox;
-    for (size_t i = 0; i < sizeof(sampleRates) / sizeof(sampleRates[0]); ++i) {
+    for (int i = 0; i < int(sizeof(sampleRates) / sizeof(sampleRates[0])); ++i) {
 	m_sampleRateCombo->addItem(QString("%1").arg(sampleRates[i]));
 	if (sampleRates[i] == m_format.getSampleRate()) {
             m_sampleRateCombo->setCurrentIndex(i);
--- a/widgets/CommandHistory.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/CommandHistory.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -37,7 +37,7 @@
 
 #include <typeinfo>
 
-#define DEBUG_COMMAND_HISTORY 1
+//#define DEBUG_COMMAND_HISTORY 1
 
 CommandHistory *CommandHistory::m_instance = 0;
 
--- a/widgets/IconLoader.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/IconLoader.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -80,8 +80,8 @@
     }
     if (pmap.isNull()) return pmap;
 
-    for (int i = 0; i < sizeof(autoInvertExceptions)/
-                        sizeof(autoInvertExceptions[0]); ++i) {
+    for (int i = 0; i < int(sizeof(autoInvertExceptions)/
+                            sizeof(autoInvertExceptions[0])); ++i) {
         if (autoInvertExceptions[i] == name) {
             return pmap;
         }
--- a/widgets/InteractiveFileFinder.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/InteractiveFileFinder.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -217,7 +217,8 @@
 }
 
 QString
-InteractiveFileFinder::getSaveFileName(FileType type, QString fallbackLocation)
+InteractiveFileFinder::getSaveFileName(FileType type, 
+                                       QString fallbackLocation)
 {
     QString settingsKeyStub;
     QString lastPath = fallbackLocation;
@@ -312,7 +313,6 @@
     dialog.setNameFilters(filters);
     dialog.setWindowTitle(title);
     dialog.setDirectory(lastPath);
-
     dialog.setAcceptMode(QFileDialog::AcceptSave);
     dialog.setFileMode(QFileDialog::AnyFile);
     dialog.setConfirmOverwrite(false); // we'll do that
--- a/widgets/ItemEditDialog.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/ItemEditDialog.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -28,7 +28,7 @@
 #include <float.h> // for FLT_MIN/MAX
 
 
-ItemEditDialog::ItemEditDialog(size_t sampleRate, int options,
+ItemEditDialog::ItemEditDialog(int sampleRate, int options,
                                QString valueUnits, QWidget *parent) :
     QDialog(parent),
     m_sampleRate(sampleRate),
@@ -50,7 +50,7 @@
 
     int row = 0, subrow = 0;
 
-    size_t singleStep = RealTime::frame2RealTime(2, sampleRate).usec() - 1;
+    int singleStep = RealTime::frame2RealTime(2, sampleRate).usec() - 1;
 
     if ((options & ShowTime) || (options & ShowDuration)) {
 
@@ -190,7 +190,7 @@
 }
 
 void
-ItemEditDialog::setFrameTime(long frame)
+ItemEditDialog::setFrameTime(int frame)
 {
     if (!m_frameTimeSpinBox) return;
 
@@ -202,7 +202,7 @@
     m_resetButton->setEnabled(false);
 }
 
-long
+int
 ItemEditDialog::getFrameTime() const
 {
     return m_frameTimeSpinBox->value();
@@ -221,7 +221,7 @@
 }
 
 void
-ItemEditDialog::setFrameDuration(long duration)
+ItemEditDialog::setFrameDuration(int duration)
 {
     if (!m_frameDurationSpinBox) return;
 
@@ -233,7 +233,7 @@
     m_resetButton->setEnabled(false);
 }
 
-long
+int
 ItemEditDialog::getFrameDuration() const
 {
     return m_frameDurationSpinBox->value();
@@ -303,7 +303,7 @@
 {
     RealTime rt = getRealTime();
     rt.sec = i;
-    size_t frame = RealTime::realTime2Frame(rt, m_sampleRate);
+    int frame = RealTime::realTime2Frame(rt, m_sampleRate);
     m_frameTimeSpinBox->setValue(frame);
     m_resetButton->setEnabled(true);
 }
@@ -313,7 +313,7 @@
 {
     RealTime rt = getRealTime();
     rt.nsec = i * 1000;
-    size_t frame = RealTime::realTime2Frame(rt, m_sampleRate);
+    int frame = RealTime::realTime2Frame(rt, m_sampleRate);
     m_frameTimeSpinBox->setValue(frame);
     m_resetButton->setEnabled(true);
 }
@@ -338,7 +338,7 @@
 {
     RealTime rt = getRealDuration();
     rt.sec = i;
-    size_t frame = RealTime::realTime2Frame(rt, m_sampleRate);
+    int frame = RealTime::realTime2Frame(rt, m_sampleRate);
     m_frameDurationSpinBox->setValue(frame);
     m_resetButton->setEnabled(true);
 }
@@ -348,7 +348,7 @@
 {
     RealTime rt = getRealDuration();
     rt.nsec = i * 1000;
-    size_t frame = RealTime::realTime2Frame(rt, m_sampleRate);
+    int frame = RealTime::realTime2Frame(rt, m_sampleRate);
     m_frameDurationSpinBox->setValue(frame);
     m_resetButton->setEnabled(true);
 }
--- a/widgets/ItemEditDialog.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/ItemEditDialog.h	Wed Jun 18 13:51:27 2014 +0100
@@ -37,17 +37,17 @@
         ShowText       = 1 << 3
     };
 
-    ItemEditDialog(size_t sampleRate, int options, QString valueUnits = "",
+    ItemEditDialog(int sampleRate, int options, QString valueUnits = "",
                    QWidget *parent = 0);
 
-    void setFrameTime(long frame);
-    long getFrameTime() const;
+    void setFrameTime(int frame);
+    int getFrameTime() const;
 
     void setRealTime(RealTime rt);
     RealTime getRealTime() const;
 
-    void setFrameDuration(long frame);
-    long getFrameDuration() const;
+    void setFrameDuration(int frame);
+    int getFrameDuration() const;
     
     void setRealDuration(RealTime rt);
     RealTime getRealDuration() const;
@@ -70,9 +70,9 @@
     void reset();
 
 protected:
-    size_t m_sampleRate;
-    long m_defaultFrame;
-    long m_defaultDuration;
+    int m_sampleRate;
+    int m_defaultFrame;
+    int m_defaultDuration;
     float m_defaultValue;
     QString m_defaultText;
     QSpinBox *m_frameTimeSpinBox;
--- a/widgets/LayerTree.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/LayerTree.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -155,12 +155,12 @@
 }
 
 void
-ModelMetadataModel::propertyContainerPropertyChanged(PropertyContainer *pc)
+ModelMetadataModel::propertyContainerPropertyChanged(PropertyContainer *)
 {
 }
 
 void
-ModelMetadataModel::playParametersAudibilityChanged(bool a)
+ModelMetadataModel::playParametersAudibilityChanged(bool )
 {
 }
 
@@ -169,7 +169,7 @@
 {
     if (!index.isValid()) return QVariant();
 
-    QObject *obj = static_cast<QObject *>(index.internalPointer());
+//    QObject *obj = static_cast<QObject *>(index.internalPointer());
     int row = index.row(), col = index.column();
 
     //!!! not exactly the ideal use of a std::set
@@ -206,13 +206,13 @@
 }
 
 bool
-ModelMetadataModel::setData(const QModelIndex &index, const QVariant &value, int role)
+ModelMetadataModel::setData(const QModelIndex &, const QVariant &, int )
 {
     return false;
 }
 
 Qt::ItemFlags
-ModelMetadataModel::flags(const QModelIndex &index) const
+ModelMetadataModel::flags(const QModelIndex &) const
 {
     Qt::ItemFlags flags = Qt::ItemIsEnabled;
     return flags;
@@ -237,7 +237,7 @@
 ModelMetadataModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (!parent.isValid()) {
-        if (row >= m_models.size()) return QModelIndex();
+        if (row >= (int)m_models.size()) return QModelIndex();
 	return createIndex(row, column, (void *)0);
     }
 
@@ -245,7 +245,7 @@
 }
 
 QModelIndex
-ModelMetadataModel::parent(const QModelIndex &index) const
+ModelMetadataModel::parent(const QModelIndex &) const
 {
     return QModelIndex();
 }
@@ -258,7 +258,7 @@
 }
 
 int
-ModelMetadataModel::columnCount(const QModelIndex &parent) const
+ModelMetadataModel::columnCount(const QModelIndex &) const
 {
     return m_columnCount;
 }
--- a/widgets/ModelDataTableDialog.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/ModelDataTableDialog.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -168,14 +168,14 @@
 }
 
 void
-ModelDataTableDialog::userScrolledToFrame(unsigned long frame)
+ModelDataTableDialog::userScrolledToFrame(int frame)
 {
     QModelIndex index = m_table->getModelIndexForFrame(frame);
     makeCurrent(index.row());
 }
 
 void
-ModelDataTableDialog::playbackScrolledToFrame(unsigned long frame)
+ModelDataTableDialog::playbackScrolledToFrame(int frame)
 {
     if (m_trackPlayback) {
         QModelIndex index = m_table->getModelIndexForFrame(frame);
@@ -248,14 +248,14 @@
 }
 
 void
-ModelDataTableDialog::viewPressed(const QModelIndex &index)
+ModelDataTableDialog::viewPressed(const QModelIndex &)
 {
 //    SVDEBUG << "ModelDataTableDialog::viewPressed: " << index.row() << ", " << index.column() << endl;
 }
 
 void
 ModelDataTableDialog::currentChanged(const QModelIndex &current,
-                                     const QModelIndex &previous)
+                                     const QModelIndex &)
 {
 //    SVDEBUG << "ModelDataTableDialog::currentChanged: from "
 //              << previous.row() << ", " << previous.column()
--- a/widgets/ModelDataTableDialog.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/ModelDataTableDialog.h	Wed Jun 18 13:51:27 2014 +0100
@@ -38,11 +38,11 @@
     QToolBar *getPlayToolbar() { return m_playToolbar; }
 
 signals:
-    void scrollToFrame(unsigned long frame);
+    void scrollToFrame(int frame);
 
 public slots:
-    void userScrolledToFrame(unsigned long frame);
-    void playbackScrolledToFrame(unsigned long frame);
+    void userScrolledToFrame(int frame);
+    void playbackScrolledToFrame(int frame);
     void addCommand(Command *);
 
 protected slots:
--- a/widgets/PluginParameterBox.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/PluginParameterBox.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -331,10 +331,10 @@
         value = min + step * qtz;
     }
 
-    int imax = 100;
+//    int imax = 100;
     
     if (qtz > 0.0) {
-        imax = lrintf((max - min) / qtz);
+//        imax = lrintf((max - min) / qtz);
     } else {
         qtz = (max - min) / 100.0;
     }
--- a/widgets/PluginParameterDialog.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/PluginParameterDialog.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -51,7 +51,7 @@
     m_blockSize(0),
     m_windowType(HanningWindow),
     m_parameterBox(0),
-    m_selectionOnly(false)
+    m_currentSelectionOnly(false)
 {
     setWindowTitle(tr("Plugin Parameters"));
 
@@ -540,15 +540,15 @@
 }
 
 void
-PluginParameterDialog::getProcessingParameters(size_t &blockSize) const
+PluginParameterDialog::getProcessingParameters(int &blockSize) const
 {
     blockSize = m_blockSize;
     return;
 }
 
 void
-PluginParameterDialog::getProcessingParameters(size_t &stepSize,
-                                               size_t &blockSize,
+PluginParameterDialog::getProcessingParameters(int &stepSize,
+                                               int &blockSize,
                                                WindowType &windowType) const
 {
     stepSize = m_stepSize;
--- a/widgets/PluginParameterDialog.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/PluginParameterDialog.h	Wed Jun 18 13:51:27 2014 +0100
@@ -70,8 +70,8 @@
 
     //!!! merge with PluginTransform::ExecutionContext
 
-    void getProcessingParameters(size_t &blockSize) const;
-    void getProcessingParameters(size_t &stepSize, size_t &blockSize,
+    void getProcessingParameters(int &blockSize) const;
+    void getProcessingParameters(int &stepSize, int &blockSize,
                                  WindowType &windowType) const;
 
     int exec();
@@ -96,8 +96,8 @@
     Vamp::PluginBase *m_plugin;
 
     int m_channel;
-    size_t m_stepSize;
-    size_t m_blockSize;
+    int m_stepSize;
+    int m_blockSize;
 
     WindowType m_windowType;
     PluginParameterBox *m_parameterBox;
--- a/widgets/PropertyBox.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/PropertyBox.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -517,6 +517,7 @@
 	break;
     }
 
+    case PropertyContainer::InvalidProperty:
     default:
 	break;
     }
--- a/widgets/PropertyStack.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/PropertyStack.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -96,7 +96,7 @@
     }
     m_boxes.clear();
     
-    for (size_t i = 0; i < m_client->getPropertyContainerCount(); ++i) {
+    for (int i = 0; i < m_client->getPropertyContainerCount(); ++i) {
 
 	PropertyContainer *container = m_client->getPropertyContainer(i);
 	QString name = container->getPropertyContainerName();
@@ -147,7 +147,7 @@
 bool
 PropertyStack::containsContainer(PropertyContainer *pc) const
 {
-    for (size_t i = 0; i < m_client->getPropertyContainerCount(); ++i) {
+    for (int i = 0; i < m_client->getPropertyContainerCount(); ++i) {
 	PropertyContainer *container = m_client->getPropertyContainer(i);
 	if (pc == container) return true;
     }
--- a/widgets/SubdividingMenu.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/SubdividingMenu.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -22,7 +22,7 @@
 using std::set;
 using std::map;
 
-SubdividingMenu::SubdividingMenu(size_t lowerLimit, size_t upperLimit,
+SubdividingMenu::SubdividingMenu(int lowerLimit, int upperLimit,
                                  QWidget *parent) :
     QMenu(parent),
     m_lowerLimit(lowerLimit ? lowerLimit : 14),
@@ -31,8 +31,8 @@
 {
 }
 
-SubdividingMenu::SubdividingMenu(const QString &title, size_t lowerLimit,
-                                 size_t upperLimit, QWidget *parent) :
+SubdividingMenu::SubdividingMenu(const QString &title, int lowerLimit,
+                                 int upperLimit, QWidget *parent) :
     QMenu(title, parent),
     m_lowerLimit(lowerLimit ? lowerLimit : 14),
     m_upperLimit(upperLimit ? upperLimit : (m_lowerLimit * 5) / 2),
@@ -53,11 +53,11 @@
 {
     m_entriesSet = true;
 
-    size_t total = entries.size();
+    int total = entries.size();
         
     if (total < m_upperLimit) return;
 
-    size_t count = 0;
+    int count = 0;
     QMenu *chunkMenu = new QMenu();
     chunkMenu->setTearOffEnabled(isTearOffEnabled());
 
--- a/widgets/SubdividingMenu.h	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/SubdividingMenu.h	Wed Jun 18 13:51:27 2014 +0100
@@ -39,10 +39,10 @@
     Q_OBJECT
 
 public:
-    SubdividingMenu(size_t lowerLimit = 0, size_t upperLimit = 0,
+    SubdividingMenu(int lowerLimit = 0, int upperLimit = 0,
                     QWidget *parent = 0);
-    SubdividingMenu(const QString &title, size_t lowerLimit = 0,
-                    size_t upperLimit = 0, QWidget *parent = 0);
+    SubdividingMenu(const QString &title, int lowerLimit = 0,
+                    int upperLimit = 0, QWidget *parent = 0);
     virtual ~SubdividingMenu();
 
     void setEntries(const std::set<QString> &entries);
@@ -65,8 +65,8 @@
 protected:
     std::map<QString, QMenu *> m_nameToChunkMenuMap;
 
-    size_t m_lowerLimit;
-    size_t m_upperLimit;
+    int m_lowerLimit;
+    int m_upperLimit;
 
     bool m_entriesSet;
     std::map<QString, QObject *> m_pendingEntries;
--- a/widgets/TransformFinder.cpp	Tue Jun 03 11:10:52 2014 +0100
+++ b/widgets/TransformFinder.cpp	Wed Jun 18 13:51:27 2014 +0100
@@ -201,7 +201,7 @@
              j != sorted.begin(); ) {
             --j;
             m_sortedResults.push_back(*j);
-            if (m_sortedResults.size() == maxResults) break;
+            if ((int)m_sortedResults.size() == maxResults) break;
         }
 
         if (m_sortedResults.empty()) m_selectedTransform = "";
@@ -209,7 +209,7 @@
 
         m_upToDateCount = 0;
 
-        for (int j = m_labels.size(); j > m_sortedResults.size(); ) {
+        for (int j = (int)m_labels.size(); j > (int)m_sortedResults.size(); ) {
             m_labels[--j]->hide();
         }
 
@@ -235,9 +235,9 @@
         return;
     }
 
-    if (m_upToDateCount >= m_sortedResults.size()) return;
+    if (m_upToDateCount >= (int)m_sortedResults.size()) return;
 
-    while (m_upToDateCount < m_sortedResults.size()) {
+    while (m_upToDateCount < (int)m_sortedResults.size()) {
 
         int i = m_upToDateCount;
 
@@ -302,7 +302,7 @@
         }
         selectedText += tr("</small>");
 
-        if (i >= m_labels.size()) {
+        if (i >= (int)m_labels.size()) {
             SelectableLabel *label = new SelectableLabel(m_resultsFrame);
             m_resultsLayout->addWidget(label);
             connect(label, SIGNAL(selectionChanged()), this,
@@ -338,7 +338,7 @@
 {
     QObject *s = sender();
     m_selectedTransform = "";
-    for (int i = 0; i < m_labels.size(); ++i) {
+    for (int i = 0; i < (int)m_labels.size(); ++i) {
         if (!m_labels[i]->isVisible()) continue;
         if (m_labels[i] == s) {
             if (m_labels[i]->isSelected()) {
@@ -374,7 +374,7 @@
 void
 TransformFinder::up()
 {
-    for (int i = 0; i < m_labels.size(); ++i) {
+    for (int i = 0; i < (int)m_labels.size(); ++i) {
         if (!m_labels[i]->isVisible()) continue;
         if (m_labels[i]->objectName() == m_selectedTransform) {
             if (i > 0) {
@@ -390,10 +390,10 @@
 void
 TransformFinder::down()
 {
-    for (int i = 0; i < m_labels.size(); ++i) {
+    for (int i = 0; i < (int)m_labels.size(); ++i) {
         if (!m_labels[i]->isVisible()) continue;
         if (m_labels[i]->objectName() == m_selectedTransform) {
-            if (i+1 < m_labels.size() &&
+            if (i+1 < (int)m_labels.size() &&
                 m_labels[i+1]->isVisible()) {
                 m_labels[i]->setSelected(false);
                 m_labels[i+1]->setSelected(true);