changeset 869:6c08e99ca0f3 tonioni

Merge from default branch
author Chris Cannam
date Mon, 10 Nov 2014 09:20:06 +0000
parents 4a5d144bd5d0 (current diff) d854c72dcaa1 (diff)
children 0cdaf382f21e 2857e6352b06
files
diffstat 8 files changed, 34 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -1331,7 +1331,9 @@
 
     QPoint illuminatePos;
     bool illuminate = v->shouldIlluminateLocalFeatures(this, illuminatePos);
-    char labelbuf[10];
+    
+    const int buflen = 40;
+    char labelbuf[buflen];
 
     for (int sx = sx0; sx <= sx1; ++sx) {
 
@@ -1395,7 +1397,7 @@
 		if (sx >= 0 && sx < m_cache->width() &&
 		    sy >= 0 && sy < m_cache->height()) {
 		    float value = m_model->getValueAt(sx, sy);
-		    sprintf(labelbuf, "%06f", value);
+		    snprintf(labelbuf, buflen, "%06f", value);
 		    QString text(labelbuf);
 		    paint.setPen(v->getBackground());
 		    paint.drawText(rx0 + 2,
--- a/layer/LinearColourScale.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/layer/LinearColourScale.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -43,8 +43,9 @@
 
     float val = min;
     float inc = (max - val) / n;
-
-    char buffer[40];
+    
+    const int buflen = 40;
+    char buffer[buflen];
 
     int boxx = 5, boxy = 5;
     if (layer->getScaleUnits() != "") {
@@ -84,7 +85,7 @@
 	ty = y - paint.fontMetrics().height() +
 	    paint.fontMetrics().ascent() + 2;
 
-	sprintf(buffer, "%.*f", dp, val);
+	snprintf(buffer, buflen, "%.*f", dp, val);
 	QString label = QString(buffer);
 
 	paint.drawLine(boxx + boxw - boxw/3, y, boxx + boxw, y);
--- a/layer/LinearNumericalScale.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/layer/LinearNumericalScale.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -42,7 +42,8 @@
     float val = minf;
     float inc = (maxf - val) / n;
 
-    char buffer[40];
+    const int buflen = 40;
+    char buffer[buflen];
 
     int w = getWidth(v, paint) + x0;
 
@@ -86,7 +87,7 @@
 	    continue;
         }
 
-	sprintf(buffer, "%.*f", dp, dispval);
+	snprintf(buffer, buflen, "%.*f", dp, dispval);
 
 	QString label = QString(buffer);
 
--- a/layer/LogColourScale.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/layer/LogColourScale.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -46,7 +46,8 @@
     float val = minlog;
     float inc = (maxlog - val) / n;
 
-    char buffer[40];
+    const int buflen = 40;
+    char buffer[buflen];
 
     int boxx = 5, boxy = 5;
     if (layer->getScaleUnits() != "") {
@@ -85,7 +86,7 @@
 	int digits = trunc(log10f(dv));
 	int sf = dp + (digits > 0 ? digits : 0);
 	if (sf < 2) sf = 2;
-	sprintf(buffer, "%.*g", sf, dv);
+	snprintf(buffer, buflen, "%.*g", sf, dv);
 
 	QString label = QString(buffer);
 
--- a/layer/LogNumericalScale.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/layer/LogNumericalScale.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -55,7 +55,8 @@
     cerr << "min = " << minlog << ", max = " << maxlog << ", inc = " << inc << ", minDispInc = " << minDispInc << endl;
 #endif
 
-    char buffer[40];
+    const int buflen = 40;
+    char buffer[buflen];
 
     float round = 1.f;
     int dp = 0;
@@ -104,7 +105,7 @@
 #ifdef DEBUG_TIME_VALUE_LAYER
         cerr << "sf = " << sf << endl;
 #endif
-	sprintf(buffer, "%.*g", sf, dispval);
+	snprintf(buffer, buflen, "%.*g", sf, dispval);
 
 	QString label = QString(buffer);
 
--- a/view/Pane.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/view/Pane.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -469,7 +469,7 @@
 
     m_scaleWidth = 0;
 
-    if (workModel) {
+    if (workModel && hasTopLayerTimeXAxis()) {
         drawModelTimeExtents(r, paint, workModel);
     }
 
--- a/widgets/ActivityLog.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/widgets/ActivityLog.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -30,7 +30,7 @@
 using std::cerr;
 using std::endl;
 
-#define PRINT_ACTIVITY 1
+//#define PRINT_ACTIVITY 1
 
 ActivityLog::ActivityLog() : QDialog()
 {
--- a/widgets/CSVFormatDialog.cpp	Tue Sep 09 16:36:21 2014 +0100
+++ b/widgets/CSVFormatDialog.cpp	Mon Nov 10 09:20:06 2014 +0000
@@ -99,6 +99,9 @@
         cpc->setCurrentIndex(int(m_format.getColumnPurpose(i)));
 
         for (int j = 0; j < example.size() && j < 6; ++j) {
+            if (i >= example[j].size()) {
+                continue;
+            }
             QLabel *label = new QLabel;
             label->setTextFormat(Qt::PlainText);
             QString text = TextAbbrev::abbreviate(example[j][i], 35);
@@ -118,6 +121,7 @@
     
     m_timingTypeCombo = new QComboBox;
     m_timingTypeCombo->addItem(tr("Explicitly, in seconds"));
+    m_timingTypeCombo->addItem(tr("Explicitly, in milliseconds"));
     m_timingTypeCombo->addItem(tr("Explicitly, in audio sample frames"));
     m_timingTypeCombo->addItem(tr("Implicitly: rows are equally spaced in time"));
     layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2);
@@ -125,7 +129,7 @@
 	    this, SLOT(timingTypeChanged(int)));
     m_timingTypeCombo->setCurrentIndex
         (m_format.getTimingType() == CSVFormat::ExplicitTiming ?
-         m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 1 : 2);
+         m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 2 : 3);
 
     m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):"));
     layout->addWidget(m_sampleRateLabel, row, 0);
@@ -240,6 +244,15 @@
 
     case 1:
 	m_format.setTimingType(CSVFormat::ExplicitTiming);
+	m_format.setTimeUnits(CSVFormat::TimeMilliseconds);
+	m_sampleRateCombo->setEnabled(true);
+	m_sampleRateLabel->setEnabled(true);
+	m_windowSizeCombo->setEnabled(false);
+	m_windowSizeLabel->setEnabled(false);
+	break;
+
+    case 2:
+	m_format.setTimingType(CSVFormat::ExplicitTiming);
 	m_format.setTimeUnits(CSVFormat::TimeAudioFrames);
 	m_sampleRateCombo->setEnabled(true);
 	m_sampleRateLabel->setEnabled(true);
@@ -247,7 +260,7 @@
 	m_windowSizeLabel->setEnabled(false);
 	break;
 
-    case 2:
+    case 3:
 	m_format.setTimingType(CSVFormat::ImplicitTiming);
 	m_format.setTimeUnits(CSVFormat::TimeWindows);
 	m_sampleRateCombo->setEnabled(true);