comparison layer/Colour3DPlotLayer.cpp @ 1104:46cc4644206d spectrogram-minor-refactor

Convert ColumnNormalization to an enum class, and separate out normalize-visible
author Chris Cannam
date Thu, 14 Jul 2016 16:12:05 +0100
parents d84a0033b305
children ea5ae9dd10ba
comparison
equal deleted inserted replaced
1103:d84a0033b305 1104:46cc4644206d
55 m_colourScale(ColourScale::LinearColourScale), 55 m_colourScale(ColourScale::LinearColourScale),
56 m_colourScaleSet(false), 56 m_colourScaleSet(false),
57 m_colourMap(0), 57 m_colourMap(0),
58 m_gain(1.0), 58 m_gain(1.0),
59 m_binScale(BinScale::Linear), 59 m_binScale(BinScale::Linear),
60 m_normalization(ColumnOp::NoNormalization), 60 m_normalization(ColumnNormalization::None),
61 m_normalizeVisibleArea(false),
61 m_invertVertical(false), 62 m_invertVertical(false),
62 m_opaque(false), 63 m_opaque(false),
63 m_smooth(false), 64 m_smooth(false),
64 m_peakResolution(256), 65 m_peakResolution(256),
65 m_miny(0), 66 m_miny(0),
81 delete m_peakCache; 82 delete m_peakCache;
82 83
83 cacheInvalid(); //!!! dup with above? 84 cacheInvalid(); //!!! dup with above?
84 } 85 }
85 86
87 ColourScale::Scale
88 Colour3DPlotLayer::convertToColourScale(int value)
89 {
90 switch (value) {
91 default:
92 case 0: return ColourScale::LinearColourScale;
93 case 1: return ColourScale::LogColourScale;
94 case 2: return ColourScale::PlusMinusOneScale;
95 case 3: return ColourScale::AbsoluteScale;
96 }
97 }
98
99 int
100 Colour3DPlotLayer::convertFromColourScale(ColourScale::Scale scale)
101 {
102 switch (scale) {
103 case ColourScale::LinearColourScale: return 0;
104 case ColourScale::LogColourScale: return 1;
105 case ColourScale::PlusMinusOneScale: return 2;
106 case ColourScale::AbsoluteScale: return 3;
107
108 case ColourScale::MeterColourScale:
109 case ColourScale::PhaseColourScale:
110 default: return 0;
111 }
112 }
113
114 std::pair<ColumnNormalization, bool>
115 Colour3DPlotLayer::convertToColumnNorm(int value)
116 {
117 switch (value) {
118 default:
119 case 0: return { ColumnNormalization::None, false };
120 case 1: return { ColumnNormalization::Max1, false };
121 case 2: return { ColumnNormalization::None, true }; // visible area
122 case 3: return { ColumnNormalization::Hybrid, false };
123 }
124 }
125
126 int
127 Colour3DPlotLayer::convertFromColumnNorm(ColumnNormalization norm, bool visible)
128 {
129 if (visible) return 2;
130 switch (norm) {
131 case ColumnNormalization::None: return 0;
132 case ColumnNormalization::Max1: return 1;
133 case ColumnNormalization::Hybrid: return 3;
134
135 case ColumnNormalization::Sum1:
136 default: return 0;
137 }
138 }
139
86 void 140 void
87 Colour3DPlotLayer::setSynchronousPainting(bool synchronous) 141 Colour3DPlotLayer::setSynchronousPainting(bool synchronous)
88 { 142 {
89 m_synchronous = synchronous; 143 m_synchronous = synchronous;
90 } 144 }
199 Colour3DPlotLayer::getProperties() const 253 Colour3DPlotLayer::getProperties() const
200 { 254 {
201 PropertyList list; 255 PropertyList list;
202 list.push_back("Colour"); 256 list.push_back("Colour");
203 list.push_back("Colour Scale"); 257 list.push_back("Colour Scale");
204 list.push_back("Normalize Columns"); 258 list.push_back("Normalization");
205 list.push_back("Normalize Visible Area");
206 list.push_back("Gain"); 259 list.push_back("Gain");
207 list.push_back("Bin Scale"); 260 list.push_back("Bin Scale");
208 list.push_back("Invert Vertical Scale"); 261 list.push_back("Invert Vertical Scale");
209 list.push_back("Opaque"); 262 list.push_back("Opaque");
210 list.push_back("Smooth"); 263 list.push_back("Smooth");
214 QString 267 QString
215 Colour3DPlotLayer::getPropertyLabel(const PropertyName &name) const 268 Colour3DPlotLayer::getPropertyLabel(const PropertyName &name) const
216 { 269 {
217 if (name == "Colour") return tr("Colour"); 270 if (name == "Colour") return tr("Colour");
218 if (name == "Colour Scale") return tr("Scale"); 271 if (name == "Colour Scale") return tr("Scale");
219 if (name == "Normalize Columns") return tr("Normalize Columns"); 272 if (name == "Normalization") return tr("Normalization");
220 if (name == "Normalize Visible Area") return tr("Normalize Visible Area");
221 if (name == "Invert Vertical Scale") return tr("Invert Vertical Scale"); 273 if (name == "Invert Vertical Scale") return tr("Invert Vertical Scale");
222 if (name == "Gain") return tr("Gain"); 274 if (name == "Gain") return tr("Gain");
223 if (name == "Opaque") return tr("Always Opaque"); 275 if (name == "Opaque") return tr("Always Opaque");
224 if (name == "Smooth") return tr("Smooth"); 276 if (name == "Smooth") return tr("Smooth");
225 if (name == "Bin Scale") return tr("Bin Scale"); 277 if (name == "Bin Scale") return tr("Bin Scale");
227 } 279 }
228 280
229 QString 281 QString
230 Colour3DPlotLayer::getPropertyIconName(const PropertyName &name) const 282 Colour3DPlotLayer::getPropertyIconName(const PropertyName &name) const
231 { 283 {
232 if (name == "Normalize Columns") return "normalise-columns";
233 if (name == "Normalize Visible Area") return "normalise";
234 if (name == "Invert Vertical Scale") return "invert-vertical"; 284 if (name == "Invert Vertical Scale") return "invert-vertical";
235 if (name == "Opaque") return "opaque"; 285 if (name == "Opaque") return "opaque";
236 if (name == "Smooth") return "smooth"; 286 if (name == "Smooth") return "smooth";
237 return ""; 287 return "";
238 } 288 }
239 289
240 Layer::PropertyType 290 Layer::PropertyType
241 Colour3DPlotLayer::getPropertyType(const PropertyName &name) const 291 Colour3DPlotLayer::getPropertyType(const PropertyName &name) const
242 { 292 {
243 if (name == "Gain") return RangeProperty; 293 if (name == "Gain") return RangeProperty;
244 if (name == "Normalize Columns") return ToggleProperty;
245 if (name == "Normalize Visible Area") return ToggleProperty;
246 if (name == "Invert Vertical Scale") return ToggleProperty; 294 if (name == "Invert Vertical Scale") return ToggleProperty;
247 if (name == "Opaque") return ToggleProperty; 295 if (name == "Opaque") return ToggleProperty;
248 if (name == "Smooth") return ToggleProperty; 296 if (name == "Smooth") return ToggleProperty;
249 return ValueProperty; 297 return ValueProperty;
250 } 298 }
251 299
252 QString 300 QString
253 Colour3DPlotLayer::getPropertyGroupName(const PropertyName &name) const 301 Colour3DPlotLayer::getPropertyGroupName(const PropertyName &name) const
254 { 302 {
255 if (name == "Normalize Columns" || 303 if (name == "Normalization" ||
256 name == "Normalize Visible Area" || 304 name == "Colour Scale" ||
257 name == "Colour Scale" ||
258 name == "Gain") return tr("Scale"); 305 name == "Gain") return tr("Scale");
259 if (name == "Bin Scale" || 306 if (name == "Bin Scale" ||
260 name == "Invert Vertical Scale") return tr("Bins"); 307 name == "Invert Vertical Scale") return tr("Bins");
261 if (name == "Opaque" || 308 if (name == "Opaque" ||
262 name == "Smooth" || 309 name == "Smooth" ||
293 // linear, log, +/-1, abs 340 // linear, log, +/-1, abs
294 *min = 0; 341 *min = 0;
295 *max = 3; 342 *max = 3;
296 *deflt = 0; 343 *deflt = 0;
297 344
298 val = (int)m_colourScale; 345 val = convertFromColourScale(m_colourScale);
299 346
300 } else if (name == "Colour") { 347 } else if (name == "Colour") {
301 348
302 *min = 0; 349 *min = 0;
303 *max = ColourMapper::getColourMapCount() - 1; 350 *max = ColourMapper::getColourMapCount() - 1;
307 354
308 } else if (name == "Normalization") { 355 } else if (name == "Normalization") {
309 356
310 *min = 0; 357 *min = 0;
311 *max = 3; 358 *max = 3;
312 *deflt = int(ColumnOp::NoNormalization); 359 *deflt = 0;
313 val = (int)m_normalization; 360
361 val = convertFromColumnNorm(m_normalization, m_normalizeVisibleArea);
314 362
315 } else if (name == "Invert Vertical Scale") { 363 } else if (name == "Invert Vertical Scale") {
316 364
317 *deflt = 0; 365 *deflt = 0;
318 val = (m_invertVertical ? 1 : 0); 366 val = (m_invertVertical ? 1 : 0);
349 return ColourMapper::getColourMapName(value); 397 return ColourMapper::getColourMapName(value);
350 } 398 }
351 if (name == "Colour Scale") { 399 if (name == "Colour Scale") {
352 switch (value) { 400 switch (value) {
353 default: 401 default:
354 //!!! yuck
355 case 0: return tr("Linear"); 402 case 0: return tr("Linear");
356 case 1: return tr("Log"); 403 case 1: return tr("Log");
357 case 2: return tr("+/-1"); 404 case 2: return tr("+/-1");
358 case 3: return tr("Absolute"); 405 case 3: return tr("Absolute");
359 } 406 }
400 Colour3DPlotLayer::setProperty(const PropertyName &name, int value) 447 Colour3DPlotLayer::setProperty(const PropertyName &name, int value)
401 { 448 {
402 if (name == "Gain") { 449 if (name == "Gain") {
403 setGain(float(pow(10, value/20.0))); 450 setGain(float(pow(10, value/20.0)));
404 } else if (name == "Colour Scale") { 451 } else if (name == "Colour Scale") {
405 switch (value) { 452 setColourScale(convertToColourScale(value));
406 default:
407 case 0: setColourScale(ColourScale::LinearColourScale); break;
408 case 1: setColourScale(ColourScale::LogColourScale); break;
409 case 2: setColourScale(ColourScale::PlusMinusOneScale); break;
410 case 3: setColourScale(ColourScale::AbsoluteScale); break;
411 }
412 } else if (name == "Colour") { 453 } else if (name == "Colour") {
413 setColourMap(value); 454 setColourMap(value);
414 } else if (name == "Invert Vertical Scale") { 455 } else if (name == "Invert Vertical Scale") {
415 setInvertVertical(value ? true : false); 456 setInvertVertical(value ? true : false);
416 } else if (name == "Opaque") { 457 } else if (name == "Opaque") {
422 default: 463 default:
423 case 0: setBinScale(BinScale::Linear); break; 464 case 0: setBinScale(BinScale::Linear); break;
424 case 1: setBinScale(BinScale::Log); break; 465 case 1: setBinScale(BinScale::Log); break;
425 } 466 }
426 } else if (name == "Normalization") { 467 } else if (name == "Normalization") {
427 switch (value) { 468 auto n = convertToColumnNorm(value);
428 default: 469 setNormalization(n.first);
429 case 0: setNormalization(ColumnOp::NoNormalization); break; 470 setNormalizeVisibleArea(n.second);
430 case 1: setNormalization(ColumnOp::NormalizeColumns); break;
431 case 2: setNormalization(ColumnOp::NormalizeVisibleArea); break;
432 case 3: setNormalization(ColumnOp::NormalizeHybrid); break;
433 }
434 } 471 }
435 } 472 }
436 473
437 void 474 void
438 Colour3DPlotLayer::setColourScale(ColourScale::Scale scale) 475 Colour3DPlotLayer::setColourScale(ColourScale::Scale scale)
482 { 519 {
483 return m_binScale; 520 return m_binScale;
484 } 521 }
485 522
486 void 523 void
487 Colour3DPlotLayer::setNormalization(ColumnOp::Normalization n) 524 Colour3DPlotLayer::setNormalization(ColumnNormalization n)
488 { 525 {
489 if (m_normalization == n) return; 526 if (m_normalization == n) return;
490 527
491 m_normalization = n; 528 m_normalization = n;
492 cacheInvalid(); 529 cacheInvalid();
493 530
494 emit layerParametersChanged(); 531 emit layerParametersChanged();
495 } 532 }
496 533
497 ColumnOp::Normalization 534 ColumnNormalization
498 Colour3DPlotLayer::getNormalization() const 535 Colour3DPlotLayer::getNormalization() const
499 { 536 {
500 return m_normalization; 537 return m_normalization;
538 }
539
540 void
541 Colour3DPlotLayer::setNormalizeVisibleArea(bool n)
542 {
543 if (m_normalizeVisibleArea == n) return;
544
545 m_normalizeVisibleArea = n;
546 cacheInvalid();
547
548 emit layerParametersChanged();
549 }
550
551 bool
552 Colour3DPlotLayer::getNormalizeVisibleArea() const
553 {
554 return m_normalizeVisibleArea;
501 } 555 }
502 556
503 void 557 void
504 Colour3DPlotLayer::setInvertVertical(bool n) 558 Colour3DPlotLayer::setInvertVertical(bool n)
505 { 559 {
568 } 622 }
569 623
570 bool 624 bool
571 Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider *v) const 625 Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider *v) const
572 { 626 {
573 if (m_normalization == ColumnOp::NormalizeVisibleArea) { 627 if (m_normalizeVisibleArea) {
574 return false; 628 return false;
575 } 629 }
576 if (shouldPaintDenseIn(v)) { 630 if (shouldPaintDenseIn(v)) {
577 return true; 631 return true;
578 } 632 }
963 { 1017 {
964 Profiler profiler("Colour3DPlotLayer::getColumn"); 1018 Profiler profiler("Colour3DPlotLayer::getColumn");
965 1019
966 DenseThreeDimensionalModel::Column values = m_model->getColumn(col); 1020 DenseThreeDimensionalModel::Column values = m_model->getColumn(col);
967 values.resize(m_model->getHeight(), 0.f); 1021 values.resize(m_model->getHeight(), 0.f);
968 if (m_normalization != ColumnOp::NormalizeColumns && 1022 if (m_normalization != ColumnNormalization::Max1 &&
969 m_normalization != ColumnOp::NormalizeHybrid) { 1023 m_normalization != ColumnNormalization::Hybrid) {
970 return values; 1024 return values;
971 } 1025 }
972 1026
973 double colMax = 0.f, colMin = 0.f; 1027 double colMax = 0.f, colMin = 0.f;
974 double min = 0.f, max = 0.f; 1028 double min = 0.f, max = 0.f;
991 double newvalue = min + (max - min) * norm; 1045 double newvalue = min + (max - min) * norm;
992 1046
993 if (value != newvalue) values[y] = float(newvalue); 1047 if (value != newvalue) values[y] = float(newvalue);
994 } 1048 }
995 1049
996 if (m_normalization == ColumnOp::NormalizeHybrid 1050 if (m_normalization == ColumnNormalization::Hybrid
997 && (colMax > 0.0)) { 1051 && (colMax > 0.0)) {
998 double logmax = log10(colMax); 1052 double logmax = log10(colMax);
999 for (int y = 0; y < nv; ++y) { 1053 for (int y = 0; y < nv; ++y) {
1000 values[y] = float(values[y] * logmax); 1054 values[y] = float(values[y] * logmax);
1001 } 1055 }
1060 cerr << "Colour3DPlotLayer::fillCache: Have no cache, making one" << endl; 1114 cerr << "Colour3DPlotLayer::fillCache: Have no cache, making one" << endl;
1061 #endif 1115 #endif
1062 m_cache = new QImage(cacheWidth, cacheHeight, QImage::Format_Indexed8); 1116 m_cache = new QImage(cacheWidth, cacheHeight, QImage::Format_Indexed8);
1063 m_cache->setColorCount(256); 1117 m_cache->setColorCount(256);
1064 m_cache->fill(0); 1118 m_cache->fill(0);
1065 if (m_normalization != ColumnOp::NormalizeVisibleArea) { 1119 if (!m_normalizeVisibleArea) {
1066 m_peaksCache = new QImage 1120 m_peaksCache = new QImage
1067 (cacheWidth / m_peakResolution + 1, cacheHeight, 1121 (cacheWidth / m_peakResolution + 1, cacheHeight,
1068 QImage::Format_Indexed8); 1122 QImage::Format_Indexed8);
1069 m_peaksCache->setColorCount(256); 1123 m_peaksCache->setColorCount(256);
1070 m_peaksCache->fill(0); 1124 m_peaksCache->fill(0);
1095 if (fillStart < 0) fillStart = 0; 1149 if (fillStart < 0) fillStart = 0;
1096 if (fillEnd >= cacheWidth) fillEnd = cacheWidth-1; 1150 if (fillEnd >= cacheWidth) fillEnd = cacheWidth-1;
1097 if (fillEnd < 0) fillEnd = 0; 1151 if (fillEnd < 0) fillEnd = 0;
1098 if (fillEnd < fillStart) fillEnd = fillStart; 1152 if (fillEnd < fillStart) fillEnd = fillStart;
1099 1153
1100 bool normalizeVisible = (m_normalization == ColumnOp::NormalizeVisibleArea); 1154 bool normalizeVisible = (m_normalizeVisibleArea);
1101 1155
1102 if (!normalizeVisible && (m_cacheValidStart < m_cacheValidEnd)) { 1156 if (!normalizeVisible && (m_cacheValidStart < m_cacheValidEnd)) {
1103 1157
1104 if (m_cacheValidEnd < fillStart) { 1158 if (m_cacheValidEnd < fillStart) {
1105 fillStart = m_cacheValidEnd + 1; 1159 fillStart = m_cacheValidEnd + 1;
1400 paintAlternative(v, paint, rect); 1454 paintAlternative(v, paint, rect);
1401 return; 1455 return;
1402 1456
1403 //!!!??? 1457 //!!!???
1404 1458
1405 if (m_normalization == ColumnOp::NormalizeVisibleArea) { 1459 if (m_normalizeVisibleArea) {
1406 rect = v->getPaintRect(); 1460 rect = v->getPaintRect();
1407 } 1461 }
1408 1462
1409 sv_frame_t modelStart = m_model->getStartFrame(); 1463 sv_frame_t modelStart = m_model->getStartFrame();
1410 sv_frame_t modelEnd = m_model->getEndFrame(); 1464 sv_frame_t modelEnd = m_model->getEndFrame();
1802 } 1856 }
1803 1857
1804 return true; 1858 return true;
1805 } 1859 }
1806 1860
1807 static ColourScale::Scale
1808 convertInColourScale(int fileScale)
1809 {
1810 //!!! this is very badly handled, switching the enum directly for
1811 //!!! the ColourScale one did not work out well!
1812
1813 switch (fileScale) {
1814 default:
1815 case 0: return ColourScale::LinearColourScale;
1816 case 1: return ColourScale::LogColourScale;
1817 case 2: return ColourScale::PlusMinusOneScale;
1818 case 3: return ColourScale::AbsoluteScale;
1819 }
1820 }
1821
1822 static int
1823 convertOutColourScale(ColourScale::Scale scale)
1824 {
1825 switch (scale) {
1826 case ColourScale::LinearColourScale: return 0;
1827 case ColourScale::LogColourScale: return 1;
1828 case ColourScale::PlusMinusOneScale: return 2;
1829 case ColourScale::AbsoluteScale: return 3;
1830
1831 case ColourScale::MeterColourScale:
1832 case ColourScale::PhaseColourScale:
1833 default: return 0;
1834 }
1835 }
1836
1837 void 1861 void
1838 Colour3DPlotLayer::toXml(QTextStream &stream, 1862 Colour3DPlotLayer::toXml(QTextStream &stream,
1839 QString indent, QString extraAttributes) const 1863 QString indent, QString extraAttributes) const
1840 { 1864 {
1841 QString s = QString("scale=\"%1\" " 1865 QString s = QString("scale=\"%1\" "
1842 "colourScheme=\"%2\" " 1866 "colourScheme=\"%2\" "
1843 "minY=\"%3\" " 1867 "minY=\"%3\" "
1844 "maxY=\"%4\" " 1868 "maxY=\"%4\" "
1845 "invertVertical=\"%5\" " 1869 "invertVertical=\"%5\" "
1846 "opaque=\"%6\" %7") 1870 "opaque=\"%6\" %7")
1847 .arg(convertOutColourScale(m_colourScale)) 1871 .arg(convertFromColourScale(m_colourScale))
1848 .arg(m_colourMap) 1872 .arg(m_colourMap)
1849 .arg(m_miny) 1873 .arg(m_miny)
1850 .arg(m_maxy) 1874 .arg(m_maxy)
1851 .arg(m_invertVertical ? "true" : "false") 1875 .arg(m_invertVertical ? "true" : "false")
1852 .arg(m_opaque ? "true" : "false") 1876 .arg(m_opaque ? "true" : "false")
1859 // normalization in future: write out the column normalization 1883 // normalization in future: write out the column normalization
1860 // type separately, and then whether we are normalizing visible 1884 // type separately, and then whether we are normalizing visible
1861 // area as well afterwards 1885 // area as well afterwards
1862 1886
1863 s += QString("columnNormalization=\"%1\" ") 1887 s += QString("columnNormalization=\"%1\" ")
1864 .arg(m_normalization == ColumnOp::NormalizeColumns ? "peak" : 1888 .arg(m_normalization == ColumnNormalization::Max1 ? "peak" :
1865 m_normalization == ColumnOp::NormalizeHybrid ? "hybrid" : "none"); 1889 m_normalization == ColumnNormalization::Hybrid ? "hybrid" : "none");
1866 1890
1867 // Old-style normalization attribute, for backward compatibility 1891 // Old-style normalization attribute, for backward compatibility
1868 1892
1869 s += QString("normalizeColumns=\"%1\" ") 1893 s += QString("normalizeColumns=\"%1\" ")
1870 .arg(m_normalization == ColumnOp::NormalizeColumns ? "true" : "false"); 1894 .arg(m_normalization == ColumnNormalization::Max1 ? "true" : "false");
1871 1895
1872 // And this applies to both old- and new-style attributes 1896 // And this applies to both old- and new-style attributes
1873 1897
1874 s += QString("normalizeVisibleArea=\"%1\" ") 1898 s += QString("normalizeVisibleArea=\"%1\" ")
1875 .arg(m_normalization == ColumnOp::NormalizeVisibleArea ? "true" : "false"); 1899 .arg(m_normalizeVisibleArea ? "true" : "false");
1876 1900
1877 Layer::toXml(stream, indent, extraAttributes + " " + s); 1901 Layer::toXml(stream, indent, extraAttributes + " " + s);
1878 } 1902 }
1879 1903
1880 void 1904 void
1881 Colour3DPlotLayer::setProperties(const QXmlAttributes &attributes) 1905 Colour3DPlotLayer::setProperties(const QXmlAttributes &attributes)
1882 { 1906 {
1883 bool ok = false, alsoOk = false; 1907 bool ok = false, alsoOk = false;
1884 1908
1885 ColourScale::Scale colourScale = convertInColourScale 1909 ColourScale::Scale colourScale = convertToColourScale
1886 (attributes.value("colourScale").toInt(&ok)); 1910 (attributes.value("colourScale").toInt(&ok));
1887 if (ok) setColourScale(colourScale); 1911 if (ok) setColourScale(colourScale);
1888 1912
1889 int colourMap = attributes.value("colourScheme").toInt(&ok); 1913 int colourMap = attributes.value("colourScheme").toInt(&ok);
1890 if (ok) setColourMap(colourMap); 1914 if (ok) setColourMap(colourMap);
1919 if (columnNormalization != "") { 1943 if (columnNormalization != "") {
1920 1944
1921 haveNewStyleNormalization = true; 1945 haveNewStyleNormalization = true;
1922 1946
1923 if (columnNormalization == "peak") { 1947 if (columnNormalization == "peak") {
1924 setNormalization(ColumnOp::NormalizeColumns); 1948 setNormalization(ColumnNormalization::Max1);
1925 } else if (columnNormalization == "hybrid") { 1949 } else if (columnNormalization == "hybrid") {
1926 setNormalization(ColumnOp::NormalizeHybrid); 1950 setNormalization(ColumnNormalization::Hybrid);
1927 } else if (columnNormalization == "none") { 1951 } else if (columnNormalization == "none") {
1928 // do nothing 1952 setNormalization(ColumnNormalization::None);
1929 } else { 1953 } else {
1930 cerr << "NOTE: Unknown or unsupported columnNormalization attribute \"" 1954 cerr << "NOTE: Unknown or unsupported columnNormalization attribute \""
1931 << columnNormalization << "\"" << endl; 1955 << columnNormalization << "\"" << endl;
1932 } 1956 }
1933 } 1957 }
1934 1958
1935 if (!haveNewStyleNormalization) { 1959 if (!haveNewStyleNormalization) {
1936 1960
1961 setNormalization(ColumnNormalization::None);
1962
1937 bool normalizeColumns = 1963 bool normalizeColumns =
1938 (attributes.value("normalizeColumns").trimmed() == "true"); 1964 (attributes.value("normalizeColumns").trimmed() == "true");
1939 if (normalizeColumns) { 1965 if (normalizeColumns) {
1940 setNormalization(ColumnOp::NormalizeColumns); 1966 setNormalization(ColumnNormalization::Max1);
1941 } 1967 }
1942 1968
1943 bool normalizeHybrid = 1969 bool normalizeHybrid =
1944 (attributes.value("normalizeHybrid").trimmed() == "true"); 1970 (attributes.value("normalizeHybrid").trimmed() == "true");
1945 if (normalizeHybrid) { 1971 if (normalizeHybrid) {
1946 setNormalization(ColumnOp::NormalizeHybrid); 1972 setNormalization(ColumnNormalization::Hybrid);
1947 } 1973 }
1948 } 1974 }
1949 1975
1950 bool normalizeVisibleArea = 1976 bool normalizeVisibleArea =
1951 (attributes.value("normalizeVisibleArea").trimmed() == "true"); 1977 (attributes.value("normalizeVisibleArea").trimmed() == "true");
1952 if (normalizeVisibleArea) { 1978 setNormalizeVisibleArea(normalizeVisibleArea);
1953 setNormalization(ColumnOp::NormalizeVisibleArea);
1954 }
1955 1979
1956 //!!! todo: check save/reload scaling, compare with 1980 //!!! todo: check save/reload scaling, compare with
1957 //!!! SpectrogramLayer, compare with prior SV versions, compare 1981 //!!! SpectrogramLayer, compare with prior SV versions, compare
1958 //!!! with Tony v1 and v2 and their save files 1982 //!!! with Tony v1 and v2 and their save files
1959 } 1983 }