changeset 680:ced5f158eda7 tonioni

Merge from default branch
author Chris Cannam
date Fri, 22 Nov 2013 10:40:51 +0000
parents 47735c9518e7 (current diff) 41029a6e55c6 (diff)
children 917039d333bb
files
diffstat 5 files changed, 40 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Tue Jul 16 17:59:01 2013 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Fri Nov 22 10:40:51 2013 +0000
@@ -1350,11 +1350,11 @@
     
     QImage *source = m_cache;
     
-    std::cerr << "modelResolution " << modelResolution << ", srRatio "
+    SVDEBUG << "modelResolution " << modelResolution << ", srRatio "
               << srRatio << ", m_peakResolution " << m_peakResolution
               << ", zoomLevel " << zoomLevel << ", result "
               << ((modelResolution * srRatio * m_peakResolution) / zoomLevel)
-              << std::endl;
+              << endl;
 
     if (m_peaksCache) {
         if (((modelResolution * srRatio * m_peakResolution) / zoomLevel) < 1) {
@@ -1362,10 +1362,10 @@
             source = m_peaksCache;
             modelResolution *= m_peakResolution;
         } else {
-            std::cerr << "not using peaks cache" << std::endl;
+            SVDEBUG << "not using peaks cache" << endl;
         }
     } else {
-        std::cerr << "have no peaks cache" << std::endl;
+        SVDEBUG << "have no peaks cache" << endl;
     }
 
     int psy1i = -1;
--- a/layer/WaveformLayer.cpp	Tue Jul 16 17:59:01 2013 +0100
+++ b/layer/WaveformLayer.cpp	Fri Nov 22 10:40:51 2013 +0000
@@ -670,7 +670,7 @@
                               *ranges, modelZoomLevel);
 
 #ifdef DEBUG_WAVEFORM_PAINT
