mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	Merge 814c4df261 into bdff2dc45c
				
					
				
			This commit is contained in:
		
						commit
						4d5b763f5e
					
				
					 5 changed files with 602 additions and 40 deletions
				
			
		|  | @ -202,6 +202,17 @@ static __inline BOOL WriteRegistryKey32(HKEY root, const char* key, int32_t val) | ||||||
| 	DWORD tmp = (DWORD)val; | 	DWORD tmp = (DWORD)val; | ||||||
| 	return SetRegistryKey32(root, key, tmp); | 	return SetRegistryKey32(root, key, tmp); | ||||||
| } | } | ||||||
|  | static __inline BOOL  IsAppsUseDarkMode() { | ||||||
|  | 	char buffer [4] ; | ||||||
|  | 	DWORD cbData = (DWORD)(sizeof(buffer)); | ||||||
|  | 	LSTATUS res = RegGetValue(REGKEY_HKCU, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", RRF_RT_REG_DWORD, NULL, buffer, &cbData); | ||||||
|  | 	if (res == ERROR_SUCCESS) | ||||||
|  | 	{ | ||||||
|  | 		int i = (int)(buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]); | ||||||
|  | 		return i == 0; | ||||||
|  | 	} | ||||||
|  | 	return FALSE; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| /* Helpers for boolean registry operations */ | /* Helpers for boolean registry operations */ | ||||||
| #define ReadRegistryKeyBool(root, key) (ReadRegistryKey32(root, key) != 0) | #define ReadRegistryKeyBool(root, key) (ReadRegistryKey32(root, key) != 0) | ||||||
|  |  | ||||||
							
								
								
									
										375
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										375
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -38,7 +38,7 @@ | ||||||
| #include <getopt.h> | #include <getopt.h> | ||||||
| #include <assert.h> | #include <assert.h> | ||||||
| #include <delayimp.h> | #include <delayimp.h> | ||||||
| 
 | #include"ui_data.h" | ||||||
| #include "rufus.h" | #include "rufus.h" | ||||||
| #include "format.h" | #include "format.h" | ||||||
| #include "missing.h" | #include "missing.h" | ||||||
|  | @ -57,7 +57,10 @@ | ||||||
| #include "cdio/logging.h" | #include "cdio/logging.h" | ||||||
| #include "../res/grub/grub_version.h" | #include "../res/grub/grub_version.h" | ||||||
| #include "../res/grub2/grub2_version.h" | #include "../res/grub2/grub2_version.h" | ||||||
| 
 | #include<dwmapi.h> | ||||||
|  | #include <Richedit.h> | ||||||
|  | #pragma comment(lib,"UxTheme.lib") | ||||||
|  | #pragma comment(lib,"DwmApi.lib") | ||||||
| enum bootcheck_return { | enum bootcheck_return { | ||||||
| 	BOOTCHECK_PROCEED = 0, | 	BOOTCHECK_PROCEED = 0, | ||||||
| 	BOOTCHECK_CANCEL = -1, | 	BOOTCHECK_CANCEL = -1, | ||||||
|  | @ -147,6 +150,28 @@ const int nb_steps[FS_MAX] = { 5, 5, 12, 1, 10, 1, 1, 1, 1 }; | ||||||
| const char* flash_type[BADLOCKS_PATTERN_TYPES] = { "SLC", "MLC", "TLC" }; | const char* flash_type[BADLOCKS_PATTERN_TYPES] = { "SLC", "MLC", "TLC" }; | ||||||
| RUFUS_DRIVE rufus_drive[MAX_DRIVES] = { 0 }; | RUFUS_DRIVE rufus_drive[MAX_DRIVES] = { 0 }; | ||||||
| 
 | 
 | ||||||
|  | // hdc is a memory DC with a 32bpp bitmap selected into it.
 | ||||||
|  | // This function sets the alpha channel to 255 without
 | ||||||
|  | // affecting any of the color channels.
 | ||||||
|  | 
 | ||||||
|  | void MakeBitmapOpaque( | ||||||
|  | 	HDC hdc, int x, int y, int cx, int cy) | ||||||
|  | { | ||||||
|  | 	BITMAPINFO bi = {0}; | ||||||
|  | 	bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | ||||||
|  | 	bi.bmiHeader.biWidth = 1; | ||||||
|  | 	bi.bmiHeader.biHeight = 1; | ||||||
|  | 	bi.bmiHeader.biPlanes = 1; | ||||||
|  | 	bi.bmiHeader.biBitCount = 32; | ||||||
|  | 	bi.bmiHeader.biCompression = BI_RGB; | ||||||
|  | 
 | ||||||
|  | 	RGBQUAD bitmapBits = { 0x00, 0x00, 0x00, 0xFF }; | ||||||
|  | 
 | ||||||
|  | 	StretchDIBits(hdc, x, y, cx, cy, | ||||||
|  | 		0, 0, 1, 1, &bitmapBits, &bi, | ||||||
|  | 		DIB_RGB_COLORS, SRCPAINT); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // TODO: Remember to update copyright year in stdlg's AboutCallback() WM_INITDIALOG,
 | // TODO: Remember to update copyright year in stdlg's AboutCallback() WM_INITDIALOG,
 | ||||||
| // localization_data.sh and the .rc when the year changes!
 | // localization_data.sh and the .rc when the year changes!
 | ||||||
| 
 | 
 | ||||||
|  | @ -934,10 +959,283 @@ out: | ||||||
| 	SetProposedLabel(device_index); | 	SetProposedLabel(device_index); | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
| } | } | ||||||
|  | /*
 | ||||||
|  |  * DarkMode CheckBox Subclass Proc | ||||||
|  |  */ | ||||||
| 
 | 
 | ||||||
|  | static LRESULT CALLBACK ButtonSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, | ||||||
|  | 	LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) | ||||||
|  | { | ||||||
|  | 	if (!IsAppsUseDarkMode) | ||||||
|  | 	{ | ||||||
|  | 		return DefSubclassProc(hWnd, uMsg, wParam, lParam); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	switch (uMsg) | ||||||
|  | 	{ | ||||||
|  | 
 | ||||||
|  | 	case WM_PAINT: | ||||||
|  | 	{ | ||||||
|  | 		DefSubclassProc(hWnd, uMsg, wParam, lParam); | ||||||
|  | 		if (!IsWindowEnabled(hWnd)) | ||||||
|  | 		{ | ||||||
|  | 
 | ||||||
|  | 			return true; | ||||||
|  | 		} | ||||||
|  | 		HDC hDc = GetDC(hWnd); | ||||||
|  | 		RECT rc1; | ||||||
|  | 		GetClientRect(hWnd, &rc1); | ||||||
|  | 		SetBkMode(hDc, TRANSPARENT); | ||||||
|  | 		SetTextColor(hDc, RGB(255, 255, 255)); | ||||||
|  | 		HTHEME btnTheme = OpenThemeData(hWnd, L"Button"); | ||||||
|  | 		SIZE siz; | ||||||
|  | 		GetThemePartSize(btnTheme, hDc, 3, 1, NULL, TS_DRAW, &siz); | ||||||
|  | 		rc1.left += siz.cx + 2; | ||||||
|  | 		FillRect(hDc, &rc1, CreateSolidBrush(ColorControlDark)); | ||||||
|  | 		rc1.top += GetSystemMetrics(SM_CXPADDEDBORDER); | ||||||
|  | 		LPCWSTR* staticText[99] = {0}; | ||||||
|  | 		GetWindowText(hWnd, staticText, ARRAYSIZE(staticText)); | ||||||
|  | 		DTTOPTS opts; | ||||||
|  | 		opts.dwSize = sizeof(DTTOPTS); | ||||||
|  | 		opts.dwFlags = DTT_TEXTCOLOR; | ||||||
|  | 		opts.crText = RGB(255, 255, 255); | ||||||
|  | 		HFONT font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0); | ||||||
|  | 		SelectObject(hDc, font); | ||||||
|  | 		DrawThemeTextEx(btnTheme, hDc, 3, 0, &staticText, -1, DT_SINGLELINE | DT_LEFT, &rc1, &opts); | ||||||
|  | 		ReleaseDC(hWnd, hDc); | ||||||
|  | 		return true; | ||||||
|  | 	} | ||||||
|  | 	} | ||||||
|  | 	return DefSubclassProc(hWnd, uMsg, wParam, lParam); | ||||||
|  | } | ||||||
|  | /*
 | ||||||
|  |  * Set DarkMode to all Child Windows | ||||||
|  |  */ | ||||||
|  | static BOOL CALLBACK ThemeCallback(HWND hWnd, LPARAM lParam) | ||||||
|  | { | ||||||
|  | 	const char* str[255] = {0}; | ||||||
|  | 	GetClassName(hWnd, &str, 255); | ||||||
|  | 	bool isDarkmode = IsAppsUseDarkMode(); | ||||||
|  | 	if (strcmp(str, L"Button") == 0) | ||||||
|  | 	{ | ||||||
|  | 		LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE); | ||||||
|  | 		if ((style & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX) | ||||||
|  | 		{ | ||||||
|  | 			if (!isDarkmode) | ||||||
|  | 			{ | ||||||
|  | 				RemoveWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass); | ||||||
|  | 				return true; | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 				SetWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass, 0); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		else | ||||||
|  | 			SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_Explorer" : L"Explorer", NULL); | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"ComboBox") == 0) | ||||||
|  | 	{ | ||||||
|  | 		SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_CFD" : L"Explorer", NULL); | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"ToolBar") == 0) | ||||||
|  | 	{ | ||||||
|  | 		wchar_t toolbarText[50]; | ||||||
|  | 		wchar_t multiToolbarText[50] ; | ||||||
|  | 		utf8_to_wchar_no_alloc(lmprintf(MSG_315), multiToolbarText, ARRAYSIZE(multiToolbarText)); | ||||||
|  | 		GetWindowText(hWnd, &toolbarText, 16); | ||||||
|  | 		if (strcmp(toolbarText, multiToolbarText) != 0) | ||||||
|  | 			SetWindowTheme(hWnd, isDarkmode ? L"DarkMode" : L"Explorer", NULL); | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"EDIT") == 0) | ||||||
|  | 	{ | ||||||
|  | 		LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE); | ||||||
|  | 		if (((style & WS_VSCROLL) == WS_VSCROLL) || ((style & WS_HSCROLL) == WS_HSCROLL)) | ||||||
|  | 			SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_Explorer" : L"Explorer", NULL); | ||||||
|  | 		else | ||||||
|  | 			SetWindowTheme(hWnd, isDarkmode ? L"DarkMode_CFD" : L"Explorer", NULL); | ||||||
|  | 		 | ||||||
|  | 			 | ||||||
|  | 
 | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * DarkMod Dialog Subclass Proc | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | static LRESULT CALLBACK DlgSubclassProc(HWND hDlg, UINT message, WPARAM wParam, | ||||||
|  | 	LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) | ||||||
|  | { | ||||||
|  | 	RECT rcDlg; | ||||||
|  | 	GetClientRect(hDlg, &rcDlg); | ||||||
|  | 	HDC dc; | ||||||
|  | 	switch (message) | ||||||
|  | 	{ | ||||||
|  | 	case WM_NCPAINT: | ||||||
|  | 	{ | ||||||
|  | 		LRESULT result = DefSubclassProc(hDlg, message, wParam, lParam); | ||||||
|  | 		HDC windowDC = GetWindowDC(hDlg); | ||||||
|  | 		RECT rcWin, rcClient; | ||||||
|  | 		GetWindowRect(hDlg, &rcWin); | ||||||
|  | 		GetClientRect(hDlg, &rcClient); | ||||||
|  | 		MapWindowPoints(hDlg, NULL, (LPPOINT)&rcWin, 2); | ||||||
|  | 		int rcWinWidth = rcWin.right - rcWin.left; | ||||||
|  | 		int rcWinHieght = rcWin.bottom - rcWin.top; | ||||||
|  | 		int rcrcClientWidth = rcClient.right - rcClient.left; | ||||||
|  | 		int rcrcClientHieght = rcClient.bottom - rcClient.top; | ||||||
|  | 		int borderWidth = (rcWinWidth - rcrcClientWidth) / 2; | ||||||
|  | 		int captionHight = rcWinHieght - rcrcClientHieght - borderWidth; | ||||||
|  | 		OffsetRect(&rcWin, -rcWin.left, -rcWin.top); | ||||||
|  | 		OffsetRect(&rcClient, borderWidth, captionHight); | ||||||
|  | 		HRGN updateRgn = wParam != 1 ?(HRGN)wParam : CreateRectRgnIndirect(&rcWin); | ||||||
|  | 		HRGN clipRgn = CreateRectRgn(0, 0, 0, 0); | ||||||
|  | 		HRGN ncRgn = CreateRectRgn(0, 0, 0, 0); | ||||||
|  | 
 | ||||||
|  | 		if (wParam == 1) | ||||||
|  | 			clipRgn = CreateRectRgnIndirect(&rcClient); | ||||||
|  | 		else | ||||||
|  | 			GetClipRgn(windowDC, clipRgn); | ||||||
|  | 		CombineRgn(ncRgn, updateRgn, clipRgn, RGN_DIFF); | ||||||
|  | 		SelectClipRgn(windowDC, ncRgn); | ||||||
|  | 		FillRect(windowDC, &rcWin, CreateSolidBrush(RGB(63, 63, 63))); | ||||||
|  | 		HRGN hRgn= CreateRectRgnIndirect(&rcWin); | ||||||
|  | 		SelectClipRgn(windowDC, hRgn); | ||||||
|  | 		MakeBitmapOpaque(windowDC, 0, 0, rcWinWidth, rcWinHieght); | ||||||
|  | 		safe_release_dc(hDlg, windowDC); | ||||||
|  | 		return result; | ||||||
|  | 	} | ||||||
|  | 	case WM_NCCALCSIZE: | ||||||
|  | 	{ | ||||||
|  | 		//TODO: get real caption Size
 | ||||||
|  | 
 | ||||||
|  | 		if (wParam) | ||||||
|  | 		{ | ||||||
|  | 			NCCALCSIZE_PARAMS* ncParma = (NCCALCSIZE_PARAMS*)(lParam); | ||||||
|  | 			ncParma->rgrc[0].left += 1;//pr++;
 | ||||||
|  | 			ncParma->rgrc[0].top += 31; | ||||||
|  | 			ncParma->rgrc[0].right -= 1; | ||||||
|  | 			ncParma->rgrc[0].bottom -= 1; | ||||||
|  | 			return 0; | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			RECT* rect = (RECT*)lParam; | ||||||
|  | 			rect->top += 31; | ||||||
|  | 			rect->left += 1; | ||||||
|  | 			rect->right -= 1; | ||||||
|  | 			rect->bottom -= 1; | ||||||
|  | 			return 0; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	case WM_SHOWWINDOW: | ||||||
|  | 	{ | ||||||
|  | 		if (wParam) | ||||||
|  | 		{ | ||||||
|  | 			EnumChildWindows(hDlg, ThemeCallback, lParam); | ||||||
|  | 			BOOL allowncpaint = TRUE; | ||||||
|  | 			COLORREF caption = RGB(0x0,0x0,0x0); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int)); | ||||||
|  | 			RECT rcDlg; | ||||||
|  | 			GetWindowRect(hDlg, &rcDlg); | ||||||
|  | 			SetWindowPos(hDlg, 0, 0, 0, rcDlg.right-rcDlg.left, rcDlg.bottom-rcDlg.top, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); | ||||||
|  | 			 | ||||||
|  | 			if (hLog) | ||||||
|  | 			{ | ||||||
|  | 				RECT rcLog; | ||||||
|  | 				GetWindowRect(hLog, &rcLog); | ||||||
|  | 				GetClientRect(hDlg, &rcDlg); | ||||||
|  | 				rcLog.left = rcDlg.left + 1; | ||||||
|  | 				rcLog.right = rcDlg.right - 1; | ||||||
|  | 				SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER); | ||||||
|  | 			} | ||||||
|  | 			RedrawWindow(hDlg, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		return DefSubclassProc(hDlg, message, wParam, lParam); | ||||||
|  | 	 | ||||||
|  | 	} | ||||||
|  | 		 | ||||||
|  | 	case WM_CTLCOLORLISTBOX: | ||||||
|  | 		SetBkColor((HDC)wParam, RGB(25, 25, 25)); | ||||||
|  | 		SetTextColor((HDC)wParam, RGB(255, 255, 255)); | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25)); | ||||||
|  | 	case WM_CTLCOLOREDIT: | ||||||
|  | 	{ | ||||||
|  | 		HDC hdc = (HDC)wParam; | ||||||
|  | 		SetBkColor((HDC)wParam, RGB(25, 25, 25)); | ||||||
|  | 		HBRUSH sysbrash = GetSysColorBrush(COLOR_WINDOWFRAME); | ||||||
|  | 		SetTextColor(hdc, RGB(255, 255, 255)); | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25)); | ||||||
|  | 	} | ||||||
|  | 	case WM_CTLCOLORBTN: | ||||||
|  | 	case WM_CTLCOLORDLG: | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(ColorControlDark); | ||||||
|  | 	case WM_CTLCOLORSTATIC: | ||||||
|  | 		 dc = GetDC((HWND)lParam); | ||||||
|  | 		RECT rcDlg; | ||||||
|  | 		GetClientRect((HWND)lParam, &rcDlg); | ||||||
|  | 		safe_release_dc((HWND)lParam, dc); | ||||||
|  | 		if ((HWND)lParam == GetDlgItem(hDlg, IDC_LABEL)) | ||||||
|  | 		{ | ||||||
|  | 			 | ||||||
|  | 			SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOWFRAME)); | ||||||
|  | 
 | ||||||
|  | 			 | ||||||
|  | 			return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25)); | ||||||
|  | 		} | ||||||
|  | 		if ((HWND)lParam != GetDlgItem(hDlg, IDS_CSM_HELP_TXT)) | ||||||
|  | 		{ | ||||||
|  | 			 | ||||||
|  | 			SetBkMode((HDC)wParam, TRANSPARENT); | ||||||
|  | 			SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR); | ||||||
|  | 			//MakeBitmapOpaque((HDC)wParam, 0, 0, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top);
 | ||||||
