Mercurial > hg > svgui
comparison view/Pane.cpp @ 835:7792b7667f74
Introduce (but don't yet populate) the fixed layers vector; rename m_layers to m_layerStack to reflect its ordering by stacking
author | Chris Cannam |
---|---|
date | Tue, 02 Sep 2014 14:47:04 +0100 |
parents | 5acfb11e8aef |
children | d843e6275d0f |
comparison
equal
deleted
inserted
replaced
834:9ad718fdc369 | 835:7792b7667f74 |
---|---|
200 int current = 0; | 200 int current = 0; |
201 int level = 1; | 201 int level = 1; |
202 | 202 |
203 //!!! pull out into function (presumably in View) | 203 //!!! pull out into function (presumably in View) |
204 bool haveConstraint = false; | 204 bool haveConstraint = false; |
205 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); | 205 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); |
206 ++i) { | 206 ++i) { |
207 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) { | 207 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) { |
208 haveConstraint = true; | 208 haveConstraint = true; |
209 break; | 209 break; |
210 } | 210 } |
424 if (m_manager && | 424 if (m_manager && |
425 // !m_manager->isPlaying() && | 425 // !m_manager->isPlaying() && |
426 m_mouseInWidget && | 426 m_mouseInWidget && |
427 toolMode == ViewManager::MeasureMode) { | 427 toolMode == ViewManager::MeasureMode) { |
428 | 428 |
429 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 429 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { |
430 --vi; | 430 --vi; |
431 | 431 |
432 std::vector<QRect> crosshairExtents; | 432 std::vector<QRect> crosshairExtents; |
433 | 433 |
434 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, | 434 if ((*vi)->getCrosshairExtents(this, paint, m_identifyPoint, |
445 bool haveSomeTimeXAxis = false; | 445 bool haveSomeTimeXAxis = false; |
446 | 446 |
447 const Model *waveformModel = 0; // just for reporting purposes | 447 const Model *waveformModel = 0; // just for reporting purposes |
448 const Model *workModel = 0; | 448 const Model *workModel = 0; |
449 | 449 |
450 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 450 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { |
451 --vi; | 451 --vi; |
452 if (!haveSomeTimeXAxis && (*vi)->hasTimeXAxis()) { | 452 if (!haveSomeTimeXAxis && (*vi)->hasTimeXAxis()) { |
453 haveSomeTimeXAxis = true; | 453 haveSomeTimeXAxis = true; |
454 } | 454 } |
455 if (dynamic_cast<WaveformLayer *>(*vi)) { | 455 if (dynamic_cast<WaveformLayer *>(*vi)) { |
584 | 584 |
585 if (!hasDisplayExtents) { | 585 if (!hasDisplayExtents) { |
586 | 586 |
587 if (!hasValueExtents) { | 587 if (!hasValueExtents) { |
588 | 588 |
589 for (LayerList::iterator vi = m_layers.end(); | 589 for (LayerList::iterator vi = m_layerStack.end(); |
590 vi != m_layers.begin(); ) { | 590 vi != m_layerStack.begin(); ) { |
591 | 591 |
592 --vi; | 592 --vi; |
593 | 593 |
594 if ((*vi) == topLayer) continue; | 594 if ((*vi) == topLayer) continue; |
595 | 595 |
604 } | 604 } |
605 } else if (unit != "") { // && hasValueExtents && !hasDisplayExtents | 605 } else if (unit != "") { // && hasValueExtents && !hasDisplayExtents |
606 | 606 |
607 QString requireUnit = unit; | 607 QString requireUnit = unit; |
608 | 608 |
609 for (LayerList::iterator vi = m_layers.end(); | 609 for (LayerList::iterator vi = m_layerStack.end(); |
610 vi != m_layers.begin(); ) { | 610 vi != m_layerStack.begin(); ) { |
611 | 611 |
612 --vi; | 612 --vi; |
613 | 613 |
614 if ((*vi) == topLayer) continue; | 614 if ((*vi) == topLayer) continue; |
615 | 615 |
736 | 736 |
737 paint.setPen(QColor(50, 50, 50)); | 737 paint.setPen(QColor(50, 50, 50)); |
738 | 738 |
739 int y = height() - fontHeight + fontAscent - 6; | 739 int y = height() - fontHeight + fontAscent - 6; |
740 | 740 |
741 LayerList::iterator vi = m_layers.end(); | 741 LayerList::iterator vi = m_layerStack.end(); |
742 | 742 |
743 if (vi != m_layers.begin()) { | 743 if (vi != m_layerStack.begin()) { |
744 | 744 |
745 switch ((*--vi)->getPreferredFrameCountPosition()) { | 745 switch ((*--vi)->getPreferredFrameCountPosition()) { |
746 | 746 |
747 case Layer::PositionTop: | 747 case Layer::PositionTop: |
748 y = fontAscent + 6; | 748 y = fontAscent + 6; |
914 int lly = height() - 6; | 914 int lly = height() - 6; |
915 if (m_manager->getZoomWheelsEnabled()) { | 915 if (m_manager->getZoomWheelsEnabled()) { |
916 lly -= 20; | 916 lly -= 20; |
917 } | 917 } |
918 | 918 |
919 if (r.y() + r.height() < lly - int(m_layers.size()) * fontHeight) { | 919 if (r.y() + r.height() < lly - int(m_layerStack.size()) * fontHeight) { |
920 return; | 920 return; |
921 } | 921 } |
922 | 922 |
923 QStringList texts; | 923 QStringList texts; |
924 std::vector<QPixmap> pixmaps; | 924 std::vector<QPixmap> pixmaps; |
925 for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { | 925 for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { |
926 texts.push_back((*i)->getLayerPresentationName()); | 926 texts.push_back((*i)->getLayerPresentationName()); |
927 // cerr << "Pane " << this << ": Layer presentation name for " << *i << ": " | 927 // cerr << "Pane " << this << ": Layer presentation name for " << *i << ": " |
928 // << texts[texts.size()-1] << endl; | 928 // << texts[texts.size()-1] << endl; |
929 pixmaps.push_back((*i)->getLayerPresentationPixmap | 929 pixmaps.push_back((*i)->getLayerPresentationPixmap |
930 (QSize(fontAscent, fontAscent))); | 930 (QSize(fontAscent, fontAscent))); |
1091 return false; | 1091 return false; |
1092 } | 1092 } |
1093 | 1093 |
1094 if (m_scaleWidth > 0) { | 1094 if (m_scaleWidth > 0) { |
1095 | 1095 |
1096 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 1096 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { |
1097 --vi; | 1097 --vi; |
1098 | 1098 |
1099 paint.save(); | 1099 paint.save(); |
1100 | 1100 |
1101 paint.setPen(getForeground()); | 1101 paint.setPen(getForeground()); |
1125 height(), QImage::Format_RGB32); | 1125 height(), QImage::Format_RGB32); |
1126 | 1126 |
1127 int formerScaleWidth = m_scaleWidth; | 1127 int formerScaleWidth = m_scaleWidth; |
1128 | 1128 |
1129 if (m_manager && m_manager->shouldShowVerticalScale()) { | 1129 if (m_manager && m_manager->shouldShowVerticalScale()) { |
1130 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 1130 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { |
1131 --vi; | 1131 --vi; |
1132 QPainter paint(image); | 1132 QPainter paint(image); |
1133 m_scaleWidth = (*vi)->getVerticalScaleWidth | 1133 m_scaleWidth = (*vi)->getVerticalScaleWidth |
1134 (this, m_manager->shouldShowVerticalColourScale(), paint); | 1134 (this, m_manager->shouldShowVerticalColourScale(), paint); |
1135 break; | 1135 break; |
1162 QImage *image = new QImage(100, 100, QImage::Format_RGB32); | 1162 QImage *image = new QImage(100, 100, QImage::Format_RGB32); |
1163 QPainter paint(image); | 1163 QPainter paint(image); |
1164 | 1164 |
1165 int sw = 0; | 1165 int sw = 0; |
1166 if (m_manager && m_manager->shouldShowVerticalScale()) { | 1166 if (m_manager && m_manager->shouldShowVerticalScale()) { |
1167 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { | 1167 for (LayerList::iterator vi = m_layerStack.end(); vi != m_layerStack.begin(); ) { |
1168 --vi; | 1168 --vi; |
1169 sw = (*vi)->getVerticalScaleWidth | 1169 sw = (*vi)->getVerticalScaleWidth |
1170 (this, m_manager->shouldShowVerticalColourScale(), paint); | 1170 (this, m_manager->shouldShowVerticalColourScale(), paint); |
1171 break; | 1171 break; |
1172 } | 1172 } |
1275 } | 1275 } |
1276 | 1276 |
1277 Layer * | 1277 Layer * |
1278 Pane::getTopFlexiNoteLayer() | 1278 Pane::getTopFlexiNoteLayer() |
1279 { | 1279 { |
1280 for (int i = int(m_layers.size()) - 1; i >= 0; --i) { | 1280 for (int i = int(m_layerStack.size()) - 1; i >= 0; --i) { |
1281 if (LayerFactory::getInstance()->getLayerType(m_layers[i]) == | 1281 if (LayerFactory::getInstance()->getLayerType(m_layerStack[i]) == |
1282 LayerFactory::FlexiNotes) { | 1282 LayerFactory::FlexiNotes) { |
1283 return m_layers[i]; | 1283 return m_layerStack[i]; |
1284 } | 1284 } |
1285 } | 1285 } |
1286 return 0; | 1286 return 0; |
1287 } | 1287 } |
1288 | 1288 |
1878 | 1878 |
1879 QString unit; | 1879 QString unit; |
1880 float min, max; | 1880 float min, max; |
1881 bool log; | 1881 bool log; |
1882 Layer *layer = 0; | 1882 Layer *layer = 0; |
1883 for (LayerList::const_iterator i = m_layers.begin(); | 1883 for (LayerList::const_iterator i = m_layerStack.begin(); |
1884 i != m_layers.end(); ++i) { | 1884 i != m_layerStack.end(); ++i) { |
1885 if ((*i)->getValueExtents(min, max, log, unit) && | 1885 if ((*i)->getValueExtents(min, max, log, unit) && |
1886 (*i)->getDisplayExtents(min, max)) { | 1886 (*i)->getDisplayExtents(min, max)) { |
1887 layer = *i; | 1887 layer = *i; |
1888 break; | 1888 break; |
1889 } | 1889 } |
2391 int level = 1; | 2391 int level = 1; |
2392 | 2392 |
2393 | 2393 |
2394 //!!! pull out into function (presumably in View) | 2394 //!!! pull out into function (presumably in View) |
2395 bool haveConstraint = false; | 2395 bool haveConstraint = false; |
2396 for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); | 2396 for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); |
2397 ++i) { | 2397 ++i) { |
2398 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) { | 2398 if ((*i)->getZoomConstraint() && !(*i)->supportsOtherZoomLevels()) { |
2399 haveConstraint = true; | 2399 haveConstraint = true; |
2400 break; | 2400 break; |
2401 } | 2401 } |