From 8c8dab4bf387a3181dffed9c1c353dd8ff37142b Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Sat, 16 Oct 2021 02:47:43 +0300 Subject: [PATCH] GUI improvements --- ExplorerPatcher/GUI.c | 53 ++++++++++++++++++++++++++---------- ExplorerPatcher/settings.reg | 13 ++++++--- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index dca3b86..ff0726c 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -232,11 +232,18 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) } DWORD dwLineHeight = GUI_LINE_HEIGHT; + DWORD dwBottom = _this->padding.bottom; + DWORD dwTop = _this->padding.top; + if (!strncmp(line, ";a ", 3) || !strncmp(line, ";e ", 3)) + { + dwBottom = 0; + dwLineHeight -= 0.2 * dwLineHeight; + } rcText.left = dwLeftPad + _this->padding.left; - rcText.top = _this->padding.top + dwMaxHeight; + rcText.top = dwTop + dwMaxHeight; rcText.right = (rc.right - rc.left) - _this->padding.right; - rcText.bottom = dwMaxHeight + dwLineHeight * dy - _this->padding.bottom; + rcText.bottom = dwMaxHeight + dwLineHeight * dy - dwBottom; if (!strncmp(line, ";T ", 3)) { @@ -324,9 +331,9 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) hOldFont = SelectObject(hdcPaint, hFontRegular); } - if (!strncmp(line, ";T ", 3) || !strncmp(line, ";t ", 3) || !strncmp(line, ";u ", 3) || !strncmp(line, ";M ", 3)) + if (!strncmp(line, ";e ", 3) || !strncmp(line, ";a ", 3) || !strncmp(line, ";T ", 3) || !strncmp(line, ";t ", 3) || !strncmp(line, ";u ", 3) || !strncmp(line, ";M ", 3)) { - if (!strncmp(line, ";t ", 3)) + if (!strncmp(line, ";t ", 3) || !strncmp(line, ";e ", 3) || !strncmp(line, ";a ", 3)) { char* p = strstr(line, "%VERSIONINFO%"); if (p) @@ -350,6 +357,20 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) text, MAX_LINE_LENGTH ); + if (!strncmp(line, ";a ", 3)) + { + RECT rcTemp; + rcTemp = rcText; + DrawTextW( + hdcPaint, + L"\u2795 ", + 3, + &rcTemp, + DT_CALCRECT + ); + rcText.left += rcTemp.right - rcTemp.left; + rcText.right += rcTemp.right - rcTemp.left; + } if (!strncmp(line, ";M ", 3)) { TCHAR exeName[MAX_PATH + 1]; @@ -417,7 +438,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) ); if (rcNew.right - rcNew.left > dwMaxWidth) { - dwMaxWidth = rcNew.right - rcNew.left + 20 * dx; + dwMaxWidth = rcNew.right - rcNew.left + 50 * dx; } if (IsThemeActive()) { @@ -665,6 +686,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) text + 3, MAX_LINE_LENGTH ); + wchar_t* x = wcschr(text, L'\n'); if (x) *x = 0; x = wcschr(text, L'\r'); @@ -1004,14 +1026,17 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) if (p) *p = 0; p = strchr(line, '\n'); if (p) *p = 0; - ShellExecuteA( - NULL, - "open", - line + 1, - NULL, - NULL, - SW_SHOWNORMAL - ); + if (line[1] != 0) + { + ShellExecuteA( + NULL, + "open", + line + 1, + NULL, + NULL, + SW_SHOWNORMAL + ); + } } } if (hDC) @@ -1040,7 +1065,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) ); if (rcNew.right - rcNew.left > dwMaxWidth) { - dwMaxWidth = rcNew.right - rcNew.left + 20 * dx; + dwMaxWidth = rcNew.right - rcNew.left + 50 * dx; } if (IsThemeActive()) { diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index 9ad4362..dc973db 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -224,12 +224,17 @@ [HKEY_CURRENT_USER\Control Panel\Desktop] ;b Show Windows build info on the desktop * "PaintDesktopversion"=dword:00000000 +[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher] +;b Enable advanced mitigations for correct rendering using classic theme * +"ClassicThemeMitigations"=dword:00000000 + ;T About -;t Version %VERSIONINFO% +;e ExplorerPatcher +;e Version %VERSIONINFO% ;t Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved. -;t -;t This project aims to bring back a productive working environment on Windows 11. +;e +;e This project aims to bring back a productive working environment on Windows 11. ;t Proudly programmed by Valentin-Gabriel Radu. ;l Visit project GitHub (https://github.com/valinet) ;https://github.com/valinet @@ -241,7 +246,7 @@ ;https://www.paypal.com/donate?business=valentingabrielradu%40gmail.com&no_recurring=0&item_name=ExplorerPatcher¤cy_code=EUR ;f -;t Settings marked with an (*) require restarting the File Explorer process. +;t Settings marked with an (*) require restarting File Explorer. ;u Restart File Explorer ;restart ;u Restore default settings