|  | 
 | ||||||
|  | 			return (INT_PTR)CreateSolidBrush(ColorControlDark); | ||||||
|  | 		} | ||||||
|  | 		SetBkMode((HDC)wParam, TRANSPARENT); | ||||||
|  | 		SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR); | ||||||
|  | 		 | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(ColorControlDark); | ||||||
|  | 	case WM_SETTINGCHANGE: | ||||||
|  | 	{ | ||||||
|  | 		if (IsAppsUseDarkMode()) | ||||||
|  | 		{ | ||||||
|  | 			BOOL allowncpaint = TRUE; | ||||||
|  | 			COLORREF caption = RGB(0x0,0x0,0x0); | ||||||
|  | 			DWM_WINDOW_CORNER_PREFERENCE f = DWMWCP_DONOTROUND; | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_WINDOW_CORNER_PREFERENCE, &f, sizeof(f)); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int)); | ||||||
|  | 			if (hLog) | ||||||
|  | 			{ | ||||||
|  | 				RECT rcLog, rcDlg; | ||||||
|  | 				GetWindowRect(hLog, &rcLog); | ||||||
|  | 				GetClientRect(hDlg, &rcDlg); | ||||||
|  | 				rcLog.left = rcDlg.left + 1; | ||||||
|  | 				rcLog.right = rcDlg.right - 1; | ||||||
|  | 				SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		return DefSubclassProc(hDlg, message, wParam, lParam); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	default: | ||||||
|  | 		return DefSubclassProc(hDlg, message, wParam, lParam); | ||||||
|  | 		break; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| // Callback for the log window
 | // Callback for the log window
 | ||||||
|  | 
 | ||||||
| BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| { | { | ||||||
|  | 	BOOL resized_already = FALSE; | ||||||
|  | 	REQRESIZE* rsz; | ||||||
| 	HDC hDC; | 	HDC hDC; | ||||||
| 	HFONT hf; | 	HFONT hf; | ||||||
| 	LONG lfHeight; | 	LONG lfHeight; | ||||||
|  | @ -948,10 +1246,14 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| 	switch (message) { | 	switch (message) { | ||||||
| 	case WM_INITDIALOG: | 	case WM_INITDIALOG: | ||||||
| 		apply_localization(IDD_LOG, hDlg); | 		apply_localization(IDD_LOG, hDlg); | ||||||
| 		hLog = GetDlgItem(hDlg, IDC_LOG_EDIT); |  | ||||||
| 		 | 		 | ||||||
|  | 		hLog = GetDlgItem(hDlg, IDC_LOG_EDIT); | ||||||
| 		// Increase the size of our log textbox to MAX_LOG_SIZE (unsigned word)
 | 		// Increase the size of our log textbox to MAX_LOG_SIZE (unsigned word)
 | ||||||
| 		PostMessage(hLog, EM_LIMITTEXT, MAX_LOG_SIZE , 0); | 		PostMessage(hLog, EM_LIMITTEXT, MAX_LOG_SIZE , 0); | ||||||
|  | 		if (IsAppsUseDarkMode()) | ||||||
|  | 		{ | ||||||
|  | 			SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
|  | 		} | ||||||
| 		// Set the font to Unicode so that we can display anything
 | 		// Set the font to Unicode so that we can display anything
 | ||||||
| 		hDC = GetDC(NULL); | 		hDC = GetDC(NULL); | ||||||
| 		lfHeight = -MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72); | 		lfHeight = -MulDiv(9, GetDeviceCaps(hDC, LOGPIXELSY), 72); | ||||||
|  | @ -973,6 +1275,7 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| 		style &= ~(ES_RIGHT); | 		style &= ~(ES_RIGHT); | ||||||
| 		SetWindowLongPtr(hLog, GWL_STYLE, style); | 		SetWindowLongPtr(hLog, GWL_STYLE, style); | ||||||
| 		break; | 		break; | ||||||
|  | 
 | ||||||
| 	case WM_COMMAND: | 	case WM_COMMAND: | ||||||
| 		switch (LOWORD(wParam)) { | 		switch (LOWORD(wParam)) { | ||||||
| 		case IDCANCEL: | 		case IDCANCEL: | ||||||
|  | @ -1018,7 +1321,34 @@ BOOL CALLBACK LogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| 		ResizeButtonHeight(hDlg, IDC_LOG_SAVE); | 		ResizeButtonHeight(hDlg, IDC_LOG_SAVE); | ||||||
| 		ResizeButtonHeight(hDlg, IDC_LOG_CLEAR); | 		ResizeButtonHeight(hDlg, IDC_LOG_CLEAR); | ||||||
| 		return TRUE; | 		return TRUE; | ||||||
|  | 	case WM_SETTINGCHANGE: | ||||||
|  | 		if (!IsAppsUseDarkMode()) | ||||||
|  | 		{ | ||||||
|  | 			BOOL allowncpaint = FALSE; | ||||||
|  | 			COLORREF caption = DWMWA_COLOR_DEFAULT; | ||||||
|  | 			DWM_WINDOW_CORNER_PREFERENCE f = DWMWCP_DONOTROUND; | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int)); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_WINDOW_CORNER_PREFERENCE, &f, sizeof(f)); | ||||||
|  | 			if (hLog) | ||||||
|  | 			{ | ||||||
|  | 				RECT rcLog, rcDlg; | ||||||
|  | 				GetWindowRect(hLog, &rcLog); | ||||||
|  | 				GetClientRect(hDlg, &rcDlg); | ||||||
|  | 				rcLog.left = rcDlg.left + 1; | ||||||
|  | 				rcLog.right = rcDlg.right - 1; | ||||||
|  | 				SetWindowPos(hLog, NULL, 0, 0, rcLog.right - rcLog.left, rcLog.bottom - rcLog.top, SWP_NOMOVE | SWP_NOZORDER); | ||||||
|  | 			} | ||||||
|  | 			RemoveWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass); | ||||||
|  | 		} | ||||||
|  | 			 | ||||||
|  | 		else | ||||||
|  | 	    SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
|  | 		EnumChildWindows(hDlg, ThemeCallback, lParam); | ||||||
|  | 		return TRUE; | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1232,6 +1562,7 @@ out: | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| // The scanning process can be blocking for message processing => use a thread
 | // The scanning process can be blocking for message processing => use a thread
 | ||||||
| DWORD WINAPI ImageScanThread(LPVOID param) | DWORD WINAPI ImageScanThread(LPVOID param) | ||||||
| { | { | ||||||
|  | @ -2149,6 +2480,8 @@ static void PrintStatusTimeout(const char* str, BOOL val) | ||||||
| /*
 | /*
 | ||||||
|  * Main dialog callback |  * Main dialog callback | ||||||
|  */ |  */ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | ||||||
| { | { | ||||||
| 	static DWORD DeviceNum = 0; | 	static DWORD DeviceNum = 0; | ||||||
|  | @ -2704,6 +3037,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | 		fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; | ||||||
| 		safe_release_dc(hDlg, hDC); | 		safe_release_dc(hDlg, hDC); | ||||||
| 		apply_localization(IDD_DIALOG, hDlg); | 		apply_localization(IDD_DIALOG, hDlg); | ||||||
|  | 		if (IsAppsUseDarkMode()) | ||||||
|  | 			SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
| 		// The AppStore version always enables Fido
 | 		// The AppStore version always enables Fido
 | ||||||
| 		if (appstore_version) | 		if (appstore_version) | ||||||
| 			SetFidoCheck(); | 			SetFidoCheck(); | ||||||
|  | @ -2713,6 +3048,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		log_displayed = FALSE; | 		log_displayed = FALSE; | ||||||
| 		hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback); | 		hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback); | ||||||
| 		InitDialog(hDlg); | 		InitDialog(hDlg); | ||||||
|  | 		 | ||||||
| 		GetDevices(0); | 		GetDevices(0); | ||||||
| 		EnableControls(TRUE, FALSE); | 		EnableControls(TRUE, FALSE); | ||||||
| 		UpdateImage(FALSE); | 		UpdateImage(FALSE); | ||||||
|  | @ -2736,6 +3072,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		// Set 'START' as the selected button if it's enabled, otherwise use 'SELECT', instead
 | 		// Set 'START' as the selected button if it's enabled, otherwise use 'SELECT', instead
 | ||||||
| 		SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)(IsWindowEnabled(hStart) ? hStart : hSelectImage), TRUE); | 		SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)(IsWindowEnabled(hStart) ? hStart : hSelectImage), TRUE); | ||||||
| 		 | 		 | ||||||
|  | 		 | ||||||
| #if defined(ALPHA) | #if defined(ALPHA) | ||||||
| 		// Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them
 | 		// Add a VERY ANNOYING popup for Alpha releases, so that people don't start redistributing them
 | ||||||
