From 402ea683390fce23d32b2efe2ae2a0576cd98bd0 Mon Sep 17 00:00:00 2001 From: dmex Date: Wed, 16 Dec 2015 10:44:24 +0000 Subject: [PATCH] ToolStatus: Added target cursor for Find window(s) Toolbar buttons; Fixed some Statusbar part widths not being reset; Removed Statusbar tooltips; Added more consistency checking to ReBarLoadLayoutSettings; git-svn-id: svn://svn.code.sf.net/p/processhacker/code@6262 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 2.x/trunk/plugins/ToolStatus/main.c | 8 ++++++-- 2.x/trunk/plugins/ToolStatus/statusbar.c | 10 ++++----- 2.x/trunk/plugins/ToolStatus/toolbar.c | 26 +++++++++++++----------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/2.x/trunk/plugins/ToolStatus/main.c b/2.x/trunk/plugins/ToolStatus/main.c index fa60769a0..ccee724cc 100644 --- a/2.x/trunk/plugins/ToolStatus/main.c +++ b/2.x/trunk/plugins/ToolStatus/main.c @@ -724,6 +724,9 @@ static LRESULT CALLBACK MainWndSubclassProc( // Direct all mouse events to this window. SetCapture(hWnd); + // Set the cursor. + SetCursor(LoadCursor(NULL, IDC_CROSS)); + // Send the window to the bottom. SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); @@ -958,8 +961,6 @@ static LRESULT CALLBACK MainWndSubclassProc( } break; case WM_LBUTTONUP: - case WM_RBUTTONUP: - case WM_MBUTTONUP: { if (TargetingWindow) { @@ -968,6 +969,9 @@ static LRESULT CALLBACK MainWndSubclassProc( TargetingCompleted = TRUE; + // Reset the original cursor. + SetCursor(LoadCursor(NULL, IDC_ARROW)); + // Bring the window back to the top, and preserve the Always on Top setting. SetWindowPos(PhMainWndHandle, PhGetIntegerSetting(L"MainWindowAlwaysOnTop") ? HWND_TOPMOST : HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); diff --git a/2.x/trunk/plugins/ToolStatus/statusbar.c b/2.x/trunk/plugins/ToolStatus/statusbar.c index ca168a4d2..b10af59a7 100644 --- a/2.x/trunk/plugins/ToolStatus/statusbar.c +++ b/2.x/trunk/plugins/ToolStatus/statusbar.c @@ -329,9 +329,6 @@ VOID UpdateStatusBar( { text[count] = PhCreateString(L"-"); } - - if (resetMaxWidths) - StatusBarMaxWidths[index] = 0; } break; case STATUS_MAXIOPROCESS: @@ -362,9 +359,6 @@ VOID UpdateStatusBar( { text[count] = PhCreateString(L"-"); } - - if (resetMaxWidths) - StatusBarMaxWidths[index] = 0; } break; case STATUS_VISIBLEITEMS: @@ -459,6 +453,10 @@ VOID UpdateStatusBar( break; } + + if (resetMaxWidths) + StatusBarMaxWidths[index] = 0; + if (!GetTextExtentPoint32(hdc, text[count]->Buffer, (ULONG)text[count]->Length / sizeof(WCHAR), &size)) size.cx = 200; diff --git a/2.x/trunk/plugins/ToolStatus/toolbar.c b/2.x/trunk/plugins/ToolStatus/toolbar.c index a0acfc1f7..3e479a1de 100644 --- a/2.x/trunk/plugins/ToolStatus/toolbar.c +++ b/2.x/trunk/plugins/ToolStatus/toolbar.c @@ -331,7 +331,7 @@ static VOID RebarLoadSettings( 0, STATUSCLASSNAME, NULL, - WS_CHILD | WS_VISIBLE | CCS_BOTTOM | SBARS_SIZEGRIP | SBARS_TOOLTIPS, + WS_CHILD | WS_VISIBLE | CCS_BOTTOM | SBARS_SIZEGRIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, PhMainWndHandle, NULL, @@ -720,20 +720,22 @@ VOID ReBarLoadLayoutSettings( PhStringToInteger64(&cxPart, 10, &cxInteger); PhStringToInteger64(&stylePart, 10, &nStyleInteger); - bandOldIndex = (UINT)SendMessage(RebarHandle, RB_IDTOINDEX, (UINT)idInteger, 0); + if ((bandOldIndex = (UINT)SendMessage(RebarHandle, RB_IDTOINDEX, (UINT)idInteger, 0)) == -1) + break; - SendMessage(RebarHandle, RB_MOVEBAND, bandOldIndex, bandIndex); + if (SendMessage(RebarHandle, RB_MOVEBAND, bandOldIndex, bandIndex)) + { + REBARBANDINFO rebarBandInfo = { REBARBANDINFO_V6_SIZE }; + rebarBandInfo.fMask = RBBIM_STYLE | RBBIM_SIZE; - REBARBANDINFO rebarBandInfo = { REBARBANDINFO_V6_SIZE }; - rebarBandInfo.fMask = RBBIM_STYLE | RBBIM_SIZE | RBBIM_ID; + if (SendMessage(RebarHandle, RB_GETBANDINFO, bandIndex, (LPARAM)&rebarBandInfo)) + { + rebarBandInfo.cx = (UINT)cxInteger; + rebarBandInfo.fStyle |= (UINT)nStyleInteger; - SendMessage(RebarHandle, RB_GETBANDINFO, bandIndex, (LPARAM)&rebarBandInfo); - - rebarBandInfo.cx = (UINT)cxInteger; - rebarBandInfo.fStyle |= (UINT)nStyleInteger; - //rebarBandInfo.fStyle = (rebarBandInfo.fStyle & ~(RBBS_HIDDEN | RBBS_BREAK)) | (UINT)nStyleInteger; - - SendMessage(RebarHandle, RB_SETBANDINFO, bandIndex, (LPARAM)&rebarBandInfo); + SendMessage(RebarHandle, RB_SETBANDINFO, bandIndex, (LPARAM)&rebarBandInfo); + } + } } }