comparison view/Pane.cpp @ 607:5b72899d692b

Give a dedicated key to toggling the centre line, and move it out of the overlay level setting -- reducing number of overlay levels to 3. Introduce two distinct vertical scale types (so that we can hide the spectrogram colour scale part easily)
author Chris Cannam
date Mon, 30 Jan 2012 16:01:59 +0000
parents 2f087d950621
children d632a1e87018 5c9dcec5f3e9
comparison
equal deleted inserted replaced
606:fbab21439115 607:5b72899d692b
552 // drawn from any underlying layer with a scale and that unit. 552 // drawn from any underlying layer with a scale and that unit.
553 // If the top layer has no scale and no value extents at all, 553 // If the top layer has no scale and no value extents at all,
554 // then the scale should be drawn from any underlying layer 554 // then the scale should be drawn from any underlying layer
555 // with a scale regardless of unit. 555 // with a scale regardless of unit.
556 556
557 int sw = topLayer->getVerticalScaleWidth(this, paint); 557 int sw = topLayer->getVerticalScaleWidth
558 (this, m_manager->shouldShowVerticalColourScale(), paint);
558 559
559 if (sw > 0) { 560 if (sw > 0) {
560 scaleLayer = topLayer; 561 scaleLayer = topLayer;
561 m_scaleWidth = sw; 562 m_scaleWidth = sw;
562 563
574 575
575 --vi; 576 --vi;
576 577
577 if ((*vi) == topLayer) continue; 578 if ((*vi) == topLayer) continue;
578 579
579 sw = (*vi)->getVerticalScaleWidth(this, paint); 580 sw = (*vi)->getVerticalScaleWidth
581 (this, m_manager->shouldShowVerticalColourScale(), paint);
580 582
581 if (sw > 0) { 583 if (sw > 0) {
582 scaleLayer = *vi; 584 scaleLayer = *vi;
583 m_scaleWidth = sw; 585 m_scaleWidth = sw;
584 break; 586 break;
603 // risk ending up with the wrong scale) 605 // risk ending up with the wrong scale)
604 606
605 if ((*vi)->getValueExtents(min, max, log, unit) && 607 if ((*vi)->getValueExtents(min, max, log, unit) &&
606 unit == requireUnit) { 608 unit == requireUnit) {
607 609
608 sw = (*vi)->getVerticalScaleWidth(this, paint); 610 sw = (*vi)->getVerticalScaleWidth
611 (this, m_manager->shouldShowVerticalColourScale(), paint);
609 if (sw > 0) { 612 if (sw > 0) {
610 scaleLayer = *vi; 613 scaleLayer = *vi;
611 m_scaleWidth = sw; 614 m_scaleWidth = sw;
612 } 615 }
613 } 616 }
631 paint.setBrush(getBackground()); 634 paint.setBrush(getBackground());
632 paint.drawRect(0, -1, m_scaleWidth, height()+1); 635 paint.drawRect(0, -1, m_scaleWidth, height()+1);
633 636
634 paint.setBrush(Qt::NoBrush); 637 paint.setBrush(Qt::NoBrush);
635 scaleLayer->paintVerticalScale 638 scaleLayer->paintVerticalScale
636 (this, paint, QRect(0, 0, m_scaleWidth, height())); 639 (this, m_manager->shouldShowVerticalColourScale(),
640 paint, QRect(0, 0, m_scaleWidth, height()));
637 641
638 paint.restore(); 642 paint.restore();
639 } 643 }
640 } 644 }
641 645
1051 paint.setBrush(getBackground()); 1055 paint.setBrush(getBackground());
1052 paint.drawRect(xorigin, -1, m_scaleWidth, height()+1); 1056 paint.drawRect(xorigin, -1, m_scaleWidth, height()+1);
1053 1057
1054 paint.setBrush(Qt::NoBrush); 1058 paint.setBrush(Qt::NoBrush);
1055 (*vi)->paintVerticalScale 1059 (*vi)->paintVerticalScale
1056 (this, paint, QRect(xorigin, 0, m_scaleWidth, height())); 1060 (this, m_manager->shouldShowVerticalColourScale(),
1061 paint, QRect(xorigin, 0, m_scaleWidth, height()));
1057 1062
1058 paint.restore(); 1063 paint.restore();
1059 break; 1064 break;
1060 } 1065 }
1061 } 1066 }
1076 1081
1077 if (m_manager && m_manager->shouldShowVerticalScale()) { 1082 if (m_manager && m_manager->shouldShowVerticalScale()) {
1078 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 1083 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) {
1079 --vi; 1084 --vi;
1080 QPainter paint(image); 1085 QPainter paint(image);
1081 m_scaleWidth = (*vi)->getVerticalScaleWidth(this, paint); 1086 m_scaleWidth = (*vi)->getVerticalScaleWidth
1087 (this, m_manager->shouldShowVerticalColourScale(), paint);
1082 break; 1088 break;
1083 } 1089 }
1084 } else { 1090 } else {
1085 m_scaleWidth = 0; 1091 m_scaleWidth = 0;
1086 } 1092 }
1112 int sw = 0; 1118 int sw = 0;
1113 if (m_manager && m_manager->shouldShowVerticalScale()) { 1119 if (m_manager && m_manager->shouldShowVerticalScale()) {
1114 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { 1120 for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) {
1115 --vi; 1121 --vi;
1116 QPainter paint(image); 1122 QPainter paint(image);
1117 sw = (*vi)->getVerticalScaleWidth(this, paint); 1123 sw = (*vi)->getVerticalScaleWidth
1124 (this, m_manager->shouldShowVerticalColourScale(), paint);
1118 break; 1125 break;
1119 } 1126 }
1120 } 1127 }
1121 1128
1122 return QSize(sw + s.width(), s.height()); 1129 return QSize(sw + s.width(), s.height());