| 		MessageBoxA(NULL, "This is an Alpha version of " APPLICATION_NAME " - It is meant to be used for " | 		MessageBoxA(NULL, "This is an Alpha version of " APPLICATION_NAME " - It is meant to be used for " | ||||||
|  | @ -2746,9 +3083,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			"testing ONLY and should NOT be distributed as a release.", "TEST VERSION", MSG_INFO); | 			"testing ONLY and should NOT be distributed as a release.", "TEST VERSION", MSG_INFO); | ||||||
| #endif | #endif | ||||||
| 		// Let's not take any risk: Ask Windows to redraw the whole dialog before we exit init
 | 		// Let's not take any risk: Ask Windows to redraw the whole dialog before we exit init
 | ||||||
|  | 		 | ||||||
| 		RedrawWindow(hMainDialog, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW); | 		RedrawWindow(hMainDialog, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW); | ||||||
| 		InvalidateRect(hMainDialog, NULL, TRUE); | 		InvalidateRect(hMainDialog, NULL, TRUE); | ||||||
| 		 | 		 | ||||||
|  | 	 | ||||||
| 		return (INT_PTR)FALSE; | 		return (INT_PTR)FALSE; | ||||||
| 	 | 	 | ||||||
| 	case WM_DRAWITEM: | 	case WM_DRAWITEM: | ||||||
|  | @ -2773,22 +3112,34 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				return (INT_PTR)TRUE; | 				return (INT_PTR)TRUE; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		break; |  | ||||||
| 		 | 		 | ||||||
|  | 		break; | ||||||
|  | 	case WM_SETTINGCHANGE: | ||||||
|  | 		if (!IsAppsUseDarkMode()) | ||||||
|  | 		{ | ||||||
|  | 			BOOL allowncpaint = FALSE; | ||||||
|  | 			COLORREF caption = DWMWA_COLOR_DEFAULT; | ||||||
|  | 			DWM_WINDOW_CORNER_PREFERENCE f = DWMWCP_ROUND; | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_CAPTION_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_BORDER_COLOR, &caption, sizeof caption); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_WINDOW_CORNER_PREFERENCE, &f, sizeof(f)); | ||||||
|  | 			DwmSetWindowAttribute(hDlg, DWMWA_ALLOW_NCPAINT, &allowncpaint, sizeof(int)); | ||||||
|  | 			RemoveWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass); | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 		{ | ||||||
|  | 			SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
|  | 		} | ||||||
|  | 			 | ||||||
|  | 		EnumChildWindows(hDlg, ThemeCallback, lParam); | ||||||
|  | 		RedrawWindow(hMainDialog, NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW | RDW_ERASENOW); | ||||||
|  | 		return DefWindowProc(hDlg, message, wParam, lParam); | ||||||
| 	case WM_PAINT: | 	case WM_PAINT: | ||||||
| 		hDC = BeginPaint(hDlg, &ps); | 		hDC = BeginPaint(hDlg, &ps); | ||||||
| 		OnPaint(hDC); | 		OnPaint(hDC); | ||||||
| 		EndPaint(hDlg, &ps); | 		EndPaint(hDlg, &ps); | ||||||
| 		break; | 		break; | ||||||
| 
 | 
 | ||||||
