Sat, 17 Aug 2013 00:47:24 +0300
Use brighter text color with dark backgrounds for the message manager
changelog.txt | file | annotate | diff | comparison | revisions | |
src/gldraw.cpp | file | annotate | diff | comparison | revisions | |
src/gldraw.h | file | annotate | diff | comparison | revisions | |
src/ldtypes.cpp | file | annotate | diff | comparison | revisions |
--- a/changelog.txt Sat Aug 17 00:02:17 2013 +0300 +++ b/changelog.txt Sat Aug 17 00:47:24 2013 +0300 @@ -18,6 +18,7 @@ - If the vertex snapper finds a vertex closer than 4 pixels, it likely is the vertex being looked for and the algorithm can terminate early, hopefully this will save a few cycles on large parts. - The camera icons now draw real tooltips instead of emulated ones. +- Fixed: The message log was still written with black text with dark backgrounds. ================================================= == Changes in version 0.2-alpha
--- a/src/gldraw.cpp Sat Aug 17 00:02:17 2013 +0300 +++ b/src/gldraw.cpp Sat Aug 17 00:47:24 2013 +0300 @@ -519,7 +519,7 @@ QFontMetrics metrics = QFontMetrics (font()); QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); - paint.setPen (m_darkbg ? Qt::white : Qt::black); + paint.setPen (getTextPen()); paint.drawText (m_width - textSize.width(), m_height - 16, textSize.width(), textSize.height(), Qt::AlignCenter, text); @@ -607,13 +607,13 @@ str fmtstr = tr ("%1 Camera"); - // Draw a label for the current camera in the top left corner + // Draw a label for the current camera in the bottom left corner { const ushort margin = 4; str label; label = fmt (fmtstr, tr (g_CameraNames[camera()])); - paint.setPen (m_darkbg ? Qt::white : Qt::black); + paint.setPen (getTextPen()); paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); } @@ -632,12 +632,11 @@ if (msglog()) { int y = 0; const int margin = 2; - QColor col = Qt::black; - paint.setPen (QPen()); + QColor penColor = getTextPen(); for (const MessageManager::Line& line : *msglog()) { - col.setAlphaF (line.alpha); - paint.setPen (QPen (col)); + penColor.setAlphaF (line.alpha); + paint.setPen (penColor); paint.drawText (QPoint (margin, y + margin + metrics.ascent()), line.text); y += metrics.height(); } @@ -661,8 +660,13 @@ } // ============================================================================= -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// ----------------------------------------------------------------------------- +QColor GLRenderer::getTextPen () const { + return m_darkbg ? Qt::white : Qt::black; +} + // ============================================================================= +// ----------------------------------------------------------------------------- void GLRenderer::compileAllObjects() { if (!file()) return;
--- a/src/gldraw.h Sat Aug 17 00:02:17 2013 +0300 +++ b/src/gldraw.h Sat Aug 17 00:47:24 2013 +0300 @@ -154,6 +154,7 @@ void updateRectVerts(); void pick (uint mouseX, uint mouseY); // Perform object selection void setObjectColor (LDObject* obj, const ListType list); // Set the color to an object list + QColor getTextPen() const; // Determine which color to draw text with private slots: void slot_toolTipTimer();
--- a/src/ldtypes.cpp Sat Aug 17 00:02:17 2013 +0300 +++ b/src/ldtypes.cpp Sat Aug 17 00:47:24 2013 +0300 @@ -639,9 +639,8 @@ // It takes care of history management so we can capture low-level changes, this // makes history stuff work out of the box. template<class T> void changeProperty (LDObject* obj, T* ptr, const T& val) { - long idx; - if (obj->file()) { + long idx = obj->getIndex(); str before = obj->raw(); *ptr = val; str after = obj->raw();