From 3edfebd9fbf17fd9e77b371ffc14a7ec264bb485 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Aug 2012 12:11:15 +0000 Subject: - fix for Clist Nicer status button - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@1426 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 138 +++++++++++++-------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'plugins/Clist_nicer/src/Coolsb/coolsblib.cpp') diff --git a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp index 42f74c4ca0..51eefa1f91 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp @@ -49,9 +49,9 @@ SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) if (!sw) return 0; - if(nBar == SB_HORZ) + if (nBar == SB_HORZ) return &sw->sbarHorz; - else if(nBar == SB_VERT) + else if (nBar == SB_VERT) return &sw->sbarVert; else return 0; @@ -59,7 +59,7 @@ SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd) { - if(GetScrollWndFromHwnd(hwnd)) + if (GetScrollWndFromHwnd(hwnd)) return TRUE; else return FALSE; @@ -90,7 +90,7 @@ void WINAPI CoolSB_SetESBProc(WPROC proc) static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) { - if(fFrameChanged == FALSE) + if (fFrameChanged == FALSE) { /* RECT rect; @@ -130,9 +130,9 @@ int WINAPI CoolSB_GetDefaultMinThumbSize(void) // set the minimum thumb size for a scrollbar. This // differs between NT4 and 2000, so need to check to see // which platform we are running under - if(dwVersion < 0x80000000) // Windows NT/2000 + if (dwVersion < 0x80000000) // Windows NT/2000 { - if(LOBYTE(LOWORD(dwVersion)) >= 5) + if (LOBYTE(LOWORD(dwVersion)) >= 5) return MINTHUMBSIZE_2000; else return MINTHUMBSIZE_NT4; @@ -147,14 +147,14 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) { SCROLLBAR *sb = GetScrollBarFromHwnd(hwnd, fnBar); - if(sb == 0) + 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; } @@ -175,14 +175,14 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) DWORD dwCurStyle; //BOOL fDisabled; - if(pEnableScrollBar == 0) + if (pEnableScrollBar == 0) pEnableScrollBar = EnableScrollBar; GetClientRect(hwnd, &rect); //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; } @@ -202,7 +202,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) GetScrollInfo(hwnd, SB_VERT, si); //check to see if the window has left-aligned scrollbars - if(GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LEFTSCROLLBAR) + if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LEFTSCROLLBAR) sw->fLeftScrollbar = TRUE; else sw->fLeftScrollbar = FALSE; @@ -218,10 +218,10 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) //scrollbars will automatically get enabled, even if //they aren't to start with....sorry, but there isn't an //easy alternative. - if(dwCurStyle & WS_HSCROLL) + if (dwCurStyle & WS_HSCROLL) sw->sbarHorz.fScrollFlags = CSBS_VISIBLE; - if(dwCurStyle & WS_VSCROLL) + if (dwCurStyle & WS_VSCROLL) sw->sbarVert.fScrollFlags = CSBS_VISIBLE; //need to be able to distinguish between horizontal and vertical @@ -296,7 +296,7 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) //clear any existing state, and OR in the disabled flags sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; - if(oldstate == sbar->fScrollFlags) + if (oldstate == sbar->fScrollFlags) bFailed = TRUE; } @@ -309,7 +309,7 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) //clear any existing state, and OR in the disabled flags sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; - if(oldstate == sbar->fScrollFlags) + if (oldstate == sbar->fScrollFlags) bFailed = TRUE; } @@ -335,25 +335,25 @@ BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) 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; @@ -401,24 +401,24 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) return SetScrollInfo(hwnd, fnBar, lpsi, fRedraw); - //if(CoolSB_IsThumbTracking(hwnd)) + //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(max(0, 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)); @@ -440,7 +440,7 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f || mysi->nPage == (UINT)mysi->nMax && mysi->nMax == 0 || mysi->nMax <= mysi->nMin) { - if(sbar->fScrollVisible) + if (sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, FALSE); fRecalcFrame = TRUE; @@ -458,7 +458,7 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f } - if(fRedraw && !CoolSB_IsThumbTracking(hwnd)) + if (fRedraw && !CoolSB_IsThumbTracking(hwnd)) RedrawNonClient(hwnd, fRecalcFrame); return mysi->nPos; @@ -476,7 +476,7 @@ int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) } //this is what should happen, but real scrollbars don't work like this.. - //if(CoolSB_IsThumbTracking(hwnd)) + //if (CoolSB_IsThumbTracking(hwnd)) // return mysi->nPos; //validate and set the scollbar position @@ -484,7 +484,7 @@ int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) mysi->nPos = max(nPos, mysi->nMin); mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); - if(fRedraw && !CoolSB_IsThumbTracking(hwnd)) + if (fRedraw && !CoolSB_IsThumbTracking(hwnd)) RedrawNonClient(hwnd, FALSE); return oldpos; @@ -497,7 +497,7 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) return SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, fRedraw); - if(CoolSB_IsThumbTracking(hwnd)) + if (CoolSB_IsThumbTracking(hwnd)) return mysi->nPos; //hide the scrollbar if nMin == nMax @@ -505,7 +505,7 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, mysi->nMin = nMinPos; mysi->nMax = nMaxPos; - if(fRedraw) + if (fRedraw) RedrawNonClient(hwnd, FALSE); return TRUE; @@ -530,7 +530,7 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); //bFailed = TRUE; - if(fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL); + if (fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_HSCROLL); else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_HSCROLL); } @@ -541,11 +541,11 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) sbar->fScrollFlags |= (fShow == TRUE ? CSBS_VISIBLE : 0); //bFailed = TRUE; - if(fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_VSCROLL); + if (fShow) SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle | WS_VSCROLL); else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_VSCROLL); } - if(bFailed) + if (bFailed) { return FALSE; } @@ -554,7 +554,7 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) //DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); //style |= WS_VSCROLL; - //if(s + //if (s //SetWindowLongPtr(hwnd, GWL_STYLE, style); SetWindowPos(hwnd, 0, 0, 0, 0, 0, @@ -616,11 +616,11 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p return FALSE; //check that we havn't reached the maximum allowed buttons yet - if(sbar->nButtons == MAX_COOLSB_BUTS) + if (sbar->nButtons == MAX_COOLSB_BUTS) return FALSE; //insert at end - if(nPos == -1) + if (nPos == -1) { sbut = &sbar->sbButtons[sbar->nButtons]; } @@ -644,42 +644,42 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p //specified by the SCROLLBUT->fMask. //Otherwise, use a default property value - if(psb->fMask & SBBF_TYPE) + if (psb->fMask & SBBF_TYPE) sbut->uButType = psb->uButType; else sbut->uButType = SBBT_PUSHBUTTON; - if(psb->fMask & SBBF_STATE) + if (psb->fMask & SBBF_STATE) sbut->uState = psb->uState; else sbut->uState = 0; - if(psb->fMask & SBBF_ID) + if (psb->fMask & SBBF_ID) sbut->uCmdId = psb->uCmdId; else sbut->uCmdId = 0; - if(psb->fMask & SBBF_SIZE) + if (psb->fMask & SBBF_SIZE) sbut->nSize = psb->nSize; else sbut->nSize = -1; - if(psb->fMask & SBBF_PLACEMENT) + if (psb->fMask & SBBF_PLACEMENT) sbut->uPlacement = psb->uPlacement; else sbut->uPlacement = SBBP_LEFT; - if(psb->fMask & SBBF_BITMAP) + if (psb->fMask & SBBF_BITMAP) sbut->hBmp = psb->hBmp; else sbut->hBmp = 0; - if(psb->fMask & SBBF_ENHMETAFILE) + if (psb->fMask & SBBF_ENHMETAFILE) sbut->hEmf = psb->hEmf; else sbut->hEmf = 0; - if(psb->fMask & SBBF_CURSOR) + if (psb->fMask & SBBF_CURSOR) sbut->hCurs = psb->hCurs; else sbut->hCurs = 0; @@ -701,7 +701,7 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p if ((sbut->uButType & SBBM_RESIZABLE) && sbut->uPlacement == SBBP_RIGHT) sbut->uButType &= ~SBBM_RESIZABLE; - if(psb->fMask & SBBF_BUTMINMAX) + if (psb->fMask & SBBF_BUTMINMAX) { sbut->nMinSize = psb->nMinSize; sbut->nMaxSize = psb->nMaxSize; @@ -720,7 +720,7 @@ static SCROLLBUT *GetButtonFromId(SCROLLBAR *sbar, UINT uCmdId) int i; for (i = 0; i < sbar->nButtons; i++) { - if(sbar->sbButtons[i].uCmdId == uCmdId) + if (sbar->sbButtons[i].uCmdId == uCmdId) return &sbar->sbButtons[i]; } @@ -747,7 +747,7 @@ BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCm //find the button to modify, depending on if we //are modifying by position or command id - if(fByCmd == FALSE) + if (fByCmd == FALSE) { //button from position if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons) @@ -755,23 +755,23 @@ BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCm else sbut = &sbar->sbButtons[uItem]; } - else if(fByCmd == TRUE) + else if (fByCmd == TRUE) { //button from command identifier if (!(sbut = GetButtonFromId(sbar, uItem))) return FALSE; } - if(psb->fMask & SBBF_TYPE) sbut->uButType = psb->uButType; - if(psb->fMask & SBBF_STATE) sbut->uState = psb->uState; - if(psb->fMask & SBBF_ID) sbut->uCmdId = psb->uCmdId; - if(psb->fMask & SBBF_SIZE) sbut->nSize = psb->nSize; - if(psb->fMask & SBBF_PLACEMENT) sbut->uPlacement = psb->uPlacement; - 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_TYPE) sbut->uButType = psb->uButType; + if (psb->fMask & SBBF_STATE) sbut->uState = psb->uState; + if (psb->fMask & SBBF_ID) sbut->uCmdId = psb->uCmdId; + if (psb->fMask & SBBF_SIZE) sbut->nSize = psb->nSize; + if (psb->fMask & SBBF_PLACEMENT) sbut->uPlacement = psb->uPlacement; + 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) + if (psb->fMask & SBBF_BUTMINMAX) { sbut->nMinSize = psb->nMinSize; sbut->nMaxSize = psb->nMaxSize; @@ -791,16 +791,16 @@ BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd //find the button to modify, depending on if we //are modifying by position or command id - if(fByCmd == FALSE && ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons)) + if (fByCmd == FALSE && ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons)) { return FALSE; } - else if(fByCmd == TRUE) + else if (fByCmd == TRUE) { //find the button with the specified command id for (i = 0; i < sbar->nButtons; i++) { - if(sbar->sbButtons[i].uCmdId == uItem) + if (sbar->sbButtons[i].uCmdId == uItem) { //change the id to an index uItem = i; @@ -809,7 +809,7 @@ BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd } //if we failed to find the button... - if(i == sbar->nButtons) return FALSE; + if (i == sbar->nButtons) return FALSE; } //remove the button! @@ -841,7 +841,7 @@ BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, S //find the button to modify, depending on if we //are modifying by position or command id - if(fByCmd == FALSE) + if (fByCmd == FALSE) { //button from position if ((int)uItem < 0 || (int)uItem >= (UINT)sbar->nButtons) @@ -849,7 +849,7 @@ BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, S else sbut = &sbar->sbButtons[uItem]; } - else if(fByCmd == TRUE) + else if (fByCmd == TRUE) { //button from command identifier if (!(sbut = GetButtonFromId(sbar, uItem))) @@ -878,13 +878,13 @@ BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) { SCROLLBAR *sbar; - if(nLength == 0 || nWidth == 0) + if (nLength == 0 || nWidth == 0) return FALSE; - if(nLength < -8 || nWidth < -8) + if (nLength < -8 || nWidth < -8) return FALSE; - if(nLength > 256 || nWidth > 256) + if (nLength > 256 || nWidth > 256) return FALSE; if (!GetScrollWndFromHwnd(hwnd)) @@ -954,7 +954,7 @@ BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { - if(fThumbAlways) + if (fThumbAlways) sbar->fScrollFlags |= CSBS_THUMBALWAYS; else sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; @@ -963,7 +963,7 @@ BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { - if(fThumbAlways) + if (fThumbAlways) sbar->fScrollFlags |= CSBS_THUMBALWAYS; else sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; @@ -984,7 +984,7 @@ BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size) if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if(size == -1) + if (size == -1) size = CoolSB_GetDefaultMinThumbSize(); if ((wBar == SB_HORZ || wBar == SB_BOTH) && -- cgit v1.2.3