| 	case WM_CTLCOLORSTATIC: |  | ||||||
| 		if ((HWND)lParam != GetDlgItem(hDlg, IDS_CSM_HELP_TXT)) |  | ||||||
| 			return FALSE; |  | ||||||
| 		SetBkMode((HDC)wParam, TRANSPARENT); |  | ||||||
| 		CreateStaticFont((HDC)wParam, &hyperlink_font, FALSE); |  | ||||||
| 		SelectObject((HDC)wParam, hyperlink_font); |  | ||||||
| 		SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR); |  | ||||||
| 		return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); |  | ||||||
| 
 | 
 | ||||||
| 	case WM_NOTIFY: | 	case WM_NOTIFY: | ||||||
| 		switch (((LPNMHDR)lParam)->code) { | 		switch (((LPNMHDR)lParam)->code) { | ||||||
|  |  | ||||||
							
								
								
									
										174
									
								
								src/stdlg.c
									
										
									
									
									
								
							
							
						
						
									
										174
									
								
								src/stdlg.c
									
										
									
									
									
								
							|  | @ -43,6 +43,7 @@ | ||||||
| #include "registry.h" | #include "registry.h" | ||||||
| #include "settings.h" | #include "settings.h" | ||||||
| #include "license.h" | #include "license.h" | ||||||
|  | #include <Uxtheme.h> | ||||||
| 
 | 
 | ||||||
| /* Globals */ | /* Globals */ | ||||||
| extern BOOL is_x86_64, appstore_version; | extern BOOL is_x86_64, appstore_version; | ||||||
|  | @ -83,6 +84,162 @@ void SetDialogFocus(HWND hDlg, HWND hCtrl) | ||||||
| 	SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hCtrl, TRUE); | 	SendMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)hCtrl, TRUE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * DarkMode CheckBox Subclass Proc | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | static LRESULT CALLBACK ButtonSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, | ||||||
|  | 	LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) | ||||||
|  | { | ||||||
|  | 	if (!IsAppsUseDarkMode) | ||||||
|  | 	{ | ||||||
|  | 		return DefSubclassProc(hWnd, uMsg, wParam, lParam); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	switch (uMsg) | ||||||
|  | 	{ | ||||||
|  | 	 | ||||||
|  | 	case WM_PAINT: | ||||||
|  | 	{ | ||||||
|  | 	DefSubclassProc(hWnd, uMsg, wParam, lParam); | ||||||
|  | 		if (!IsWindowEnabled(hWnd)) | ||||||
|  | 		{ | ||||||
|  | 
 | ||||||
|  | 			return TRUE; | ||||||
|  | 		} | ||||||
|  | 		HDC hDc = GetDC(hWnd); | ||||||
|  | 		RECT rc1; | ||||||
|  | 		GetClientRect(hWnd, &rc1); | ||||||
|  | 		SetBkMode(hDc, TRANSPARENT); | ||||||
|  | 		SetTextColor(hDc, RGB(255, 255, 255)); | ||||||
|  | 		HTHEME btnTheme = OpenThemeData(hWnd, L"Button"); | ||||||
|  | 		SIZE siz; | ||||||
|  | 		GetThemePartSize(btnTheme, hDc, 3, 1, NULL, TS_DRAW, &siz); | ||||||
|  | 		rc1.left += siz.cx + 2; | ||||||
|  | 		FillRect(hDc, &rc1, CreateSolidBrush(ColorControlDark)); | ||||||
|  | 		rc1.top += GetSystemMetrics(SM_CXPADDEDBORDER); | ||||||
|  | 		LPCWSTR* staticText[99] = {0}; | ||||||
|  | 		GetWindowText(hWnd, staticText, ARRAYSIZE(staticText)); | ||||||
|  | 		DTTOPTS opts; | ||||||
|  | 		opts.dwSize = sizeof(DTTOPTS); | ||||||
|  | 		opts.dwFlags = DTT_TEXTCOLOR; | ||||||
|  | 		opts.crText = RGB(255, 255, 255); | ||||||
|  | 		HFONT font = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0); | ||||||
|  | 		SelectObject(hDc, font); | ||||||
|  | 		DrawThemeTextEx(btnTheme, hDc, 3, 0, &staticText, -1, DT_SINGLELINE | DT_LEFT, &rc1, &opts); | ||||||
|  | 		ReleaseDC(hWnd, hDc); | ||||||
|  | 		return TRUE; | ||||||
|  | 	} | ||||||
|  | 	} | ||||||
|  | 	return DefSubclassProc(hWnd, uMsg, wParam, lParam); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * Set DarkMode to all Child Windows | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | static BOOL CALLBACK ThemeCallback(HWND hWnd, LPARAM lParam) | ||||||
|  | { | ||||||
|  | 	char* str[255]; | ||||||
|  | 	GetClassName(hWnd, &str, 255); | ||||||
|  | 	BOOL isDarkMode = IsAppsUseDarkMode(); | ||||||
|  | 
 | ||||||
|  | 	if (strcmp(str, L"Button") == 0) | ||||||
|  | 	{ | ||||||
|  | 		LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE); | ||||||
|  | 		if ((style & BS_AUTOCHECKBOX) == BS_AUTOCHECKBOX) | ||||||
|  | 		{ | ||||||
|  | 			if (!isDarkMode) | ||||||
|  | 			{ | ||||||
|  | 				RemoveWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass); | ||||||
|  | 				return TRUE; | ||||||
|  | 			} | ||||||
|  | 			else | ||||||
|  | 				SetWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass, 0); | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		else | ||||||
|  | 			SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_Explorer" : L"Explorer", NULL); | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"ComboBox") == 0) | ||||||
|  | 	{ | ||||||
|  | 		SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_CFD" : L"Explorer", NULL); | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"ToolBar") == 0) | ||||||
|  | 	{ | ||||||
|  | 		char* title[16]; | ||||||
|  | 		GetWindowText(hWnd, &title, 16); | ||||||
|  | 		if (strcmp(title, L"Multiple buttons") != 0) | ||||||
|  | 			SetWindowTheme(hWnd, isDarkMode ? L"DarkMode" : L"Explorer", NULL); | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"EDIT") == 0) | ||||||
|  | 	{ | ||||||
|  | 		LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE); | ||||||
|  | 		if(((style & WS_VSCROLL) == WS_VSCROLL) || ((style & WS_HSCROLL) == WS_HSCROLL)) | ||||||
|  | 		SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_Explorer" : L"Explorer", NULL); | ||||||
|  | 		else | ||||||
|  | 		SetWindowTheme(hWnd, isDarkMode ? L"DarkMode_CFD" : L"Explorer", NULL); | ||||||
|  | 
 | ||||||
|  | 		 | ||||||
|  | 	} | ||||||
|  | 	else if (strcmp(str, L"RichEdit20W") == 0) | ||||||
|  | 	{ | ||||||
|  | 		SendMessage(hWnd, EM_SETBKGNDCOLOR, 0, isDarkMode ? (LPARAM)ColorControlDark : (LPARAM)GetSysColor(COLOR_BTNFACE)); | ||||||
|  | 		CHARFORMAT cf; | ||||||
|  | 		cf.cbSize = sizeof(cf); | ||||||
|  | 		cf.dwMask = CFM_COLOR; | ||||||
|  | 		cf.crTextColor = isDarkMode ?  RGB(255, 255, 255): RGB(0, 0, 0); | ||||||
|  | 		cf.dwEffects = 0; | ||||||
|  | 		SendMessage(hWnd, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf); | ||||||
|  | 		//SetWindowTheme(hEdit[i], L"DarkMode_Explorer", NULL);
 | ||||||
|  | 		SetWindowTheme(hWnd, NULL, isDarkMode ? L"DarkMode_Explorer::ScrollBar" : L"Explorer::ScrollBar"); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * DarkMod Dialog Subclass Proc | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | static LRESULT CALLBACK DlgSubclassProc(HWND hDlg, UINT message, WPARAM wParam, | ||||||
|  | 	LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) | ||||||
|  | { | ||||||
|  | 	if (!IsAppsUseDarkMode()) | ||||||
|  | 	{ | ||||||
|  | 		return DefSubclassProc(hDlg, message, wParam, lParam); | ||||||
|  | 	} | ||||||
|  | 	switch (message) | ||||||
|  | 	{ | ||||||
|  | 	case WM_SHOWWINDOW: | ||||||
|  | 		EnumChildWindows(hDlg, ThemeCallback, lParam); | ||||||
|  | 		return DefWindowProc(hDlg, message, wParam, lParam); | ||||||
|  | 	case WM_CTLCOLORLISTBOX: | ||||||
|  | 		SetBkColor((HDC)wParam, RGB(25, 25, 25)); | ||||||
|  | 		SetTextColor((HDC)wParam, RGB(255, 255, 255)); | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25)); | ||||||
|  | 	case WM_CTLCOLOREDIT: | ||||||
|  | 	{ | ||||||
|  | 		HDC hdc = (HDC)wParam; | ||||||
|  | 		SetBkColor((HDC)wParam, RGB(25, 25, 25)); | ||||||
|  | 		SetTextColor(hdc, RGB(255, 255, 255)); | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(RGB(25, 25, 25)); | ||||||
|  | 
 | ||||||
|  | 	} | ||||||
|  | 	case WM_CTLCOLORBTN: | ||||||
|  | 	case WM_CTLCOLORDLG: | ||||||
|  | 		return (INT_PTR)CreateSolidBrush(ColorControlDark); | ||||||
|  | 	case WM_CTLCOLORSTATIC: | ||||||
|  | 			SetBkMode((HDC)wParam, TRANSPARENT); | ||||||
|  | 			SetTextColor((HDC)wParam, TOOLBAR_ICON_COLOR); | ||||||
|  | 			return (INT_PTR)CreateSolidBrush(ColorControlDark); | ||||||
|  | 	default: | ||||||
|  | 		return DefSubclassProc(hDlg, message, wParam, lParam); | ||||||
|  | 		break; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| /*
 | /*
 | ||||||
|  * Return the UTF8 path of a file selected through a load or save dialog |  * Return the UTF8 path of a file selected through a load or save dialog | ||||||
|  * All string parameters are UTF-8 |  * All string parameters are UTF-8 | ||||||
|  | @ -216,7 +373,6 @@ out: | ||||||
| void CreateStatusBar(void) | void CreateStatusBar(void) | ||||||
| { | { | ||||||
| 	RECT rect; | 	RECT rect; | ||||||
| 	int edge[2]; |  | ||||||
| 	HFONT hFont; | 	HFONT hFont; | ||||||
| 
 | 
 | ||||||
| 	// Create the status bar
 | 	// Create the status bar
 | ||||||
|  | @ -226,10 +382,10 @@ void CreateStatusBar(void) | ||||||
| 
 | 
 | ||||||
| 	// Create 2 status areas
 | 	// Create 2 status areas
 | ||||||
| 	GetClientRect(hMainDialog, &rect); | 	GetClientRect(hMainDialog, &rect); | ||||||
| 	edge[0] = rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale); | 	int edge[] = { rect.right - (int)(SB_TIMER_SECTION_SIZE * fScale) , rect.right,-1}; | ||||||
| 	edge[1] = rect.right; |  | ||||||
| 	SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge); |  | ||||||
| 
 | 
 | ||||||
|  | 	SendMessage(hStatus, SB_SETPARTS, (WPARAM)ARRAYSIZE(edge), (LPARAM)&edge); | ||||||
|  | 	//SendMessage(hStatus, WM_SIZE, 0, 0);
 | ||||||
| 	// Set the font
 | 	// Set the font
 | ||||||
| 	hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), | 	hFont = CreateFontA(-MulDiv(9, GetDeviceCaps(GetDC(hMainDialog), LOGPIXELSY), 72), | ||||||
| 		0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | 		0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | ||||||
|  | @ -337,6 +493,7 @@ INT_PTR CALLBACK LicenseCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM | ||||||
| 		style &= ~(ES_RIGHT); | 		style &= ~(ES_RIGHT); | ||||||
| 		SetWindowLongPtr(hLicense, GWL_STYLE, style); | 		SetWindowLongPtr(hLicense, GWL_STYLE, style); | ||||||
| 		SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3); | 		SetDlgItemTextA(hDlg, IDC_LICENSE_TEXT, gplv3); | ||||||
|  | 		SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
| 		break; | 		break; | ||||||
| 	case WM_COMMAND: | 	case WM_COMMAND: | ||||||
| 		switch (LOWORD(wParam)) { | 		switch (LOWORD(wParam)) { | ||||||
|  | @ -403,6 +560,7 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP | ||||||
| 		// Need to send an explicit SetSel to avoid being positioned at the end of richedit control when tabstop is used
 | 		// Need to send an explicit SetSel to avoid being positioned at the end of richedit control when tabstop is used
 | ||||||
| 		SendMessage(hEdit[1], EM_SETSEL, 0, 0); | 		SendMessage(hEdit[1], EM_SETSEL, 0, 0); | ||||||
| 		SendMessage(hEdit[0], EM_REQUESTRESIZE, 0, 0); | 		SendMessage(hEdit[0], EM_REQUESTRESIZE, 0, 0); | ||||||
|  | 		SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
| 		break; | 		break; | ||||||
| 	case WM_NOTIFY: | 	case WM_NOTIFY: | ||||||
| 		switch (((LPNMHDR)lParam)->code) { | 		switch (((LPNMHDR)lParam)->code) { | ||||||
|  | @ -555,6 +713,7 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP | ||||||
| 			ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDYES), 0, dh -cbh, 0, 0, 1.0f); | 			ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDYES), 0, dh -cbh, 0, 0, 1.0f); | ||||||
| 			ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDNO), 0, dh -cbh, 0, 0, 1.0f); | 			ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDNO), 0, dh -cbh, 0, 0, 1.0f); | ||||||
| 		} | 		} | ||||||
|  | 		SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
| 		return (INT_PTR)TRUE; | 		return (INT_PTR)TRUE; | ||||||
| 	case WM_CTLCOLORSTATIC: | 	case WM_CTLCOLORSTATIC: | ||||||
| 		// Change the background colour for static text and icon
 | 		// Change the background colour for static text and icon
 | ||||||
|  | @ -988,6 +1147,9 @@ INT_PTR CALLBACK TooltipCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM | ||||||
| 		return (INT_PTR)FALSE; | 		return (INT_PTR)FALSE; | ||||||
| 
 | 
 | ||||||
| 	switch (message) { | 	switch (message) { | ||||||
|  | 	case WM_NCPAINT: | ||||||
|  | 		SendMessageW(ttlist[i].hTip, TTM_SETWINDOWTHEME, 0, IsAppsUseDarkMode() ? ((LPARAM)&L"DarkMode_Explorer") : ((LPARAM)&L"Explorer")); | ||||||
|  | 		return CallWindowProc(ttlist[i].original_proc, hDlg, message, wParam, lParam); | ||||||
| 	case WM_NOTIFY: | 	case WM_NOTIFY: | ||||||
| 		switch (((LPNMHDR)lParam)->code) { | 		switch (((LPNMHDR)lParam)->code) { | ||||||
| 		case TTN_GETDISPINFOW: | 		case TTN_GETDISPINFOW: | ||||||
|  | @ -1318,6 +1480,7 @@ INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM l | ||||||
| 		SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK|ENM_REQUESTRESIZE); | 		SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK|ENM_REQUESTRESIZE); | ||||||
| 		SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE)); | 		SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE)); | ||||||
| 		SendMessage(hPolicy, EM_REQUESTRESIZE, 0, 0); | 		SendMessage(hPolicy, EM_REQUESTRESIZE, 0, 0); | ||||||
|  | 		SetWindowSubclass(hDlg, DlgSubclassProc, uIdSubclass, 0); | ||||||
| 		break; | 		break; | ||||||
| 	case WM_NOTIFY: | 	case WM_NOTIFY: | ||||||
| 		if ((((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) && (!resized_already)) { | 		if ((((LPNMHDR)lParam)->code == EN_REQUESTRESIZE) && (!resized_already)) { | ||||||
|  | @ -1568,6 +1731,9 @@ INT_PTR CALLBACK NewVersionCallback(HWND hDlg, UINT message, WPARAM wParam, LPAR | ||||||
| 	case WM_CTLCOLORSTATIC: | 	case WM_CTLCOLORSTATIC: | ||||||
| 		if ((HWND)lParam != GetDlgItem(hDlg, IDC_WEBSITE)) | 		if ((HWND)lParam != GetDlgItem(hDlg, IDC_WEBSITE)) | ||||||
| 			return FALSE; | 			return FALSE; | ||||||
|  | 		HDC hdcCtrl = GET_WM_CTLCOLOR_HDC(wParam, lParam, message); | ||||||
|  | 		HWND hWndCtrl = GET_WM_CTLCOLOR_HWND(wParam, lParam, message); | ||||||
|  | 		WORD cc = GET_WM_CTLCOLOR_TYPE(wParam, lParam, message); | ||||||
| 		// Change the font for the hyperlink
 | 		// Change the font for the hyperlink
 | ||||||
| 		SetBkMode((HDC)wParam, TRANSPARENT); | 		SetBkMode((HDC)wParam, TRANSPARENT); | ||||||
| 		CreateStaticFont((HDC)wParam, &hyperlink_font, TRUE); | 		CreateStaticFont((HDC)wParam, &hyperlink_font, TRUE); | ||||||
|  |  | ||||||
							
								
								
									
										55
									
								
								src/ui.c
									
										
									
									
									
								
							
							
						
						
									
										55
									
								
								src/ui.c
									
										
									
									
									
								
							|  | @ -38,10 +38,10 @@ | ||||||
| #include "resource.h" | #include "resource.h" | ||||||
| #include "msapi_utf8.h" | #include "msapi_utf8.h" | ||||||
| #include "localization.h" | #include "localization.h" | ||||||
| 
 | #include "WinUser.h" | ||||||
| #include "ui.h" | #include "ui.h" | ||||||
| #include "ui_data.h" | #include "ui_data.h" | ||||||
| 
 | #include "registry.h" | ||||||
| UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU; | UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU; | ||||||
| HIMAGELIST hUpImageList, hDownImageList; | HIMAGELIST hUpImageList, hDownImageList; | ||||||
| extern BOOL use_vds, appstore_version; | extern BOOL use_vds, appstore_version; | ||||||
|  | @ -350,6 +350,13 @@ void PositionMainControls(HWND hDlg) | ||||||
| 	GetWindowRect(hCtrl, &rc); | 	GetWindowRect(hCtrl, &rc); | ||||||
| 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | ||||||
| 	advanced_device_section_height = rc.top; | 	advanced_device_section_height = rc.top; | ||||||
|  | 	LONG_PTR style = GetWindowLongPtrW(hCtrl, GWL_STYLE); | ||||||
|  | 	/*if ((style & SS_OWNERDRAW) != SS_OWNERDRAW)
 | ||||||
|  | 	{ | ||||||
|  | 		style |= SS_OWNERDRAW; | ||||||
|  | 		style |= ~BS_AUTOCHECKBOX; | ||||||
|  | 		SetWindowLongPtrW(hCtrl, GWL_STYLE, style); | ||||||
|  | 	}*/ | ||||||
| 	hCtrl = GetDlgItem(hDlg, IDC_UEFI_MEDIA_VALIDATION); | 	hCtrl = GetDlgItem(hDlg, IDC_UEFI_MEDIA_VALIDATION); | ||||||
| 	GetWindowRect(hCtrl, &rc); | 	GetWindowRect(hCtrl, &rc); | ||||||
| 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | 	MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); | ||||||
|  | @ -893,14 +900,20 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | ||||||
| 	wchar_t winfo[128]; | 	wchar_t winfo[128]; | ||||||
| 	static BOOL marquee_mode = FALSE; | 	static BOOL marquee_mode = FALSE; | ||||||
| 	static uint32_t pos = 0, min = 0, max = 0xFFFF; | 	static uint32_t pos = 0, min = 0, max = 0xFFFF; | ||||||
| 	static COLORREF color = PROGRESS_BAR_NORMAL_COLOR; | 	BOOL isDark = IsAppsUseDarkMode(); | ||||||
|  | 	COLORREF normalColor = isDark ? PROGRESS_BAR_DARK_NORMAL_COLOR : PROGRESS_BAR_NORMAL_COLOR; | ||||||
|  | 	COLORREF backgroundColor = isDark ? PROGRESS_BAR_DARK_BACKGROUND_COLOR : PROGRESS_BAR_BACKGROUND_COLOR; | ||||||
|  | 	COLORREF normalTextColor = isDark ? PROGRESS_BAR_DARK_NORMAL_TEXT_COLOR : PROGRESS_BAR_NORMAL_TEXT_COLOR; | ||||||
|  | 	COLORREF invertedlTextColor = isDark ? PROGRESS_BAR_DARK_INVERTED_TEXT_COLOR : PROGRESS_BAR_INVERTED_TEXT_COLOR; | ||||||
|  | 	COLORREF boxColor = isDark ? PROGRESS_BAR_DARK_BOX_COLOR : PROGRESS_BAR_BOX_COLOR; | ||||||
|  | 	COLORREF color = normalColor; | ||||||
| 
 | 
 | ||||||
