From 452a60e97b7b1b82dd519ae07bf2db0db79e3cac Mon Sep 17 00:00:00 2001 From: klugier Date: Fri, 3 May 2019 20:45:32 +0000 Subject: [PATCH] Ide: AppPreview header now supports dark theme and fix minor rendering problem related to this class. git-svn-id: svn://ultimatepp.org/upp/trunk@13080 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Template.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/uppsrc/ide/Template.cpp b/uppsrc/ide/Template.cpp index d9e75f603..5e9c18ede 100644 --- a/uppsrc/ide/Template.cpp +++ b/uppsrc/ide/Template.cpp @@ -107,15 +107,17 @@ void AppPreview::Layout() void AppPreview::Paint(Draw& w) { Size sz = GetSize(); - Font fnt = CourierZ(12); int y = 0; int i = sb; while(y < sz.cy) { - bool hdr = i < line.GetCount() && line[i].header; - w.DrawRect(0, y, sz.cx, fnt.GetCy(), hdr ? LtCyan : SColorPaper); + auto is_header = i < line.GetCount() && line[i].header; + auto font = is_header ? ArialZ(12).Bold().Italic() : CourierZ(12); + auto rect_color = is_header ? (IsDarkTheme() ? DarkTheme(LtCyan) : LtCyan) : SColorPaper; + + w.DrawRect(0, y, sz.cx, font.GetCy(), rect_color); if(i < line.GetCount()) - w.DrawText(0, y, line[i].text, hdr ? ArialZ(12).Bold().Italic() : fnt, SColorText); - y += fnt.GetCy(); + w.DrawText(0, y, line[i].text, font, SColorText); + y += font.GetCy(); i++; } }