diff options
author | George Hazan <george.hazan@gmail.com> | 2012-08-10 12:11:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-08-10 12:11:15 +0000 |
commit | 3edfebd9fbf17fd9e77b371ffc14a7ec264bb485 (patch) | |
tree | 770ac65c0d515935389ee3ff5248e679937c396d /plugins/Clist_nicer/src/Coolsb | |
parent | 8e71ba6e620317052a0122135270e6fd4275e74a (diff) |
- fix for Clist Nicer status button
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1426 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_nicer/src/Coolsb')
-rw-r--r-- | plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 138 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/Coolsb/coolscroll.cpp | 410 |
2 files changed, 274 insertions, 274 deletions
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) &&
diff --git a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp index ac31f86c24..499c98ca1a 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp @@ -132,7 +132,7 @@ static void __stdcall RotateRect(RECT *rect) //
static void __stdcall RotateRect0(SCROLLBAR *sb, RECT *rect)
{
- if(sb->nBarType == SB_VERT)
+ if (sb->nBarType == SB_VERT)
RotateRect(rect);
}
@@ -171,16 +171,16 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO UINT flags = arrow;
//HACKY bit so this routine can be called by vertical and horizontal code
- if(sbar->nBarType == SB_VERT)
+ if (sbar->nBarType == SB_VERT)
{
- if(flags & DFCS_SCROLLLEFT) flags = flags & ~DFCS_SCROLLLEFT | DFCS_SCROLLUP;
- if(flags & DFCS_SCROLLRIGHT) flags = flags & ~DFCS_SCROLLRIGHT | DFCS_SCROLLDOWN;
+ if (flags & DFCS_SCROLLLEFT) flags = flags & ~DFCS_SCROLLLEFT | DFCS_SCROLLUP;
+ if (flags & DFCS_SCROLLRIGHT) flags = flags & ~DFCS_SCROLLRIGHT | DFCS_SCROLLDOWN;
}
- if(fMouseDown) flags |= (DFCS_FLAT | DFCS_PUSHED);
+ if (fMouseDown) flags |= (DFCS_FLAT | DFCS_PUSHED);
#ifdef FLAT_SCROLLBARS
- if(sbar->fFlatScrollbar != CSBS_NORMAL)
+ if (sbar->fFlatScrollbar != CSBS_NORMAL)
{
HDC hdcmem1, hdcmem2;
HBITMAP hbm1, oldbm1;
@@ -212,7 +212,7 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO #ifndef HOT_TRACKING
- if(fMouseDown)
+ if (fMouseDown)
{
//uncomment these to make the cool scrollbars
//look like the common controls flat scrollbars
@@ -221,7 +221,7 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO }
#endif
//draw a flat monochrome version of a scrollbar arrow (dark)
- if(fMouseDown)
+ if (fMouseDown)
{
SetBkColor(hdcmem2, GetSysColor(COLOR_BTNTEXT));
BitBlt(hdcmem1, 0, 0, width, height, hdcmem2, 0, 0, SRCCOPY);
@@ -230,7 +230,7 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO BitBlt(hdc, rect->left, rect->top, width, height, hdcmem1, 0, 0, SRCCOPY);
}
//draw a flat monochrome version of a scrollbar arrow (grey)
- else if(fMouseOver)
+ else if (fMouseOver)
{
SetBkColor(hdcmem2, GetSysColor(COLOR_BTNTEXT));
FillRect(hdcmem1, &rc, reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
@@ -268,35 +268,35 @@ static int DrawScrollArrow(SCROLLBAR *sbar, HDC hdc, RECT *rect, UINT arrow, BOO //
static int GetScrollMetric(SCROLLBAR *sbar, int metric)
{
- if(sbar->nBarType == SB_HORZ)
+ if (sbar->nBarType == SB_HORZ)
{
- if(metric == SM_CXHORZSB)
+ if (metric == SM_CXHORZSB)
{
- if(sbar->nArrowLength < 0)
+ if (sbar->nArrowLength < 0)
return -sbar->nArrowLength * GetSystemMetrics(SM_CXHSCROLL);
else
return sbar->nArrowLength;
}
else
{
- if(sbar->nArrowWidth < 0)
+ if (sbar->nArrowWidth < 0)
return -sbar->nArrowWidth * GetSystemMetrics(SM_CYHSCROLL);
else
return sbar->nArrowWidth;
}
}
- else if(sbar->nBarType == SB_VERT)
+ else if (sbar->nBarType == SB_VERT)
{
- if(metric == SM_CYVERTSB)
+ if (metric == SM_CYVERTSB)
{
- if(sbar->nArrowLength < 0)
+ if (sbar->nArrowLength < 0)
return -sbar->nArrowLength * GetSystemMetrics(SM_CYVSCROLL);
else
return sbar->nArrowLength;
}
else
{
- if(sbar->nArrowWidth < 0)
+ if (sbar->nArrowWidth < 0)
return -sbar->nArrowWidth * GetSystemMetrics(SM_CXVSCROLL);
else
return sbar->nArrowWidth;
@@ -314,7 +314,7 @@ static COLORREF GetSBForeColor(void) COLORREF c1 = GetSysColor(COLOR_3DHILIGHT);
COLORREF c2 = GetSysColor(COLOR_WINDOW);
- if(c1 != 0xffffff && c1 == c2)
+ if (c1 != 0xffffff && c1 == c2)
{
return GetSysColor(COLOR_BTNFACE);
}
@@ -412,7 +412,7 @@ static BOOL GetHScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) {
GetWindowRect(hwnd, rect);
- if(sw->fLeftScrollbar)
+ if (sw->fLeftScrollbar)
{
rect->left += sw->cxLeftEdge + (sw->sbarVert.fScrollVisible ?
GetScrollMetric(&sw->sbarVert, SM_CXVERTSB) : 0);
@@ -449,7 +449,7 @@ static BOOL GetVScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) (sw->sbarHorz.fScrollVisible ? //bottom window edge
GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB) : 0);
- if(sw->fLeftScrollbar)
+ if (sw->fLeftScrollbar)
{
rect->left += sw->cxLeftEdge;
rect->right = rect->left + (sw->sbarVert.fScrollVisible ?
@@ -470,9 +470,9 @@ static BOOL GetVScrollRect(SCROLLWND *sw, HWND hwnd, RECT *rect) //
BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect)
{
- if(nBar == SB_HORZ)
+ if (nBar == SB_HORZ)
return GetHScrollRect(sw, hwnd, rect);
- else if(nBar == SB_VERT)
+ else if (nBar == SB_VERT)
return GetVScrollRect(sw, hwnd, rect);
else
return FALSE;
@@ -491,9 +491,9 @@ static int GetSingleButSize(SCROLLBAR *sbar, SCROLLBUT *sbut) {
//multiple of the system button size
//or a specific button size
- if(sbut->nSize < 0)
+ if (sbut->nSize < 0)
{
- if(sbar->nBarType == SB_HORZ)
+ if (sbar->nBarType == SB_HORZ)
return -sbut->nSize * GetSystemMetrics(SM_CXHSCROLL);
else
return -sbut->nSize * GetSystemMetrics(SM_CYVSCROLL);
@@ -516,7 +516,7 @@ static int GetButtonSize(SCROLLBAR *sbar, HWND hwnd, UINT uBeforeAfter) for (i = 0; i < sbar->nButtons; i++)
{
//only consider those buttons on the same side as nTopBottom says
- if(sbut[i].uPlacement == uBeforeAfter)
+ if (sbut[i].uPlacement == uBeforeAfter)
{
nPixels += GetSingleButSize(sbar, &sbut[i]);
}
@@ -548,12 +548,12 @@ static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int //of a standard scrollbar button
butsize = GetScrollMetric(sbar, SM_SCROLL_LENGTH);
- if(1) //sbar->nBarType == SB_HORZ)
+ if (1) //sbar->nBarType == SB_HORZ)
{
scrollsize = rect->right - rect->left;
startcoord = rect->left;
}
- /*else if(sbar->nBarType == SB_VERT)
+ /*else if (sbar->nBarType == SB_VERT)
{
scrollsize = rect->bottom - rect->top;
startcoord = rect->top;
@@ -570,30 +570,30 @@ static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int //
// Work out the scrollbar thumb SIZE
//
- if(si->nPage == 0)
+ if (si->nPage == 0)
{
thumbsize = butsize;
}
- else if(siMaxMin > 0)
+ else if (siMaxMin > 0)
{
thumbsize = MulDiv(si->nPage, workingsize, siMaxMin);
- if(thumbsize < sbar->nMinThumbSize)
+ if (thumbsize < sbar->nMinThumbSize)
thumbsize = sbar->nMinThumbSize;
}
//
// Work out the scrollbar thumb position
//
- if(siMaxMin > 0)
+ if (siMaxMin > 0)
{
int pagesize = max(1, si->nPage);
thumbpos = MulDiv(si->nPos - si->nMin, workingsize-thumbsize, siMaxMin - pagesize);
- if(thumbpos < 0)
+ if (thumbpos < 0)
thumbpos = 0;
- if(thumbpos >= workingsize-thumbsize)
+ if (thumbpos >= workingsize-thumbsize)
thumbpos = workingsize-thumbsize;
}
@@ -618,45 +618,45 @@ static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, i int scrollwidth = rect->right-rect->left;
int workingwidth = scrollwidth - butwidth*2;
- if(y < rect->top || y >= rect->bottom)
+ if (y < rect->top || y >= rect->bottom)
return HTSCROLL_NONE;
CalcThumbSize(sbar, rect, &thumbwidth, &thumbpos);
//if we have had to scale the buttons to fit in the rect,
//then adjust the button width accordingly
- if(scrollwidth <= butwidth * 2)
+ if (scrollwidth <= butwidth * 2)
{
butwidth = scrollwidth / 2;
}
//check for left button click
- if(x >= rect->left && x < rect->left + butwidth)
+ if (x >= rect->left && x < rect->left + butwidth)
{
return HTSCROLL_LEFT;
}
//check for right button click
- else if(x >= rect->right-butwidth && x < rect->right)
+ else if (x >= rect->right-butwidth && x < rect->right)
{
return HTSCROLL_RIGHT;
}
//if the thumb is too big to fit (i.e. it isn't visible)
//then return a NULL scrollbar area
- if(thumbwidth >= workingwidth)
+ if (thumbwidth >= workingwidth)
return HTSCROLL_NONE;
//check for point in the thumbbar
- if(x >= thumbpos && x < thumbpos+thumbwidth)
+ if (x >= thumbpos && x < thumbpos+thumbwidth)
{
return HTSCROLL_THUMB;
}
//check for left margin
- else if(x >= rect->left+butwidth && x < thumbpos)
+ else if (x >= rect->left+butwidth && x < thumbpos)
{
return HTSCROLL_PAGELEFT;
}
- else if(x >= thumbpos+thumbwidth && x < rect->right-butwidth)
+ else if (x >= thumbpos+thumbwidth && x < rect->right-butwidth)
{
return HTSCROLL_PAGERIGHT;
}
@@ -717,11 +717,11 @@ static LRESULT PostCustomDrawNotify(HWND hwnd, HDC hdc, UINT nBar, RECT *prect, nmcd.uItem = nItem;
nmcd.hdc = hdc;
- if(fMouseDown)
+ if (fMouseDown)
nmcd.uState = CDIS_SELECTED;
- else if(fMouseOver)
+ else if (fMouseOver)
nmcd.uState = CDIS_HOT;
- else if(fInactive)
+ else if (fInactive)
nmcd.uState = CDIS_DISABLED;
else
nmcd.uState = CDIS_DEFAULT;
@@ -815,21 +815,21 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r UINT uLeftButFlags = DFCS_SCROLLLEFT;
UINT uRightButFlags = DFCS_SCROLLRIGHT;
- if(scrollwidth <= 0)
+ if (scrollwidth <= 0)
return 0;
si = &sb->scrollInfo;
siMaxMin = si->nMax - si->nMin;
- if(hwnd != hwndCurCoolSB)
+ if (hwnd != hwndCurCoolSB)
uDrawFlags = HTSCROLL_NONE;
//
// work out the thumb size and position
//
CalcThumbSize(sb, rect, &thumbwidth, &thumbpos);
- if(sb->fScrollFlags & ESB_DISABLE_LEFT) uLeftButFlags |= DFCS_INACTIVE;
- if(sb->fScrollFlags & ESB_DISABLE_RIGHT) uRightButFlags |= DFCS_INACTIVE;
+ if (sb->fScrollFlags & ESB_DISABLE_LEFT) uLeftButFlags |= DFCS_INACTIVE;
+ if (sb->fScrollFlags & ESB_DISABLE_RIGHT) uRightButFlags |= DFCS_INACTIVE;
//if we need to grey the arrows because there is no data to scroll
if (!IsScrollInfoActive(si) && !(sb->fScrollFlags & CSBS_THUMBALWAYS))
@@ -838,7 +838,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r uRightButFlags |= DFCS_INACTIVE;
}
- if(hwnd == hwndCurCoolSB)
+ if (hwnd == hwndCurCoolSB)
{
#ifdef FLAT_SCROLLBARS
BOOL ldis = !(uLeftButFlags & DFCS_INACTIVE);
@@ -861,14 +861,14 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r //
// Draw the scrollbar now
//
- if(scrollwidth > butwidth*2)
+ if (scrollwidth > butwidth*2)
{
//LEFT ARROW
SetRect(&ctrl, rect->left, rect->top, rect->left + butwidth, rect->bottom);
RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINELEFT, fMouseDownL, fMouseOverL, uLeftButFlags & DFCS_INACTIVE);
else
DrawScrollArrow(sb, hdc, &ctrl, uLeftButFlags, fMouseDownL, fMouseOverL);
@@ -877,7 +877,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r //MIDDLE PORTION
//if we can fit the thumbbar in, then draw it
- if(thumbwidth > 0 && thumbwidth <= workingwidth
+ if (thumbwidth > 0 && thumbwidth <= workingwidth
&& IsScrollInfoActive(si) && ((sb->fScrollFlags & ESB_DISABLE_BOTH) != ESB_DISABLE_BOTH))
{
//Draw the scrollbar margin above the thumb
@@ -885,13 +885,13 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r RotateRect0(sb, &sbm);
- if(fCustomDraw)
+ if (fCustomDraw)
{
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &sbm, SB_PAGELEFT, uDrawFlags == HTSCROLL_PAGELEFT, FALSE, FALSE);
}
else
{
- if(uDrawFlags == HTSCROLL_PAGELEFT)
+ if (uDrawFlags == HTSCROLL_PAGELEFT)
DrawCheckedRect(hdc, &sbm, crInverse1, crInverse2);
else
DrawCheckedRect(hdc, &sbm, crCheck1, crCheck2);
@@ -905,13 +905,13 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r sbm.right = rect->right - butwidth;
RotateRect0(sb, &sbm);
- if(fCustomDraw)
+ if (fCustomDraw)
{
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &sbm, SB_PAGERIGHT, uDrawFlags == HTSCROLL_PAGERIGHT, 0, 0);
}
else
{
- if(uDrawFlags == HTSCROLL_PAGERIGHT)
+ if (uDrawFlags == HTSCROLL_PAGERIGHT)
DrawCheckedRect(hdc, &sbm, crInverse1, crInverse2);
else
DrawCheckedRect(hdc, &sbm, crCheck1, crCheck2);
@@ -924,7 +924,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r RotateRect0(sb, &thumb);
- if(fCustomDraw)
+ if (fCustomDraw)
{
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &thumb, SB_THUMBTRACK, uDrawFlags==HTSCROLL_THUMB, uHitTestPortion == HTSCROLL_THUMB && fBarHot, FALSE);
}
@@ -932,7 +932,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r {
#ifdef FLAT_SCROLLBARS
- if(hwnd == hwndCurCoolSB && sb->fFlatScrollbar && (uDrawFlags == HTSCROLL_THUMB ||
+ if (hwnd == hwndCurCoolSB && sb->fFlatScrollbar && (uDrawFlags == HTSCROLL_THUMB ||
(uHitTestPortion == HTSCROLL_THUMB && fBarHot)))
{
PaintRect(hdc, &thumb, GetSysColor(COLOR_3DSHADOW));
@@ -961,12 +961,12 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r ctrl.right --;
RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_THUMBTRACK, fMouseDownL, FALSE, FALSE);
else
{
#ifdef FLAT_SCROLLBARS
- if(sb->fFlatScrollbar == CSBS_HOTTRACKED && uDrawFlags == HTSCROLL_THUMB)
+ if (sb->fFlatScrollbar == CSBS_HOTTRACKED && uDrawFlags == HTSCROLL_THUMB)
PaintRect(hdc, &ctrl, GetSysColor(COLOR_3DSHADOW));
else
#endif
@@ -981,7 +981,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0);
else
PaintRect(hdc, &ctrl, GetSysColor(COLOR_SCROLLBAR));
@@ -993,7 +993,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r {
RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0);
else
DrawCheckedRect(hdc, &ctrl, crCheck1, crCheck2);
@@ -1007,7 +1007,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINERIGHT, fMouseDownR, fMouseOverR, uRightButFlags & DFCS_INACTIVE);
else
DrawScrollArrow(sb, hdc, &ctrl, uRightButFlags, fMouseDownR, fMouseOverR);
@@ -1023,7 +1023,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r SetRect(&ctrl, rect->left, rect->top, rect->left + butwidth, rect->bottom);
RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINELEFT, fMouseDownL, fMouseOverL, uLeftButFlags & DFCS_INACTIVE);
else
DrawScrollArrow(sb, hdc, &ctrl, uLeftButFlags, fMouseDownL, fMouseOverL);
@@ -1033,21 +1033,21 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r OffsetRect(&ctrl, scrollwidth - butwidth, 0);
RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_LINERIGHT, fMouseDownR, fMouseOverR, uRightButFlags & DFCS_INACTIVE);
else
DrawScrollArrow(sb, hdc, &ctrl, uRightButFlags, fMouseDownR, fMouseOverR);
RotateRect0(sb, &ctrl);
//if there is a gap between the buttons, fill it with a solid color
- //if(butwidth & 0x0001)
- if(ctrl.left != rect->left + butwidth)
+ //if (butwidth & 0x0001)
+ if (ctrl.left != rect->left + butwidth)
{
ctrl.left --;
ctrl.right -= butwidth;
RotateRect0(sb, &ctrl);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sb->nBarType, &ctrl, SB_PAGERIGHT, 0, 0, 0);
else
DrawCheckedRect(hdc, &ctrl, crCheck1, crCheck2);
@@ -1086,7 +1086,7 @@ static LRESULT NCDrawVScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r //
static LRESULT NCDrawScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *rect, UINT uDrawFlags)
{
- if(sb->nBarType == SB_HORZ)
+ if (sb->nBarType == SB_HORZ)
return NCDrawHScrollbar(sb, hwnd, hdc, rect, uDrawFlags);
else
return NCDrawVScrollbar(sb, hwnd, hdc, rect, uDrawFlags);
@@ -1109,7 +1109,7 @@ static void DrawImage(HDC hdc, HBITMAP hBitmap, RECT *rc) SIZE delta;
COLORREF colorOld;
- if(hBitmap == NULL)
+ if (hBitmap == NULL)
return;
// center bitmap in caller's rectangle
@@ -1121,7 +1121,7 @@ static void DrawImage(HDC hdc, HBITMAP hBitmap, RECT *rc) delta.cx = (rc->right-rc->left - cx) / 2;
delta.cy = (rc->bottom-rc->top - cy) / 2;
- if(rc->right-rc->left > cx)
+ if (rc->right-rc->left > cx)
{
SetRect(&rcDest, rc->left+delta.cx, rc->top + delta.cy, 0, 0);
rcDest.right = rcDest.left + cx;
@@ -1203,7 +1203,7 @@ static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT f flags &= ~SBBS_PUSHED;
case SBBT_TOGGLEBUTTON:
- if(sbut->uState != SBBS_NORMAL)
+ if (sbut->uState != SBBS_NORMAL)
flags |= SBBS_PUSHED;
//intentionally fall through here...
@@ -1211,28 +1211,28 @@ static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT f case SBBT_PUSHBUTTON:
f = flags & SBBS_PUSHED ? DFCS_PUSHED | DFCS_FLAT : 0;
- if(sbut->uButType & SBBM_LEFTARROW)
+ if (sbut->uButType & SBBM_LEFTARROW)
{
DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLLEFT | f);
}
- else if(sbut->uButType & SBBM_RIGHTARROW)
+ else if (sbut->uButType & SBBM_RIGHTARROW)
{
DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLRIGHT | f);
}
- else if(sbut->uButType & SBBM_UPARROW)
+ else if (sbut->uButType & SBBM_UPARROW)
{
DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLUP | f);
}
- else if(sbut->uButType & SBBM_DOWNARROW)
+ else if (sbut->uButType & SBBM_DOWNARROW)
{
DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLDOWN | f);
}
else
{
//
- if(flags & SBBS_PUSHED)
+ if (flags & SBBS_PUSHED)
{
- if(sbut->uButType & SBBM_RECESSED)
+ if (sbut->uButType & SBBM_RECESSED)
{
InflateRect(&rect, -1, -1);
DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_FLAT);
@@ -1250,13 +1250,13 @@ static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT f else
{
// draw the button borders
- if(sbut->uButType & SBBM_TYPE2)
+ if (sbut->uButType & SBBM_TYPE2)
{
DrawFrameControl(hdc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH);
InflateRect(&rect, -2, -2);
}
- else if(sbut->uButType & SBBM_TYPE3)
+ else if (sbut->uButType & SBBM_TYPE3)
{
DrawFrameControl(hdc, &rect, DFC_BUTTON, DFCS_BUTTONPUSH);
InflateRect(&rect, -1, -1);
@@ -1272,11 +1272,11 @@ static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT f rect.top++; rect.left++;
}
- if(sbut->hBmp)
+ if (sbut->hBmp)
{
PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE));
- if(flags & SBBS_PUSHED)
+ if (flags & SBBS_PUSHED)
{
rect.top++; rect.left++;
}
@@ -1285,12 +1285,12 @@ static UINT DrawScrollButton(SCROLLBUT *sbut, HDC hdc, const RECT *pctrl, UINT f DrawImage(hdc, sbut->hBmp, &rect);
SelectClipRgn(hdc, 0);
}
- else if(sbut->hEmf)
+ else if (sbut->hEmf)
{
PaintRect(hdc, &rect, GetSysColor(COLOR_3DFACE));
InflateRect(&rect, -1, -1);
- if(flags & SBBS_PUSHED)
+ if (flags & SBBS_PUSHED)
{
rect.top++; rect.left++;
}
@@ -1388,17 +1388,17 @@ HDC CoolSB_GetDC(HWND hwnd, WPARAM wParam) DWORD flags = 0x10000;
HRGN hrgn = (HRGN)wParam;
- if(hrgn == (HRGN)1)
+ if (hrgn == (HRGN)1)
{
GetWindowRect(hwnd, &rc);
OffsetRect(&rc, -rc.left, -rc.top);
hrgn = CreateRectRgnIndirect(&rc);
}
- if(GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPCHILDREN)
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPCHILDREN)
flags |= DCX_CLIPCHILDREN;
- if(GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPSIBLINGS)
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPSIBLINGS)
flags |= DCX_CLIPSIBLINGS;
return GetDCEx(hwnd, hrgn, flags | DCX_CACHE|DCX_NORESETATTRS|DCX_WINDOW | DCX_INTERSECTUPDATE);
@@ -1421,7 +1421,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) GetWindowRect(hwnd, &winrect);
//if entire region needs painting, then make a region to cover the entire window
- if(fUpdateAll)
+ if (fUpdateAll)
hrgn = (HRGN)wParam;
else
hrgn = (HRGN)wParam;
@@ -1433,7 +1433,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) // Only draw the horizontal scrollbar if the window is tall enough
//
sb = &sw->sbarHorz;
- if(sb->fScrollVisible)
+ if (sb->fScrollVisible)
{
int hbarwidth = 0, leftright = 0;
@@ -1453,7 +1453,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) hbarwidth = rect.right - rect.left;
//check that we can fit any left/right buttons in the available space
- if(sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE))
+ if (sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE))
{
//adjust the scrollbar rectangle to fit the buttons into
sb->fButVisibleAfter = TRUE;
@@ -1461,7 +1461,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) leftright |= SBBP_RIGHT;
//check that there is enough space for the right buttons
- if(sb->nButSizeBefore + sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE))
+ if (sb->nButSizeBefore + sb->nButSizeAfter < (hbarwidth - MIN_COOLSB_SIZE))
{
sb->fButVisibleBefore = TRUE;
rect.left += sb->nButSizeBefore;
@@ -1477,7 +1477,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) DrawHorzButtons(sb, hdc, &rect, leftright);
#endif// INCLUDE_BUTTONS
- if(uCurrentScrollbar == SB_HORZ)
+ if (uCurrentScrollbar == SB_HORZ)
fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion);
else
fCustomDraw |= NCDrawHScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NONE);
@@ -1487,7 +1487,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) // Only draw the vertical scrollbar if the window is wide enough to accomodate it
//
sb = &sw->sbarVert;
- if(sb->fScrollVisible)
+ if (sb->fScrollVisible)
{
int vbarheight = 0, updown = 0;
@@ -1507,7 +1507,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) vbarheight = rect.bottom - rect.top;
//check that we can fit any left/right buttons in the available space
- if(sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE))
+ if (sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE))
{
//adjust the scrollbar rectangle to fit the buttons into
sb->fButVisibleAfter = TRUE;
@@ -1515,7 +1515,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) updown |= SBBP_BOTTOM;
//check that there is enough space for the right buttons
- if(sb->nButSizeBefore + sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE))
+ if (sb->nButSizeBefore + sb->nButSizeAfter < (vbarheight - MIN_COOLSB_SIZE))
{
sb->fButVisibleBefore = TRUE;
rect.top += sb->nButSizeBefore;
@@ -1531,7 +1531,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) DrawVertButtons(sb, hdc, &rect, updown);
#endif // INCLUDE_BUTTONS
- if(uCurrentScrollbar == SB_VERT)
+ if (uCurrentScrollbar == SB_VERT)
fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion);
else
fCustomDraw |= NCDrawVScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NONE);
@@ -1563,7 +1563,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) // DRAW THE DEAD AREA
// only do this if the horizontal and vertical bars are visible
- if(sw->sbarHorz.fScrollVisible && sw->sbarVert.fScrollVisible)
+ if (sw->sbarHorz.fScrollVisible && sw->sbarVert.fScrollVisible)
{
GetWindowRect(hwnd, &rect);
OffsetRect(&rect, -winrect.left, -winrect.top);
@@ -1571,7 +1571,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) rect.bottom -= sw->cyBottomEdge;
rect.top = rect.bottom - GetScrollMetric(&sw->sbarHorz, SM_CYHORZSB);
- if(sw->fLeftScrollbar)
+ if (sw->fLeftScrollbar)
{
rect.left += sw->cxLeftEdge;
rect.right = rect.left + GetScrollMetric(&sw->sbarVert, SM_CXVERTSB);
@@ -1582,7 +1582,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) rect.left = rect.right - GetScrollMetric(&sw->sbarVert, SM_CXVERTSB);
}
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, SB_BOTH, &rect, 32, 0, 0, 0);
else
{
@@ -1633,12 +1633,12 @@ static LRESULT NCHitTest(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) GetVScrollRect(sw, hwnd, &vrect);
//Clicked in the horizontal scrollbar area
- if(sw->sbarHorz.fScrollVisible && PtInRect(&hrect, pt))
+ if (sw->sbarHorz.fScrollVisible && PtInRect(&hrect, pt))
{
return HTHSCROLL;
}
//Clicked in the vertical scrollbar area
- else if(sw->sbarVert.fScrollVisible && PtInRect(&vrect, pt))
+ else if (sw->sbarVert.fScrollVisible && PtInRect(&vrect, pt))
{
return HTVSCROLL;
}
@@ -1657,14 +1657,14 @@ static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) {
RECT rc = *rect;
- if(y < rc.top || y >= rc.bottom) return HTSCROLL_NONE;
+ if (y < rc.top || y >= rc.bottom) return HTSCROLL_NONE;
#ifdef INCLUDE_BUTTONS
- if(sb->fButVisibleBefore)
+ if (sb->fButVisibleBefore)
{
//clicked on the buttons to the left of the scrollbar
- if(x >= rc.left && x < rc.left + sb->nButSizeBefore)
+ if (x >= rc.left && x < rc.left + sb->nButSizeBefore)
return HTSCROLL_INSERTED;
//adjust the rectangle to exclude the left-side buttons, now that we
@@ -1672,10 +1672,10 @@ static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) rc.left += sb->nButSizeBefore;
}
- if(sb->fButVisibleAfter)
+ if (sb->fButVisibleAfter)
{
//clicked on the buttons to the right of the scrollbar
- if(x >= rc.right - sb->nButSizeAfter && x < rc.right)
+ if (x >= rc.right - sb->nButSizeAfter && x < rc.right)
return HTSCROLL_INSERTED;
//adjust the rectangle to exclude the right-side buttons, now that we
@@ -1707,9 +1707,9 @@ static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) //
static UINT GetPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y)
{
- if(sb->nBarType == SB_HORZ)
+ if (sb->nBarType == SB_HORZ)
return GetHorzPortion(sb, hwnd, rect, x, y);
- else if(sb->nBarType == SB_VERT)
+ else if (sb->nBarType == SB_VERT)
return GetVertPortion(sb, hwnd, rect, x, y);
else
return HTSCROLL_NONE;
@@ -1721,8 +1721,8 @@ static UINT GetPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) //
static void GetRealHorzScrollRect(SCROLLBAR *sb, RECT *rect)
{
- if(sb->fButVisibleBefore) rect->left += sb->nButSizeBefore;
- if(sb->fButVisibleAfter) rect->right -= sb->nButSizeAfter;
+ if (sb->fButVisibleBefore) rect->left += sb->nButSizeBefore;
+ if (sb->fButVisibleAfter) rect->right -= sb->nButSizeAfter;
}
//
@@ -1731,8 +1731,8 @@ static void GetRealHorzScrollRect(SCROLLBAR *sb, RECT *rect) //
static void GetRealVertScrollRect(SCROLLBAR *sb, RECT *rect)
{
- if(sb->fButVisibleBefore) rect->top += sb->nButSizeBefore;
- if(sb->fButVisibleAfter) rect->bottom -= sb->nButSizeAfter;
+ if (sb->fButVisibleBefore) rect->top += sb->nButSizeBefore;
+ if (sb->fButVisibleAfter) rect->bottom -= sb->nButSizeAfter;
}
//
@@ -1741,11 +1741,11 @@ static void GetRealVertScrollRect(SCROLLBAR *sb, RECT *rect) //
static void GetRealScrollRect(SCROLLBAR *sb, RECT *rect)
{
- if(sb->nBarType == SB_HORZ)
+ if (sb->nBarType == SB_HORZ)
{
GetRealHorzScrollRect(sb, rect);
}
- else if(sb->nBarType == SB_VERT)
+ else if (sb->nBarType == SB_VERT)
{
GetRealVertScrollRect(sb, rect);
}
@@ -1773,20 +1773,20 @@ static UINT GetHorzButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fRetur if (!PtInRect(rect, pt))
return -1;
- if(sb->fButVisibleAfter)
+ if (sb->fButVisibleAfter)
rightpos -= sb->nButSizeAfter;
for (i = 0; i < sb->nButtons; i++)
{
- if(sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT)
+ if (sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT)
{
butwidth = GetSingleButSize(sb, &sbut[i]);
//if the current button is under the specified point
- if(pt.x >= leftpos && pt.x < leftpos + butwidth)
+ if (pt.x >= leftpos && pt.x < leftpos + butwidth)
{
//if the caller wants us to return the rectangle of the button
- if(fReturnRect)
+ if (fReturnRect)
{
rect->left = leftpos;
rect->right = leftpos + butwidth;
@@ -1797,15 +1797,15 @@ static UINT GetHorzButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fRetur leftpos += butwidth;
}
- else if(sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT)
+ else if (sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT)
{
butwidth = GetSingleButSize(sb, &sbut[i]);
//if the current button is under the specified point
- if(pt.x >= rightpos && pt.x < rightpos + butwidth)
+ if (pt.x >= rightpos && pt.x < rightpos + butwidth)
{
//if the caller wants us to return the rectangle of the button
- if(fReturnRect)
+ if (fReturnRect)
{
rect->left = rightpos;
rect->right = rightpos + butwidth;
@@ -1845,7 +1845,7 @@ static UINT GetVertButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fRetur //
static UINT GetButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fReturnRect)
{
- if(sb->nBarType == SB_HORZ)
+ if (sb->nBarType == SB_HORZ)
{
return GetHorzButtonFromPt(sb, rect, pt, fReturnRect);
}
@@ -1864,24 +1864,24 @@ static UINT GetHorzButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) SCROLLBUT *sbut = sb->sbButtons;
int leftpos = rect->left, rightpos = rect->right;
- if(sb->fButVisibleAfter)
+ if (sb->fButVisibleAfter)
rightpos -= sb->nButSizeAfter;
//find the particular button in question
for (i = 0; i < index; i++)
{
- if(sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT)
+ if (sb->fButVisibleBefore && sbut[i].uPlacement == SBBP_LEFT)
{
leftpos += GetSingleButSize(sb, &sbut[i]);
}
- else if(sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT)
+ else if (sb->fButVisibleAfter && sbut[i].uPlacement == SBBP_RIGHT)
{
rightpos += GetSingleButSize(sb, &sbut[i]);
}
}
//now return the rectangle
- if(sbut[i].uPlacement == SBBP_LEFT)
+ if (sbut[i].uPlacement == SBBP_LEFT)
{
rect->left = leftpos;
rect->right = leftpos + GetSingleButSize(sb, &sbut[i]);
@@ -1906,7 +1906,7 @@ static UINT GetVertButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index) static UINT GetButtonRectFromId(SCROLLBAR *sb, RECT *rect, UINT index)
{
- if(sb->nBarType == SB_HORZ)
+ if (sb->nBarType == SB_HORZ)
{
return GetHorzButtonRectFromId(sb, rect, index);
}
@@ -1936,7 +1936,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //
// HORIZONTAL SCROLLBAR PROCESSING
//
- if(wParam == HTHSCROLL)
+ if (wParam == HTHSCROLL)
{
uScrollTimerMsg = WM_HSCROLL;
uCurrentScrollbar = SB_HORZ;
@@ -1949,7 +1949,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //
// VERTICAL SCROLLBAR PROCESSING
//
- else if(wParam == HTVSCROLL)
+ else if (wParam == HTVSCROLL)
{
uScrollTimerMsg = WM_VSCROLL;
uCurrentScrollbar = SB_VERT;
@@ -2021,7 +2021,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa sw->fThumbTracking = TRUE;
sb->scrollInfo.nTrackPos = sb->scrollInfo.nPos;
- if(wParam == HTVSCROLL)
+ if (wParam == HTVSCROLL)
nThumbMouseOffset = pt.y - nThumbPos;
else
nThumbMouseOffset = pt.x - nThumbPos;
@@ -2029,7 +2029,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa nLastPos = -sb->scrollInfo.nPos;
nThumbPos0 = nThumbPos;
- //if(sb->fFlatScrollbar)
+ //if (sb->fFlatScrollbar)
//{
GetWindowRect(hwnd, &winrect);
OffsetRect(&rect, -winrect.left, -winrect.top);
@@ -2042,11 +2042,11 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //Any part of the scrollbar
case HTSCROLL_LEFT:
- if(sb->fScrollFlags & ESB_DISABLE_LEFT) return 0;
+ if (sb->fScrollFlags & ESB_DISABLE_LEFT) return 0;
else goto target1;
case HTSCROLL_RIGHT:
- if(sb->fScrollFlags & ESB_DISABLE_RIGHT) return 0;
+ if (sb->fScrollFlags & ESB_DISABLE_RIGHT) return 0;
else goto target1;
goto target1;
@@ -2068,7 +2068,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa // Check what area the mouse is now over :
// 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)
+ if (uCurrentScrollbar == SB_HORZ)
uScrollTimerPortion = GetHorzScrollPortion(sb, hwnd, &rect, pt.x, pt.y);
else
uScrollTimerPortion = GetVertScrollPortion(sb, hwnd, &rect, pt.x, pt.y);
@@ -2080,7 +2080,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa #ifndef HOT_TRACKING
//if we aren't hot-tracking, then don't highlight
//the scrollbar thumb unless we click on it
- if(uScrollTimerPortion == HTSCROLL_THUMB)
+ if (uScrollTimerPortion == HTSCROLL_THUMB)
uScrollTimerPortion = HTSCROLL_NONE;
#endif
NCDrawScrollbar(sb, hwnd, hdc, &rect, uScrollTimerPortion);
@@ -2116,7 +2116,7 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) UINT buttonIdx = 0;
//current scrollportion is the button that we clicked down on
- if(uCurrentScrollPortion != HTSCROLL_NONE)
+ if (uCurrentScrollPortion != HTSCROLL_NONE)
{
SCROLLBAR *sb = &sw->sbarHorz;
lParam = GetMessagePos();
@@ -2127,13 +2127,13 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) pt.y = HIWORD(lParam);
//emulate the mouse input on a scrollbar here...
- if(uCurrentScrollbar == SB_HORZ)
+ if (uCurrentScrollbar == SB_HORZ)
{
//get the total area of the normal Horz scrollbar area
sb = &sw->sbarHorz;
GetHScrollRect(sw, hwnd, &rect);
}
- else if(uCurrentScrollbar == SB_VERT)
+ else if (uCurrentScrollbar == SB_VERT)
{
//get the total area of the normal Horz scrollbar area
sb = &sw->sbarVert;
@@ -2157,7 +2157,7 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //Send the notification BEFORE we redraw, so the
//bitmap can be changed smoothly by the user if they require
- if(uCurrentButton == buttonIdx)
+ if (uCurrentButton == buttonIdx)
{
SCROLLBUT *sbut = &sb->sbButtons[buttonIdx];
UINT cmdid = sbut->uCmdId;
@@ -2167,7 +2167,7 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //send a notify??
//only post a message if the command id is valid
- if(cmdid != -1 && cmdid > 0)
+ if (cmdid != -1 && cmdid > 0)
SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(cmdid, CSBN_CLICKED), 0);
//user might have deleted this button, so redraw whole area
@@ -2194,7 +2194,7 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) case HTSCROLL_THUMB:
//In case we were thumb tracking, make sure we stop NOW
- if(sw->fThumbTracking == TRUE)
+ if (sw->fThumbTracking == TRUE)
{
SendScrollMessage(hwnd, uScrollTimerMsg, SB_THUMBPOSITION, nLastPos);
sw->fThumbTracking = FALSE;
@@ -2230,7 +2230,7 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) {
/*
// Can't remember why I did this!
- if(GetCapture() == hwnd)
+ if (GetCapture() == hwnd)
{
ReleaseCapture();
}*/
@@ -2284,13 +2284,13 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) {
//keep the thumb within the scrollbar limits
thumbpos = pt.x - nThumbMouseOffset;
- if(thumbpos < rc.left) thumbpos = rc.left;
- if(thumbpos > rc.right - nThumbSize) thumbpos = rc.right - nThumbSize;
+ if (thumbpos < rc.left) thumbpos = rc.left;
+ if (thumbpos > rc.right - nThumbSize) thumbpos = rc.right - nThumbSize;
}
GetWindowRect(hwnd, &winrect);
- if(sbar->nBarType == SB_VERT)
+ if (sbar->nBarType == SB_VERT)
RotateRect(&winrect);
hdc = GetWindowDC(hwnd);
@@ -2306,7 +2306,7 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) SetRect(&rc2, rc.left, rc.top, thumbpos, rc.bottom);
RotateRect0(sbar, &rc2);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_PAGELEFT, 0, 0, 0);
else
DrawCheckedRect(hdc, &rc2, crCheck1, crCheck2);
@@ -2318,7 +2318,7 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) RotateRect0(sbar, &rc2);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_PAGERIGHT, 0, 0, 0);
else
DrawCheckedRect(hdc, &rc2, crCheck1, crCheck2);
@@ -2330,13 +2330,13 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) RotateRect0(sbar, &rc2);
- if(fCustomDraw)
+ if (fCustomDraw)
PostCustomDrawNotify(hwnd, hdc, sbar->nBarType, &rc2, SB_THUMBTRACK, TRUE, TRUE, FALSE);
else
{
#ifdef FLAT_SCROLLBARS
- if(sbar->fFlatScrollbar)
+ if (sbar->fFlatScrollbar)
PaintRect(hdc, &rc2, GetSysColor(COLOR_3DSHADOW));
else
#endif
@@ -2351,12 +2351,12 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) //post a SB_TRACKPOS message!!!
siMaxMin = si->nMax - si->nMin;
- if(siMaxMin > 0)
+ if (siMaxMin > 0)
pos = MulDiv(thumbpos-rc.left, siMaxMin-si->nPage + 1, rc.right-rc.left-nThumbSize);
else
pos = thumbpos - rc.left;
- if(pos != nLastPos)
+ if (pos != nLastPos)
{
si->nTrackPos = pos;
SendScrollMessage(hwnd, uScrollTimerMsg, SB_THUMBTRACK, pos);
@@ -2399,22 +2399,22 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) RECT winrect;
UINT buttonIdx = 0;
- if(sw->fThumbTracking == TRUE)
+ if (sw->fThumbTracking == TRUE)
{
int x, y;
lParam = GetMessagePos();
x = LOWORD(lParam);
y = HIWORD(lParam);
- if(uCurrentScrollbar == SB_HORZ)
+ if (uCurrentScrollbar == SB_HORZ)
return ThumbTrackHorz(&sw->sbarHorz, hwnd, x,y);
- else if(uCurrentScrollbar == SB_VERT)
+ else if (uCurrentScrollbar == SB_VERT)
return ThumbTrackVert(&sw->sbarVert, hwnd, x,y);
}
- if(uCurrentScrollPortion == HTSCROLL_NONE)
+ if (uCurrentScrollPortion == HTSCROLL_NONE)
{
return CallWindowProc(sw->oldproc, hwnd, WM_MOUSEMOVE, wParam, lParam);
}
@@ -2432,11 +2432,11 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) pt.y = HIWORD(nlParam);
//emulate the mouse input on a scrollbar here...
- if(uCurrentScrollbar == SB_HORZ)
+ if (uCurrentScrollbar == SB_HORZ)
{
sb = &sw->sbarHorz;
}
- else if(uCurrentScrollbar == SB_VERT)
+ else if (uCurrentScrollbar == SB_VERT)
{
sb = &sw->sbarVert;
}
@@ -2467,19 +2467,19 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //if the button to the LEFT of the current
//button is resizable, then resize it
#ifdef RESIZABLE_BUTTONS
- if(uCurrentButton > 0)
+ if (uCurrentButton > 0)
{
sbut = &sb->sbButtons[uCurrentButton - 1];
//only resize if BOTH buttons are on same side of scrollbar
- if(sbut->uPlacement == (sbut+1)->uPlacement && (sbut->uButType & SBBM_RESIZABLE))
+ if (sbut->uPlacement == (sbut+1)->uPlacement && (sbut->uButType & SBBM_RESIZABLE))
{
int oldsize = sbut->nSize;
int butsize1, butsize2;
RECT rect2;
int scrollsize;
- if(uCurrentScrollbar == SB_HORZ)
+ if (uCurrentScrollbar == SB_HORZ)
{
rect.left -= GetSingleButSize(sb, sbut);
sbut->nSize = pt.x - rect.left;
@@ -2490,8 +2490,8 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) sbut->nSize = pt.y - rect.top;
}
- //if(sbut->nSize < 0) sbut->nSize = 0;
- if(sbut->nSize < (int)sbut->nMinSize)
+ //if (sbut->nSize < 0) sbut->nSize = 0;
+ if (sbut->nSize < (int)sbut->nMinSize)
sbut->nSize = sbut->nMinSize;
if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize)
@@ -2499,7 +2499,7 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) GetScrollRect(sw, uCurrentScrollbar, hwnd, &rect2);
- if(uCurrentScrollbar == SB_HORZ)
+ if (uCurrentScrollbar == SB_HORZ)
scrollsize = rect2.right-rect2.left;
else
scrollsize = rect2.bottom-rect2.top;
@@ -2508,7 +2508,7 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) butsize2 = GetButtonSize(sb, hwnd, SBBP_RIGHT);
//adjust the button size if it gets too big
- if(butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
+ if (butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
{
sbut->nSize -= (butsize1+butsize2) - (scrollsize - MINSCROLLSIZE);
}
@@ -2527,19 +2527,19 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //if the button under the mouse is not the active button,
//then display the active button in its normal state
- if(buttonIdx != uCurrentButton
+ if (buttonIdx != uCurrentButton
//include this if toggle buttons always stay depressed
//if they are being activated
&& (sb->sbButtons[uCurrentButton].uButType & SBBT_MASK) != SBBT_TOGGLEBUTTON)
{
- if(lastbutton != buttonIdx)
+ if (lastbutton != buttonIdx)
DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_NORMAL);
}
//otherwise, depress the active button if the mouse is over
//it (just like a normal scroll button works)
else
{
- if(lastbutton != buttonIdx)
+ if (lastbutton != buttonIdx)
DrawScrollButton(&sb->sbButtons[uCurrentButton], hdc, &rect, SBBS_PUSHED);
}
@@ -2561,11 +2561,11 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) OffsetRect(&rect, -winrect.left, -winrect.top);
hdc = GetWindowDC(hwnd);
- if(thisportion != uCurrentScrollPortion)
+ if (thisportion != uCurrentScrollPortion)
{
uScrollTimerPortion = HTSCROLL_NONE;
- if(lastportion != thisportion)
+ if (lastportion != thisportion)
NCDrawScrollbar(sb, hwnd, hdc, &rect, HTSCROLL_NORMAL);
}
//otherwise, draw the button in its depressed / clicked state
@@ -2573,7 +2573,7 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) {
uScrollTimerPortion = uCurrentScrollPortion;
- if(lastportion != thisportion)
+ if (lastportion != thisportion)
NCDrawScrollbar(sb, hwnd, hdc, &rect, thisportion);
}
@@ -2610,7 +2610,7 @@ static void ResizeButtonsToFit(SCROLLWND *sw, SCROLLBAR *sbar, HWND hwnd) //shrinking any resizable buttons
GetScrollRect(sw, sbar->nBarType, hwnd, &rc);
- if(sbar->nBarType == SB_HORZ)
+ if (sbar->nBarType == SB_HORZ)
scrollsize = rc.right-rc.left;
else
scrollsize = rc.bottom-rc.top;
@@ -2621,7 +2621,7 @@ static void ResizeButtonsToFit(SCROLLWND *sw, SCROLLBAR *sbar, HWND hwnd) for (i = 0; i < sbar->nButtons; i++)
{
sbut = &sbar->sbButtons[i];
- if(sbut->uButType & SBBM_RESIZABLE)
+ if (sbut->uButType & SBBM_RESIZABLE)
{
sbut->nSize = sbut->nSizeReserved;
}
@@ -2630,19 +2630,19 @@ static void ResizeButtonsToFit(SCROLLWND *sw, SCROLLBAR *sbar, HWND hwnd) butsize1 = GetButtonSize(sbar, hwnd, SBBP_LEFT);
butsize2 = GetButtonSize(sbar, hwnd, SBBP_RIGHT);
- if(butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
+ if (butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
{
i = 0;
while(i < sbar->nButtons &&
butsize1 + butsize2 > scrollsize - MINSCROLLSIZE)
{
sbut = &sbar->sbButtons[i++];
- if(sbut->uButType & SBBM_RESIZABLE)
+ if (sbut->uButType & SBBM_RESIZABLE)
{
int oldsize = sbut->nSize;
sbut->nSize -= (butsize1+butsize2) - (scrollsize-MINSCROLLSIZE);
- if(sbut->nSize < (int)sbut->nMinSize)
+ if (sbut->nSize < (int)sbut->nMinSize)
sbut->nSize = sbut->nMinSize;
if ((UINT)sbut->nSize > (UINT)sbut->nMaxSize)
@@ -2732,7 +2732,7 @@ static LRESULT NCCalcSize(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam if ((sb->fScrollFlags & CSBS_VISIBLE) &&
rect->right - rect->left >= GetScrollMetric(sb, SM_CXVERTSB))
{
- if(sw->fLeftScrollbar)
+ if (sw->fLeftScrollbar)
rect->left += GetScrollMetric(sb, SM_CXVERTSB);
else
rect->right -= GetScrollMetric(sb, SM_CXVERTSB);
@@ -2764,9 +2764,9 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa //over one of the scrollbars
#ifdef HOT_TRACKING
hwndCurCoolSB = hwnd;
- if(wHitTest == HTHSCROLL)
+ if (wHitTest == HTHSCROLL)
{
- if(uMouseOverScrollbar == SB_HORZ)
+ if (uMouseOverScrollbar == SB_HORZ)
return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam);
uLastHitTestPortion = HTSCROLL_NONE;
@@ -2777,9 +2777,9 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa NCPaint(sw, hwnd, 1, 0);
}
- else if(wHitTest == HTVSCROLL)
+ else if (wHitTest == HTVSCROLL)
{
- if(uMouseOverScrollbar == SB_VERT)
+ if (uMouseOverScrollbar == SB_VERT)
return CallWindowProc(sw->oldproc, hwnd, WM_NCMOUSEMOVE, wHitTest, lParam);
uLastHitTestPortion = HTSCROLL_NONE;
@@ -2801,21 +2801,21 @@ static LRESULT NCMouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wHitTest, LPARAM lPa static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM lParam)
{
//let all timer messages go past if we don't have a timer installed ourselves
- if(uScrollTimerId == 0 && uMouseOverId == 0)
+ if (uScrollTimerId == 0 && uMouseOverId == 0)
{
return CallWindowProc(swnd->oldproc, hwnd, WM_TIMER, wTimerId, lParam);
}
#ifdef HOT_TRACKING
//mouse-over timer
- if(wTimerId == COOLSB_TIMERID3)
+ if (wTimerId == COOLSB_TIMERID3)
{
POINT pt;
RECT rect, winrect;
HDC hdc;
SCROLLBAR *sbar;
- if(swnd->fThumbTracking)
+ if (swnd->fThumbTracking)
return 0;
//if the mouse moves outside the current scrollbar,
@@ -2834,7 +2834,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM }
else
{
- if(uMouseOverScrollbar == SB_HORZ)
+ if (uMouseOverScrollbar == SB_HORZ)
{
sbar = &swnd->sbarHorz;
uHitTestPortion = GetHorzPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y);
@@ -2845,7 +2845,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM uHitTestPortion = GetVertPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y);
}
- if(uLastHitTestPortion != uHitTestPortion)
+ if (uLastHitTestPortion != uHitTestPortion)
{
rect = MouseOverRect;
GetRealScrollRect(sbar, &rect);
@@ -2869,14 +2869,14 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM //regular timer interval to auto-generate scroll messages
//this gives a slight pause between first pressing the scroll arrow, and the
//actual scroll starting
- if(wTimerId == COOLSB_TIMERID1)
+ if (wTimerId == COOLSB_TIMERID1)
{
KillTimer(hwnd, uScrollTimerId);
uScrollTimerId = SetTimer(hwnd, COOLSB_TIMERID2, COOLSB_TIMERINTERVAL2, 0);
return 0;
}
//send the scrollbar message repeatedly
- else if(wTimerId == COOLSB_TIMERID2)
+ else if (wTimerId == COOLSB_TIMERID2)
{
//need to process a spoof WM_MOUSEMOVE, so that
//we know where the mouse is each time the scroll timer goes off.
@@ -2888,7 +2888,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM MouseMove(swnd, hwnd, MK_LBUTTON, MAKELPARAM(pt.x, pt.y));
- if(uScrollTimerPortion != HTSCROLL_NONE)
+ if (uScrollTimerPortion != HTSCROLL_NONE)
SendScrollMessage(hwnd, uScrollTimerMsg, uScrollTimerPortion, 0);
return 0;
@@ -2907,9 +2907,9 @@ static LRESULT CoolSB_StyleChange(SCROLLWND *swnd, HWND hwnd, UINT msg, WPARAM w {
STYLESTRUCT *ss = (STYLESTRUCT *)lParam;
- if(wParam == GWL_EXSTYLE)
+ if (wParam == GWL_EXSTYLE)
{
- if(ss->styleNew & WS_EX_LEFTSCROLLBAR)
+ if (ss->styleNew & WS_EX_LEFTSCROLLBAR)
swnd->fLeftScrollbar = TRUE;
else
swnd->fLeftScrollbar = FALSE;
@@ -2925,7 +2925,7 @@ static LRESULT CoolSB_Notify(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM l NMTTDISPINFO *nmdi = (NMTTDISPINFO *)lParam;
- if(nmdi->hdr.hwndFrom == swnd->hwndToolTip &&
+ if (nmdi->hdr.hwndFrom == swnd->hwndToolTip &&
nmdi->hdr.code == TTN_GETDISPINFO)
{
//convert the tooltip notify from a "ISHWND" style
@@ -2974,7 +2974,7 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA #ifdef HIDE_CURSOR_AFTER_MOUSEUP
static UINT lastmsg;
- if(lastmsg == WM_LBUTTONDOWN)
+ if (lastmsg == WM_LBUTTONDOWN)
{
lastmsg = hi;
return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam);
@@ -2984,13 +2984,13 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA #endif
//if we are over either or our scrollbars
- if(lo == HTHSCROLL || lo == HTVSCROLL)
+ if (lo == HTHSCROLL || lo == HTVSCROLL)
{
xy = GetMessagePos();
pt.x = LOWORD(xy);
pt.y = HIWORD(xy);
- if(lo == HTHSCROLL)
+ if (lo == HTHSCROLL)
{
sbar = &swnd->sbarHorz;
GetScrollRect(swnd, SB_HORZ, hwnd, &rect);
@@ -3003,9 +3003,9 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA id = GetVertPortion(sbar, hwnd, &rect, pt.x, pt.y);
}
- if(id != HTSCROLL_INSERTED)
+ if (id != HTSCROLL_INSERTED)
{
- if(swnd->hwndToolTip != 0)
+ if (swnd->hwndToolTip != 0)
{
SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, FALSE, 0);
SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0);
@@ -3014,7 +3014,7 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA return CallWindowProc(swnd->oldproc, hwnd, WM_SETCURSOR, wParam, lParam);
}
- if(swnd->hwndToolTip != 0)
+ if (swnd->hwndToolTip != 0)
{
SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, TRUE, 0);
}
@@ -3025,15 +3025,15 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA sbut = &sbar->sbButtons[id];
curTool = sbut->uCmdId;
- if(lastid != id && swnd->hwndToolTip != 0)
+ if (lastid != id && swnd->hwndToolTip != 0)
{
- if(IsWindowVisible(swnd->hwndToolTip))
+ if (IsWindowVisible(swnd->hwndToolTip))
SendToolTipMessage(swnd->hwndToolTip, TTM_UPDATE, TRUE, 0);
}
lastid = id;
- if(sbut->hCurs != 0)
+ if (sbut->hCurs != 0)
{
SetCursor(sbut->hCurs);
return 0;
@@ -3045,7 +3045,7 @@ static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARA lastid = -1;
}
}
- else if(swnd->hwndToolTip != 0)
+ else if (swnd->hwndToolTip != 0)
{
SendToolTipMessage(swnd->hwndToolTip, TTM_ACTIVATE, FALSE, 0);
SendToolTipMessage(swnd->hwndToolTip, TTM_POP, 0, 0);
@@ -3116,14 +3116,14 @@ LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lP case WM_NCRBUTTONDOWN: case WM_NCRBUTTONUP:
case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP:
RelayMouseEvent(hwnd, swnd->hwndToolTip, (WM_MOUSEMOVE-WM_NCMOUSEMOVE) + (message));
- if(wParam == HTHSCROLL || wParam == HTVSCROLL)
+ if (wParam == HTHSCROLL || wParam == HTVSCROLL)
return 0;
else
break;
case WM_NCLBUTTONDBLCLK:
//TRACE("WM_NCLBUTTONDBLCLK %d\n", count++);
- if(wParam == HTHSCROLL || wParam == HTVSCROLL)
+ if (wParam == HTHSCROLL || wParam == HTVSCROLL)
return NCLButtonDown(swnd, hwnd, wParam, lParam);
else
break;
@@ -3155,7 +3155,7 @@ LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lP // return CoolSB_StyleChange(swnd, hwnd, WM_STYLECHANGING, wParam, lParam);
case WM_STYLECHANGED:
- if(swnd->bPreventStyleChange)
+ if (swnd->bPreventStyleChange)
{
// the NCPAINT handler has told us to eat this message!
return 0;
@@ -3181,7 +3181,7 @@ LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lP //if the cursor isn't moving, because they will think that the mouse
//is moving position, and the internal timer will never expire
//
- if(lastpos != lParam)
+ if (lastpos != lParam)
{
RelayMouseEvent(hwnd, swnd->hwndToolTip, WM_MOUSEMOVE);
lastpos = lParam;
|