-        std::cerr << ranges->size() << " ranges from " << frame0 << " to " << frame1 << std::endl;
+        std::cerr << "channel " << ch << ": " << ranges->size() << " ranges from " << frame0 << " to " << frame1 << " at zoom level " << modelZoomLevel << std::endl;
 #endif
 
 	if (mergingChannels || mixingChannels) {
@@ -844,18 +844,18 @@
 	    }
 
 	    if (x != x0 && prevRangeBottom != -1) {
-		if (prevRangeBottom > rangeBottom &&
-		    prevRangeTop    > rangeBottom) {
+		if (prevRangeBottom > rangeBottom + 1 &&
+		    prevRangeTop    > rangeBottom + 1) {
 //		    paint->setPen(midColour);
 		    paint->setPen(baseColour);
-		    paint->drawLine(x-1, prevRangeTop, x, rangeBottom);
+		    paint->drawLine(x-1, prevRangeTop, x, rangeBottom + 1);
 		    paint->setPen(prevRangeTopColour);
 		    paint->drawPoint(x-1, prevRangeTop);
-		} else if (prevRangeBottom < rangeTop &&
-			   prevRangeTop    < rangeTop) {
+		} else if (prevRangeBottom < rangeTop - 1 &&
+			   prevRangeTop    < rangeTop - 1) {
 //		    paint->setPen(midColour);
 		    paint->setPen(baseColour);
-		    paint->drawLine(x-1, prevRangeBottom, x, rangeTop);
+		    paint->drawLine(x-1, prevRangeBottom, x, rangeTop - 1);
 		    paint->setPen(prevRangeBottomColour);
 		    paint->drawPoint(x-1, prevRangeBottom);
 		}
@@ -874,7 +874,7 @@
 	    }
 
 #ifdef DEBUG_WAVEFORM_PAINT
-            std::cerr << "range " << rangeBottom << " -> " << rangeTop << std::endl;
+            std::cerr << "range " << rangeBottom << " -> " << rangeTop << ", means " << meanBottom << " -> " << meanTop << ", raw range " << range.min() << " -> " << range.max() << std::endl;
 #endif
 
             if (rangeTop == rangeBottom) {
@@ -990,11 +990,11 @@
             max = range.max();
             singleValue = (min == max);
         } else {
-            int imin = int(range.min() * 1000);
-            int imax = int(range.max() * 1000);
+            int imin = lrint(range.min() * 10000);
+            int imax = lrint(range.max() * 10000);
             singleValue = (imin == imax);
-            min = float(imin)/1000;
-            max = float(imax)/1000;
+            min = float(imin)/10000;
+            max = float(imax)/10000;
         }
 
 	int db = int(AudioLevel::multiplier_to_dB(std::max(fabsf(range.min()),
--- a/view/View.cpp	Tue Jul 16 17:59:01 2013 +0100
+++ b/view/View.cpp	Fri Nov 22 10:40:51 2013 +0000
@@ -995,7 +995,7 @@
     case PlaybackScrollPage:
     { 
 	int xold = getXForFrame(oldPlayPointerFrame);
-	update(xold - 1, 0, 3, height());
+	update(xold - 4, 0, 9, height());
 
 	long w = getEndFrame() - getStartFrame();
 	w -= w/5;
@@ -1034,12 +1034,12 @@
 		bool changed = setCentreFrame(newCentre, false);
 		if (changed) {
 		    xold = getXForFrame(oldPlayPointerFrame);
-		    update(xold - 1, 0, 3, height());
+		    update(xold - 4, 0, 9, height());
 		}
 	    }
 	}
 
-	update(xnew - 1, 0, 3, height());
+	update(xnew - 4, 0, 9, height());
 
 	break;
     }
--- a/widgets/CSVFormatDialog.cpp	Tue Jul 16 17:59:01 2013 +0100
+++ b/widgets/CSVFormatDialog.cpp	Fri Nov 22 10:40:51 2013 +0000
@@ -17,6 +17,8 @@
 
 #include "layer/LayerFactory.h"
 
+#include "TextAbbrev.h"
+
 #include <QFrame>
 #include <QGridLayout>
 #include <QPushButton>
@@ -96,7 +98,8 @@
         for (int j = 0; j < example.size() && j < 6; ++j) {
             QLabel *label = new QLabel;
             label->setTextFormat(Qt::PlainText);
-            label->setText(example[j][i]);
+            QString text = TextAbbrev::abbreviate(example[j][i], 35);
+            label->setText(text);
             label->setFont(fp);
             label->setPalette(palette);
             label->setIndent(8);
--- a/widgets/InteractiveFileFinder.cpp	Tue Jul 16 17:59:01 2013 +0100
+++ b/widgets/InteractiveFileFinder.cpp	Fri Nov 22 10:40:51 2013 +0000
@@ -102,6 +102,11 @@
         }
         break;
 
+    case CSVFile:
+        settingsKey = "layerpath";
+        filter = tr("Comma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nText files (*.txt)\nAll files (*.*)");
+        break;
+
     case AnyFile:
         settingsKey = "lastpath";
         filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)")
@@ -229,6 +234,12 @@
         filter = tr("Portable Network Graphics files (*.png)\nAll files (*.*)");
         break;
 
+    case CSVFile:
+        settingsKey = "savelayerpath";
+        title = tr("Select a file to export to");
+        filter = tr("Comma-separated data files (*.csv)\nText files (*.txt)\nAll files (*.*)");
+        break;
+
     case AnyFile:
         std::cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: AnyFile cannot be used here" << std::endl;
         abort();
@@ -268,6 +279,8 @@
         dialog.setDefaultSuffix("wav");
     } else if (type == ImageFile) {
         dialog.setDefaultSuffix("png");
+    } else if (type == CSVFile) {
+        dialog.setDefaultSuffix("csv");
     }
 
     bool good = false;
@@ -364,6 +377,10 @@
         settingsKey = "imagepath";
         break;
 
+    case CSVFile:
+        settingsKey = "layerpath";
+        break;
+
     case AnyFile:
         settingsKey = "lastpath";
         break;