From 79ec345d3a6648b61924022599e1cd38d9cc08d5 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 15 Oct 2005 16:37:34 +0000 Subject: [PATCH] Winefile: - fix item background color for non-white windows background - fix drive size output: wsprintf() -> _stprintf() - declare COLOR_SELECTION_TXT svn path=/trunk/; revision=18483 --- reactos/subsys/system/winefile/winefile.c | 15 ++++++++++++--- reactos/subsys/system/winefile/winefile.h | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/reactos/subsys/system/winefile/winefile.c b/reactos/subsys/system/winefile/winefile.c index 5576b0bc607..c44163bb09a 100644 --- a/reactos/subsys/system/winefile/winefile.c +++ b/reactos/subsys/system/winefile/winefile.c @@ -2832,12 +2832,21 @@ static void format_bytes(LPTSTR buffer, LONGLONG bytes) float fBytes = (float)bytes; +#ifdef __WINE__ /* work around for incorrect implementation of wsprintf()/_stprintf() in WINE */ if (bytes >= 1073741824) /* 1 GB */ wsprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f); else if (bytes >= 1048576) /* 1 MB */ wsprintf(buffer, sFmtMB, fBytes/1048576.f+.5f); else if (bytes >= 1024) /* 1 kB */ wsprintf(buffer, sFmtkB, fBytes/1024.f+.5f); +#else + if (bytes >= 1073741824) /* 1 GB */ + _stprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f); + else if (bytes >= 1048576) /* 1 MB */ + _stprintf(buffer, sFmtMB, fBytes/1048576.f+.5f); + else if (bytes >= 1024) /* 1 kB */ + _stprintf(buffer, sFmtkB, fBytes/1024.f+.5f); +#endif else _stprintf(buffer, sLongNumFmt, bytes); } @@ -3218,10 +3227,10 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi textcolor = RGB(0,0,0); if (dis->itemState & ODS_FOCUS) { - textcolor = RGB(255,255,255); + textcolor = COLOR_SELECTION_TXT; bkcolor = COLOR_SELECTION; } else { - bkcolor = RGB(255,255,255); + bkcolor = GetSysColor(COLOR_WINDOW); } hbrush = CreateSolidBrush(bkcolor); @@ -3430,7 +3439,7 @@ static void draw_item(Pane* pane, LPDRAWITEMSTRUCT dis, Entry* entry, int calcWi HPEN lastPen; HPEN hpen; - if (!(GetVersion() & 0x80000000)) { /* Windows NT? */ + if (!(GetVersion() & 0x80000000)) { /* Windows NT or higher? */ LOGBRUSH lb = {PS_SOLID, RGB(255,255,255)}; hpen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &lb, 0, 0); } else diff --git a/reactos/subsys/system/winefile/winefile.h b/reactos/subsys/system/winefile/winefile.h index 530ff14b833..3fec9bbc216 100644 --- a/reactos/subsys/system/winefile/winefile.h +++ b/reactos/subsys/system/winefile/winefile.h @@ -101,6 +101,7 @@ enum IMAGE { #define COLOR_COMPRESSED RGB(0,0,255) #define COLOR_SELECTION RGB(0,0,128) +#define COLOR_SELECTION_TXT RGB(255,255,255) #ifdef _NO_EXTENSIONS #define COLOR_SPLITBAR WHITE_BRUSH