517 str text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); |
517 str text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); |
518 |
518 |
519 QFontMetrics metrics = QFontMetrics (font()); |
519 QFontMetrics metrics = QFontMetrics (font()); |
520 QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); |
520 QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); |
521 |
521 |
522 paint.setPen (m_darkbg ? Qt::white : Qt::black); |
522 paint.setPen (getTextPen()); |
523 paint.drawText (m_width - textSize.width(), m_height - 16, textSize.width(), |
523 paint.drawText (m_width - textSize.width(), m_height - 16, textSize.width(), |
524 textSize.height(), Qt::AlignCenter, text); |
524 textSize.height(), Qt::AlignCenter, text); |
525 |
525 |
526 // If we're drawing, draw the vertices onto the screen. |
526 // If we're drawing, draw the vertices onto the screen. |
527 if (editMode() == Draw) { |
527 if (editMode() == Draw) { |
605 paint.drawPixmap (info.destRect, *info.img, info.srcRect); |
605 paint.drawPixmap (info.destRect, *info.img, info.srcRect); |
606 } |
606 } |
607 |
607 |
608 str fmtstr = tr ("%1 Camera"); |
608 str fmtstr = tr ("%1 Camera"); |
609 |
609 |
610 // Draw a label for the current camera in the top left corner |
610 // Draw a label for the current camera in the bottom left corner |
611 { |
611 { |
612 const ushort margin = 4; |
612 const ushort margin = 4; |
613 |
613 |
614 str label; |
614 str label; |
615 label = fmt (fmtstr, tr (g_CameraNames[camera()])); |
615 label = fmt (fmtstr, tr (g_CameraNames[camera()])); |
616 paint.setPen (m_darkbg ? Qt::white : Qt::black); |
616 paint.setPen (getTextPen()); |
617 paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); |
617 paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); |
618 } |
618 } |
619 |
619 |
620 // Tool tips |
620 // Tool tips |
621 if (m_drawToolTip) { |
621 if (m_drawToolTip) { |
630 |
630 |
631 // Message log |
631 // Message log |
632 if (msglog()) { |
632 if (msglog()) { |
633 int y = 0; |
633 int y = 0; |
634 const int margin = 2; |
634 const int margin = 2; |
635 QColor col = Qt::black; |
635 QColor penColor = getTextPen(); |
636 paint.setPen (QPen()); |
|
637 |
636 |
638 for (const MessageManager::Line& line : *msglog()) { |
637 for (const MessageManager::Line& line : *msglog()) { |
639 col.setAlphaF (line.alpha); |
638 penColor.setAlphaF (line.alpha); |
640 paint.setPen (QPen (col)); |
639 paint.setPen (penColor); |
641 paint.drawText (QPoint (margin, y + margin + metrics.ascent()), line.text); |
640 paint.drawText (QPoint (margin, y + margin + metrics.ascent()), line.text); |
642 y += metrics.height(); |
641 y += metrics.height(); |
643 } |
642 } |
644 } |
643 } |
645 |
644 |
659 paint.drawRect (rect); |
658 paint.drawRect (rect); |
660 } |
659 } |
661 } |
660 } |
662 |
661 |
663 // ============================================================================= |
662 // ============================================================================= |
664 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
663 // ----------------------------------------------------------------------------- |
665 // ============================================================================= |
664 QColor GLRenderer::getTextPen () const { |
|
665 return m_darkbg ? Qt::white : Qt::black; |
|
666 } |
|
667 |
|
668 // ============================================================================= |
|
669 // ----------------------------------------------------------------------------- |
666 void GLRenderer::compileAllObjects() { |
670 void GLRenderer::compileAllObjects() { |
667 if (!file()) |
671 if (!file()) |
668 return; |
672 return; |
669 |
673 |
670 m_knownVerts.clear(); |
674 m_knownVerts.clear(); |