comparison view/View.cpp @ 279:47fe0352861e

* add pitch label to spectrogram harmonic cursor as well
author Chris Cannam
date Tue, 03 Jul 2007 18:56:27 +0000
parents a078aa2932cc
children 86a112b5b319
comparison
equal deleted inserted replaced
278:a078aa2932cc 279:47fe0352861e
618 void 618 void
619 View::drawVisibleText(QPainter &paint, int x, int y, QString text, TextStyle style) const 619 View::drawVisibleText(QPainter &paint, int x, int y, QString text, TextStyle style) const
620 { 620 {
621 if (style == OutlinedText) { 621 if (style == OutlinedText) {
622 622
623 paint.save();
624
625 QColor penColour, surroundColour;
626
627 if (hasLightBackground()) {
628 penColour = Qt::black;
629 surroundColour = Qt::white;
630 } else {
631 penColour = Qt::white;
632 surroundColour = Qt::black;
633 }
634
635 /*
623 QColor origPenColour = paint.pen().color(); 636 QColor origPenColour = paint.pen().color();
624 QColor penColour = origPenColour; 637 QColor penColour = origPenColour;
625 QColor surroundColour = Qt::white; //palette().background().color(); 638 QColor surroundColour = Qt::white; //palette().background().color();
626 639
627 if (!hasLightBackground()) { 640 if (!hasLightBackground()) {
628 int h, s, v; 641 int h, s, v;
629 penColour.getHsv(&h, &s, &v); 642 penColour.getHsv(&h, &s, &v);
630 penColour = QColor::fromHsv(h, s, 255 - v); 643 penColour = QColor::fromHsv(h, s, 255 - v);
631 surroundColour = Qt::black; 644 surroundColour = Qt::black;
632 } 645 }
633 646 */
634 paint.setPen(surroundColour); 647 paint.setPen(surroundColour);
635 648
636 for (int dx = -1; dx <= 1; ++dx) { 649 for (int dx = -1; dx <= 1; ++dx) {
637 for (int dy = -1; dy <= 1; ++dy) { 650 for (int dy = -1; dy <= 1; ++dy) {
638 if (!(dx || dy)) continue; 651 if (!(dx || dy)) continue;
641 } 654 }
642 655
643 paint.setPen(penColour); 656 paint.setPen(penColour);
644 657
645 paint.drawText(x, y, text); 658 paint.drawText(x, y, text);
646 659 /*
647 paint.setPen(origPenColour); 660 paint.setPen(origPenColour);
661 */
662 paint.restore();
648 663
649 } else { 664 } else {
650 665
651 std::cerr << "ERROR: View::drawVisibleText: Boxed style not yet implemented!" << std::endl; 666 std::cerr << "ERROR: View::drawVisibleText: Boxed style not yet implemented!" << std::endl;
652 } 667 }