CtrlLib, ide: DarkTheme fixes

git-svn-id: svn://ultimatepp.org/upp/trunk@12914 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-03-29 09:49:07 +00:00
parent 33df3ece07
commit dd4536bfe3
4 changed files with 17 additions and 16 deletions

View file

@ -122,17 +122,17 @@ void FileList::Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const
{
const File& m = ValueTo<File>(q);
bool inverted = abs(Grayscale(paper) - Grayscale(m.ink)) < 120;
w.DrawRect(r, paper);
int x = r.left + 2;
w.DrawImage(x, r.top + (r.Height() - m.icon.GetSize().cy) / 2, m.icon);
x += iconwidth;
x += 2;
FontInfo fi = m.font.Info();
bool inv = (style & (Display::CURSOR|Display::SELECT)) && (style & Display::FOCUS);
DrawFileName(w, x, r.top + (r.Height() - fi.GetHeight()) / 2,
r.right - x - 2, r.Height(), WString(m.name), m.isdir, m.font,
inverted ? SColorHighlightText : m.ink,
inverted ? SColorHighlightText : m.extink,
inv ? SColorHighlightText : m.ink,
inv ? SColorHighlightText : m.extink,
WString(m.desc), m.descfont, justname, m.underline);
}

View file

@ -4,7 +4,7 @@ void PaintText(Draw& w, int& x, int y, const char *text, const Vector<ItemTextPa
int starti, int count, bool focuscursor, Color _ink, bool italic)
{
static int maxascent = MaxAscent(BrowserFont());
bool dark = IsDark(SColorPaper());
bool dark = IsDarkTheme();
for(int i = starti; i < count; i++) {
const ItemTextPart& p = n[i];
Font f = BrowserFont();
@ -13,15 +13,15 @@ void PaintText(Draw& w, int& x, int y, const char *text, const Vector<ItemTextPa
case ITEM_PNAME:
f.Bold();
case ITEM_NUMBER:
ink = dark ? Color(28, 255, 0) : Red;
ink = AdjustIfDark(Red());
break;
case ITEM_TNAME:
ink = dark ? LtGreen : Green;
ink = SGreen();
case ITEM_NAME:
f.Bold();
break;
case ITEM_UPP:
ink = Cyan;
ink = AdjustIfDark(Cyan);
break;
case ITEM_CPP_TYPE:
case ITEM_CPP:
@ -168,7 +168,7 @@ int CppItemInfoDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
}
PaintText(w, x, y, m, n, 0, starti, focuscursor, _ink);
if(m.virt || m.over)
w.DrawRect(x0, r.bottom - 2, x - x0, 1, m.over ? m.virt ? LtRed : LtBlue : SColorText);
w.DrawRect(x0, r.bottom - 2, x - x0, 1, m.over ? m.virt ? SLtRed() : SLtBlue() : SColorText());
if(m.inherited && m.IsType())
w.DrawRect(r.left, r.top, r.Width(), 1, SColorDisabled);
@ -187,8 +187,8 @@ int CppItemInfoDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
Point p(xx + (sz.cx - tsz.cx) / 2, yy + (sz.cy - tsz.cy) / 2);
for(int ax = -1; ax <= 1; ax++)
for(int ay = -1; ay <= 1; ay++)
w.DrawText(p.x + ax, p.y + ay, txt, fnt, White);
w.DrawText(p.x, p.y, txt, fnt, Blue);
w.DrawText(p.x + ax, p.y + ay, txt, fnt, SWhite());
w.DrawText(p.x, p.y, txt, fnt, SBlue());
}
x += sz.cx + Zx(3);
}

View file

@ -128,15 +128,15 @@ void WorkspaceWork::ScanWorkspace() {
fnt.Bold();
if(pi.italic)
fnt.Italic();
package.Add(pk, Null, fnt, Nvl(pi.ink, SColorText()), false, 0, Null, SColorMark);
package.Add(pk, Null, fnt, Nvl(AdjustIfDark(pi.ink), SColorText()), false, 0, Null, SColorMark);
}
if(!organizer) {
if(main.GetCount())
package.Add(prjaux, IdeImg::PrjAux(), ListFont(), Magenta);
package.Add(ideaux, IdeImg::IdeAux(), ListFont(), Magenta);
package.Add(tempaux, IdeImg::TempAux(), ListFont(), Magenta);
package.Add(prjaux, IdeImg::PrjAux(), ListFont(), AdjustIfDark(Magenta));
package.Add(ideaux, IdeImg::IdeAux(), ListFont(), AdjustIfDark(Magenta));
package.Add(tempaux, IdeImg::TempAux(), ListFont(), AdjustIfDark(Magenta));
if(main.GetCount())
package.Add(METAPACKAGE, IdeImg::Meta(), ListFont(), Red);
package.Add(METAPACKAGE, IdeImg::Meta(), ListFont(), AdjustIfDark(Red));
}
package.SetCursor(0);

View file

@ -125,8 +125,9 @@ void AppMain___()
// Ctrl::ShowRepaint(50);
Logi() << UPP_FUNCTION_NAME << "(): " << SplashCtrl::GenerateVersionInfo(' ');
Ctrl::SetUHDEnabled();
Ctrl::SetDarkThemeEnabled();
SetLanguage(LNG_ENGLISH);
SetDefaultCharset(CHARSET_UTF8);