# HG changeset patch # User Chris Cannam # Date 1415611206 0 # Node ID 6c08e99ca0f3019133f88c82c4df6d7468e85e69 # Parent 4a5d144bd5d0820a418e64d954d0ea3b0e0eeee4# Parent d854c72dcaa1f2b4ad2098e0e0ee18e605fed6c4 Merge from default branch diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 layer/Colour3DPlotLayer.cpp --- 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, diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 layer/LinearColourScale.cpp --- 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); diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 layer/LinearNumericalScale.cpp --- 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); diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 layer/LogColourScale.cpp --- 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); diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 layer/LogNumericalScale.cpp --- 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); diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 view/Pane.cpp --- 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); } diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 widgets/ActivityLog.cpp --- 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() { diff -r 4a5d144bd5d0 -r 6c08e99ca0f3 widgets/CSVFormatDialog.cpp --- 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);