From 0c8a93e6411035f6a1ca9e6537a6d569711cf4c3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Dec 2014 13:42:27 +0000 Subject: garbage collection: dead params, unused variables etc git-svn-id: http://svn.miranda-ng.org/main/trunk@11328 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 342 ++++++++++---------------- plugins/Clist_nicer/src/Coolsb/coolscroll.cpp | 93 ++----- 2 files changed, 154 insertions(+), 281 deletions(-) (limited to 'plugins/Clist_nicer/src/Coolsb') diff --git a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp index 87c426d6dc..538f77f2a7 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp @@ -38,31 +38,29 @@ static TCHAR szPropStr[] = _T("CoolSBSubclassPtr"); LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -SCROLLWND *GetScrollWndFromHwnd(HWND hwnd) +SCROLLWND* GetScrollWndFromHwnd(HWND hwnd) { return (SCROLLWND *)GetProp(hwnd, szPropStr); } -SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) +SCROLLBAR* GetScrollBarFromHwnd(HWND hwnd, UINT nBar) { SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - - if ( !sw) return 0; - + if (!sw) + return 0; + if (nBar == SB_HORZ) return &sw->sbarHorz; - else if (nBar == SB_VERT) + if (nBar == SB_VERT) return &sw->sbarVert; - else - return 0; + return 0; } BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd) { if (GetScrollWndFromHwnd(hwnd)) return TRUE; - else - return FALSE; + return FALSE; } BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); @@ -77,7 +75,7 @@ BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); // using Detours (or any other LIB??) // -typedef BOOL (WINAPI *WPROC)(HWND, UINT, UINT); +typedef BOOL(WINAPI *WPROC)(HWND, UINT, UINT); static WPROC pEnableScrollBar = 0; @@ -85,36 +83,32 @@ void WINAPI CoolSB_SetESBProc(WPROC proc) { pEnableScrollBar = proc; } -// -// static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) { - if (fFrameChanged == FALSE) - { + if (fFrameChanged == FALSE) { /* RECT rect; HRGN hrgn1, hrgn2; - + SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - + GetScrollRect(sw, SB_HORZ, hwnd, &rect); hrgn1 = CreateRectRgnIndirect(&rect); - + GetScrollRect(sw, SB_VERT, hwnd, &rect); hrgn2 = CreateRectRgnIndirect(&rect); - + CombineRgn(hrgn1, hrgn2, hrgn1, RGN_OR); - + SendMessage(hwnd, WM_NCPAINT, (WPARAM)hrgn1, 0); - + DeleteObject(hrgn1); DeleteObject(hrgn2);*/ SendMessage(hwnd, WM_NCPAINT, 1, 0); } - else - { + else { SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_DRAWFRAME); } @@ -134,13 +128,10 @@ int WINAPI CoolSB_GetDefaultMinThumbSize(void) { if (LOBYTE(LOWORD(dwVersion)) >= 5) return MINTHUMBSIZE_2000; - else - return MINTHUMBSIZE_NT4; - } - else - { return MINTHUMBSIZE_NT4; } + + return MINTHUMBSIZE_NT4; } static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) @@ -150,12 +141,10 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) if (sb == 0) return FALSE; - if (fnBar == SB_HORZ) - { + if (fnBar == SB_HORZ) { return &sb->scrollInfo; } - else if (fnBar == SB_VERT) - { + else if (fnBar == SB_VERT) { return &sb->scrollInfo; } else @@ -182,8 +171,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) //if we have already initialized Cool Scrollbars for this window, //then stop the user from doing it again - if (GetScrollWndFromHwnd(hwnd) != 0) - { + if (GetScrollWndFromHwnd(hwnd) != 0) { return FALSE; } @@ -193,12 +181,12 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) si = &sw->sbarHorz.scrollInfo; si->cbSize = sizeof(SCROLLINFO); - si->fMask = SIF_ALL; + si->fMask = SIF_ALL; GetScrollInfo(hwnd, SB_HORZ, si); si = &sw->sbarVert.scrollInfo; si->cbSize = sizeof(SCROLLINFO); - si->fMask = SIF_ALL; + si->fMask = SIF_ALL; GetScrollInfo(hwnd, SB_VERT, si); //check to see if the window has left-aligned scrollbars @@ -226,20 +214,20 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) //need to be able to distinguish between horizontal and vertical //scrollbars in some instances - sw->sbarHorz.nBarType = SB_HORZ; - sw->sbarVert.nBarType = SB_VERT; + sw->sbarHorz.nBarType = SB_HORZ; + sw->sbarVert.nBarType = SB_VERT; - sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL; - sw->sbarVert.fFlatScrollbar = CSBS_NORMAL; + sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL; + sw->sbarVert.fFlatScrollbar = CSBS_NORMAL; //set the default arrow sizes for the scrollbars - sw->sbarHorz.nArrowLength = SYSTEM_METRIC; - sw->sbarHorz.nArrowWidth = SYSTEM_METRIC; - sw->sbarVert.nArrowLength = SYSTEM_METRIC; - sw->sbarVert.nArrowWidth = SYSTEM_METRIC; + sw->sbarHorz.nArrowLength = SYSTEM_METRIC; + sw->sbarHorz.nArrowWidth = SYSTEM_METRIC; + sw->sbarVert.nArrowLength = SYSTEM_METRIC; + sw->sbarVert.nArrowWidth = SYSTEM_METRIC; + + sw->bPreventStyleChange = FALSE; - sw->bPreventStyleChange = FALSE; - mir_subclassWindow(hwnd, CoolSBWndProc); CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize()); @@ -250,11 +238,11 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) InitCommonControlsEx(&ice); sw->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TOOLTIPS_CLASS, _T(""), - WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - hwnd, NULL, GetModuleHandle(0), - NULL); + WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hwnd, NULL, GetModuleHandle(0), + NULL); ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND; @@ -264,7 +252,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) ti.hinst = GetModuleHandle(0); SendMessage(sw->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - + #else UNREFERENCED_PARAMETER(ice); @@ -272,27 +260,25 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) sw->hwndToolTip = 0; #endif - + //send the window a frame changed message to update the scrollbars RedrawNonClient(hwnd, TRUE); return TRUE; } -BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) +BOOL WINAPI CoolSB_EnableScrollBar(HWND hwnd, int wSBflags, UINT wArrows) { SCROLLBAR *sbar; UINT oldstate; BOOL bFailed = FALSE; - if ( !CoolSB_IsCoolScrollEnabled(hwnd)) + if (!CoolSB_IsCoolScrollEnabled(hwnd)) return EnableScrollBar(hwnd, wSBflags, wArrows); - if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { oldstate = sbar->fScrollFlags; - + //clear any existing state, and OR in the disabled flags sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; @@ -301,11 +287,9 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) } - if ((wSBflags == SB_VERT || wSBflags == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wSBflags == SB_VERT || wSBflags == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { oldstate = sbar->fScrollFlags; - + //clear any existing state, and OR in the disabled flags sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; @@ -316,45 +300,33 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) return !bFailed; } -BOOL WINAPI CoolSB_GetScrollBarInfo(HWND hwnd) +BOOL WINAPI CoolSB_GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi) { -// SCROLLBARINFO sbi; not defined in winuser.h - return FALSE; -} - -BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) -{ - SCROLLINFO *mysi; BOOL copied = FALSE; - - if ( !lpsi) + + if (!lpsi) return FALSE; - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) - { + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, fnBar); + if (!mysi) return GetScrollInfo(hwnd, fnBar, lpsi); - } - - if (lpsi->fMask & SIF_PAGE) - { + + if (lpsi->fMask & SIF_PAGE) { lpsi->nPage = mysi->nPage; copied = TRUE; } - if (lpsi->fMask & SIF_POS) - { + if (lpsi->fMask & SIF_POS) { lpsi->nPos = mysi->nPos; copied = TRUE; } - if (lpsi->fMask & SIF_TRACKPOS) - { + if (lpsi->fMask & SIF_TRACKPOS) { lpsi->nTrackPos = mysi->nTrackPos; copied = TRUE; } - if (lpsi->fMask & SIF_RANGE) - { + if (lpsi->fMask & SIF_RANGE) { lpsi->nMin = mysi->nMin; lpsi->nMax = mysi->nMax; copied = TRUE; @@ -363,24 +335,22 @@ BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) return copied; } -int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar) +int WINAPI CoolSB_GetScrollPos(HWND hwnd, int nBar) { - SCROLLINFO *mysi; - - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) return GetScrollPos(hwnd, nBar); return mysi->nPos; } -BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos) +BOOL WINAPI CoolSB_GetScrollRange(HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos) { - SCROLLINFO *mysi; - - if ( !lpMinPos || !lpMaxPos) + if (!lpMinPos || !lpMaxPos) return FALSE; - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) return GetScrollRange(hwnd, nBar, lpMinPos, lpMaxPos); *lpMinPos = mysi->nMin; @@ -389,95 +359,73 @@ BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lp return TRUE; } -int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw) +int WINAPI CoolSB_SetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw) { - SCROLLINFO *mysi; - SCROLLBAR *sbar; - BOOL fRecalcFrame = FALSE; + BOOL fRecalcFrame = FALSE; - if ( !lpsi) + if (!lpsi) return FALSE; - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, fnBar); + if (!mysi) return SetScrollInfo(hwnd, fnBar, lpsi, fRedraw); - //if (CoolSB_IsThumbTracking(hwnd)) - // return mysi->nPos; - - if (lpsi->fMask & SIF_RANGE) - { + if (lpsi->fMask & SIF_RANGE) { mysi->nMin = lpsi->nMin; mysi->nMax = lpsi->nMax; } //The nPage member must specify a value from 0 to nMax - nMin +1. - if (lpsi->fMask & SIF_PAGE) - { + if (lpsi->fMask & SIF_PAGE) { UINT t = (UINT)(mysi->nMax - mysi->nMin + 1); mysi->nPage = min(lpsi->nPage, t); } //The nPos member must specify a value between nMin and nMax - max(nPage - 1, 0). - if (lpsi->fMask & SIF_POS) - { + if (lpsi->fMask & SIF_POS) { mysi->nPos = max(lpsi->nPos, mysi->nMin); mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); } - sbar = GetScrollBarFromHwnd(hwnd, fnBar); + SCROLLBAR *sbar = GetScrollBarFromHwnd(hwnd, fnBar); - if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) - { - if ( !sbar->fScrollVisible) - { + if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) { + if (!sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); fRecalcFrame = TRUE; } } - else - { - if ( mysi->nPage > (UINT)mysi->nMax + else { + if (mysi->nPage > (UINT)mysi->nMax || mysi->nPage == (UINT)mysi->nMax && mysi->nMax == 0 - || mysi->nMax <= mysi->nMin) - { - if (sbar->fScrollVisible) - { + || mysi->nMax <= mysi->nMin) { + if (sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, FALSE); fRecalcFrame = TRUE; } } - else - { - if ( !sbar->fScrollVisible) - { + else { + if (!sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); fRecalcFrame = TRUE; } - } - } if (fRedraw && !CoolSB_IsThumbTracking(hwnd)) RedrawNonClient(hwnd, fRecalcFrame); - + return mysi->nPos; } int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) { - SCROLLINFO *mysi; int oldpos; - - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) - { - return SetScrollPos(hwnd, nBar, nPos, fRedraw); - } - //this is what should happen, but real scrollbars don't work like this.. - //if (CoolSB_IsThumbTracking(hwnd)) - // return mysi->nPos; + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) + return SetScrollPos(hwnd, nBar, nPos, fRedraw); //validate and set the scollbar position oldpos = mysi->nPos; @@ -490,11 +438,10 @@ int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) return oldpos; } -int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw) +int WINAPI CoolSB_SetScrollRange(HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw) { - SCROLLINFO *mysi; - - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) return SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, fRedraw); if (CoolSB_IsThumbTracking(hwnd)) @@ -504,7 +451,7 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, //nMax-nMin must not be greater than MAXLONG mysi->nMin = nMinPos; mysi->nMax = nMaxPos; - + if (fRedraw) RedrawNonClient(hwnd, FALSE); @@ -514,19 +461,17 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, // // Show or hide the specified scrollbars // -BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) +BOOL WINAPI CoolSB_ShowScrollBar(HWND hwnd, int wBar, BOOL fShow) { SCROLLBAR *sbar; BOOL bFailed = FALSE; DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - if ( !CoolSB_IsCoolScrollEnabled(hwnd)) + if (!CoolSB_IsCoolScrollEnabled(hwnd)) return ShowScrollBar(hwnd, wBar, fShow); - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { + sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; sbar->fScrollFlags |= fShow ? CSBS_VISIBLE : 0; //bFailed = TRUE; @@ -534,10 +479,8 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_HSCROLL); } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { + sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; sbar->fScrollFlags |= fShow ? CSBS_VISIBLE : 0; //bFailed = TRUE; @@ -545,22 +488,20 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_VSCROLL); } - if (bFailed) - { + if (bFailed) { return FALSE; } - else - { + else { //DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); //style |= WS_VSCROLL; - + //if (s //SetWindowLongPtr(hwnd, GWL_STYLE, style); - SetWindowPos(hwnd, 0, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | + SetWindowPos(hwnd, 0, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); - + return TRUE; } } @@ -570,9 +511,9 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) // HRESULT WINAPI UninitializeCoolSB(HWND hwnd) { - int i = 0; SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - if ( !sw) return E_FAIL; + if (!sw) + return E_FAIL; RemoveProp(hwnd, szPropStr); //SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); @@ -611,7 +552,7 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) return FALSE; - + //check that we havn't reached the maximum allowed buttons yet if (sbar->nButtons == MAX_COOLSB_BUTS) return FALSE; @@ -685,9 +626,9 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p We don't use the callback function anymore. The uButType member must now specify SBBT_OWNERDRAW, and a WM_NOTIFY will be sent when a button must be drawn - if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW)) + if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW)) pDrawProc = psb->pDrawProc; - else + else pDrawProc = 0;*/ sbar->nButtons++; @@ -767,7 +708,7 @@ BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCm if (psb->fMask & SBBF_BITMAP) sbut->hBmp = psb->hBmp; if (psb->fMask & SBBF_ENHMETAFILE) sbut->hEmf = psb->hEmf; if (psb->fMask & SBBF_CURSOR) sbut->hCurs = psb->hCurs; - + if (psb->fMask & SBBF_BUTMINMAX) { sbut->nMinSize = psb->nMinSize; @@ -816,7 +757,7 @@ BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd } sbar->nButtons--; - + RedrawNonClient(hwnd, TRUE); return TRUE; @@ -861,20 +802,20 @@ BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, S #else -BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb) { return FALSE; } -BOOL WINAPI CoolSB_ModifyButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } -BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd) { return FALSE; } -BOOL WINAPI CoolSB_GetButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } +BOOL WINAPI CoolSB_InsertButton(HWND, int, UINT, SCROLLBUT*) { return FALSE; } +BOOL WINAPI CoolSB_ModifyButton(HWND, int, UINT, BOOL, SCROLLBUT*) { return FALSE; } +BOOL WINAPI CoolSB_RemoveButton(HWND, int, UINT, BOOL) { return FALSE; } +BOOL WINAPI CoolSB_GetButton(HWND, int, UINT, BOOL, SCROLLBUT*) { return FALSE; } #endif //INCLUDE_BUTTONS // // Set the size of the scrollbars // -BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) +BOOL WINAPI CoolSB_SetSize(HWND hwnd, int wBar, int nLength, int nWidth) { SCROLLBAR *sbar; - + if (nLength == 0 || nWidth == 0) return FALSE; @@ -884,29 +825,23 @@ BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) if (nLength > 256 || nWidth > 256) return FALSE; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { sbar->nArrowLength = nLength; - sbar->nArrowWidth = nWidth; + sbar->nArrowWidth = nWidth; } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { sbar->nArrowLength = nLength; - sbar->nArrowWidth = nWidth; + sbar->nArrowWidth = nWidth; } RedrawNonClient(hwnd, TRUE); - return TRUE; } - // // Alter the display mode of the scrollbars // wBar - SB_HORZ / SB_VERT / SB_BOTH @@ -916,23 +851,16 @@ BOOL WINAPI CoolSB_SetStyle(HWND hwnd, int wBar, UINT nStyle) { SCROLLBAR *sbar; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) sbar->fFlatScrollbar = nStyle; - } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) sbar->fFlatScrollbar = nStyle; - } RedrawNonClient(hwnd, FALSE); - return TRUE; } @@ -945,23 +873,19 @@ BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) { SCROLLBAR *sbar; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { if (fThumbAlways) - sbar->fScrollFlags |= CSBS_THUMBALWAYS; + sbar->fScrollFlags |= CSBS_THUMBALWAYS; else sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { if (fThumbAlways) - sbar->fScrollFlags |= CSBS_THUMBALWAYS; + sbar->fScrollFlags |= CSBS_THUMBALWAYS; else sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; } @@ -978,23 +902,17 @@ BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size) { SCROLLBAR *sbar; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; if (size == -1) size = CoolSB_GetDefaultMinThumbSize(); - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) sbar->nMinThumbSize = size; - } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) sbar->nMinThumbSize = size; - } return TRUE; } diff --git a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp index cb2490ed44..b70587874c 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp @@ -535,7 +535,6 @@ static int GetButtonSize(SCROLLBAR *sbar, HWND hwnd, UINT uBeforeAfter) // static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int *pthumbpos) { - SCROLLINFO *si; int scrollsize; //total size of the scrollbar including arrow buttons int workingsize; //working area (where the thumb can slide) int siMaxMin; @@ -543,29 +542,16 @@ static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int int startcoord; int thumbpos = 0, thumbsize = 0; - int adjust=0; static int count=0; //work out the width (for a horizontal) or the height (for a vertical) //of a standard scrollbar button butsize = GetScrollMetric(sbar, SM_SCROLL_LENGTH); - if (1) //sbar->nBarType == SB_HORZ) - { - scrollsize = rect->right - rect->left; - startcoord = rect->left; - } - /*else if (sbar->nBarType == SB_VERT) - { - scrollsize = rect->bottom - rect->top; - startcoord = rect->top; - } - else - { - return 0; - }*/ + scrollsize = rect->right - rect->left; + startcoord = rect->left; - si = &sbar->scrollInfo; + SCROLLINFO *si = &sbar->scrollInfo; siMaxMin = si->nMax - si->nMin + 1; workingsize = scrollsize - butsize * 2; @@ -613,7 +599,7 @@ static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int // the rectangle must not include space for any inserted buttons // (i.e, JUST the scrollbar area) // -static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, int x, int y) +static UINT GetHorzScrollPortion(SCROLLBAR *sbar, const RECT *rect, int x, int y) { int thumbwidth, thumbpos; int butwidth = GetScrollMetric(sbar, SM_SCROLL_LENGTH); @@ -670,12 +656,12 @@ static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, i // For vertical scrollbars, rotate all coordinates by -90 degrees // so that we can use the horizontal version of this function // -static UINT GetVertScrollPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetVertScrollPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { UINT r; RotateRect(rect); - r = GetHorzScrollPortion(sb, hwnd, rect, y, x); + r = GetHorzScrollPortion(sb, rect, y, x); RotateRect(rect); return r; } @@ -750,7 +736,7 @@ static LRESULT PostCustomDrawNotify(HWND hwnd, HDC hdc, UINT nBar, RECT *prect, #endif */ -static LRESULT PostMouseNotify0(HWND hwnd, UINT msg, UINT nBar, RECT *prect, UINT nCmdId, POINT pt) +static LRESULT PostMouseNotify0(HWND hwnd, UINT nBar, RECT *prect, UINT nCmdId, POINT pt) { #ifdef NOTIFY_MOUSE NMCOOLBUTMSG nmcb; @@ -810,7 +796,6 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r COLORREF crInverse1 = InvertCOLORREF(crCheck1); COLORREF crInverse2 = InvertCOLORREF(crCheck2); - UINT uDFCFlat = sb->fFlatScrollbar ? DFCS_FLAT : 0; UINT uDEFlat = sb->fFlatScrollbar ? BF_FLAT : 0; //drawing flags to modify the appearance of the scrollbar buttons @@ -1380,32 +1365,10 @@ static LRESULT DrawVertButtons(SCROLLBAR *sbar, HDC hdc, const RECT *rect, int l // NOT needed if we don't bother to mask the scrollbars we draw // to prevent the old window procedure from accidently drawing over them // -HDC CoolSB_GetDC(HWND hwnd, WPARAM wParam) +HDC CoolSB_GetDC(HWND hwnd, WPARAM) { // I just can't figure out GetDCEx, so I'll just use this: return GetWindowDC(hwnd); - - /* - RECT rc; - DWORD flags = 0x10000; - HRGN hrgn = (HRGN)wParam; - - if (hrgn == (HRGN)1) - { - GetWindowRect(hwnd, &rc); - OffsetRect(&rc, -rc.left, -rc.top); - hrgn = CreateRectRgnIndirect(&rc); - } - - if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPCHILDREN) - flags |= DCX_CLIPCHILDREN; - - if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPSIBLINGS) - flags |= DCX_CLIPSIBLINGS; - - return GetDCEx(hwnd, hrgn, flags | DCX_CACHE|DCX_NORESETATTRS|DCX_WINDOW | DCX_INTERSECTUPDATE); - */ - //return GetDCEx(hwnd, NULL, flags | DCX_WINDOW| DCX_NORESETATTRS); } static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) @@ -1431,8 +1394,6 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) sb = &sw->sbarHorz; if (sb->fScrollVisible) { - int hbarwidth = 0, leftright = 0; - //get the screen coordinates of the whole horizontal scrollbar area GetHScrollRect(sw, hwnd, &rect); @@ -1451,8 +1412,6 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) sb = &sw->sbarVert; if (sb->fScrollVisible) { - int vbarheight = 0, updown = 0; - //get the screen cooridinates of the whole horizontal scrollbar area GetVScrollRect(sw, hwnd, &rect); @@ -1575,7 +1534,7 @@ static LRESULT NCHitTest(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) // Return a HT* value indicating what part of the scrollbar was clicked // Rectangle is not adjusted // -static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetHorzPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { RECT rc = *rect; @@ -1609,17 +1568,17 @@ static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) //Now we have the rectangle for the scrollbar itself, so work out //what part we clicked on. - return GetHorzScrollPortion(sb, hwnd, &rc, x, y); + return GetHorzScrollPortion(sb, &rc, x, y); } // // Just call the horizontal version, with adjusted coordinates // -static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetVertPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { UINT ret; RotateRect(rect); - ret = GetHorzPortion(sb, hwnd, rect, y, x); + ret = GetHorzPortion(sb, rect, y, x); RotateRect(rect); return ret; } @@ -1627,12 +1586,12 @@ static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) // // Wrapper function for GetHorzPortion and GetVertPortion // -static UINT GetPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { if (sb->nBarType == SB_HORZ) - return GetHorzPortion(sb, hwnd, rect, x, y); + return GetHorzPortion(sb, rect, x, y); else if (sb->nBarType == SB_VERT) - return GetVertPortion(sb, hwnd, rect, x, y); + return GetVertPortion(sb, rect, x, y); else return HTSCROLL_NONE; } @@ -1847,7 +1806,6 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa RECT rect, winrect; HDC hdc; SCROLLBAR *sb; - SCROLLBUT *sbut = 0; POINT pt; pt.x = LOWORD(lParam); @@ -1866,7 +1824,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //get the total area of the normal Horz scrollbar area GetHScrollRect(sw, hwnd, &rect); - uCurrentScrollPortion = GetHorzPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + uCurrentScrollPortion = GetHorzPortion(sb, &rect, LOWORD(lParam), HIWORD(lParam)); } // // VERTICAL SCROLLBAR PROCESSING @@ -1879,7 +1837,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //get the total area of the normal Horz scrollbar area GetVScrollRect(sw, hwnd, &rect); - uCurrentScrollPortion = GetVertPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + uCurrentScrollPortion = GetVertPortion(sb, &rect, LOWORD(lParam), HIWORD(lParam)); } // // NORMAL PROCESSING @@ -1991,9 +1949,9 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa // If the scroll thumb has moved under the mouse in response to // a call to SetScrollPos etc, then we don't hilight the scrollbar margin if (uCurrentScrollbar == SB_HORZ) - uScrollTimerPortion = GetHorzScrollPortion(sb, hwnd, &rect, pt.x, pt.y); + uScrollTimerPortion = GetHorzScrollPortion(sb, &rect, pt.x, pt.y); else - uScrollTimerPortion = GetVertScrollPortion(sb, hwnd, &rect, pt.x, pt.y); + uScrollTimerPortion = GetVertScrollPortion(sb, &rect, pt.x, pt.y); GetWindowRect(hwnd, &winrect); OffsetRect(&rect, -winrect.left, -winrect.top); @@ -2035,7 +1993,6 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) HDC hdc; POINT pt; RECT winrect; - UINT buttonIdx = 0; //current scrollportion is the button that we clicked down on if (uCurrentScrollPortion != HTSCROLL_NONE) @@ -2340,7 +2297,6 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) LPARAM nlParam; SCROLLBAR *sb = &sw->sbarHorz; - SCROLLBUT *sbut = 0; nlParam = GetMessagePos(); @@ -2364,7 +2320,7 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //see if we clicked in the inserted buttons / normal scrollbar //thisportion = GetPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); - thisportion = GetPortion(sb, hwnd, &rect, pt.x, pt.y); + thisportion = GetPortion(sb, &rect, pt.x, pt.y); //we need to do different things depending on if the //user is activating the scrollbar itself, or one of @@ -2578,7 +2534,6 @@ static LRESULT NCCalcSize(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam NCCALCSIZE_PARAMS *nccsp; RECT *rect; RECT oldrect; - BOOL fCalcValidRects = (wParam == TRUE); SCROLLBAR *sb; LRESULT ret; DWORD dwStyle; @@ -2744,12 +2699,12 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM if (uMouseOverScrollbar == SB_HORZ) { sbar = &swnd->sbarHorz; - uHitTestPortion = GetHorzPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); + uHitTestPortion = GetHorzPortion(sbar, &MouseOverRect, pt.x, pt.y); } else { sbar = &swnd->sbarVert; - uHitTestPortion = GetVertPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); + uHitTestPortion = GetVertPortion(sbar, &MouseOverRect, pt.x, pt.y); } if (uLastHitTestPortion != uHitTestPortion) @@ -2824,7 +2779,7 @@ static LRESULT CoolSB_StyleChange(SCROLLWND *swnd, HWND hwnd, UINT msg, WPARAM w } static UINT curTool = -1; -static LRESULT CoolSB_Notify(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) +static LRESULT CoolSB_Notify(SCROLLWND* /*swnd*/, HWND hwnd, WPARAM wParam, LPARAM lParam) { #ifdef COOLSB_TOOLTIPS @@ -2864,7 +2819,7 @@ static LRESULT SendToolTipMessage0(HWND hwndTT, UINT message, WPARAM wParam, LPA // We must intercept any calls to SetWindowLongPtr, to make sure that // the user does not set the WS_VSCROLL or WS_HSCROLL styles // -static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) +static LRESULT CoolSB_SetCursor(SCROLLWND* /*swnd*/, HWND hwnd, WPARAM wParam, LPARAM lParam) { #ifdef INCLUDE_BUTTONS UINT lo = LOWORD(lParam); -- cgit v1.2.3