| 	switch (message) { | 	switch (message) { | ||||||
| 
 | 
 | ||||||
| 	case PBM_SETSTATE: | 	case PBM_SETSTATE: | ||||||
| 		switch (wParam) { | 		switch (wParam) { | ||||||
| 		case PBST_NORMAL: | 		case PBST_NORMAL: | ||||||
| 			color = PROGRESS_BAR_NORMAL_COLOR; | 			color = normalColor; | ||||||
| 			break; | 			break; | ||||||
| 		case PBST_PAUSED: | 		case PBST_PAUSED: | ||||||
| 			color = PROGRESS_BAR_PAUSED_COLOR; | 			color = PROGRESS_BAR_PAUSED_COLOR; | ||||||
|  | @ -930,7 +943,7 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | ||||||
| 		if ((wParam == TRUE) && (!marquee_mode)) { | 		if ((wParam == TRUE) && (!marquee_mode)) { | ||||||
| 			marquee_mode = TRUE; | 			marquee_mode = TRUE; | ||||||
| 			pos = min; | 			pos = min; | ||||||
| 			color = PROGRESS_BAR_NORMAL_COLOR; | 			color = normalColor; | ||||||
| 			SetTimer(hCtrl, TID_MARQUEE_TIMER, MARQUEE_TIMER_REFRESH, NULL); | 			SetTimer(hCtrl, TID_MARQUEE_TIMER, MARQUEE_TIMER_REFRESH, NULL); | ||||||
| 			InvalidateRect(hProgress, NULL, TRUE); | 			InvalidateRect(hProgress, NULL, TRUE); | ||||||
| 		} else if ((wParam == FALSE) && (marquee_mode)) { | 		} else if ((wParam == FALSE) && (marquee_mode)) { | ||||||
|  | @ -971,7 +984,7 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | ||||||
| 			// Optional first segment
 | 			// Optional first segment
 | ||||||
| 			if (pos + ((max - min) / 5) > max) { | 			if (pos + ((max - min) / 5) > max) { | ||||||
| 				rc.right = MulDiv(pos + ((max - min) / 5) - max, rc.right, max - min); | 				rc.right = MulDiv(pos + ((max - min) / 5) - max, rc.right, max - min); | ||||||
| 				SetTextColor(hDC, PROGRESS_BAR_INVERTED_TEXT_COLOR); | 				SetTextColor(hDC, invertedlTextColor); | ||||||
| 				SetBkColor(hDC, color); | 				SetBkColor(hDC, color); | ||||||
| 				ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | 				ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | ||||||
| 					ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | 					ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | ||||||
|  | @ -981,8 +994,8 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | ||||||
| 			// Optional second segment
 | 			// Optional second segment
 | ||||||
| 			if (pos > min) { | 			if (pos > min) { | ||||||
| 				rc.right = MulDiv(pos - min, rc.right, max - min); | 				rc.right = MulDiv(pos - min, rc.right, max - min); | ||||||
| 				SetTextColor(hDC, PROGRESS_BAR_NORMAL_TEXT_COLOR); | 				SetTextColor(hDC, normalTextColor); | ||||||
| 				SetBkColor(hDC, PROGRESS_BAR_BACKGROUND_COLOR); | 				SetBkColor(hDC, backgroundColor); | ||||||
| 				ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | 				ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | ||||||
| 					ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | 					ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | ||||||
| 				rc.left = rc.right; | 				rc.left = rc.right; | ||||||
|  | @ -990,14 +1003,14 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | ||||||
| 			} | 			} | ||||||
| 			// Second to last segment
 | 			// Second to last segment
 | ||||||
| 			rc.right = MulDiv(pos - min + ((max - min) / 5), rc.right, max - min); | 			rc.right = MulDiv(pos - min + ((max - min) / 5), rc.right, max - min); | ||||||
| 			SetTextColor(hDC, PROGRESS_BAR_INVERTED_TEXT_COLOR); | 			SetTextColor(hDC, invertedlTextColor); | ||||||
| 			SetBkColor(hDC, color); | 			SetBkColor(hDC, color); | ||||||
| 			ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | 			ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | ||||||
| 				ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | 				ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | ||||||
| 		} else { | 		} else { | ||||||
| 			// First segment
 | 			// First segment
 | ||||||
| 			rc.right = (pos > min) ? MulDiv(pos - min, rc.right, max - min) : rc.left; | 			rc.right = (pos > min) ? MulDiv(pos - min, rc.right, max - min) : rc.left; | ||||||
| 			SetTextColor(hDC, PROGRESS_BAR_INVERTED_TEXT_COLOR); | 			SetTextColor(hDC, invertedlTextColor); | ||||||
| 			SetBkColor(hDC, color); | 			SetBkColor(hDC, color); | ||||||
| 			ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | 			ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | ||||||
| 				ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | 				ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | ||||||
|  | @ -1005,12 +1018,12 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam | ||||||
| 		// Last segment
 | 		// Last segment
 | ||||||
| 		rc.left = rc.right; | 		rc.left = rc.right; | ||||||
| 		rc.right = full_right; | 		rc.right = full_right; | ||||||
| 		SetTextColor(hDC, PROGRESS_BAR_NORMAL_TEXT_COLOR); | 		SetTextColor(hDC, normalTextColor); | ||||||
| 		SetBkColor(hDC, PROGRESS_BAR_BACKGROUND_COLOR); | 		SetBkColor(hDC, backgroundColor); | ||||||
| 		ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | 		ExtTextOut(hDC, (full_right - size.cx) / 2, (rc.bottom - size.cy) / 2, | ||||||
| 			ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | 			ETO_CLIPPED | ETO_OPAQUE | ETO_NUMERICSLOCAL, &rc, winfo, (int)wcslen(winfo), NULL); | ||||||
| 		// Bounding rectangle
 | 		// Bounding rectangle
 | ||||||
| 		SetDCPenColor(hDC, PROGRESS_BAR_BOX_COLOR); | 		SetDCPenColor(hDC, boxColor); | ||||||
| 		Rectangle(hDC, rc2.left, rc2.top, rc2.right, rc2.bottom); | 		Rectangle(hDC, rc2.left, rc2.top, rc2.right, rc2.bottom); | ||||||
| 		EndPaint(hCtrl, &ps); | 		EndPaint(hCtrl, &ps); | ||||||
| 		return (INT_PTR)TRUE; | 		return (INT_PTR)TRUE; | ||||||
|  | @ -1060,8 +1073,16 @@ void CreateAdditionalControls(HWND hDlg) | ||||||
| 		hIconDown = (HICON)LoadImage(hDll, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | 		hIconDown = (HICON)LoadImage(hDll, MAKEINTRESOURCE(16750), IMAGE_ICON, s16, s16, LR_DEFAULTCOLOR | LR_SHARED); | ||||||
| 	hUpImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0); | 	hUpImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0); | ||||||
| 	hDownImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0); | 	hDownImageList = ImageList_Create(i16, i16, ILC_COLOR32 | ILC_HIGHQUALITYSCALE, 1, 0); | ||||||
| 	ImageList_AddIcon(hUpImageList, hIconUp); | 	if (!IsAppsUseDarkMode()) | ||||||
| 	ImageList_AddIcon(hDownImageList, hIconDown); | 	{ | ||||||
|  | 		ImageList_AddIcon(hUpImageList, hIconUp); | ||||||
|  | 		ImageList_AddIcon(hDownImageList, hIconDown); | ||||||
|  | 	} | ||||||
|  | 	else | ||||||
|  | 	{ | ||||||
|  | 		ImageList_AddMasked(hUpImageList, LoadBitmap(0, MAKEINTRESOURCE(32753)), CLR_DEFAULT); | ||||||
|  | 		ImageList_AddMasked(hDownImageList, LoadBitmap(0, MAKEINTRESOURCE(32752)), CLR_DEFAULT); | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
| 	// Create the advanced options toolbars
 | 	// Create the advanced options toolbars
 | ||||||
| 	memset(wtbtext, 0, sizeof(wtbtext)); | 	memset(wtbtext, 0, sizeof(wtbtext)); | ||||||
|  | @ -1585,10 +1606,12 @@ void SetBootTypeDropdownWidth(void) | ||||||
| void OnPaint(HDC hdc) | void OnPaint(HDC hdc) | ||||||
| { | { | ||||||
| 	int i; | 	int i; | ||||||
| 	HPEN hp = CreatePen(0, (fScale < 1.5f) ? 2 : 3, RGB(0, 0, 0)); | 	 | ||||||
|  | 	HPEN hp = CreatePen(0, (fScale < 1.5f) ? 2 : 3, IsAppsUseDarkMode() ? RGB(255,255,255) : RGB(0, 0, 0)); | ||||||
| 	SelectObject(hdc, hp); | 	SelectObject(hdc, hp); | ||||||
| 	for (i = 0; i < ARRAYSIZE(section_vpos); i++) { | 	for (i = 0; i < ARRAYSIZE(section_vpos); i++) { | ||||||
| 		MoveToEx(hdc, mw + 10, section_vpos[i], NULL); | 		MoveToEx(hdc, mw + 10, section_vpos[i], NULL); | ||||||
| 		LineTo(hdc, mw + fw, section_vpos[i]); | 		LineTo(hdc, mw + fw, section_vpos[i]); | ||||||
| 	} | 	} | ||||||
|  | 	 | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								src/ui.h
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								src/ui.h
									
										
									
									
									
								
							|  | @ -21,7 +21,8 @@ | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include "resource.h" | #include "resource.h" | ||||||
| #include "localization.h" | #include "localization.h" | ||||||
| 
 | //#include<vsstyle.h>
 | ||||||
|  | //#include <vssym32.h>
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| // Progress bar colors
 | // Progress bar colors
 | ||||||
|  | @ -33,8 +34,17 @@ | ||||||
| #define PROGRESS_BAR_PAUSED_COLOR			RGB(0xDA, 0xCB, 0x26) | #define PROGRESS_BAR_PAUSED_COLOR			RGB(0xDA, 0xCB, 0x26) | ||||||
| #define PROGRESS_BAR_ERROR_COLOR			RGB(0xDA, 0x26, 0x26) | #define PROGRESS_BAR_ERROR_COLOR			RGB(0xDA, 0x26, 0x26) | ||||||
| 
 | 
 | ||||||
|  | #define PROGRESS_BAR_DARK_NORMAL_TEXT_COLOR		RGB(0xFF, 0xFF, 0xFF) | ||||||
|  | #define PROGRESS_BAR_DARK_INVERTED_TEXT_COLOR	RGB(0x00, 0x00, 0x00) | ||||||
|  | #define PROGRESS_BAR_DARK_BACKGROUND_COLOR		RGB(0x3F, 0x3F, 0x3F) | ||||||
|  | #define PROGRESS_BAR_DARK_BOX_COLOR				RGB(192, 192,192) | ||||||
|  | #define PROGRESS_BAR_DARK_NORMAL_COLOR			RGB(40,100,180) | ||||||
|  | #define PROGRESS_BAR_DARK_PAUSED_COLOR			RGB(0xDA, 0xCB, 0x26) | ||||||
|  | #define PROGRESS_BAR_DARK_ERROR_COLOR			RGB(0xDA, 0x26, 0x26) | ||||||
|  | #define ColorControlDark                        RGB(32, 32, 32) | ||||||
|  | 
 | ||||||
| // Toolbar icons main color
 | // Toolbar icons main color
 | ||||||
| #define TOOLBAR_ICON_COLOR					RGB(0x29, 0x80, 0xB9) | #define TOOLBAR_ICON_COLOR				RGB(255, 255, 255)	//(0x29, 0x80, 0xB9)
 | ||||||
| 
 | 
 | ||||||
| // Toolbar default style
 | // Toolbar default style
 | ||||||
| #define TOOLBAR_STYLE						( WS_CHILD | WS_TABSTOP | WS_VISIBLE | \ | #define TOOLBAR_STYLE						( WS_CHILD | WS_TABSTOP | WS_VISIBLE | \ | ||||||
|  | @ -106,3 +116,4 @@ extern void ShowLanguageMenu(RECT rcExclude); | ||||||
| extern void SetPassesTooltip(void); | extern void SetPassesTooltip(void); | ||||||
| extern void SetBootTypeDropdownWidth(void); | extern void SetBootTypeDropdownWidth(void); | ||||||
| extern void OnPaint(HDC hdc); | extern void OnPaint(HDC hdc); | ||||||
|  | static UINT_PTR uIdSubclass = 1; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue