diff view/Pane.cpp @ 806:4c8ca536b54f warnfix_no_size_t

Some more unsigned/long removal
author Chris Cannam
date Tue, 17 Jun 2014 15:36:56 +0100
parents 410816717c2c
children 40c6c9344ff6
line wrap: on
line diff
--- a/view/Pane.cpp	Tue Jun 17 15:18:06 2014 +0100
+++ b/view/Pane.cpp	Tue Jun 17 15:36:56 2014 +0100
@@ -543,7 +543,7 @@
     paint.end();
 }
 
-size_t
+int
 Pane::getVerticalScaleWidth() const
 {
     if (m_scaleWidth > 0) return m_scaleWidth;
@@ -784,8 +784,6 @@
     int x0 = getXForFrame(model->getStartFrame());
     int x1 = getXForFrame(model->getEndFrame());
 
-    int lw = 10;
-
     paint.save();
 
     QBrush brush;
@@ -938,7 +936,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 +964,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 +975,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 +1039,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 +1081,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 +1112,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 +1152,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 +1171,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 +1187,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();
@@ -1354,7 +1352,7 @@
         } else {
             
             int mouseFrame = getFrameForX(e->x());
-            size_t resolution = 1;
+            int resolution = 1;
             int snapFrame = mouseFrame;
     
             Layer *layer = getSelectedLayer();
@@ -1822,9 +1820,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 +1833,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 +1912,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 +2039,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 +2056,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 {
@@ -2155,7 +2152,7 @@
 
     if (relocate) {
 
-        long f = getFrameForX(e->x());
+        int f = getFrameForX(e->x());
 
         setCentreFrame(f);
 
@@ -2226,11 +2223,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 +2352,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 +2490,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 +2588,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;