From 881c3bf8a2018e4d2cadc7df41e46385d9d20781 Mon Sep 17 00:00:00 2001 From: Dart Vanya Date: Mon, 7 Oct 2024 05:15:34 +0300 Subject: [PATCH] Theme fixes and enhancements - Advanced options menu Reset added --- SystemInformer/chdlg.c | 19 ++- SystemInformer/delayhook.c | 35 +++-- SystemInformer/options.c | 26 ++++ SystemInformer/sessshad.c | 2 + phlib/extlv.c | 18 ++- phlib/theme.c | 120 ++++++++++++++---- phlib/treenew.c | 10 +- .../ExtendedNotifications.rc | 2 +- plugins/ExtendedTools/ExtendedTools.rc | 2 +- plugins/ExtendedTools/disktab.c | 2 +- plugins/ExtendedTools/fwtab.c | 13 +- plugins/HardwareDevices/devicetree.c | 1 + plugins/NetworkTools/NetworkTools.rc | 16 +-- plugins/NetworkTools/options.c | 39 +++--- plugins/NetworkTools/resource.h | 4 +- plugins/ToolStatus/ToolStatus.rc | 2 +- tools/peview/delayhook.c | 17 ++- 17 files changed, 250 insertions(+), 78 deletions(-) diff --git a/SystemInformer/chdlg.c b/SystemInformer/chdlg.c index d889ad72746b..b267303ccd20 100644 --- a/SystemInformer/chdlg.c +++ b/SystemInformer/chdlg.c @@ -454,6 +454,10 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc( } PhSetDialogFocus(WindowHandle, context->ComboBoxHandle); + + if (PhEnableThemeSupport) + DestroyWindow(GetDlgItem(WindowHandle, IDC_SIZE_)); + PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport); } break; case WM_DESTROY: @@ -560,7 +564,20 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc( clientRect.top = clientRect.bottom; clientRect.bottom = clientRect.top + PhGetDpi(50, dpi); - FillRect(hdc, &clientRect, PhEnableThemeSupport ? PhThemeWindowBackgroundBrush : GetSysColorBrush(COLOR_3DFACE)); + + if (PhEnableThemeSupport) + { + SetDCBrushColor(hdc, RGB(50, 50, 50)); + FillRect(hdc, &clientRect, GetStockObject(DC_BRUSH)); + clientRect.bottom = clientRect.top + PhGetDpi(2, dpi); + InflateRect(&clientRect, -1, 0); + SetDCBrushColor(hdc, RGB(36, 36, 36)); + FillRect(hdc, &clientRect, GetStockObject(DC_BRUSH)); + } + else + { + FillRect(hdc, &clientRect, GetSysColorBrush(COLOR_3DFACE)); + } SetWindowLongPtr(WindowHandle, DWLP_MSGRESULT, TRUE); } diff --git a/SystemInformer/delayhook.c b/SystemInformer/delayhook.c index 9f6f6411e3f9..aaa594255843 100644 --- a/SystemInformer/delayhook.c +++ b/SystemInformer/delayhook.c @@ -227,28 +227,34 @@ LRESULT CALLBACK PhStaticWindowHookProcedure( PAINTSTRUCT ps; HDC hdc; HICON iconHandle; + RECT clientRect; if (!PhGetWindowContext(WindowHandle, SCHAR_MAX)) break; if (iconHandle = (HICON)(UINT_PTR)CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, STM_GETICON, 0, 0)) // Static_GetIcon(WindowHandle, 0) { - if (hdc = BeginPaint(WindowHandle, &ps)) + if (BeginPaint(WindowHandle, &ps)) { - FillRect(hdc, &ps.rcPaint, PhThemeWindowBackgroundBrush); + // Fix artefacts when window moving back from off-screen (Dart Vanya) + hdc = GetDC(WindowHandle); + GetClientRect(WindowHandle, &clientRect); + + FillRect(hdc, &clientRect, PhThemeWindowBackgroundBrush); DrawIconEx( hdc, - ps.rcPaint.left, - ps.rcPaint.top, + clientRect.left, + clientRect.top, iconHandle, - ps.rcPaint.right - ps.rcPaint.left, - ps.rcPaint.bottom - ps.rcPaint.top, + clientRect.right - clientRect.left, + clientRect.bottom - clientRect.top, 0, NULL, DI_NORMAL ); + ReleaseDC(WindowHandle, hdc); EndPaint(WindowHandle, &ps); } } @@ -378,17 +384,24 @@ VOID ThemeWindowStatusBarDrawPart( { SetTextColor(bufferDc, RGB(0xff, 0xff, 0xff)); SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor); + blockRect.left -= 3, blockRect.top -= 1; FillRect(bufferDc, &blockRect, PhGetStockBrush(DC_BRUSH)); - //FrameRect(bufferDc, &blockRect, GetSysColorBrush(COLOR_HIGHLIGHT)); + blockRect.left += 3, blockRect.top += 1; } else { + RECT separator; SetTextColor(bufferDc, PhThemeWindowTextColor); FillRect(bufferDc, &blockRect, PhThemeWindowBackgroundBrush); - //FrameRect(bufferDc, &blockRect, GetSysColorBrush(COLOR_HIGHLIGHT)); + + separator = blockRect; + separator.left = separator.right - 1; + PhInflateRect(&separator, 0, -1); + SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor); + FillRect(bufferDc, &separator, PhGetStockBrush(DC_BRUSH)); } - blockRect.left += 2; + blockRect.left += 2, blockRect.bottom -= 1; DrawText( bufferDc, text, @@ -396,7 +409,7 @@ VOID ThemeWindowStatusBarDrawPart( &blockRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_HIDEPREFIX ); - blockRect.left -= 2; + blockRect.left -= 2, blockRect.bottom += 1; } VOID ThemeWindowRenderStatusBar( @@ -448,6 +461,8 @@ VOID ThemeWindowRenderStatusBar( DrawFrameControl(bufferDc, &sizeGripRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); } + // Top statusbar border will be drawn by bottom tabcontrol border + for (INT i = 0; i < blockCount; i++) { ThemeWindowStatusBarDrawPart(Context, WindowHandle, bufferDc, clientRect, i); diff --git a/SystemInformer/options.c b/SystemInformer/options.c index 729437624385..e858aaf79f3d 100644 --- a/SystemInformer/options.c +++ b/SystemInformer/options.c @@ -3234,6 +3234,30 @@ INT_PTR CALLBACK PhpOptionsAdvancedDlgProc( PhDereferenceObject(text); } break; + case IDC_RESET: + { + PPH_OPTIONS_ADVANCED_ROOT_NODE* nodes; + ULONG numberOfNodes; + if (!GetSelectedOptionsAdvancedNodes(context, &nodes, &numberOfNodes)) + break; + for (ULONG i = 0; i < numberOfNodes; i++) + { + PhSettingFromString( + nodes[i]->Setting->Type, + &nodes[i]->Setting->DefaultValue, + NULL, + PhSystemDpi, + nodes[i]->Setting + ); + PhMoveReference( + &nodes[i]->ValueString, + PhSettingToString(nodes[i]->Setting->Type, nodes[i]->Setting) + ); + } + TreeNew_NodesStructured(context->TreeNewHandle); + PhApplyTreeNewFilters(&context->TreeFilterSupport); + } + break; } } break; @@ -3254,6 +3278,8 @@ INT_PTR CALLBACK PhpOptionsAdvancedDlgProc( PPH_EMENU_ITEM item; menu = PhCreateEMenu(); + PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_RESET, L"&Reset", NULL, NULL), ULONG_MAX); + PhInsertEMenuItem(menu, PhCreateEMenuSeparator(), ULONG_MAX); PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_COPY, L"&Copy\bCtrl+C", NULL, NULL), ULONG_MAX); PhInsertCopyCellEMenuItem(menu, IDC_COPY, context->TreeNewHandle, contextMenuEvent->Column); diff --git a/SystemInformer/sessshad.c b/SystemInformer/sessshad.c index 189428c492f2..8e25a44c7afd 100644 --- a/SystemInformer/sessshad.c +++ b/SystemInformer/sessshad.c @@ -159,6 +159,8 @@ INT_PTR CALLBACK PhpSessionShadowDlgProc( Button_SetCheck(GetDlgItem(hwndDlg, IDC_SHIFT), hotkey.Y & KBDSHIFT); Button_SetCheck(GetDlgItem(hwndDlg, IDC_CTRL), hotkey.Y & KBDCTRL); Button_SetCheck(GetDlgItem(hwndDlg, IDC_ALT), hotkey.Y & KBDALT); + + PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport); } break; case WM_DESTROY: diff --git a/phlib/extlv.c b/phlib/extlv.c index 19e256e017cf..43af9f72b976 100644 --- a/phlib/extlv.c +++ b/phlib/extlv.c @@ -253,7 +253,23 @@ LRESULT CALLBACK PhpExtendedListViewWndProc( if (newFont) SelectFont(customDraw->nmcd.hdc, newFont); - if (colorChanged) + // Fix text readability for hot and selected colored items (Dart Vanya) + BOOLEAN UseThemeTextColor = FALSE; + if (PhEnableThemeSupport) + { + LVITEM item; + item.iItem = (DWORD)customDraw->nmcd.dwItemSpec; + item.mask = LVIF_STATE; + item.stateMask = LVIS_SELECTED; + ListView_GetItem(context->Handle, &item); + UseThemeTextColor = customDraw->nmcd.uItemState & CDIS_HOT || item.state & LVIS_SELECTED; + } + + if (UseThemeTextColor) + { + customDraw->clrText = PhThemeWindowTextColor; + } + else if (colorChanged) { if (PhGetColorBrightness(customDraw->clrTextBk) > 100) // slightly less than half customDraw->clrText = RGB(0x00, 0x00, 0x00); diff --git a/phlib/theme.c b/phlib/theme.c index c802f41b2325..96f5ff38db0f 100644 --- a/phlib/theme.c +++ b/phlib/theme.c @@ -873,6 +873,14 @@ BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows( PhInitializeWindowThemeACLUI(WindowHandle); } + else if (PhEqualStringZ(windowClassName, WC_EDIT, FALSE)) + { + // Fix scrollbar on multiline edit (Dart Vanya) + if (GetWindowLongPtr(WindowHandle, GWL_STYLE) & ES_MULTILINE) + { + PhWindowThemeSetDarkMode(WindowHandle, TRUE); + } + } return TRUE; } @@ -2193,7 +2201,9 @@ LRESULT CALLBACK PhpThemeWindowSubclassProc( { HDC hdc = (HDC)wParam; - SetBkMode(hdc, TRANSPARENT); + //SetBkMode(hdc, TRANSPARENT); + // Fix typing in multiline edit (Dart Vanya) + SetBkColor(hdc, PhThemeWindowBackground2Color); SetTextColor(hdc, PhThemeWindowTextColor); SetDCBrushColor(hdc, PhThemeWindowBackground2Color); return (INT_PTR)PhGetStockBrush(DC_BRUSH); @@ -2310,12 +2320,19 @@ LRESULT CALLBACK PhpThemeWindowGroupBoxSubclassProc( case WM_PAINT: { PAINTSTRUCT ps; + HDC hdc; + RECT clientRect; if (!BeginPaint(WindowHandle, &ps)) break; - ThemeWindowRenderGroupBoxControl(WindowHandle, ps.hdc, &ps.rcPaint, oldWndProc); + // Fix artefacts when window moving back from off-screen (Dart Vanya) + hdc = GetDC(WindowHandle); + GetClientRect(WindowHandle, &clientRect); + + ThemeWindowRenderGroupBoxControl(WindowHandle, hdc, &clientRect, oldWndProc); + ReleaseDC(WindowHandle, hdc); EndPaint(WindowHandle, &ps); } goto DefaultWndProc; @@ -2392,17 +2409,44 @@ VOID ThemeWindowRenderTabControl( INT currentSelection = TabCtrl_GetCurSel(WindowHandle); INT count = TabCtrl_GetItemCount(WindowHandle); + RECT itemRect = { 0 }; + //RECT itemRectHighlighted; + //INT itemHighlighted = INT_ERROR; + INT headerBottom; + INT oldTop; + + oldTop = clientRect->top; + TabCtrl_GetItemRect(WindowHandle, 0, &itemRect); + clientRect->top += (itemRect.bottom - itemRect.top) * TabCtrl_GetRowCount(WindowHandle) + 2; + + SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color); + FrameRect(bufferDc, clientRect, PhGetStockBrush(DC_BRUSH)); + headerBottom = clientRect->top; + clientRect->top = oldTop; + + TCITEM tabItem; + WCHAR tabHeaderText[MAX_PATH] = L""; + memset(&tabItem, 0, sizeof(TCITEM)); + + tabItem.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_STATE; + tabItem.dwStateMask = TCIS_BUTTONPRESSED | TCIS_HIGHLIGHTED; + tabItem.cchTextMax = RTL_NUMBER_OF(tabHeaderText); + tabItem.pszText = tabHeaderText; + for (INT i = 0; i < count; i++) { - RECT itemRect; + if (i == currentSelection) + continue; TabCtrl_GetItemRect(WindowHandle, i, &itemRect); + PhOffsetRect(&itemRect, 2, 2); + itemRect.bottom += itemRect.bottom + 1 < headerBottom ? 1 : -1; + itemRect.right += itemRect.right + 1 < clientRect->right; + if (PhPtInRect(&itemRect, Context->CursorPos)) { - PhOffsetRect(&itemRect, 2, 2); - //switch (PhpThemeColorMode) //{ //case 0: // New colors @@ -2426,12 +2470,12 @@ VOID ThemeWindowRenderTabControl( SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor); FillRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH)); - //FrameRect(bufferDc, &itemRect, GetSysColorBrush(COLOR_HIGHLIGHT)); + //itemRectHighlighted = itemRect; + //itemHighlighted = i; + //continue; } else { - PhOffsetRect(&itemRect, 2, 2); - //switch (PhpThemeColorMode) //{ //case 0: // New colors @@ -2451,30 +2495,16 @@ VOID ThemeWindowRenderTabControl( // } // break; //case 1: // Old colors - if (currentSelection == i) { // SetTextColor(bufferDc, PhThemeWindowTextColor); - SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color);// PhThemeWindowHighlightColor); // PhThemeWindowForegroundColor); + SetDCBrushColor(bufferDc, RGB(49, 49, 49)); FillRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH)); - } - else - { - // SetTextColor(bufferDc, PhThemeWindowTextColor); - FillRect(bufferDc, &itemRect, PhThemeWindowBackgroundBrush); + SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color); + FrameRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH)); } } { - TCITEM tabItem; - WCHAR tabHeaderText[MAX_PATH] = L""; - - memset(&tabItem, 0, sizeof(TCITEM)); - - tabItem.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_STATE; - tabItem.dwStateMask = TCIS_BUTTONPRESSED | TCIS_HIGHLIGHTED; - tabItem.cchTextMax = RTL_NUMBER_OF(tabHeaderText); - tabItem.pszText = tabHeaderText; - if (TabCtrl_GetItem(WindowHandle, i, &tabItem)) { DrawText( @@ -2487,6 +2517,46 @@ VOID ThemeWindowRenderTabControl( } } } + + { + TabCtrl_GetItemRect(WindowHandle, currentSelection, &itemRect); + + PhOffsetRect(&itemRect, 2, 2); + itemRect.bottom += itemRect.bottom + 1 < headerBottom ? 1 : -1; + itemRect.right += itemRect.right + 1 < clientRect->right; + PhInflateRect(&itemRect, 1, 1); // draw selected tab slightly bigger + itemRect.bottom -= 1; + SetDCBrushColor(bufferDc, PhPtInRect(&itemRect, Context->CursorPos) ? PhThemeWindowHighlightColor : RGB(0x50, 0x50, 0x50)); + FillRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH)); + + if (TabCtrl_GetItem(WindowHandle, currentSelection, &tabItem)) + { + DrawText( + bufferDc, + tabItem.pszText, + (UINT)PhCountStringZ(tabItem.pszText), + &itemRect, + DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_HIDEPREFIX + ); + } + + //if (itemHighlighted != INT_ERROR) + //{ + // SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor); + // FillRect(bufferDc, &itemRectHighlighted, PhGetStockBrush(DC_BRUSH)); + + // if (TabCtrl_GetItem(WindowHandle, itemHighlighted, &tabItem)) + // { + // DrawText( + // bufferDc, + // tabItem.pszText, + // (UINT)PhCountStringZ(tabItem.pszText), + // &itemRectHighlighted, + // DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_HIDEPREFIX + // ); + // } + //} + } } LRESULT CALLBACK PhpThemeWindowTabControlWndSubclassProc( diff --git a/phlib/treenew.c b/phlib/treenew.c index 738fd8b6db73..ef9cafa91dcb 100644 --- a/phlib/treenew.c +++ b/phlib/treenew.c @@ -5359,9 +5359,6 @@ VOID PhTnpPaint( { if (bitmap = CreateCompatibleBitmap(hdc, 1, 1)) { - // Draw the outline of the selection rectangle. - //FrameRect(hdc, &rowRect, GetSysColorBrush(COLOR_HIGHLIGHT)); - // Fill in the selection rectangle. oldBitmap = SelectBitmap(tempDc, bitmap); tempRect.left = 0; @@ -5401,6 +5398,13 @@ VOID PhTnpPaint( blendFunction ); + // Draw the outline of the selection rectangle (Dart Vanya) + if (Context->HasFocus && node->Selected) + { + //SetDCBrushColor(hdc, RGB(0xF0, 0xF0, 0xF0)); + FrameRect(hdc, &rowRect, GetSysColorBrush(COLOR_WINDOW)); + } + SelectBitmap(tempDc, oldBitmap); DeleteBitmap(bitmap); } diff --git a/plugins/ExtendedNotifications/ExtendedNotifications.rc b/plugins/ExtendedNotifications/ExtendedNotifications.rc index f1d69874779f..80c6410419b1 100644 --- a/plugins/ExtendedNotifications/ExtendedNotifications.rc +++ b/plugins/ExtendedNotifications/ExtendedNotifications.rc @@ -109,7 +109,7 @@ BEGIN LTEXT "Log all events to this file (leave blank to disable this feature):",IDC_STATIC,13,18,196,8 EDITTEXT IDC_LOGFILENAME,13,29,178,12,ES_AUTOHSCROLL PUSHBUTTON "Browse...",IDC_BROWSE,194,28,50,14 - LTEXT "Changes will require a restart of System Informer.",IDC_STATIC,14,45,157,8 + LTEXT "Changes will require a restart of System Informer.",IDC_STATIC,14,45,210,8 END diff --git a/plugins/ExtendedTools/ExtendedTools.rc b/plugins/ExtendedTools/ExtendedTools.rc index ff4a1e0abf5b..68902b00767e 100644 --- a/plugins/ExtendedTools/ExtendedTools.rc +++ b/plugins/ExtendedTools/ExtendedTools.rc @@ -115,7 +115,7 @@ BEGIN CONTROL "Enable GPU monitoring",IDC_ENABLEGPUMONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,46,88,10 CONTROL "Enable NPU monitoring",IDC_ENABLENPUMONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,59,88,10 CONTROL "Enable GPU/NPU fahrenheit temperature",IDC_ENABLEFAHRENHEITTEMP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,72,140,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,72,210,10 CONTROL "Enable FPS monitoring",IDC_ENABLEFPSMONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,85,130,10 LTEXT "Note: FPS monitoring requires either administrative privileges or the current user a member of the ""Performance Log Users"" group.",IDC_STATIC,7,104,211,23 END diff --git a/plugins/ExtendedTools/disktab.c b/plugins/ExtendedTools/disktab.c index 26a08446e4c6..d51314074297 100644 --- a/plugins/ExtendedTools/disktab.c +++ b/plugins/ExtendedTools/disktab.c @@ -262,7 +262,7 @@ VOID EtInitializeDiskTreeList( { DiskTreeNewHandle = WindowHandle; - PhSetControlTheme(DiskTreeNewHandle, L"explorer"); + PhSetControlTheme(DiskTreeNewHandle, !PhGetIntegerSetting(L"EnableThemeSupport") ? L"explorer" : L"DarkMode_Explorer"); TreeNew_SetRedraw(WindowHandle, FALSE); SendMessage(TreeNew_GetTooltips(DiskTreeNewHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, 0x7fff); TreeNew_SetCallback(WindowHandle, EtpDiskTreeNewCallback, NULL); diff --git a/plugins/ExtendedTools/fwtab.c b/plugins/ExtendedTools/fwtab.c index 43d1391c7732..6aa9676aaa82 100644 --- a/plugins/ExtendedTools/fwtab.c +++ b/plugins/ExtendedTools/fwtab.c @@ -253,7 +253,7 @@ VOID InitializeFwTreeList( InitializeFwTreeListDpi(FwTreeNewHandle); - PhSetControlTheme(FwTreeNewHandle, L"explorer"); + PhSetControlTheme(FwTreeNewHandle, !PhGetIntegerSetting(L"EnableThemeSupport") ? L"explorer" : L"DarkMode_Explorer"); TreeNew_SetRedraw(FwTreeNewHandle, FALSE); TreeNew_SetCallback(FwTreeNewHandle, FwTreeNewCallback, NULL); @@ -360,6 +360,8 @@ VOID LoadSettingsFwTreeList( { SendMessage(TreeNew_GetTooltips(TreeNewHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, MAXSHORT); } + + LoadSettingsFwTreeUpdateMask(); } VOID SaveSettingsFwTreeList( @@ -1409,6 +1411,15 @@ BOOLEAN NTAPI FwTreeNewCallback( data.MouseEvent->ScreenLocation.y ); + if (data.Selection) + { + if (data.Selection->Id == PH_TN_COLUMN_MENU_HIDE_COLUMN_ID || + data.Selection->Id == PH_TN_COLUMN_MENU_CHOOSE_COLUMNS_ID) + { + LoadSettingsFwTreeUpdateMask(); + } + } + PhHandleTreeNewColumnMenu(&data); PhDeleteTreeNewColumnMenu(&data); } diff --git a/plugins/HardwareDevices/devicetree.c b/plugins/HardwareDevices/devicetree.c index a7cf62d93ad9..0025f8e0cd0c 100644 --- a/plugins/HardwareDevices/devicetree.c +++ b/plugins/HardwareDevices/devicetree.c @@ -1354,6 +1354,7 @@ VOID DevicesTreeInitialize( if (PhGetIntegerSetting(L"EnableThemeSupport")) { PhInitializeWindowTheme(DeviceTreeHandle, TRUE); + PhSetControlTheme(DeviceTreeHandle, L"DarkMode_Explorer"); TreeNew_ThemeSupport(DeviceTreeHandle, TRUE); } diff --git a/plugins/NetworkTools/NetworkTools.rc b/plugins/NetworkTools/NetworkTools.rc index 25cd16e7cb4a..e7c8654c9a35 100644 --- a/plugins/NetworkTools/NetworkTools.rc +++ b/plugins/NetworkTools/NetworkTools.rc @@ -69,14 +69,14 @@ BEGIN LTEXT "Max Tracert Hops:",IDC_STATIC,113,37,60,8 CONTROL "Enable extended TCP statistics",IDC_ENABLE_EXTENDED_TCP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,19,115,10 - EDITTEXT IDC_KEYTEXT,16,100,184,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED + EDITTEXT IDC_GEOIDTEXT,16,100,184,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED LTEXT "MaxMind GeoLite Account ID:",IDC_STATIC,16,89,95,8 PUSHBUTTON "Open GeoIP.conf",IDC_GEOCONF,122,146,62,14 - PUSHBUTTON "Change",IDC_APIKEYBTN,202,100,50,14 + PUSHBUTTON "Change",IDC_APIKEYIDBTN,202,100,50,14 LTEXT "Note: You can also download GeoLite updates from the Main menu > Tools > Network Tools > Update GeoLite...",IDC_STATIC,16,167,271,24 - EDITTEXT IDC_GEOIDTEXT,16,126,184,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED + EDITTEXT IDC_KEYTEXT,16,126,184,14,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED LTEXT "MaxMind GeoLite License Key:",IDC_STATIC,16,116,97,8 - PUSHBUTTON "Change",IDC_APIKEYIDBTN,202,126,50,14 + PUSHBUTTON "Change",IDC_APIKEYBTN,202,126,50,14 PUSHBUTTON "Download update",IDRETRY,189,146,62,14 GROUPBOX "Network Tools",IDC_STATIC,7,7,222,63 GROUPBOX "GeoLite Update",IDC_STATIC,7,74,290,118 @@ -118,10 +118,10 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM CAPTION "Update MaxMind License Key" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - PUSHBUTTON "Save",IDYES,198,47,50,14 - DEFPUSHBUTTON "Cancel",IDCANCEL,252,47,50,14 - EDITTEXT IDC_KEYTEXT,7,24,295,14,ES_AUTOHSCROLL - LTEXT "Paste the license key here: ",IDC_STATIC,7,7,90,8 + DEFPUSHBUTTON "Save",IDYES,198,47,50,14 + PUSHBUTTON "Cancel",IDCANCEL,252,47,50,14 + EDITTEXT IDC_KEY_EDIT,7,24,295,14,ES_AUTOHSCROLL + LTEXT "Paste the",IDC_KEYTEXT_L,7,7,120,8 CONTROL "Checkout How-to-generate-a-license-key",IDC_HELPLINK, "SysLink",WS_TABSTOP,7,47,136,14 END diff --git a/plugins/NetworkTools/options.c b/plugins/NetworkTools/options.c index 90390b66290d..225171c9d289 100644 --- a/plugins/NetworkTools/options.c +++ b/plugins/NetworkTools/options.c @@ -46,8 +46,8 @@ INT_PTR CALLBACK OptionsDlgProc( PhSetDialogItemValue(WindowHandle, IDC_MAXHOPS, PhGetIntegerSetting(SETTING_NAME_TRACERT_MAX_HOPS), FALSE); Button_SetCheck(GetDlgItem(WindowHandle, IDC_ENABLE_EXTENDED_TCP), PhGetIntegerSetting(SETTING_NAME_EXTENDED_TCP_STATS) ? BST_CHECKED : BST_UNCHECKED); - PhSetDialogItemText(WindowHandle, IDC_KEYTEXT, PhGetStringOrEmpty(PhaGetStringSetting(SETTING_NAME_GEOLITE_API_ID))); - PhSetDialogItemText(WindowHandle, IDC_GEOIDTEXT, PhGetStringOrEmpty(PhaGetStringSetting(SETTING_NAME_GEOLITE_API_KEY))); + PhSetDialogItemText(WindowHandle, IDC_KEYTEXT, PhGetStringOrEmpty(PhaGetStringSetting(SETTING_NAME_GEOLITE_API_KEY))); + PhSetDialogItemText(WindowHandle, IDC_GEOIDTEXT, PhGetStringOrEmpty(PhaGetStringSetting(SETTING_NAME_GEOLITE_API_ID))); PhAddComboBoxStringRefs(comboHandle, OptionsGeoLiteEdition, RTL_NUMBER_OF(OptionsGeoLiteEdition)); ComboBox_SetCurSel(comboHandle, PhGetIntegerSetting(SETTING_NAME_GEOLITE_DB_TYPE)); @@ -87,7 +87,7 @@ INT_PTR CALLBACK OptionsDlgProc( ShowGeoLiteConfigDialog(WindowHandle, UlongToPtr(IDC_KEYTEXT)); - string = PhaGetStringSetting(SETTING_NAME_GEOLITE_API_ID); + string = PhaGetStringSetting(SETTING_NAME_GEOLITE_API_KEY); PhSetDialogItemText(WindowHandle, IDC_KEYTEXT, PhGetStringOrEmpty(string)); } break; @@ -100,7 +100,7 @@ INT_PTR CALLBACK OptionsDlgProc( ShowGeoLiteConfigDialog(WindowHandle, UlongToPtr(IDC_GEOIDTEXT)); - string = PhaGetStringSetting(SETTING_NAME_GEOLITE_API_KEY); + string = PhaGetStringSetting(SETTING_NAME_GEOLITE_API_ID); PhSetDialogItemText(WindowHandle, IDC_GEOIDTEXT, PhGetStringOrEmpty(string)); } break; @@ -181,12 +181,20 @@ INT_PTR CALLBACK OptionsGeoLiteDlgProc( PhCenterWindow(WindowHandle, GetParent(WindowHandle)); if (id == IDC_KEYTEXT) - PhSetDialogItemText(WindowHandle, id, PhaGetStringSetting(SETTING_NAME_GEOLITE_API_ID)->Buffer); + { + PhSetDialogItemText(WindowHandle, IDC_KEYTEXT_L, L"Paste the license key here:"); + PhSetDialogItemText(WindowHandle, IDC_KEY_EDIT, PhaGetStringSetting(SETTING_NAME_GEOLITE_API_KEY)->Buffer); + } else - PhSetDialogItemText(WindowHandle, id, PhaGetStringSetting(SETTING_NAME_GEOLITE_API_KEY)->Buffer); + { + PhSetDialogItemText(WindowHandle, IDC_KEYTEXT_L, L"Paste the account id here:"); + PhSetDialogItemText(WindowHandle, IDC_KEY_EDIT, PhaGetStringSetting(SETTING_NAME_GEOLITE_API_ID)->Buffer); + } - PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDCANCEL)); - } + PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDC_KEY_EDIT)); + + PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport")); + } break; case WM_DESTROY: { @@ -205,18 +213,9 @@ INT_PTR CALLBACK OptionsGeoLiteDlgProc( ULONG id = PtrToUlong(PhGetWindowContext(WindowHandle, PH_WINDOW_CONTEXT_DEFAULT)); PPH_STRING string; - if (id == IDC_KEYTEXT) - { - string = PhGetWindowText(GetDlgItem(WindowHandle, IDC_KEYTEXT)); - PhSetStringSetting(SETTING_NAME_GEOLITE_API_ID, PhGetStringOrEmpty(string)); - PhClearReference(&string); - } - else - { - string = PhGetWindowText(GetDlgItem(WindowHandle, IDC_KEYTEXT)); - PhSetStringSetting(SETTING_NAME_GEOLITE_API_KEY, PhGetStringOrEmpty(string)); - PhClearReference(&string); - } + string = PhGetWindowText(GetDlgItem(WindowHandle, IDC_KEY_EDIT)); + PhSetStringSetting(id == IDC_KEYTEXT ? SETTING_NAME_GEOLITE_API_KEY : SETTING_NAME_GEOLITE_API_ID, PhGetStringOrEmpty(string)); + PhClearReference(&string); EndDialog(WindowHandle, IDOK); } diff --git a/plugins/NetworkTools/resource.h b/plugins/NetworkTools/resource.h index 397ec339323c..1e88a53926f3 100644 --- a/plugins/NetworkTools/resource.h +++ b/plugins/NetworkTools/resource.h @@ -281,6 +281,8 @@ #define IDC_APIKEYBTN 1039 #define IDC_GEODBCOMBO 1040 #define IDC_GEOCONF 1041 +#define IDC_KEYTEXT_L 1042 +#define IDC_KEY_EDIT 1043 // Next default values for new objects // @@ -288,7 +290,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40006 -#define _APS_NEXT_CONTROL_VALUE 1042 +#define _APS_NEXT_CONTROL_VALUE 1044 #define _APS_NEXT_SYMED_VALUE 104 #endif #endif diff --git a/plugins/ToolStatus/ToolStatus.rc b/plugins/ToolStatus/ToolStatus.rc index f7c34016fadc..7dd7a4b8fedc 100644 --- a/plugins/ToolStatus/ToolStatus.rc +++ b/plugins/ToolStatus/ToolStatus.rc @@ -61,7 +61,7 @@ BEGIN CONTROL "Auto-hide main menu (Alt or F10 key toggle)",IDC_ENABLE_AUTOHIDE_MENU, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,78,157,10 CONTROL "Enable auto focus to search box",IDC_ENABLE_AUTOFOCUS_SEARCH, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,90,113,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,90,210,10 LTEXT "Note: Right-click the toolbar on the main window to customize the icons and graphs.",IDC_STATIC,7,7,157,18 COMBOBOX IDC_CURRENT,14,143,119,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Select the graph to show on the taskbar:",IDC_STATIC,14,132,132,8 diff --git a/tools/peview/delayhook.c b/tools/peview/delayhook.c index b4c949ccfa31..5a351df0b4c7 100644 --- a/tools/peview/delayhook.c +++ b/tools/peview/delayhook.c @@ -379,17 +379,24 @@ VOID ThemeWindowStatusBarDrawPart( { SetTextColor(bufferDc, RGB(0xff, 0xff, 0xff)); SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor); + blockRect.left -= 3, blockRect.top -= 1; FillRect(bufferDc, &blockRect, PhGetStockBrush(DC_BRUSH)); - //FrameRect(bufferDc, &blockRect, GetSysColorBrush(COLOR_HIGHLIGHT)); + blockRect.left += 3, blockRect.top += 1; } else { + RECT separator; SetTextColor(bufferDc, PhThemeWindowTextColor); FillRect(bufferDc, &blockRect, PhThemeWindowBackgroundBrush); - //FrameRect(bufferDc, &blockRect, GetSysColorBrush(COLOR_HIGHLIGHT)); + + CopyRect(&separator, &blockRect); + separator.left = separator.right - 1; + InflateRect(&separator, 0, -1); + SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor); + FillRect(bufferDc, &separator, PhGetStockBrush(DC_BRUSH)); } - blockRect.left += 2; + blockRect.left += 2, blockRect.bottom -= 1; DrawText( bufferDc, text, @@ -397,7 +404,7 @@ VOID ThemeWindowStatusBarDrawPart( &blockRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_HIDEPREFIX ); - blockRect.left -= 2; + blockRect.left -= 2, blockRect.bottom += 1; } VOID ThemeWindowRenderStatusBar( @@ -449,6 +456,8 @@ VOID ThemeWindowRenderStatusBar( DrawFrameControl(bufferDc, &sizeGripRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP); } + // Top statusbar border will be drawn by bottom tabcontrol border + for (INT i = 0; i < blockCount; i++) { ThemeWindowStatusBarDrawPart(Context, WindowHandle, bufferDc, clientRect, i);