comparison view/Pane.cpp @ 1226:6f0d7aa25816

Scale pen used for centre line
author Chris Cannam
date Thu, 26 Jan 2017 21:16:37 +0000
parents 0a13a1de1d7e
children a496986aa61b
comparison
equal deleted inserted replaced
1225:37f86e26a8d2 1226:6f0d7aa25816
564 void 564 void
565 Pane::drawVerticalScale(QRect r, Layer *topLayer, QPainter &paint) 565 Pane::drawVerticalScale(QRect r, Layer *topLayer, QPainter &paint)
566 { 566 {
567 Layer *scaleLayer = 0; 567 Layer *scaleLayer = 0;
568 568
569 // cerr << "Pane::drawVerticalScale[" << this << "]" << endl;
570
569 double min, max; 571 double min, max;
570 bool log; 572 bool log;
571 QString unit; 573 QString unit;
572 574
573 // If the top layer has no scale and reports no display 575 // If the top layer has no scale and reports no display
578 // with a scale regardless of unit. 580 // with a scale regardless of unit.
579 581
580 int sw = topLayer->getVerticalScaleWidth 582 int sw = topLayer->getVerticalScaleWidth
581 (this, m_manager->shouldShowVerticalColourScale(), paint); 583 (this, m_manager->shouldShowVerticalColourScale(), paint);
582 584
585 // cerr << "sw = " << sw << endl;
586
583 if (sw > 0) { 587 if (sw > 0) {
584 scaleLayer = topLayer; 588 scaleLayer = topLayer;
585 m_scaleWidth = sw; 589 m_scaleWidth = sw;
586 590
587 } else { 591 } else {
643 } 647 }
644 } 648 }
645 } 649 }
646 650
647 if (!scaleLayer) m_scaleWidth = 0; 651 if (!scaleLayer) m_scaleWidth = 0;
648 652
653 // cerr << "m_scaleWidth = " << m_scaleWidth << ", r.left = " << r.left() << endl;
654
649 if (m_scaleWidth > 0 && r.left() < m_scaleWidth) { 655 if (m_scaleWidth > 0 && r.left() < m_scaleWidth) {
650 656
651 // Profiler profiler("Pane::paintEvent - painting vertical scale", true); 657 // Profiler profiler("Pane::paintEvent - painting vertical scale", true);
652 658
653 // SVDEBUG << "Pane::paintEvent: calling paint.save() in vertical scale block" << endl; 659 // SVDEBUG << "Pane::paintEvent: calling paint.save() in vertical scale block" << endl;
732 QColor c = QColor(0, 0, 0); 738 QColor c = QColor(0, 0, 0);
733 if (!hasLightBackground()) { 739 if (!hasLightBackground()) {
734 c = QColor(240, 240, 240); 740 c = QColor(240, 240, 240);
735 } 741 }
736 742
737 paint.setPen(c); 743 paint.setPen(PaintAssistant::scalePen(c));
738 int x = width() / 2; 744 int x = width() / 2;
739 745
740 if (!omitLine) { 746 if (!omitLine) {
741 paint.drawLine(x, 0, x, height() - 1); 747 paint.drawLine(x, 0, x, height() - 1);
742 paint.drawLine(x-1, 1, x+1, 1); 748 paint.drawLine(x-1, 1, x+1, 1);