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/CLCButton.cpp | 35 +- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 18 +- plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 138 ++++---- plugins/Clist_nicer/src/Coolsb/coolscroll.cpp | 410 +++++++++++----------- plugins/Clist_nicer/src/Docking.cpp | 2 +- plugins/Clist_nicer/src/Include/clc.h | 2 + plugins/Clist_nicer/src/Include/rowheight_funcs.h | 4 +- plugins/Clist_nicer/src/alphablend.cpp | 22 +- plugins/Clist_nicer/src/clcidents.cpp | 2 +- plugins/Clist_nicer/src/clcitems.cpp | 100 +++--- plugins/Clist_nicer/src/clcmsgs.cpp | 36 +- plugins/Clist_nicer/src/clcpaint.cpp | 160 ++++----- plugins/Clist_nicer/src/clcutils.cpp | 46 +-- plugins/Clist_nicer/src/clistevents.cpp | 26 +- plugins/Clist_nicer/src/clistmenus.cpp | 86 ++--- plugins/Clist_nicer/src/clistmod.cpp | 12 +- plugins/Clist_nicer/src/clisttray.cpp | 12 +- plugins/Clist_nicer/src/clui.cpp | 12 +- plugins/Clist_nicer/src/cluiopts.cpp | 18 +- plugins/Clist_nicer/src/cluiservices.cpp | 22 +- plugins/Clist_nicer/src/config.cpp | 28 +- plugins/Clist_nicer/src/contact.cpp | 32 +- plugins/Clist_nicer/src/extBackg.cpp | 168 ++++----- plugins/Clist_nicer/src/init.cpp | 14 +- plugins/Clist_nicer/src/rowheight_funcs.cpp | 6 +- plugins/Clist_nicer/src/statusbar.cpp | 20 +- plugins/Clist_nicer/src/statusfloater.cpp | 122 +++---- plugins/Clist_nicer/src/viewmodes.cpp | 154 ++++---- plugins/Clist_nicer/src/wallpaper.cpp | 2 +- 29 files changed, 863 insertions(+), 846 deletions(-) diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 2f01b7d3db..ec2b7d0932 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -27,6 +27,7 @@ struct char *pszButtonID, *pszButtonDn, *pszButtonName; int isPush, isVis, isAction; HANDLE hButton; + HWND hwndButton; } static BTNS[] = { @@ -101,6 +102,15 @@ void ClcSetButtonState(int ctrlid, int status) } } +HWND ClcGetButtonWindow(int ctrlid) +{ + for (int i=0; i < SIZEOF(BTNS); i++) + if (BTNS[i].ctrlid == ctrlid) + return BTNS[i].hwndButton; + + return NULL; +} + ///////////////////////////////////////////////////////////////////////////////////////// struct MButtonExtension : public MButtonCtrl @@ -170,7 +180,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) HBRUSH hbr; RECT rc = rcClient; - if(ctl->buttonItem) { + if (ctl->buttonItem) { RECT rcParent; POINT pt; HWND hwndParent = pcli->hwndContactList; @@ -184,16 +194,16 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ScreenToClient(pcli->hwndContactList, &pt); BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); - if(imgItem) + if (imgItem) DrawAlpha(hdcMem, &rc, 0, 0, 0, 0, 0, 0, 0, imgItem); - if(g_glyphItem) { + if (g_glyphItem) { API::pfnAlphaBlend(hdcMem, (rc.right - glyphMetrics[2]) / 2, (rc.bottom - glyphMetrics[3]) / 2, glyphMetrics[2], glyphMetrics[3], g_glyphItem->hdc, glyphMetrics[0], glyphMetrics[1], glyphMetrics[2], glyphMetrics[3], g_glyphItem->bf); } } - else if(ctl->bIsSkinned) { // skinned + else if (ctl->bIsSkinned) { // skinned RECT rcParent; POINT pt; HWND hwndParent = pcli->hwndContactList; @@ -206,21 +216,21 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ScreenToClient(pcli->hwndContactList, &pt); - if(HIWORD(ctl->bIsSkinned)) + if (HIWORD(ctl->bIsSkinned)) item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED); else item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED); item = &StatusItems[item_id - ID_STATUS_OFFLINE]; SetTextColor(hdcMem, item->TEXTCOLOR); - if(item->IGNORED) { - if(pt.y < 10 || cfg::dat.bWallpaperMode) + if (item->IGNORED) { + if (pt.y < 10 || cfg::dat.bWallpaperMode) BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); else FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); } else { - if(pt.y < 10 || cfg::dat.bWallpaperMode) + if (pt.y < 10 || cfg::dat.bWallpaperMode) BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); else FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); @@ -247,7 +257,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) DeleteObject(hbr); } } - if(!ctl->bIsSkinned && ctl->buttonItem == 0) { + if (!ctl->bIsSkinned && ctl->buttonItem == 0) { if (ctl->stateId == PBS_HOT || ctl->focus) { if (ctl->bIsPushed) DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT); @@ -303,7 +313,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) } else { GetTextExtentPoint32(hdcMem, ctl->szText, lstrlen(ctl->szText), &ctl->sLabel); - if(g_cxsmIcon + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left) + if (g_cxsmIcon + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left) ctl->sLabel.cx = (rcClient.right - rcClient.left) - g_cxsmIcon - 8; else ctl->sLabel.cx += 4; @@ -335,7 +345,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) CopyRect(&rcText, &rcClient); SetBkMode(hdcMem, TRANSPARENT); // XP w/themes doesn't used the glossy disabled text. Is it always using COLOR_GRAYTEXT? Seems so. - if(!ctl->bIsSkinned) + if (!ctl->bIsSkinned) SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT)); if (ctl->arrow) DrawState(hdcMem, NULL, NULL, (LPARAM) ctl->arrow, 0, rcClient.right - rcClient.left - 5 - g_cxsmIcon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - g_cysmIcon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), g_cxsmIcon, g_cysmIcon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); @@ -383,7 +393,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case BM_SETIMAGE: - if(!lParam) + if (!lParam) break; bct->hIml = 0; @@ -518,6 +528,7 @@ static void CustomizeToolbar(HANDLE hButton, HWND hWnd, LPARAM) MButtonExtension *bct = (MButtonExtension*) GetWindowLongPtr(hWnd, 0); int idx = getButtonIndex(hButton); if (idx != -1) { // adding built-in button + BTNS[idx].hwndButton = hWnd; bct->iCtrlID = BTNS[idx].ctrlid; if (BTNS[idx].isAction) bct->bSendOnDown = TRUE; diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index 8fbaa547e6..d29a6272e9 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -1154,7 +1154,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) ulockfrm(); return -1; } - if(Frames[pos].Skinned) { + if (Frames[pos].Skinned) { int uID = (Frames[pos].TitleBar.ShowTitleBar ? ID_EXTBKOWNEDFRAMEBORDERTB - ID_STATUS_OFFLINE : ID_EXTBKOWNEDFRAMEBORDER - ID_STATUS_OFFLINE); lParam += (StatusItems[uID].MARGIN_BOTTOM + StatusItems[uID].MARGIN_TOP); } @@ -1168,7 +1168,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) if (Frames[pos].height != oldHeight) { CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,(LPARAM)0); - if(Frames[pos].Skinned) + if (Frames[pos].Skinned) RedrawWindow(Frames[pos].hWnd, 0, 0, RDW_FRAME|RDW_UPDATENOW|RDW_INVALIDATE); } } @@ -2384,7 +2384,7 @@ int SizeFramesByWindowRect(RECT *r) if (!Frames[i].floating) { if (Frames[i].OwnerWindow && Frames[i].OwnerWindow != (HWND) - 2) { /* - if(Frames[i].wndSize.right - Frames[i].wndSize.left == Frames[i].oldWndSize.right - Frames[i].oldWndSize.left && + if (Frames[i].wndSize.right - Frames[i].wndSize.left == Frames[i].oldWndSize.right - Frames[i].oldWndSize.left && Frames[i].wndSize.bottom - Frames[i].wndSize.top == Frames[i].oldWndSize.bottom - Frames[i].oldWndSize.top) noSize = SWP_NOSIZE; else { @@ -2657,7 +2657,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_NCPAINT: { - // if(wParam==1) break; + // if (wParam==1) break; { POINT ptTopLeft={0,0}; HRGN hClientRgn; ClientToScreen(hwnd,&ptTopLeft); @@ -3097,7 +3097,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) height = rect.bottom - rect.top; floatingHeight = cfg::dat.titleBarHeight; - if(floatingHeight <= 0 || floatingHeight > 50) + if (floatingHeight <= 0 || floatingHeight > 50) floatingHeight = 18; Frames[framepos].visible ? ShowWindow(Frames[framepos].ContainerWnd, SW_SHOWNOACTIVATE) : ShowWindow(Frames[framepos].ContainerWnd, SW_HIDE); @@ -3428,15 +3428,15 @@ static INT_PTR SkinDrawBgService(WPARAM wParam, LPARAM lParam) SKINDRAWREQUEST *sdrq = (SKINDRAWREQUEST *)wParam; - if(wParam == 0 || IsBadCodePtr((FARPROC)wParam) || pDrawAlpha == NULL) + if (wParam == 0 || IsBadCodePtr((FARPROC)wParam) || pDrawAlpha == NULL) return 0; hwnd = WindowFromDC(sdrq->hDC); GetClientRect(hwnd, &rc); - if(strstr(sdrq->szObjectID, "/Background") && EqualRect(&sdrq->rcClipRect, &sdrq->rcDestRect)) { + if (strstr(sdrq->szObjectID, "/Background") && EqualRect(&sdrq->rcClipRect, &sdrq->rcDestRect)) { SkinDrawBg(hwnd, sdrq->hDC); GetItemByStatus(ID_EXTBKEVTAREA, &item); - if(item.IGNORED) + if (item.IGNORED) FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE)); else { DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT, @@ -3445,7 +3445,7 @@ static INT_PTR SkinDrawBgService(WPARAM wParam, LPARAM lParam) } else { GetItemByStatus(ID_EXTBKEVTAREA, &item); - if(item.IGNORED) + if (item.IGNORED) FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE)); else { DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT, 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(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; diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index 42feed1bee..cfbbe7caeb 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -104,7 +104,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) return 0; switch (msg->message) { case WM_CREATE: - //if(GetSystemMetrics(SM_CMONITORS)>1) return 0; + //if (GetSystemMetrics(SM_CMONITORS)>1) return 0; if (cfg::getByte("CList", "Docked", 0)) PostMessage(msg->hwnd, WM_CREATEDOCKED, 0, 0); draggingTitle = 0; diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 879fc52553..a1bd91939f 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -486,7 +486,9 @@ void ReloadExtraInfo(HANDLE hContact); void LoadAvatarForContact(struct ClcContact *p); void ApplyViewMode(const char *name); DWORD CalcXMask(HANDLE hContact); + void ClcSetButtonState(int ctrlId, int status); +HWND ClcGetButtonWindow(int ctrlid); //clcpaint.c void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint); diff --git a/plugins/Clist_nicer/src/Include/rowheight_funcs.h b/plugins/Clist_nicer/src/Include/rowheight_funcs.h index 383db5b592..b7e69382d4 100644 --- a/plugins/Clist_nicer/src/Include/rowheight_funcs.h +++ b/plugins/Clist_nicer/src/Include/rowheight_funcs.h @@ -22,7 +22,7 @@ public: int height = 0; //DWORD style=GetWindowLongPtr(hwnd,GWL_STYLE); - //if(contact->iRowHeight == item) + //if (contact->iRowHeight == item) // return(dat->row_heights[item]); if (!Alloc(dat, item + 1)) @@ -31,7 +31,7 @@ public: height = dat->fontInfo[GetBasicFontID(contact)].fontHeight; if (!dat->bisEmbedded) { - if(contact->bSecondLine != MULTIROW_NEVER && contact->bSecondLine != MULTIROW_IFSPACE && contact->type == CLCIT_CONTACT) { + if (contact->bSecondLine != MULTIROW_NEVER && contact->bSecondLine != MULTIROW_IFSPACE && contact->type == CLCIT_CONTACT) { if ((contact->bSecondLine == MULTIROW_ALWAYS || ((cfg::dat.dwFlags & CLUI_FRAME_SHOWSTATUSMSG && contact->bSecondLine == MULTIROW_IFNEEDED) && (contact->xStatus > 0 || cfg::eCache[contact->extraCacheEntry].bStatusMsgValid > STATUSMSG_XSTATUSID)))) height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); } diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index f81c029bad..79b3f8353d 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -48,7 +48,7 @@ DWORD __forceinline argb_from_cola(COLORREF col, UINT32 alpha) void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) { - if(BORDERSTYLE >= 0) { + if (BORDERSTYLE >= 0) { HPEN hPenOld = 0; POINT pt; @@ -77,7 +77,7 @@ void __forceinline DrawBorderStyle(HDC hdcwnd, RECT *rc, DWORD BORDERSTYLE) DrawEdge(hdcwnd, rc, BORDERSTYLE, BF_RECT | BF_SOFT); break; } - if(hPenOld) + if (hPenOld) SelectObject(hdcwnd, hPenOld); } } @@ -125,7 +125,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor g_hottrack_done = 1; } - if(imageItem) { + if (imageItem) { IMG_RenderImageItem(hdcwnd, imageItem, rc); return; } @@ -136,7 +136,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor if (rc->right < rc->left || rc->bottom < rc->top || (realHeight <= 0) || (realWidth <= 0)) return; - if(cfg::dat.bUseFastGradients && !(FLG_CORNER & CORNER_ACTIVE)) { + if (cfg::dat.bUseFastGradients && !(FLG_CORNER & CORNER_ACTIVE)) { GRADIENT_RECT grect; TRIVERTEX tvtx[2]; int orig = 1, dest = 0; @@ -148,7 +148,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor tvtx[0].Alpha = tvtx[1].Alpha = 0; } else { - if(FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_TB) { + if (FLG_GRADIENT & GRADIENT_LR || FLG_GRADIENT & GRADIENT_TB) { orig = 0; dest = 1; } @@ -168,7 +168,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor saved_alpha = (UCHAR) (basecolor >> 24); - if(alpha < 100) { + if (alpha < 100) { BLENDFUNCTION bf; HDC hdc; HBITMAP hbm, hbmOld; @@ -307,7 +307,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor // TL+BL CORNER hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - if(hbitmap == 0 || pvBits == NULL) { + if (hbitmap == 0 || pvBits == NULL) { DeleteObject(BrMask); DeleteDC(hdc); return; @@ -456,7 +456,7 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) LONG srcOrigX = isGlyph ? item->glyphMetrics[0] : 0; LONG srcOrigY = isGlyph ? item->glyphMetrics[1] : 0; - if(item->dwFlags & IMAGE_FLAG_DIVIDED) { + if (item->dwFlags & IMAGE_FLAG_DIVIDED) { // top 3 items API::pfnAlphaBlend(hdc, rc->left, rc->top, l, t, hdcSrc, srcOrigX, srcOrigY, l, t, item->bf); @@ -467,7 +467,7 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) API::pfnAlphaBlend(hdc, rc->left, rc->top + t, l, height - t - b, hdcSrc, srcOrigX, srcOrigY + t, l, item->inner_height, item->bf); - if(item->dwFlags & IMAGE_FILLSOLID && item->fillBrush) { + if (item->dwFlags & IMAGE_FILLSOLID && item->fillBrush) { RECT rcFill; rcFill.left = rc->left + l; rcFill.top = rc->top +t; rcFill.right = rc->right - r; rcFill.bottom = rc->bottom - b; @@ -492,7 +492,7 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) LONG top = rc->top; do { - if(top + item->height <= rc->bottom) { + if (top + item->height <= rc->bottom) { API::pfnAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); top += item->height; } @@ -509,7 +509,7 @@ void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) LONG left = rc->left; do { - if(left + item->width <= rc->right) { + if (left + item->width <= rc->right) { API::pfnAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); left += item->width; } diff --git a/plugins/Clist_nicer/src/clcidents.cpp b/plugins/Clist_nicer/src/clcidents.cpp index 1315a61f32..277fbe32db 100644 --- a/plugins/Clist_nicer/src/clcidents.cpp +++ b/plugins/Clist_nicer/src/clcidents.cpp @@ -69,7 +69,7 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **c *isVisible = 0; else { int posy = RowHeight::getItemTopY(dat,index+1); - if(posyyScroll) + if (posyyScroll) *isVisible=0; //if ((index + 1) * dat->rowHeight< dat->yScroll) // *isVisible = 0; diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index b40a0a3328..fb2ac94c3f 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -85,8 +85,8 @@ struct ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, D struct ClcGroup *RemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount) { - if(contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) { - if(cfg::eCache[contact->extraCacheEntry].floater && cfg::eCache[contact->extraCacheEntry].floater->hwnd) + if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) { + if (cfg::eCache[contact->extraCacheEntry].floater && cfg::eCache[contact->extraCacheEntry].floater->hwnd) ShowWindow(cfg::eCache[contact->extraCacheEntry].floater->hwnd, SW_HIDE); } return(saveRemoveItemFromGroup(hwnd, group, contact, updateTotalCount)); @@ -96,25 +96,25 @@ void LoadAvatarForContact(struct ClcContact *p) { DWORD dwFlags; - if(p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry) + if (p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry) dwFlags = cfg::eCache[p->extraCacheEntry].dwDFlags; else dwFlags = cfg::getDword(p->hContact, "CList", "CLN_Flags", 0); - if(cfg::dat.dwFlags & CLUI_FRAME_AVATARS) + if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) p->cFlags = (dwFlags & ECF_HIDEAVATAR ? p->cFlags & ~ECF_AVATAR : p->cFlags | ECF_AVATAR); else p->cFlags = (dwFlags & ECF_FORCEAVATAR ? p->cFlags | ECF_AVATAR : p->cFlags & ~ECF_AVATAR); p->ace = NULL; - if(cfg::dat.bAvatarServiceAvail && (p->cFlags & ECF_AVATAR) && (!cfg::dat.bNoOfflineAvatars || p->wStatus != ID_STATUS_OFFLINE)) { + if (cfg::dat.bAvatarServiceAvail && (p->cFlags & ECF_AVATAR) && (!cfg::dat.bNoOfflineAvatars || p->wStatus != ID_STATUS_OFFLINE)) { p->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)p->hContact, 0); if (p->ace != NULL && p->ace->cbSize != sizeof(struct avatarCacheEntry)) p->ace = NULL; if (p->ace != NULL) p->ace->t_lastAccess = cfg::dat.t_now; } - if(p->ace == NULL) + if (p->ace == NULL) p->cFlags &= ~ECF_AVATAR; } @@ -143,15 +143,15 @@ int AddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hConta p->codePage = cfg::getDword(hContact, "Tab_SRMsg", "ANSIcodepage", cfg::getDword(hContact, "UserInfo", "ANSIcodepage", CP_ACP)); p->bSecondLine = cfg::getByte(hContact, "CList", "CLN_2ndline", cfg::dat.dualRowMode); - if(dat->bisEmbedded) + if (dat->bisEmbedded) p->extraCacheEntry = -1; else { p->extraCacheEntry = cfg::getCache(p->hContact, p->proto); GetExtendedInfo( p, dat); - if(p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry) { + if (p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry) { cfg::eCache[p->extraCacheEntry].proto_status_item = GetProtocolStatusItem(p->bIsMeta ? p->metaProto : p->proto); - if(cfg::getByte(p->hContact, "CList", "floating", 0) && g_floatoptions.enabled) { - if(cfg::eCache[p->extraCacheEntry].floater == NULL) + if (cfg::getByte(p->hContact, "CList", "floating", 0) && g_floatoptions.enabled) { + if (cfg::eCache[p->extraCacheEntry].floater == NULL) FLT_Create(p->extraCacheEntry); else { ShowWindow(cfg::eCache[p->extraCacheEntry].floater->hwnd, SW_SHOWNOACTIVATE); @@ -265,7 +265,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) struct TExtraCache *cEntry; int result; - if(iExtraCacheEntry < 0 || iExtraCacheEntry > cfg::nextCacheEntry) + if (iExtraCacheEntry < 0 || iExtraCacheEntry > cfg::nextCacheEntry) return 0; cEntry = &cfg::eCache[iExtraCacheEntry]; @@ -279,7 +279,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) else { if (!szProto) szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if(szProto) { + if (szProto) { if ( !result ) DBFreeVariant( &dbv ); if ( !( result = cfg::getTString(hContact, szProto, "YMsg", &dbv)) && lstrlen(dbv.ptszVal) > 1) @@ -290,7 +290,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) cEntry->bStatusMsgValid = STATUSMSG_XSTATUS; } } - if(cEntry->bStatusMsgValid == STATUSMSG_NOTFOUND) { // no status msg, consider xstatus name (if available) + if (cEntry->bStatusMsgValid == STATUSMSG_NOTFOUND) { // no status msg, consider xstatus name (if available) if ( !result ) DBFreeVariant( &dbv ); result = cfg::getTString(hContact, szProto, "XStatusName", &dbv); @@ -312,7 +312,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) cst.cbSize = sizeof(ICQ_CUSTOM_STATUS); cst.flags = CSSF_MASK_STATUS; cst.status = &xStatus; - if(ServiceExists(szServiceName) && !CallService(szServiceName, (WPARAM)hContact, (LPARAM)&cst) && xStatus > 0) { + if (ServiceExists(szServiceName) && !CallService(szServiceName, (WPARAM)hContact, (LPARAM)&cst) && xStatus > 0) { cst.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_TCHAR; cst.wParam = &xStatus2; cst.ptszName = xStatusName; @@ -325,11 +325,11 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) } } } - if(cEntry->bStatusMsgValid > STATUSMSG_XSTATUSNAME) { + if (cEntry->bStatusMsgValid > STATUSMSG_XSTATUSNAME) { int j = 0, i; cEntry->statusMsg = (TCHAR *)realloc(cEntry->statusMsg, (lstrlen(dbv.ptszVal) + 2) * sizeof(TCHAR)); for (i = 0; dbv.ptszVal[i]; i++) { - if(dbv.ptszVal[i] == (TCHAR)0x0d) + if (dbv.ptszVal[i] == (TCHAR)0x0d) continue; cEntry->statusMsg[j] = dbv.ptszVal[i] == (wchar_t)0x0a ? (wchar_t)' ' : dbv.ptszVal[i]; j++; @@ -340,7 +340,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) DBFreeVariant( &dbv ); - if(cEntry->bStatusMsgValid != STATUSMSG_NOTFOUND) { + if (cEntry->bStatusMsgValid != STATUSMSG_NOTFOUND) { WORD infoTypeC2[12]; int iLen, i ; @@ -349,14 +349,14 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) GetStringTypeW(CT_CTYPE2, cEntry->statusMsg, iLen, infoTypeC2); cEntry->dwCFlags &= ~ECF_RTLSTATUSMSG; for (i = 0; i < 10; i++) { - if(infoTypeC2[i] == C2_RIGHTTOLEFT) { + if (infoTypeC2[i] == C2_RIGHTTOLEFT) { cEntry->dwCFlags |= ECF_RTLSTATUSMSG; break; } } } - if(cEntry->hTimeZone == NULL) + if (cEntry->hTimeZone == NULL) TZ_LoadTimeZone(hContact, cEntry, szProto); return cEntry->bStatusMsgValid;; } @@ -379,9 +379,9 @@ static void TZ_LoadTimeZone(HANDLE hContact, struct TExtraCache *c, const char * void ReloadExtraInfo(HANDLE hContact) { - if(hContact && pcli->hwndContactTree) { + if (hContact && pcli->hwndContactTree) { int index = cfg::getCache(hContact, NULL); - if(index >= 0 && index < cfg::nextCacheEntry) { + if (index >= 0 && index < cfg::nextCacheEntry) { char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); TZ_LoadTimeZone(hContact, &cfg::eCache[index], szProto); @@ -404,7 +404,7 @@ void RTL_DetectAndSet(struct ClcContact *contact, HANDLE hContact) ZeroMemory(infoTypeC2, sizeof(WORD) * 12); - if(contact == NULL) { + if (contact == NULL) { szText = pcli->pfnGetContactDisplayName(hContact, 0); index = cfg::getCache(hContact, NULL); } @@ -412,12 +412,12 @@ void RTL_DetectAndSet(struct ClcContact *contact, HANDLE hContact) szText = contact->szText; index = contact->extraCacheEntry; } - if(index >= 0 && index < cfg::nextCacheEntry) { + if (index >= 0 && index < cfg::nextCacheEntry) { iLen = min(lstrlenW(szText), 10); GetStringTypeW(CT_CTYPE2, szText, iLen, infoTypeC2); cfg::eCache[index].dwCFlags &= ~ECF_RTLNICK; for (i = 0; i < 10; i++) { - if(infoTypeC2[i] == C2_RIGHTTOLEFT) { + if (infoTypeC2[i] == C2_RIGHTTOLEFT) { cfg::eCache[index].dwCFlags |= ECF_RTLNICK; return; } @@ -433,11 +433,11 @@ void RTL_DetectGroupName(struct ClcContact *group) group->isRtl = 0; - if(group->szText) { + if (group->szText) { iLen = min(lstrlenW(group->szText), 10); GetStringTypeW(CT_CTYPE2, group->szText, iLen, infoTypeC2); for (i = 0; i < 10; i++) { - if(infoTypeC2[i] == C2_RIGHTTOLEFT) { + if (infoTypeC2[i] == C2_RIGHTTOLEFT) { group->isRtl = 1; return; } @@ -456,10 +456,10 @@ void GetExtendedInfo(struct ClcContact *contact, struct ClcData *dat) BOOL iCacheNew = FALSE; int index; - if(dat->bisEmbedded || contact == NULL) + if (dat->bisEmbedded || contact == NULL) return; - if(contact->proto == NULL || contact->hContact == 0) + if (contact->proto == NULL || contact->hContact == 0) return; index = contact->extraCacheEntry; @@ -471,8 +471,8 @@ void GetExtendedInfo(struct ClcContact *contact, struct ClcData *dat) //g_ExtraCache[index].msgFrequency = new_freq; //DBWriteContactSettingDword(contact->hContact, "CList", "mf_freq", new_freq); - if(index >= 0 && index < cfg::nextCacheEntry) { - if(cfg::eCache[index].valid) + if (index >= 0 && index < cfg::nextCacheEntry) { + if (cfg::eCache[index].valid) return; cfg::eCache[index].valid = TRUE; } @@ -527,8 +527,8 @@ void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto) { HANDLE hContact = cEntry->hContact; - if(cfg::getByte(hContact, "EXTBK", "VALID", 0)) { - if(cEntry->status_item == NULL) + if (cfg::getByte(hContact, "EXTBK", "VALID", 0)) { + if (cEntry->status_item == NULL) cEntry->status_item = reinterpret_cast(malloc(sizeof(StatusItems_t))); ZeroMemory(cEntry->status_item, sizeof(StatusItems_t)); strcpy(cEntry->status_item->szName, "{--CONTACT--}"); // mark as "per contact" item @@ -550,7 +550,7 @@ void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto) cEntry->status_item->CORNER = cfg::getByte(hContact, "EXTBK", "CORNER", 0); cEntry->status_item->GRADIENT = cfg::getByte(hContact, "EXTBK", "GRAD", 0); } - else if(cEntry->status_item) { + else if (cEntry->status_item) { free(cEntry->status_item); cEntry->status_item = NULL; } @@ -563,7 +563,7 @@ void ReloadSkinItemsToCache() for (i = 0; i < cfg::nextCacheEntry; i++) { szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cfg::eCache[i].hContact, 0); - if(szProto) + if (szProto) LoadSkinItemToCache(&cfg::eCache[i], szProto); } } @@ -577,11 +577,11 @@ DWORD CalcXMask(HANDLE hContact) for (i = 0; i <= 10; i++) { bForced = (dwXMask & (1 << (2 * i))); bHidden = (dwXMask & (1 << (2 * i + 1))); - if(bForced == 0 && bHidden == 0) + if (bForced == 0 && bHidden == 0) continue; - else if(bForced) + else if (bForced) dwResult |= (1 << i); - else if(bHidden) + else if (bHidden) dwResult &= ~(1 << i); } return(dwResult); @@ -604,16 +604,16 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc // always hide subcontacts (but show them on embedded contact lists) - if(cfg::dat.bMetaAvail && dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && cfg::getByte(hContact, cfg::dat.szMetaName, "IsSubcontact", 0)) + if (cfg::dat.bMetaAvail && dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && cfg::getByte(hContact, cfg::dat.szMetaName, "IsSubcontact", 0)) return 1; - if(cfg::dat.bFilterEffective) { - if(szProto == NULL) + if (cfg::dat.bFilterEffective) { + if (szProto == NULL) szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); // check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set). - if(cfg::dat.bFilterEffective & CLVM_STICKY_CONTACTS) { + if (cfg::dat.bFilterEffective & CLVM_STICKY_CONTACTS) { if ((dwLocalMask = cfg::getDword(hContact, "CLVM", cfg::dat.current_viewmode, 0)) != 0) { - if(cfg::dat.bFilterEffective & CLVM_FILTER_STICKYSTATUS) { + if (cfg::dat.bFilterEffective & CLVM_FILTER_STICKYSTATUS) { WORD wStatus = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); return !((1 << (wStatus - ID_STATUS_OFFLINE)) & HIWORD(dwLocalMask)); } @@ -621,34 +621,34 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc } } // check the proto, use it as a base filter result for all further checks - if(cfg::dat.bFilterEffective & CLVM_FILTER_PROTOS) { + if (cfg::dat.bFilterEffective & CLVM_FILTER_PROTOS) { mir_snprintf(szTemp, sizeof(szTemp), "%s|", szProto); filterResult = strstr(cfg::dat.protoFilter, szTemp) ? 1 : 0; } - if(cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) { + if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) { if (!cfg::getTString(hContact, "CList", "Group", &dbv)) { _sntprintf(szGroupMask, safe_sizeof(szGroupMask), _T("%s|"), &dbv.ptszVal[1]); filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? (filterResult | (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)) : (filterResult & (_tcsstr(cfg::dat.groupFilter, szGroupMask) ? 1 : 0)); mir_free(dbv.ptszVal); } - else if(cfg::dat.filterFlags & CLVM_INCLUDED_UNGROUPED) + else if (cfg::dat.filterFlags & CLVM_INCLUDED_UNGROUPED) filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 1; else filterResult = (cfg::dat.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 0; } - if(cfg::dat.bFilterEffective & CLVM_FILTER_STATUS) { + if (cfg::dat.bFilterEffective & CLVM_FILTER_STATUS) { WORD wStatus = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); filterResult = (cfg::dat.filterFlags & CLVM_GROUPSTATUS_OP) ? ((filterResult | ((1 << (wStatus - ID_STATUS_OFFLINE)) & cfg::dat.statusMaskFilter ? 1 : 0))) : (filterResult & ((1 << (wStatus - ID_STATUS_OFFLINE)) & cfg::dat.statusMaskFilter ? 1 : 0)); } - if(cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG) { + if (cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG) { DWORD now; int iEntry = cfg::getCache(hContact, szProto); - if(iEntry >= 0 && iEntry <= cfg::nextCacheEntry) { + if (iEntry >= 0 && iEntry <= cfg::nextCacheEntry) { now = cfg::dat.t_now; now -= cfg::dat.lastMsgFilter; - if(cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN) + if (cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN) filterResult = filterResult & (cfg::eCache[iEntry].dwLastMsgTime < now); - else if(cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG_NEWERTHAN) + else if (cfg::dat.bFilterEffective & CLVM_FILTER_LASTMSG_NEWERTHAN) filterResult = filterResult & (cfg::eCache[iEntry].dwLastMsgTime > now); } } diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 97a4d0bb99..c89174af44 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -66,18 +66,18 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM index = contact->extraCacheEntry; - if(contact->type != CLCIT_CONTACT) // || contact->bIsMeta) + if (contact->type != CLCIT_CONTACT) // || contact->bIsMeta) return 0; - //if(contact->bIsMeta && LOWORD(lParam) != EIMG_EXTRA && LOWORD(lParam) != EIMG_CLIENT) + //if (contact->bIsMeta && LOWORD(lParam) != EIMG_EXTRA && LOWORD(lParam) != EIMG_CLIENT) // return 0; /* - if(contact->hContact == 5846286) { + if (contact->hContact == 5846286) { _DebugTraceA("set extra image %d", LOWORD(lParam)); } */ - if(index >= 0 && index < cfg::nextCacheEntry) { + if (index >= 0 && index < cfg::nextCacheEntry) { cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam); cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != (BYTE)0xff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam))); PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); @@ -93,7 +93,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM return 0; index = cfg::getCache((HANDLE)wParam, NULL); - if(index >= 0 && index < cfg::nextCacheEntry) { + if (index >= 0 && index < cfg::nextCacheEntry) { cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam); cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != (BYTE)0xff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam))); } @@ -101,7 +101,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM hMasterContact = (HANDLE)cfg::getDword((HANDLE)wParam, cfg::dat.szMetaName, "Handle", 0); index = cfg::getCache(hMasterContact, NULL); - if(index >= 0 && index < cfg::nextCacheEntry) { + if (index >= 0 && index < cfg::nextCacheEntry) { cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam); cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != (BYTE)0xff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam))); PostMessage(hwnd, INTM_INVALIDATE, 0, 0); @@ -118,10 +118,10 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; - if(contact->type != CLCIT_CONTACT) + if (contact->type != CLCIT_CONTACT) return 0; - if(contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry) { - if(cfg::eCache[contact->extraCacheEntry].bStatusMsgValid != STATUSMSG_NOTFOUND) + if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry) { + if (cfg::eCache[contact->extraCacheEntry].bStatusMsgValid != STATUSMSG_NOTFOUND) return((INT_PTR)cfg::eCache[contact->extraCacheEntry].statusMsg); } } return 0; @@ -139,7 +139,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; - if(contact->type != CLCIT_CONTACT) + if (contact->type != CLCIT_CONTACT) return 0; contact->flags ^= CONTACTF_PRIORITY; cfg::writeByte(contact->hContact, "CList", "Priority", (BYTE)(contact->flags & CONTACTF_PRIORITY ? 1 : 0)); @@ -155,7 +155,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; - if(contact->type != CLCIT_CONTACT) + if (contact->type != CLCIT_CONTACT) return 0; return(contact->flags & CONTACTF_PRIORITY ? 1 : 0); } @@ -170,20 +170,20 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; - if(contact->type != CLCIT_CONTACT) + if (contact->type != CLCIT_CONTACT) return 0; iEntry = contact->extraCacheEntry; - if(iEntry >= 0 && iEntry <= cfg::nextCacheEntry) { + if (iEntry >= 0 && iEntry <= cfg::nextCacheEntry) { state = !cfg::getByte(contact->hContact, "CList", "floating", 0); - if(state) { - if(cfg::eCache[iEntry].floater == NULL) + if (state) { + if (cfg::eCache[iEntry].floater == NULL) FLT_Create(iEntry); ShowWindow(cfg::eCache[contact->extraCacheEntry].floater->hwnd, SW_SHOW); } else { - if(cfg::eCache[iEntry].floater && cfg::eCache[iEntry].floater->hwnd) { + if (cfg::eCache[iEntry].floater && cfg::eCache[iEntry].floater->hwnd) { DestroyWindow(cfg::eCache[iEntry].floater->hwnd); cfg::eCache[iEntry].floater = 0; } @@ -202,14 +202,14 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM return 0; case CLM_SETFONT: - if(HIWORD(lParam)<0 || HIWORD(lParam)>FONTID_LAST) + if (HIWORD(lParam)<0 || HIWORD(lParam)>FONTID_LAST) return 0; dat->fontInfo[HIWORD(lParam)].hFont = (HFONT)wParam; dat->fontInfo[HIWORD(lParam)].changed = 1; RowHeight::getMaxRowHeight(dat, hwnd); - if(LOWORD(lParam)) + if (LOWORD(lParam)) InvalidateRect(hwnd,NULL,FALSE); return 0; diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index c9b11d07b3..17e5cba9ed 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -130,7 +130,7 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) int __fastcall GetStatusOnlineness(int status) { - if(status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE) + if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE) return 120; switch (status) { @@ -198,7 +198,7 @@ int GetBasicFontID(struct ClcContact * contact) return FONTID_GROUPS; break; case CLCIT_INFO: - if(contact->flags & CLCIIF_GROUPFONT) + if (contact->flags & CLCIIF_GROUPFONT) return FONTID_GROUPS; else return FONTID_CONTACTS; @@ -294,8 +294,8 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac if (!cfg::dat.bAvatarServiceAvail || dat->bisEmbedded) return 0; - if(contact->ace != NULL && contact->ace->cbSize == sizeof(struct avatarCacheEntry)) { - if(contact->ace->dwFlags & AVS_HIDEONCLIST) { + if (contact->ace != NULL && contact->ace->cbSize == sizeof(struct avatarCacheEntry)) { + if (contact->ace->dwFlags & AVS_HIDEONCLIST) { if (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) return avatar_size + 2; else @@ -303,7 +303,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac } bmHeight = contact->ace->bmHeight; bmWidth = contact->ace->bmWidth; - if(bmWidth != 0) + if (bmWidth != 0) dAspect = (float)bmHeight / (float)bmWidth; else dAspect = 1.0; @@ -315,13 +315,13 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac else return 0; - if(bmHeight == 0 || bmWidth == 0 || hbm == 0) + if (bmHeight == 0 || bmWidth == 0 || hbm == 0) return 0; g_maxAV_X = max(bmWidth, g_maxAV_X); g_maxAV_Y = max(bmHeight, g_maxAV_Y); - if(dAspect >= 1.0) { // height > width + if (dAspect >= 1.0) { // height > width skinMarginY = item->IGNORED ? 0 : (item->MARGIN_TOP + item->MARGIN_BOTTOM); skinMarginX = item->IGNORED ? 0 : (item->MARGIN_LEFT + item->MARGIN_RIGHT); @@ -345,10 +345,10 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac // create the region for the avatar border - use the same region for clipping, if needed. av_saved_left = rc->left; - if(cfg::dat.bCenterStatusIcons && newWidth < newHeight) + if (cfg::dat.bCenterStatusIcons && newWidth < newHeight) rc->left += (((avatar_size - 2) - ((int)newWidth + skinMarginX)) / 2); - if(cfg::dat.dwFlags & CLUI_FRAME_ROUNDAVATAR) + if (cfg::dat.dwFlags & CLUI_FRAME_ROUNDAVATAR) rgn = CreateRoundRectRgn(leftoffset + rc->left, y + topoffset, leftoffset + rc->left + (int)newWidth + 1, y + topoffset + (int)newHeight + 1, 2 * cfg::dat.avatarRadius, 2 * cfg::dat.avatarRadius); else rgn = CreateRectRgn(leftoffset + rc->left, y + topoffset, leftoffset + rc->left + (int)newWidth, y + topoffset + (int)newHeight); @@ -358,13 +358,13 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac bf.AlphaFormat = contact->ace->dwFlags & AVS_PREMULTIPLIED ? AC_SRC_ALPHA : 0; /* - if(dat->showIdle && contact->flags & CONTACTF_IDLE) + if (dat->showIdle && contact->flags & CONTACTF_IDLE) bf.SourceConstantAlpha -= (bf.SourceConstantAlpha > 100 ? 50 : 0); */ SelectClipRgn(hdcMem, rgn); SetStretchBltMode(hdcMem, HALFTONE); - if(bf.SourceConstantAlpha == 255 && bf.AlphaFormat == 0) { + if (bf.SourceConstantAlpha == 255 && bf.AlphaFormat == 0) { StretchBlt(hdcMem, leftoffset + rc->left - (g_RTL ? 1 : 0), y + topoffset, (int)newWidth, (int)newHeight, hdcAvatar, 0, 0, bmWidth, bmHeight, SRCCOPY); } else { @@ -378,18 +378,18 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac } SelectObject(hdcAV, hbmOldAV); - if(cfg::dat.dwFlags & CLUI_FRAME_AVATARBORDER) { - if(g_RTL) + if (cfg::dat.dwFlags & CLUI_FRAME_AVATARBORDER) { + if (g_RTL) OffsetRgn(rgn, -1 , 0); FrameRgn(hdcMem, rgn, cfg::dat.hBrushAvatarBorder, 1, 1); } - if(fOverlay) + if (fOverlay) fOverlay = (dwFlags & ECF_HIDEOVERLAY) ? 0 : 1; else fOverlay = (dwFlags & ECF_FORCEOVERLAY) ? 1 : 0; - if(fOverlay && cstatus && (int)newHeight >= g_cysmIcon) + if (fOverlay && cstatus && (int)newHeight >= g_cysmIcon) DrawIconEx(hdcMem, rc->left + (int)newWidth - 15, y + topoffset + (int)newHeight - 15, overlayicons[cstatus - ID_STATUS_OFFLINE], g_cxsmIcon, g_cysmIcon, 0, 0, DI_NORMAL | DI_COMPAT); SelectClipRgn(hdcMem, NULL); @@ -406,7 +406,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, struct ClcContact *contac rcFrame.top = y + topoffset - item->MARGIN_TOP; rcFrame.right = rcFrame.left + (int)newWidth + item->MARGIN_RIGHT + item->MARGIN_LEFT; rcFrame.bottom = rcFrame.top + (int)newHeight + item->MARGIN_BOTTOM + item->MARGIN_TOP; - if(g_RTL) { + if (g_RTL) { RECT rcTemp; OffsetRect(&rcFrame, 1, 0); @@ -481,7 +481,7 @@ void __inline PaintItem(HDC hdcMem, struct ClcGroup *group, struct ClcContact *c rowHeight -= cfg::dat.bRowSpacing; savedCORNER = -1; - if(group == NULL || contact == NULL) + if (group == NULL || contact == NULL) return; g_RTL = FALSE; @@ -492,28 +492,28 @@ void __inline PaintItem(HDC hdcMem, struct ClcGroup *group, struct ClcContact *c flags = contact->flags; selected = index == dat->selection && (dat->showSelAlways || dat->exStyle &CLS_EX_SHOWSELALWAYS || g_focusWnd == hwnd) && type != CLCIT_DIVIDER; avatar_done = FALSE; - if(contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) + if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) cEntry = &cfg::eCache[contact->extraCacheEntry]; else cEntry = cfg::eCache; - if(dat->bisEmbedded) + if (dat->bisEmbedded) goto set_bg_l; - if(type == CLCIT_CONTACT && (cEntry->dwCFlags & ECF_RTLNICK || mirror_always)) { - if(API::pfnSetLayout != NULL && (mirror_rtl || mirror_always)) { + if (type == CLCIT_CONTACT && (cEntry->dwCFlags & ECF_RTLNICK || mirror_always)) { + if (API::pfnSetLayout != NULL && (mirror_rtl || mirror_always)) { g_RTL = TRUE; bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; } - else if(mirror_rtltext) { + else if (mirror_rtltext) { bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; dt_nickflags = DT_RTLREADING | DT_RIGHT; } else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; } - else if(type == CLCIT_GROUP && API::pfnSetLayout != NULL) { + else if (type == CLCIT_GROUP && API::pfnSetLayout != NULL) { if ((contact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO) || cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT) { g_RTL = TRUE; bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0; @@ -581,7 +581,7 @@ set_bg_l: g_hottrack_done = 0; check_selected = (!selected || selBlend); - if(dat->bisEmbedded) { + if (dat->bisEmbedded) { rc.left = bg_indent_l; rc.top = y; rc.right = clRect->right - bg_indent_r; @@ -592,7 +592,7 @@ set_bg_l: } else { FillRect(hdcMem, &rc, cfg::dat.hBrushCLCBk); - if(g_hottrack) + if (g_hottrack) SetHotTrackColour(hdcMem,dat); } goto bgskipped; @@ -616,7 +616,7 @@ set_bg_l: if (!(perstatus_ignored = sitem->IGNORED) && !(flags & CONTACTF_NOTONLIST)) SetTextColor(hdcMem, sitem->TEXTCOLOR); - if(cfg::dat.bUsePerProto && pp_item && !pp_item->IGNORED) { + if (cfg::dat.bUsePerProto && pp_item && !pp_item->IGNORED) { sitem = pp_item; if ((perstatus_ignored || cfg::dat.bOverridePerStatusColors) && sitem->TEXTCOLOR != -1) SetTextColor(hdcMem, sitem->TEXTCOLOR); @@ -874,7 +874,7 @@ set_bg_l: StatusItems_t *ht = &StatusItems[ID_EXTBKHOTTRACK - ID_STATUS_OFFLINE]; SetHotTrackColour(hdcMem,dat); - if(ht->IGNORED == 0) + if (ht->IGNORED == 0) SetTextColor(hdcMem, ht->TEXTCOLOR); if (!g_hottrack_done) { if (ht->IGNORED == 0) { @@ -884,7 +884,7 @@ set_bg_l: } } - if(g_RTL) + if (g_RTL) API::pfnSetLayout(hdcMem, LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED); bgskipped: @@ -925,7 +925,7 @@ bgskipped: iImage = contact->iImage; - if(pi_avatar && (av_left || av_right)) { + if (pi_avatar && (av_left || av_right)) { RECT rc; rc.left = rcContent.left; @@ -933,7 +933,7 @@ bgskipped: rc.top = y; rc.bottom = rc.top + rowHeight; - if(av_left) { + if (av_left) { leftOffset += DrawAvatar(hdcMem, &rc, contact, y, dat, (WORD)(iImage ? cstatus : 0), rowHeight, cEntry->dwDFlags); rcContent.left += leftOffset; leftX += leftOffset; @@ -944,17 +944,17 @@ bgskipped: rcContent.right -= (rightOffset); } } - else if(type == CLCIT_CONTACT && !dat->bisEmbedded && !g_selectiveIcon && (dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) && av_local_wanted && (av_left || av_right)) { - if(av_right) + else if (type == CLCIT_CONTACT && !dat->bisEmbedded && !g_selectiveIcon && (dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) && av_local_wanted && (av_left || av_right)) { + if (av_right) rcContent.right -= (cfg::dat.avatarSize + 2); - if(av_left) + if (av_left) rcContent.left += (cfg::dat.avatarSize + 2); } //icon // skip icon for groups if the option is enabled... - if(type == CLCIT_GROUP && dwFlags & CLUI_FRAME_NOGROUPICON) { + if (type == CLCIT_GROUP && dwFlags & CLUI_FRAME_NOGROUPICON) { iconXSpace = 0; goto text; } @@ -968,7 +968,7 @@ bgskipped: if ((dwFlags & CLUI_FRAME_STATUSICONS && !pi_selectiveIcon) || type != CLCIT_CONTACT || (pi_selectiveIcon && !avatar_done)) { HIMAGELIST hImgList = 0; if (!dat->bisEmbedded && type == CLCIT_CONTACT && cEntry && (dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS) && cEntry->iExtraImage[EXTRA_ICON_ADV1] != 0xff) { - if(pcli->pfnIconFromStatusMode(contact->proto, contact->wStatus, contact->hContact) == iImage) { + if (pcli->pfnIconFromStatusMode(contact->proto, contact->wStatus, contact->hContact) == iImage) { hImgList = dat->himlExtraColumns; iImage = cEntry->iExtraImage[EXTRA_ICON_ADV1]; } @@ -986,7 +986,7 @@ bgskipped: if (type == CLCIT_CONTACT && dat->showIdle && (flags & CONTACTF_IDLE) && contact->wStatus != ID_STATUS_OFFLINE) mode = ILD_SELECTED; - if(pi_selectiveIcon && av_right) { + if (pi_selectiveIcon && av_right) { ImageList_DrawEx(hImgList, iImage, hdcMem, rcContent.right - 18, (twoRows && type == CLCIT_CONTACT && !cfg::dat.bCenterStatusIcons) ? y + 2 : y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode); rcContent.right -= 18; } @@ -1004,18 +1004,18 @@ bgskipped: if (type == CLCIT_CONTACT && !dat->bisEmbedded) { BYTE bApparentModeDontCare = !((flags & CONTACTF_VISTO) ^ (flags & CONTACTF_INVISTO)); contact->extraIconRightBegin = 0; - if(cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry && cEntry->iExtraValid)) { + if (cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry && cEntry->iExtraValid)) { int i, iIndex, id; DWORD dwOldMask = cEntry->dwXMask; - if(dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS) + if (dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS) cEntry->dwXMask &= ~EIMG_SHOW_ADV1; for (i = EXICON_COUNT - 1; i >= 0; i--) { iIndex = cfg::dat.exIconOrder[i] - 1; - if(iIndex >= 0 && iIndex < EXICON_COUNT) { + if (iIndex >= 0 && iIndex < EXICON_COUNT) { id = OrderTreeData[iIndex].ID; - if(cEntry->iExtraImage[id] != 0xff && ((1 << id) & cEntry->dwXMask)) { - if(contact->extraIconRightBegin == 0 && i != (EXICON_COUNT - 1)) + if (cEntry->iExtraImage[id] != 0xff && ((1 << id) & cEntry->dwXMask)) { + if (contact->extraIconRightBegin == 0 && i != (EXICON_COUNT - 1)) contact->extraIconRightBegin = rcContent.right; ImageList_DrawEx(dat->himlExtraColumns, cEntry->iExtraImage[id], hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1), 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); @@ -1029,13 +1029,13 @@ bgskipped: if (!bApparentModeDontCare && (dwFlags & CLUI_SHOWVISI) && contact->proto) { BOOL fVisi; - if(dwFlags & CLUI_SHOWVISI) + if (dwFlags & CLUI_SHOWVISI) fVisi = cEntry->dwDFlags & ECF_HIDEVISIBILITY ? 0 : 1; else fVisi = cEntry->dwDFlags & ECF_FORCEVISIBILITY ? 1 : 0; - if(fVisi) { - if(cEntry->isChatRoom) + if (fVisi) { + if (cEntry->isChatRoom) DrawIconEx(hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1), cfg::dat.hIconChatactive, cfg::dat.exIconScale, cfg::dat.exIconScale, 0, 0, DI_NORMAL | DI_COMPAT); else @@ -1071,22 +1071,22 @@ text: COLORREF clr = GetTextColor(hdcMem); ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &height); - if(oldGroupColor != -1) + if (oldGroupColor != -1) SetTextColor(hdcMem, clr); rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + iconXSpace; rc.right = clRect->right - dat->rightMargin; - if(indent == 0 && iconXSpace == 0) + if (indent == 0 && iconXSpace == 0) rc.left += 2; required = textSize.cx + countsSize.cx + spaceSize.cx; - if(required > rc.right - rc.left) + if (required > rc.right - rc.left) textSize.cx = (rc.right - rc.left) - countsSize.cx - spaceSize.cx; labelWidth = textSize.cx + countsSize.cx + spaceSize.cx; - if(g_center) + if (g_center) offset = ((rc.right - rc.left) - labelWidth) / 2; @@ -1109,7 +1109,7 @@ text: rc.left = rcContent.left; rc.right = clRect->right - dat->rightMargin; - if(textSize.cx >= rc.right - rc.left) + if (textSize.cx >= rc.right - rc.left) textSize.cx = rc.right - rc.left; offset = ((rc.right - rc.left) - textSize.cx) / 2; @@ -1155,8 +1155,8 @@ text: // avatar if (!dat->bisEmbedded) { - if(av_local_wanted && !avatar_done && pi_avatar) { - if(av_rightwithnick) { + if (av_local_wanted && !avatar_done && pi_avatar) { + if (av_rightwithnick) { RECT rcAvatar = rcContent; rcAvatar.left = rcContent.right - (cfg::dat.avatarSize - 1); @@ -1166,13 +1166,13 @@ text: else rcContent.left += DrawAvatar(hdcMem, &rcContent, contact, y, dat, (WORD)(iImage ? cstatus : 0), rowHeight, cEntry->dwDFlags); } - else if(dwFlags & CLUI_FRAME_ALWAYSALIGNNICK && !avatar_done && av_local_wanted) + else if (dwFlags & CLUI_FRAME_ALWAYSALIGNNICK && !avatar_done && av_local_wanted) rcContent.left += (dwFlags & (CLUI_FRAME_AVATARSLEFT | CLUI_FRAME_AVATARSRIGHT | CLUI_FRAME_AVATARSRIGHTWITHNICK) ? 0 : cfg::dat.avatarSize + 2); } // nickname if (!twoRows) { - if(dt_nickflags) + if (dt_nickflags) DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE | dt_nickflags); else DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE); @@ -1185,7 +1185,7 @@ text: rcContent.top = y + cfg::dat.avatarPadding / 2; - if(cfg::dat.bShowLocalTime) + if (cfg::dat.bShowLocalTime) fLocalTime = cEntry->dwDFlags & ECF_HIDELOCALTIME ? 0 : 1; else fLocalTime = cEntry->dwDFlags & ECF_FORCELOCALTIME ? 1 : 0; @@ -1209,16 +1209,16 @@ text: GetTextExtentPoint32(hdcMem, szResult, lstrlen(szResult), &szTime); verticalfit = (rowHeight - fHeight >= cfg::dat.exIconScale + 1); - if(av_right) { - if(verticalfit) + if (av_right) { + if (verticalfit) rc.left = rcContent.right + (rightIcons * g_exIconSpacing) - szTime.cx - 2; else rc.left = rcContent.right - szTime.cx - 2; } - else if(av_rightwithnick) { - if(verticalfit && rightIcons * g_exIconSpacing >= szTime.cx) + else if (av_rightwithnick) { + if (verticalfit && rightIcons * g_exIconSpacing >= szTime.cx) rc.left = clRect->right - dat->rightMargin - szTime.cx; - else if(verticalfit && !avatar_done) + else if (verticalfit && !avatar_done) rc.left = clRect->right - dat->rightMargin - szTime.cx; else { rc.left = rcContent.right - szTime.cx - 2; @@ -1226,7 +1226,7 @@ text: } } else { - if(verticalfit) + if (verticalfit) rc.left = clRect->right - dat->rightMargin - szTime.cx; else rc.left = rcContent.right - szTime.cx - 2; @@ -1236,18 +1236,18 @@ text: SetTextColor(hdcMem, oldColor); verticalfit = (rowHeight - fontHeight >= cfg::dat.exIconScale + 1); - if(verticalfit && av_right) + if (verticalfit && av_right) rcContent.right = min(clRect->right - cfg::dat.avatarSize - 2, rc.left - 2); - else if(verticalfit && !av_rightwithnick) + else if (verticalfit && !av_rightwithnick) rcContent.right = min(clRect->right - dat->rightMargin, rc.left - 3); } else { nodisplay: verticalfit = (rowHeight - fontHeight >= cfg::dat.exIconScale + 1); - if(avatar_done) { - if(verticalfit && av_right) + if (avatar_done) { + if (verticalfit && av_right) rcContent.right = clRect->right - cfg::dat.avatarSize - 2; - else if(verticalfit && !av_rightwithnick) + else if (verticalfit && !av_rightwithnick) rcContent.right = clRect->right - dat->rightMargin; } } @@ -1256,11 +1256,11 @@ nodisplay: rcContent.right = saved_right; rcContent.top += (fontHeight - 1); hPreviousFont = ChangeToFont(hdcMem, dat, FONTID_STATUS, &statusFontHeight); - //if(selected) + //if (selected) // SetTextColor(hdcMem, dat->selTextColour); rcContent.bottom = y + rowHeight; - if(cstatus >= ID_STATUS_OFFLINE && cstatus <= ID_STATUS_OUTTOLUNCH) { + if (cstatus >= ID_STATUS_OFFLINE && cstatus <= ID_STATUS_OUTTOLUNCH) { TCHAR *szText = NULL; BYTE smsgValid = cEntry->bStatusMsgValid; @@ -1270,10 +1270,10 @@ nodisplay: szText = &statusNames[cstatus - ID_STATUS_OFFLINE][0]; - if(cEntry->dwCFlags & ECF_RTLSTATUSMSG && cfg::dat.bUseDCMirroring == 3) + if (cEntry->dwCFlags & ECF_RTLSTATUSMSG && cfg::dat.bUseDCMirroring == 3) dt_2ndrowflags |= (DT_RTLREADING | DT_RIGHT); - if(rightIcons == 0) { + if (rightIcons == 0) { if ((rcContent.bottom - rcContent.top) >= (2 * statusFontHeight)) { dtFlags &= ~(DT_SINGLELINE | DT_BOTTOM | DT_NOCLIP); dtFlags |= DT_WORDBREAK; @@ -1295,11 +1295,11 @@ nodisplay: dtp.cbSize = sizeof(dtp); rcContent.right = clRect->right - dat->rightMargin - rightOffset; do { - if(rcContent.top + (statusFontHeight - 1) > rightIconsTop + 1) + if (rcContent.top + (statusFontHeight - 1) > rightIconsTop + 1) rcContent.right = old_right; dtp.uiLengthDrawn = 0; rcContent.bottom = rcContent.top + statusFontHeight - 1; - if(rcContent.bottom + statusFontHeight >= old_bottom) + if (rcContent.bottom + statusFontHeight >= old_bottom) i_dtFlags |= DT_END_ELLIPSIS; DrawTextEx(hdcMem, &szText[textCounter], -1, &rcContent, i_dtFlags, &dtp); rcContent.top += statusFontHeight; @@ -1315,16 +1315,16 @@ nodisplay: TCHAR *szText = contact->szText; RECT rc; int qlen = lstrlen(dat->szQuickSearch); - if(hPreviousFont) + if (hPreviousFont) SelectObject(hdcMem, hPreviousFont); SetTextColor(hdcMem, dat->quickSearchColour); - if(type == CLCIT_CONTACT) { + if (type == CLCIT_CONTACT) { rc.left = rcContent.left; rc.top = y + ((rowHeight - fontHeight) >> 1); rc.right = clRect->right - rightOffset; rc.right = rcContent.right; rc.bottom = rc.top; - if(twoRows) + if (twoRows) rc.top = y; } else { @@ -1352,7 +1352,7 @@ nodisplay: } ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[iImage], hdcMem, clRect->right - rightOffset - dat->extraColumnSpacing * (dat->extraColumnsCount - iImage), y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode); } - if(g_RTL) + if (g_RTL) API::pfnSetLayout(hdcMem, 0); } @@ -1457,8 +1457,8 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) SelectObject(hdcMem, hoBrush); DeleteObject(hBrush); - if(1) { - if(cfg::dat.bWallpaperMode && !dat->bisEmbedded) { + if (1) { + if (cfg::dat.bWallpaperMode && !dat->bisEmbedded) { SkinDrawBg(hwnd, hdcMem); goto bgdone; } @@ -1548,12 +1548,12 @@ bgdone: if (group->scanIndex==group->cl.count) { group=group->parent; - if(group==NULL) break; // Finished list + if (group==NULL) break; // Finished list group->scanIndex++; continue; } - if(group->cl.items[group->scanIndex]->cFlags & ECF_AVATAR) + if (group->cl.items[group->scanIndex]->cFlags & ECF_AVATAR) g_list_avatars++; if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { @@ -1581,7 +1581,7 @@ bgdone: } line_num++; - if(cfg::dat.bForceRefetchOnPaint) + if (cfg::dat.bForceRefetchOnPaint) group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry*)-1; if (y > rcPaint->top - dat->row_heights[line_num] && y <= rcPaint->bottom) { diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index f41b091517..5384867f5f 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -97,9 +97,9 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct Clc right = clRect.right; // avatar check - if(hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { - if(testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize) { - if(flags) + if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { + if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize) { + if (flags) *flags |= CLCHT_ONAVATAR; } } @@ -135,7 +135,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct Clc return hit; } } - if(hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) { + if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) { int rightOffset = hitcontact->extraIconRightBegin; int images_present = 0; @@ -241,20 +241,20 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCont } if (!dat->bisEmbedded) { - if(hitcontact->type == CLCIT_CONTACT) { - if(mirror_mode == 1 || (mirror_mode == 2 && cfg::eCache[hitcontact->extraCacheEntry].dwCFlags & ECF_RTLNICK)) + if (hitcontact->type == CLCIT_CONTACT) { + if (mirror_mode == 1 || (mirror_mode == 2 && cfg::eCache[hitcontact->extraCacheEntry].dwCFlags & ECF_RTLNICK)) return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit); } - else if(hitcontact->type == CLCIT_GROUP) { - if(cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO)) + else if (hitcontact->type == CLCIT_GROUP) { + if (cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO)) return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit); } } // avatar check - if(hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { - if(testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) { - if(flags) + if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { + if (testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) { + if (flags) *flags |= CLCHT_ONAVATAR; } } @@ -290,7 +290,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCont return hit; } } - if(hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) { + if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) { //int rightOffset = clRect.right; int rightOffset = hitcontact->extraIconRightBegin; int images_present = 0; @@ -380,7 +380,7 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) else InvalidateRect(hwnd, NULL, FALSE); previousy = dat->yScroll; - if(cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) + if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); else SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); @@ -397,7 +397,7 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) else InvalidateRect(hwnd, NULL, FALSE); - if(cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) + if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); else SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); @@ -422,14 +422,14 @@ void RecalcScrollBar(HWND hwnd, struct ClcData *dat) if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) { if (dat->noVScrollbar == 0) { - if(cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) + if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE); else SetScrollInfo(hwnd, SB_VERT, &si, TRUE); } } else { - if(cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) + if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded) CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE); else SetScrollInfo(hwnd, SB_VERT, &si, TRUE); @@ -463,16 +463,16 @@ void SetGroupExpand(HWND hwnd,struct ClcData *dat,struct ClcGroup *group,int new contentCount = pcli->pfnGetGroupContentsCount(group,1); groupy=pcli->pfnGetRowsPriorTo(&dat->list,group,-1); - if(dat->selection>groupy && dat->selectionselection=groupy; + if (dat->selection>groupy && dat->selectionselection=groupy; pcli->pfnRecalcScrollBar(hwnd,dat); GetClientRect(hwnd,&clRect); newy=dat->yScroll; posy = RowHeight::getItemBottomY(dat, groupy+contentCount); - if(posy>=newy+clRect.bottom) + if (posy>=newy+clRect.bottom) newy=posy-clRect.bottom; posy = RowHeight::getItemTopY(dat, groupy); - if(newy>posy) newy=posy; + if (newy>posy) newy=posy; ScrollTo(hwnd,dat,newy,0); nm.hdr.code=CLN_EXPANDED; @@ -581,11 +581,11 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ? GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR); if (!dat->bkChanged) { - if(cfg::dat.hBrushCLCBk) + if (cfg::dat.hBrushCLCBk) DeleteObject(cfg::dat.hBrushCLCBk); cfg::dat.hBrushCLCBk = CreateSolidBrush(dat->bkColour); if (dat->hBmpBackground) { - if(cfg::dat.hdcPic) { + if (cfg::dat.hdcPic) { SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld); DeleteDC(cfg::dat.hdcPic); cfg::dat.hdcPic = 0; @@ -593,7 +593,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) } } cfg::dat.bmpBackground = dat->hBmpBackground; - if(cfg::dat.bmpBackground) { + if (cfg::dat.bmpBackground) { HDC hdcThis = GetDC(pcli->hwndContactList); GetObject(cfg::dat.bmpBackground, sizeof(cfg::dat.bminfoBg), &(cfg::dat.bminfoBg)); cfg::dat.hdcPic = CreateCompatibleDC(hdcThis); @@ -613,7 +613,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) dat->hBmpBackground = reinterpret_cast(LoadImageA(NULL, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); } cfg::dat.bmpBackground = dat->hBmpBackground; - if(cfg::dat.bmpBackground) { + if (cfg::dat.bmpBackground) { HDC hdcThis = GetDC(pcli->hwndContactList); GetObject(cfg::dat.bmpBackground, sizeof(cfg::dat.bminfoBg), &(cfg::dat.bminfoBg)); cfg::dat.hdcPic = CreateCompatibleDC(hdcThis); diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index 93b90c34ce..de98aebffe 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -58,7 +58,7 @@ HANDLE hNotifyFrame = (HANDLE)-1; struct CListEvent* fnCreateEvent( void ) { CListEvent *p = reinterpret_cast(mir_alloc(sizeof(struct CListEvent))); - if(p) + if (p) ZeroMemory(p, sizeof(struct CListEvent)); return p; @@ -69,17 +69,17 @@ void HideShowNotifyFrame() int dwVisible = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, hNotifyFrame), 0) & F_VISIBLE; int desired; - if(cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) + if (cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) desired = cfg::dat.notifyActive ? TRUE : FALSE; else desired = dwVisible; - if(desired) { + if (desired) { if (!dwVisible) CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0); } else { - if(dwVisible) + if (dwVisible) CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0); } } @@ -151,11 +151,11 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa break; } case WM_LBUTTONUP: - if(cfg::dat.bEventAreaEnabled) + if (cfg::dat.bEventAreaEnabled) SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0); break; case WM_COMMAND: - if(LOWORD(wParam) == IDC_NOTIFYBUTTON) { + if (LOWORD(wParam) == IDC_NOTIFYBUTTON) { int iSelection; MENUITEMINFO mii = {0}; POINT pt; @@ -210,13 +210,13 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa hbmold = reinterpret_cast(SelectObject(hdcMem, hbm)); SetBkMode(hdcMem, TRANSPARENT); - if(cfg::clcdat) + if (cfg::clcdat) hFontOld = ChangeToFont(hdcMem, cfg::clcdat, FONTID_EVENTAREA, &height); - if(cfg::dat.bWallpaperMode) + if (cfg::dat.bWallpaperMode) SkinDrawBg(hwnd, hdcMem); item = &StatusItems[ID_EXTBKEVTAREA - ID_STATUS_OFFLINE]; - if(item->IGNORED) { + if (item->IGNORED) { FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); } else { @@ -231,14 +231,14 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa dwLeft = rc.left; PaintNotifyArea(hdcMem, &rc); - if(cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) { + if (cfg::dat.dwFlags & CLUI_FRAME_EVENTAREASUNKEN) { rc.left = dwLeft; InflateRect(&rc, -2, -2); DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); } BitBlt(hdc, 0, 0, rcClient.right, rcClient.bottom, hdcMem, 0, 0, SRCCOPY); SelectObject(hdcMem, hbmold); - if(hFontOld) + if (hFontOld) SelectObject(hdcMem, hFontOld); DeleteObject(hbm); DeleteDC(hdcMem); @@ -325,7 +325,7 @@ struct CListEvent* AddEvent(CLISTEVENT *cle) } } InvalidateRect(hwndEventFrame, NULL, FALSE); - if(cfg::dat.bUseFloater & CLUI_USE_FLOATER && cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) + if (cfg::dat.bUseFloater & CLUI_USE_FLOATER && cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) SFL_Update(0, 0, 0, NULL, FALSE); } @@ -389,7 +389,7 @@ int RemoveEvent(HANDLE hContact, HANDLE hDbEvent) if (cfg::dat.notifyActive) { InvalidateRect(hwndEventFrame, NULL, FALSE); - if(cfg::dat.bUseFloater & CLUI_USE_FLOATER && cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) + if (cfg::dat.bUseFloater & CLUI_USE_FLOATER && cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) SFL_Update(0, 0, 0, NULL, FALSE); } diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index a1947e51a3..cc2f9c1bac 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -136,9 +136,9 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When space is available")); SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message")); - if(cfg::clcdat) { + if (cfg::clcdat) { FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); - if(contact && contact->type != CLCIT_CONTACT) { + if (contact && contact->type != CLCIT_CONTACT) { DestroyWindow(hWnd); return FALSE; } @@ -160,45 +160,45 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA Utils::enableDlgControl(hWnd, IDC_IGN_PRIORITY, TRUE); Utils::enableDlgControl(hWnd, IDC_AVATARDISPMODE, TRUE); Utils::enableDlgControl(hWnd, IDC_SECONDLINEMODE, TRUE); - if(dwFlags & ECF_FORCEAVATAR) + if (dwFlags & ECF_FORCEAVATAR) SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 1, 0); - else if(dwFlags & ECF_HIDEAVATAR) + else if (dwFlags & ECF_HIDEAVATAR) SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 2, 0); else SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 0, 0); - if(dwFlags & ECF_FORCEOVERLAY) + if (dwFlags & ECF_FORCEOVERLAY) SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_CHECKED, 0); - else if(dwFlags & ECF_HIDEOVERLAY) + else if (dwFlags & ECF_HIDEOVERLAY) SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_INDETERMINATE, 0); - if(dwFlags & ECF_FORCELOCALTIME) + if (dwFlags & ECF_FORCELOCALTIME) SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_CHECKED, 0); - else if(dwFlags & ECF_HIDELOCALTIME) + else if (dwFlags & ECF_HIDELOCALTIME) SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_INDETERMINATE, 0); - if(dwFlags & ECF_FORCEVISIBILITY) + if (dwFlags & ECF_FORCEVISIBILITY) SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_CHECKED, 0); - else if(dwFlags & ECF_HIDEVISIBILITY) + else if (dwFlags & ECF_HIDEVISIBILITY) SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_INDETERMINATE, 0); while(xImgCtrlIds[i] != 0) { - if(dwXMask & (1 << (2 * xImgCtrlBits[i]))) + if (dwXMask & (1 << (2 * xImgCtrlBits[i]))) SendDlgItemMessage(hWnd, xImgCtrlIds[i], BM_SETCHECK, BST_CHECKED, 0); - else if(dwXMask & (1 << (2 * xImgCtrlBits[i] + 1))) + else if (dwXMask & (1 << (2 * xImgCtrlBits[i] + 1))) SendDlgItemMessage(hWnd, xImgCtrlIds[i], BM_SETCHECK, BST_UNCHECKED, 0); else SendDlgItemMessage(hWnd, xImgCtrlIds[i], BM_SETCHECK, BST_INDETERMINATE, 0); i++; } - if(bSecondLine == 0xff) + if (bSecondLine == 0xff) SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_SETCURSEL, 0, 0); else SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_SETCURSEL, (WPARAM)(bSecondLine + 1), 0); @@ -221,11 +221,11 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendMessage(hWnd, WM_USER + 100, (WPARAM)hContact, (LPARAM)0); return 0; case IDC_IGN_ALWAYSONLINE: - if(IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSONLINE)) + if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSONLINE)) CheckDlgButton(hWnd, IDC_IGN_ALWAYSOFFLINE, FALSE); break; case IDC_IGN_ALWAYSOFFLINE: - if(IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE)) + if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE)) CheckDlgButton(hWnd, IDC_IGN_ALWAYSONLINE, FALSE); break; case IDC_HIDECONTACT: @@ -265,21 +265,21 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA cfg::writeDword(hContact, "Ignore", "Mask1", newMask); SendMessage(hWnd, WM_USER + 130, 0, 0); - if(cfg::clcdat) { + if (cfg::clcdat) { LRESULT iSel = SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_GETCURSEL, 0, 0); DWORD dwFlags = cfg::getDword(hContact, "CList", "CLN_Flags", 0), dwXMask = 0; LRESULT checked = 0; int i = 0; FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); - if(iSel != CB_ERR) { + if (iSel != CB_ERR) { dwFlags &= ~(ECF_FORCEAVATAR | ECF_HIDEAVATAR); - if(iSel == 1) + if (iSel == 1) dwFlags |= ECF_FORCEAVATAR; - else if(iSel == 2) + else if (iSel == 2) dwFlags |= ECF_HIDEAVATAR; - if(contact) + if (contact) LoadAvatarForContact(contact); } @@ -287,55 +287,55 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA ECF_FORCEVISIBILITY | ECF_HIDEVISIBILITY); checked = SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_GETCHECK, 0, 0); - if(checked == BST_CHECKED) + if (checked == BST_CHECKED) dwFlags |= ECF_FORCEOVERLAY; - else if(checked == BST_UNCHECKED) + else if (checked == BST_UNCHECKED) dwFlags |= ECF_HIDEOVERLAY; checked = SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_GETCHECK, 0, 0); - if(checked == BST_CHECKED) + if (checked == BST_CHECKED) dwFlags |= ECF_FORCELOCALTIME; - else if(checked == BST_UNCHECKED) + else if (checked == BST_UNCHECKED) dwFlags |= ECF_HIDELOCALTIME; checked = SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_GETCHECK, 0, 0); - if(checked == BST_CHECKED) + if (checked == BST_CHECKED) dwFlags |= ECF_FORCEVISIBILITY; - else if(checked == BST_UNCHECKED) + else if (checked == BST_UNCHECKED) dwFlags |= ECF_HIDEVISIBILITY; cfg::writeDword(hContact, "CList", "CLN_Flags", dwFlags); if ((iSel = SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_GETCURSEL, 0, 0)) != CB_ERR) { - if(iSel == 0) { + if (iSel == 0) { DBDeleteContactSetting(hContact, "CList", "CLN_2ndline"); - if(contact) + if (contact) contact->bSecondLine = cfg::dat.dualRowMode; } else { DBWriteContactSettingByte(hContact, "CList", "CLN_2ndline", (BYTE)(iSel - 1)); - if(contact) + if (contact) contact->bSecondLine = (BYTE)(iSel - 1); } } while(xImgCtrlIds[i] != 0) { checked = SendDlgItemMessage(hWnd, xImgCtrlIds[i], BM_GETCHECK, 0, 0); - if(checked == BST_CHECKED) + if (checked == BST_CHECKED) dwXMask |= (1 << (2 * xImgCtrlBits[i])); - else if(checked == BST_UNCHECKED) + else if (checked == BST_UNCHECKED) dwXMask |= (1 << (2 * xImgCtrlBits[i] + 1)); i++; } cfg::writeDword(hContact, "CList", "CLN_xmask", dwXMask); - if(contact) { - if(contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry) { + if (contact) { + if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry) { cfg::eCache[contact->extraCacheEntry].dwDFlags = dwFlags; cfg::eCache[contact->extraCacheEntry].dwXMask = CalcXMask(hContact); } } else { int iIndex = cfg::getCache(hContact, NULL); - if(iIndex >= 0 && iIndex <= cfg::nextCacheEntry) { + if (iIndex >= 0 && iIndex <= cfg::nextCacheEntry) { cfg::eCache[iIndex].dwDFlags = dwFlags; cfg::eCache[iIndex].dwXMask = CalcXMask(hContact); } @@ -370,7 +370,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA (IsDlgButtonChecked(hWnd, IDC_IGN_ADD) ? (1 << (IGNOREEVENT_YOUWEREADDED - 1)) : 0) | (IsDlgButtonChecked(hWnd, IDC_IGN_ONLINE) ? (1 << (IGNOREEVENT_USERONLINE - 1)) : 0); - if(dwNewMask) + if (dwNewMask) *dwNewMask = dwMask; return 0; } @@ -378,8 +378,8 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA { struct ClcContact *contact = NULL; - if(FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { - if(contact) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { + if (contact) { WORD wApparentMode = cfg::getWord(contact->hContact, contact->proto, "ApparentMode", 0); CheckDlgButton(hWnd, IDC_IGN_ALWAYSOFFLINE, wApparentMode == ID_STATUS_OFFLINE ? TRUE : FALSE); @@ -392,17 +392,17 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA { struct ClcContact *contact = NULL; - if(FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { - if(contact) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { + if (contact) { WORD wApparentMode = 0, oldApparentMode = cfg::getWord(hContact, contact->proto, "ApparentMode", 0); - if(IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSONLINE)) + if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSONLINE)) wApparentMode = ID_STATUS_ONLINE; - else if(IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE)) + else if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE)) wApparentMode = ID_STATUS_OFFLINE; //DBWriteContactSettingWord(hContact, contact->proto, "ApparentMode", wApparentMode); - //if(oldApparentMode != wApparentMode) + //if (oldApparentMode != wApparentMode) CallContactService(hContact, PSS_SETAPPARENTMODE, (WPARAM)wApparentMode, 0); SendMessage(hWnd, WM_USER + 120, 0, 0); } @@ -433,7 +433,7 @@ static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM lParam) { HWND hWnd = 0; - if(hWindowListIGN == 0) + if (hWindowListIGN == 0) hWindowListIGN = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); hWnd = WindowList_Find(hWindowListIGN, (HANDLE)wParam); diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index e6f88e51ee..7e7cb40f38 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -71,8 +71,8 @@ int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON * finalStatus = status; } - if(status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) { - if(szProto) { + if (status >= ID_STATUS_CONNECTING && status < ID_STATUS_OFFLINE && phIcon != NULL) { + if (szProto) { char szBuf[128]; mir_snprintf(szBuf, 128, "%s_conn", szProto); *phIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szBuf); @@ -160,7 +160,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) * also, clip at least 2 pixels from the border (same reason) */ - if(g_CLUIImageItem) + if (g_CLUIImageItem) clip = 5; else clip = 0; @@ -172,7 +172,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) pt.y = i; //for (j = rc.left + 3 + clip; j < rc.right - 3 - clip; j += (width / iStepX)) { for (j = rc.left + clip; j < rc.right; j += (width / iStepX)) { - /*if(rgn) { + /*if (rgn) { ptTest.x = j; ptTest.y = i; if (!PtInRegion(rgn, ptTest.x, ptTest.y)) { @@ -190,7 +190,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) iCountedDots++; //Let's keep track of how many dots we checked. } } - if(rgn) + if (rgn) DeleteObject(rgn); if (iNotCoveredDots == iCountedDots) //Every dot was not covered: the window is visible. @@ -208,7 +208,7 @@ int ShowHide(WPARAM wParam, LPARAM lParam) int iVisibleState = pcli->pfnGetWindowVisibleState(pcli->hwndContactList, 0, 0); - if(IsIconic(pcli->hwndContactList)) { + if (IsIconic(pcli->hwndContactList)) { SendMessage(pcli->hwndContactList, WM_SYSCOMMAND, SC_RESTORE, 0); bShow = TRUE; } diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 7a20e71ce3..f7d6c297c3 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -64,7 +64,7 @@ void TrayIconUpdateBase(const char *szChangedProto) if (cfg::getByte("CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)) { HICON hIcon = 0; int iIcon = IconFromStatusMode(szChangedProto, averageMode, 0, &hIcon); - if(hIcon) + if (hIcon) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), szChangedProto); else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), szChangedProto); @@ -77,7 +77,7 @@ void TrayIconUpdateBase(const char *szChangedProto) HICON hIcon = 0; int iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon); - if(hIcon) + if (hIcon) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL); else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL); @@ -86,7 +86,7 @@ void TrayIconUpdateBase(const char *szChangedProto) HICON hIcon = 0; int iIcon = IconFromStatusMode(NULL, averageMode, 0, &hIcon); - if(hIcon) + if (hIcon) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL); else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL); @@ -104,7 +104,7 @@ void TrayIconUpdateBase(const char *szChangedProto) else szProto = dbv.pszVal; iIcon = IconFromStatusMode(szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0), 0, &hIcon); - if(hIcon) + if (hIcon) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL); else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL); @@ -117,7 +117,7 @@ void TrayIconUpdateBase(const char *szChangedProto) int iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon); pcli->cycleTimerId = SetTimer(NULL, 0, cfg::getWord("CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, pcli->pfnTrayCycleTimerProc); - if(hIcon) + if (hIcon) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), NULL); else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), NULL); @@ -130,7 +130,7 @@ void TrayIconUpdateBase(const char *szChangedProto) HICON hIcon = 0; int iIcon = IconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), 0, &hIcon); - if(hIcon) + if (hIcon) changed = pcli->pfnTrayIconSetBaseInfo(CopyIcon(hIcon), szChangedProto); else changed = pcli->pfnTrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, iIcon, ILD_NORMAL), szChangedProto); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 83acd46531..fb03c74075 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1079,7 +1079,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l rcFrame.bottom -= cfg::dat.statusBarHeight; rcFrame.top += (cfg::dat.topOffset - 1); - //if(g_CluiData.neeedSnap) + //if (g_CluiData.neeedSnap) // goto skipbg; if (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN) { if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { @@ -1175,7 +1175,7 @@ skipbg: SetWindowPos(pcli->hwndStatus, 0, 0, new_window_rect.bottom - 20, new_window_rect.right, 20, SWP_NOZORDER); GetWindowRect(pcli->hwndStatus, &rcStatus); cfg::dat.statusBarHeight = (rcStatus.bottom - rcStatus.top); - if(wp->cx != g_oldSize.cx) + if (wp->cx != g_oldSize.cx) SendMessage(hwnd, CLUIINTM_STATUSBARUPDATE, 0, 0); RedrawWindow(pcli->hwndStatus, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); } else @@ -1418,8 +1418,8 @@ skipbg: case WM_SYSCOMMAND: { BYTE bWindowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT); - if(SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle) { - if(wParam == SC_RESTORE) { + if (SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle) { + if (wParam == SC_RESTORE) { CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); SendMessage(hwnd, WM_SIZE, 0, 0); SendMessage(hwnd, CLUIINTM_REDRAW, 0, 0); @@ -1432,7 +1432,7 @@ skipbg: if (wParam == SC_MAXIMIZE) return 0; else if (wParam == SC_MINIMIZE) { - if(SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle && !cfg::getByte("CList", "AlwaysHideOnTB", 0)) { + if (SETTING_WINDOWSTYLE_DEFAULT == bWindowStyle && !cfg::getByte("CList", "AlwaysHideOnTB", 0)) { cfg::writeByte("CList", "State", SETTING_STATE_MINIMIZED); break; } @@ -1880,7 +1880,7 @@ buttons_done: } case WM_CLOSE: - if(SETTING_WINDOWSTYLE_DEFAULT == cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT) && !cfg::getByte("CList", "AlwaysHideOnTB", 0)) { + if (SETTING_WINDOWSTYLE_DEFAULT == cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_DEFAULT) && !cfg::getByte("CList", "AlwaysHideOnTB", 0)) { PostMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); return(0); } diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index f836995f68..3cc057ad68 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -244,7 +244,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l clr_cluiframes = (COLORREF)SendDlgItemMessage(hwndDlg, IDC_CLUIFRAMESBDR, CPM_GETCOLOUR, 0, 0); - if(g_hPenCLUIFrames) + if (g_hPenCLUIFrames) DeleteObject(g_hPenCLUIFrames); g_hPenCLUIFrames = CreatePen(PS_SOLID, 1, clr_cluiframes); cfg::writeDword("CLUI", "clr_frameborder", clr_cluiframes); @@ -290,16 +290,16 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (cfg::dat.bLayeredHack) SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); - if(g_CLUISkinnedBkColorRGB) + if (g_CLUISkinnedBkColorRGB) cfg::dat.colorkey = g_CLUISkinnedBkColorRGB; - else if(cfg::dat.bClipBorder == 0 && !(cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME)) + else if (cfg::dat.bClipBorder == 0 && !(cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME)) cfg::dat.colorkey = cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR); else { SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); cfg::dat.colorkey = RGB(255, 0, 255); } if (cfg::dat.isTransparent || cfg::dat.bFullTransparent) { - if(API::sysConfig.isWin2KPlus) { + if (API::sysConfig.isWin2KPlus) { SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); API::SetLayeredWindowAttributes(pcli->hwndContactList, 0, 255, LWA_ALPHA | LWA_COLORKEY); @@ -435,11 +435,11 @@ DWORD GetCLUIWindowStyle(BYTE style) { DWORD dwBasic = WS_CLIPCHILDREN; - if(style == SETTING_WINDOWSTYLE_THINBORDER) + if (style == SETTING_WINDOWSTYLE_THINBORDER) return dwBasic | WS_BORDER; - else if(style == SETTING_WINDOWSTYLE_TOOLWINDOW || style == 0) + else if (style == SETTING_WINDOWSTYLE_TOOLWINDOW || style == 0) return dwBasic | (WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_THICKFRAME); - else if(style == SETTING_WINDOWSTYLE_NOBORDER) + else if (style == SETTING_WINDOWSTYLE_NOBORDER) return dwBasic; return dwBasic; @@ -457,11 +457,11 @@ void ApplyCLUIBorderStyle(HWND hwnd) if (windowStyle == SETTING_WINDOWSTYLE_DEFAULT || windowStyle == SETTING_WINDOWSTYLE_TOOLWINDOW) { SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_THICKFRAME); - if(SETTING_WINDOWSTYLE_DEFAULT == windowStyle) { + if (SETTING_WINDOWSTYLE_DEFAULT == windowStyle) { SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_MAXIMIZEBOX/* | WS_MINIMIZEBOX*/)); minToTray = FALSE; } - } else if(windowStyle == SETTING_WINDOWSTYLE_THINBORDER) { + } else if (windowStyle == SETTING_WINDOWSTYLE_THINBORDER) { SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_POPUPWINDOW | WS_THICKFRAME)); SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_BORDER | WS_CLIPCHILDREN); } diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index d446872f16..d5cba25d3d 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -201,7 +201,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) caps1 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if ((caps1 & PF1_IM) && (caps2 & (PF2_LONGAWAY | PF2_SHORTAWAY))) { onlineness = GetStatusOnlineness(status); - if(onlineness > maxOnline) { + if (onlineness > maxOnline) { maxStatus = status; maxOnline = onlineness; szMaxProto = pa->szModuleName; @@ -221,7 +221,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) wStatus = maxStatus; iIcon = IconFromStatusMode((wStatus >= ID_STATUS_CONNECTING && wStatus < ID_STATUS_OFFLINE) ? szMaxProto : NULL, (int) wStatus, 0, &hIcon); g_maxStatus = (int)wStatus; - if(szMaxProto) { + if (szMaxProto) { lstrcpynA(g_maxProto, szMaxProto, 100); g_maxProto[99] = 0; } @@ -241,21 +241,25 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) */ if (szStatus) { - if(pcli->hwndContactList && IsWindow(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS)) && IsWindow(GetDlgItem(pcli->hwndContactList, IDC_TBTOPSTATUS))) { + if (pcli->hwndContactList && IsWindow(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS))) { + HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS); + SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), WM_SETTEXT, 0, (LPARAM) szStatus); if (!hIcon) { SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); - if(g_ButtonItems == NULL) - SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBTOPSTATUS), BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); + if (g_ButtonItems == NULL && hwndTtbStatus) + SendMessage( hwndTtbStatus, BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); } else { SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); - if(g_ButtonItems == NULL) - SendMessage(GetDlgItem(pcli->hwndContactList, IDC_TBTOPSTATUS), BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); + if (g_ButtonItems == NULL && hwndTtbStatus) + SendMessage(hwndTtbStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); } InvalidateRect(GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS), NULL, TRUE); - InvalidateRect(GetDlgItem(pcli->hwndContactList, IDC_TBTOPSTATUS), NULL, TRUE); + if (hwndTtbStatus) + InvalidateRect(hwndTtbStatus, NULL, TRUE); SFL_Update(hIcon, iIcon, hCListImages, szStatus, TRUE); - } } + } + } return; } diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 85994a922c..1cbfeb8190 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -207,14 +207,14 @@ int cfg::getCache(const HANDLE hContact, const char *szProto) int i, iFound = -1; for (i = 0; i < nextCacheEntry; i++) { - if(eCache[i].hContact == hContact) { + if (eCache[i].hContact == hContact) { iFound = i; break; } } - if(iFound == -1) { + if (iFound == -1) { EnterCriticalSection(&cachecs); - if(nextCacheEntry == maxCacheEntry) { + if (nextCacheEntry == maxCacheEntry) { maxCacheEntry += 100; cfg::eCache = (TExtraCache *)realloc(cfg::eCache, maxCacheEntry * sizeof(TExtraCache)); } @@ -267,7 +267,7 @@ void API::onInit() sysConfig.isXPPlus = (IsWinVerXPPlus() ? true : false); sysConfig.isWin2KPlus = (IsWinVer2000Plus() ? true : false); - if(sysConfig.isXPPlus) { + if (sysConfig.isXPPlus) { if ((hUxTheme = Utils::loadSystemLibrary(_T("\\uxtheme.dll")), true) != 0) { pfnIsThemeActive = (pfnIsThemeActive_t)GetProcAddress(hUxTheme, "IsThemeActive"); pfnOpenThemeData = (pfnOpenThemeData_t)GetProcAddress(hUxTheme, "OpenThemeData"); @@ -286,7 +286,7 @@ void API::onInit() } } } - if(sysConfig.isVistaPlus) { + if (sysConfig.isVistaPlus) { if ((hDwm = Utils::loadSystemLibrary(_T("\\dwmapi.dll")), true) != 0) { pfnDwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled_t)GetProcAddress(hDwm, "DwmIsCompositionEnabled"); pfnDwmExtendFrameIntoClientArea = (pfnDwmExtendFrameIntoClientArea_t)GetProcAddress(hDwm,"DwmExtendFrameIntoClientArea"); @@ -298,7 +298,7 @@ void API::onInit() void API::onUnload() { - if(hUxTheme) + if (hUxTheme) FreeLibrary(hUxTheme); } @@ -314,10 +314,10 @@ void API::updateState() ::ZeroMemory(&sysState, sizeof(TSysState)); - if(sysConfig.uxThemeValid) + if (sysConfig.uxThemeValid) sysState.isThemed = pfnIsThemeActive() ? true : false; - if(sysConfig.isVistaPlus) { + if (sysConfig.isVistaPlus) { sysState.isDwmActive = (pfnDwmIsCompositionEnabled && (pfnDwmIsCompositionEnabled(&result) == S_OK) && result) ? true : false; sysState.isAero = /* (CSkin::m_skinEnabled == false) && */ cfg::getByte("CLUI", "useAero", 1) /* && CSkin::m_fAeroSkinsValid */ && sysState.isDwmActive; } @@ -325,7 +325,7 @@ void API::updateState() BOOL API::SetLayeredWindowAttributes(HWND hWnd, COLORREF clr, BYTE alpha, DWORD dwFlags) { - if(sysConfig.isWin2KPlus) + if (sysConfig.isWin2KPlus) return(pfnSetLayeredWindowAttributes(hWnd, clr, alpha, dwFlags)); return(FALSE); @@ -410,7 +410,7 @@ int API::Ex_ShowDialog(EXCEPTION_POINTERS *ep, const char *szFile, int line, TCH exLine = line; exLastResult = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_EXCEPTION), 0, Ex_DlgProc, 0); exAllowContinue = fAllowContinue; - if(IDCANCEL == exLastResult) + if (IDCANCEL == exLastResult) ExitProcess(1); return 1; } @@ -444,19 +444,19 @@ HMODULE Utils::loadSystemLibrary(const TCHAR* szFilename, bool useGetHandle) HMODULE _h = 0; try { - if(0 == ::GetSystemDirectory(sysPathName, MAX_PATH)) + if (0 == ::GetSystemDirectory(sysPathName, MAX_PATH)) throw(CRTException("Error while loading system library", szFilename)); sysPathName[MAX_PATH - 1] = 0; - if(_tcslen(sysPathName) + _tcslen(szFilename) >= MAX_PATH) + if (_tcslen(sysPathName) + _tcslen(szFilename) >= MAX_PATH) throw(CRTException("Error while loading system library", szFilename)); lstrcat(sysPathName, szFilename); - if(useGetHandle) + if (useGetHandle) _h = ::GetModuleHandle(sysPathName); else _h = LoadLibrary(sysPathName); - if(0 == _h) + if (0 == _h) throw(CRTException("Error while loading system library", szFilename)); } catch(CRTException& ex) { diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index f51672e52c..25ac81aaec 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -87,19 +87,19 @@ static void MF_CalcFrequency(HANDLE hContact, DWORD dwCutoffDays, int doSleep) dbei.pBlob = NULL; CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei); - if(dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { // record time of last event + if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { // record time of last event eventCount++; } - if(eventCount >= 100 || dbei.timestamp < curTime - (dwCutoffDays * 86400)) + if (eventCount >= 100 || dbei.timestamp < curTime - (dwCutoffDays * 86400)) break; hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hEvent, 0); - if(doSleep && mf_updatethread_running == FALSE) + if (doSleep && mf_updatethread_running == FALSE) return; - if(doSleep) + if (doSleep) Sleep(100); } - if(eventCount == 0) { + if (eventCount == 0) { frequency = 0x7fffffff; cfg::writeDword(hContact, "CList", "mf_firstEvent", curTime - (dwCutoffDays * 86400)); } @@ -126,12 +126,12 @@ DWORD WINAPI MF_UpdateThread(LPVOID p) hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact != NULL && mf_updatethread_running) { MF_CalcFrequency(hContact, 50, 1); - if(mf_updatethread_running) + if (mf_updatethread_running) WaitForSingleObject(hEvent, 5000); ResetEvent(hEvent); hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); } - if(mf_updatethread_running) + if (mf_updatethread_running) WaitForSingleObject(hEvent, 1000000); ResetEvent(hEvent); } @@ -163,7 +163,7 @@ void LoadContactTree(void) if ((!hideOffline || status != ID_STATUS_OFFLINE) && !CLVM_GetContactHiddenStatus(hContact, NULL, NULL)) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode((char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0), status, hContact, NULL), 1); - if(mc_disablehgh && !mc_hgh_removed) { + if (mc_disablehgh && !mc_hgh_removed) { if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) { if (!strcmp(dbv.pszVal, "MetaContacts Hidden Group")) DBDeleteContactSetting(hContact, "CList", "Group"); @@ -194,7 +194,7 @@ DWORD INTSORT_GetLastMsgTime(HANDLE hContact) dbei.pBlob = 0; dbei.cbBlob = 0; CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbei); - if(dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) + if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) return dbei.timestamp; hDbEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)hDbEvent, 0); } @@ -230,7 +230,7 @@ int __forceinline INTSORT_CompareContacts(const struct ClcContact* c1, const str if ((c1->flags & CONTACTF_STICKY) != (c2->flags & CONTACTF_STICKY)) return 2 * (c2->flags & CONTACTF_STICKY) - 1; - if(bywhat == SORTBY_PRIOCONTACTS) { + if (bywhat == SORTBY_PRIOCONTACTS) { if ((cfg::clcdat->exStyle & CLS_EX_DIVIDERONOFF) && ((c1->flags & CONTACTF_ONLINE) != (c2->flags & CONTACTF_ONLINE))) return 0; if ((c1->flags & CONTACTF_PRIORITY) != (c2->flags & CONTACTF_PRIORITY)) @@ -261,7 +261,7 @@ int __forceinline INTSORT_CompareContacts(const struct ClcContact* c1, const str return CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, namea, -1, nameb, -1) - 2; case SORTBY_LASTMSG: - if(c1->extraCacheEntry >= 0 && c1->extraCacheEntry < cfg::nextCacheEntry && + if (c1->extraCacheEntry >= 0 && c1->extraCacheEntry < cfg::nextCacheEntry && c2->extraCacheEntry >= 0 && c2->extraCacheEntry < cfg::nextCacheEntry) return(cfg::eCache[c2->extraCacheEntry].dwLastMsgTime - cfg::eCache[c1->extraCacheEntry].dwLastMsgTime); else { @@ -277,9 +277,9 @@ int __forceinline INTSORT_CompareContacts(const struct ClcContact* c1, const str break; case SORTBY_PROTO: - if(c1->bIsMeta) + if (c1->bIsMeta) szProto1 = c1->metaProto ? c1->metaProto : c1->proto; - if(c2->bIsMeta) + if (c2->bIsMeta) szProto2 = c2->metaProto ? c2->metaProto : c2->proto; rc = GetProtoIndex(szProto1) - GetProtoIndex(szProto2); @@ -295,13 +295,13 @@ int CompareContacts(const struct ClcContact* c1, const struct ClcContact* c2) int i, result; result = INTSORT_CompareContacts(c1, c2, SORTBY_PRIOCONTACTS); - if(result) + if (result) return result; for (i = 0; i <= 2; i++) { - if(cfg::dat.sortOrder[i]) { + if (cfg::dat.sortOrder[i]) { result = INTSORT_CompareContacts(c1, c2, cfg::dat.sortOrder[i]); - if(result != 0) + if (result != 0) return result; } } diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 972ba79b1f..3b5eda0220 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -247,7 +247,7 @@ BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem) { status = (status >= ID_STATUS_OFFLINE && status <= ID_EXTBK_LAST) ? status : ID_STATUS_OFFLINE; // better check the index... *retitem = StatusItems[status - ID_STATUS_OFFLINE]; - if(g_hottrack && status != ID_EXTBKHOTTRACK) // allow hottracking for ignored items, unless hottrack item itself should be ignored + if (g_hottrack && status != ID_EXTBKHOTTRACK) // allow hottracking for ignored items, unless hottrack item itself should be ignored retitem->IGNORED = FALSE; return TRUE; } @@ -256,7 +256,7 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto) { int i; - if(szProto == NULL) + if (szProto == NULL) return NULL; for (i = ID_EXTBK_LAST_D - ID_STATUS_OFFLINE + 1; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) { @@ -285,7 +285,7 @@ void LoadExtBkSettingsFromDB() ID_EXTBK_LAST++; CopyMemory(&StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE], &StatusItems[0], sizeof(StatusItems_t)); mir_snprintf(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szDBname, 30, "EXBK_%s", accs[i]->szModuleName ); - if(i == 0) { + if (i == 0) { lstrcpynA(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szName, "{-}", 30); strncat(StatusItems[ID_EXTBK_LAST - ID_STATUS_OFFLINE].szName, accs[i]->szModuleName, 30); } @@ -349,7 +349,7 @@ void LoadExtBkSettingsFromDB() StatusItems[n]. BORDERSTYLE = ret; } } - if(cfg::dat.bFirstRun) { + if (cfg::dat.bFirstRun) { StatusItems_t *item = &StatusItems[ID_EXTBKBUTTONBAR - ID_STATUS_OFFLINE]; item->COLOR = GetSysColor(COLOR_3DFACE); @@ -422,9 +422,9 @@ void SetButtonToSkinned() void Reload3dBevelColors() { - if(cfg::dat.hPen3DBright) + if (cfg::dat.hPen3DBright) DeleteObject(cfg::dat.hPen3DBright); - if(cfg::dat.hPen3DDark) + if (cfg::dat.hPen3DDark) DeleteObject(cfg::dat.hPen3DDark); cfg::dat.hPen3DBright = CreatePen(PS_SOLID, 1, cfg::getDword("CLCExt", "3dbright", GetSysColor(COLOR_3DLIGHT))); @@ -592,7 +592,7 @@ DWORD __fastcall HexStringToLong(const char *szSource) { char *stopped; COLORREF clr = strtol(szSource, &stopped, 16); - if(clr == -1) + if (clr == -1) return clr; return(RGB(GetBValue(clr), GetGValue(clr), GetRValue(clr))); } @@ -619,13 +619,13 @@ static void PreMultiply(HBITMAP hBitmap, int mode) height = bmp.bmHeight; dwLen = width * height * 4; p = (BYTE *)malloc(dwLen); - if(p) { + if (p) { GetBitmapBits(hBitmap, dwLen, p); for (y = 0; y < height; ++y) { BYTE *px = p + width * 4 * y; for (x = 0; x < width; ++x) { - if(mode) { + if (mode) { alpha = px[3]; px[0] = px[0] * alpha/255; px[1] = px[1] * alpha/255; @@ -693,7 +693,7 @@ static HBITMAP LoadPNG(const char *szFilename, ImageItem *item) HBITMAP hBitmap = 0; hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFilename); - if(hBitmap != 0) + if (hBitmap != 0) CorrectBitmap32Alpha(hBitmap); return hBitmap; @@ -704,14 +704,14 @@ static void IMG_CreateItem(ImageItem *item, const char *fileName, HDC hdc) HBITMAP hbm = LoadPNG(fileName, item); BITMAP bm; - if(hbm) { + if (hbm) { item->hbm = hbm; item->bf.BlendFlags = 0; item->bf.BlendOp = AC_SRC_OVER; item->bf.AlphaFormat = 0; GetObject(hbm, sizeof(bm), &bm); - if(bm.bmBitsPixel == 32) { + if (bm.bmBitsPixel == 32) { PreMultiply(hbm, 1); item->dwFlags |= IMAGE_PERPIXEL_ALPHA; item->bf.AlphaFormat = AC_SRC_ALPHA; @@ -720,9 +720,9 @@ static void IMG_CreateItem(ImageItem *item, const char *fileName, HDC hdc) item->height = bm.bmHeight; item->inner_height = item->height - item->bTop - item->bBottom; item->inner_width = item->width - item->bLeft - item->bRight; - if(item->bTop && item->bBottom && item->bLeft && item->bRight) { + if (item->bTop && item->bBottom && item->bLeft && item->bRight) { item->dwFlags |= IMAGE_FLAG_DIVIDED; - if(item->inner_height <= 0 || item->inner_width <= 0) { + if (item->inner_height <= 0 || item->inner_width <= 0) { DeleteObject(hbm); item->hbm = 0; return; @@ -740,7 +740,7 @@ static void IMG_DeleteItem(ImageItem *item) DeleteObject(item->hbm); DeleteDC(item->hdc); } - if(item->fillBrush) + if (item->fillBrush) DeleteObject(item->fillBrush); } @@ -753,7 +753,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) GetPrivateProfileStringA(szItem, "BasedOn", "None", buffer, 400, file); - if(strcmp(buffer, "None")) { + if (strcmp(buffer, "None")) { int i; for (i = 0; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) { @@ -780,28 +780,28 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) this_item->CORNER = defaults->CORNER & CORNER_ACTIVE ? defaults->CORNER : 0; GetPrivateProfileStringA(szItem, "Corner", "None", buffer, 400, file); - if(strstr(buffer, "tl")) + if (strstr(buffer, "tl")) this_item->CORNER |= CORNER_TL; - if(strstr(buffer, "tr")) + if (strstr(buffer, "tr")) this_item->CORNER |= CORNER_TR; - if(strstr(buffer, "bl")) + if (strstr(buffer, "bl")) this_item->CORNER |= CORNER_BL; - if(strstr(buffer, "br")) + if (strstr(buffer, "br")) this_item->CORNER |= CORNER_BR; - if(this_item->CORNER) + if (this_item->CORNER) this_item->CORNER |= CORNER_ACTIVE; this_item->GRADIENT = defaults->GRADIENT & GRADIENT_ACTIVE ? defaults->GRADIENT : 0; GetPrivateProfileStringA(szItem, "Gradient", "None", buffer, 400, file); - if(strstr(buffer, "left")) + if (strstr(buffer, "left")) this_item->GRADIENT = GRADIENT_RL; - else if(strstr(buffer, "right")) + else if (strstr(buffer, "right")) this_item->GRADIENT = GRADIENT_LR; - else if(strstr(buffer, "up")) + else if (strstr(buffer, "up")) this_item->GRADIENT = GRADIENT_BT; - else if(strstr(buffer, "down")) + else if (strstr(buffer, "down")) this_item->GRADIENT = GRADIENT_TB; - if(this_item->GRADIENT) + if (this_item->GRADIENT) this_item->GRADIENT |= GRADIENT_ACTIVE; this_item->MARGIN_LEFT = GetPrivateProfileIntA(szItem, "Left", defaults->MARGIN_LEFT, file); @@ -826,10 +826,10 @@ void IMG_ReadItem(const char *itemname, const char *szFileName) ZeroMemory(&tmpItem, sizeof(ImageItem)); GetPrivateProfileStringA(itemname, "Glyph", "None", buffer, 500, szFileName); - if(strcmp(buffer, "None")) { + if (strcmp(buffer, "None")) { sscanf(buffer, "%d,%d,%d,%d", &tmpItem.glyphMetrics[0], &tmpItem.glyphMetrics[1], &tmpItem.glyphMetrics[2], &tmpItem.glyphMetrics[3]); - if(tmpItem.glyphMetrics[2] > tmpItem.glyphMetrics[0] && tmpItem.glyphMetrics[3] > tmpItem.glyphMetrics[1]) { + if (tmpItem.glyphMetrics[2] > tmpItem.glyphMetrics[0] && tmpItem.glyphMetrics[3] > tmpItem.glyphMetrics[1]) { tmpItem.dwFlags |= IMAGE_GLYPH; tmpItem.glyphMetrics[2] = (tmpItem.glyphMetrics[2] - tmpItem.glyphMetrics[0]) + 1; tmpItem.glyphMetrics[3] = (tmpItem.glyphMetrics[3] - tmpItem.glyphMetrics[1]) + 1; @@ -837,7 +837,7 @@ void IMG_ReadItem(const char *itemname, const char *szFileName) } } GetPrivateProfileStringA(itemname, "Image", "None", buffer, 500, szFileName); - if(strcmp(buffer, "None")) { + if (strcmp(buffer, "None")) { done_with_glyph: @@ -853,26 +853,26 @@ done_with_glyph: tmpItem.bRight = GetPrivateProfileIntA(itemname, "Right", 0, szFileName); tmpItem.bTop = GetPrivateProfileIntA(itemname, "Top", 0, szFileName); tmpItem.bBottom = GetPrivateProfileIntA(itemname, "Bottom", 0, szFileName); - if(tmpItem.dwFlags & IMAGE_GLYPH) { + if (tmpItem.dwFlags & IMAGE_GLYPH) { tmpItem.width = tmpItem.glyphMetrics[2]; tmpItem.height = tmpItem.glyphMetrics[3]; tmpItem.inner_height = tmpItem.glyphMetrics[3] - tmpItem.bTop - tmpItem.bBottom; tmpItem.inner_width = tmpItem.glyphMetrics[2] - tmpItem.bRight - tmpItem.bLeft; - if(tmpItem.bTop && tmpItem.bBottom && tmpItem.bLeft && tmpItem.bRight) + if (tmpItem.bTop && tmpItem.bBottom && tmpItem.bLeft && tmpItem.bRight) tmpItem.dwFlags |= IMAGE_FLAG_DIVIDED; tmpItem.bf.BlendFlags = 0; tmpItem.bf.BlendOp = AC_SRC_OVER; tmpItem.bf.AlphaFormat = 0; tmpItem.dwFlags |= IMAGE_PERPIXEL_ALPHA; tmpItem.bf.AlphaFormat = AC_SRC_ALPHA; - if(tmpItem.inner_height <= 0 || tmpItem.inner_width <= 0) { + if (tmpItem.inner_height <= 0 || tmpItem.inner_width <= 0) { ReleaseDC(pcli->hwndContactList, hdc); return; } } GetPrivateProfileStringA(itemname, "Fillcolor", "None", buffer, 500, szFileName); - if(strcmp(buffer, "None")) { + if (strcmp(buffer, "None")) { COLORREF fillColor = HexStringToLong(buffer); tmpItem.fillBrush = CreateSolidBrush(fillColor); tmpItem.dwFlags |= IMAGE_FILLSOLID; @@ -881,17 +881,17 @@ done_with_glyph: tmpItem.fillBrush = 0; GetPrivateProfileStringA(itemname, "Stretch", "None", buffer, 500, szFileName); - if(buffer[0] == 'B' || buffer[0] == 'b') + if (buffer[0] == 'B' || buffer[0] == 'b') tmpItem.bStretch = IMAGE_STRETCH_B; - else if(buffer[0] == 'h' || buffer[0] == 'H') + else if (buffer[0] == 'h' || buffer[0] == 'H') tmpItem.bStretch = IMAGE_STRETCH_V; - else if(buffer[0] == 'w' || buffer[0] == 'W') + else if (buffer[0] == 'w' || buffer[0] == 'W') tmpItem.bStretch = IMAGE_STRETCH_H; tmpItem.hbm = 0; if (!_stricmp(itemname, "$glyphs")) { IMG_CreateItem(&tmpItem, szFinalName, hdc); - if(tmpItem.hbm) { + if (tmpItem.hbm) { newItem = reinterpret_cast(malloc(sizeof(ImageItem))); ZeroMemory(newItem, sizeof(ImageItem)); *newItem = tmpItem; @@ -899,17 +899,17 @@ done_with_glyph: } goto imgread_done; } - if(itemname[0] == '@') { + if (itemname[0] == '@') { if (!(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); - if(tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { + if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { ImageItem *pItem = g_ImageItems; newItem = reinterpret_cast(malloc(sizeof(ImageItem))); ZeroMemory(newItem, sizeof(ImageItem)); *newItem = tmpItem; - if(g_ImageItems == NULL) + if (g_ImageItems == NULL) g_ImageItems = newItem; else { ImageItem *pItem = g_ImageItems; @@ -929,7 +929,7 @@ done_with_glyph: if (!strcmp(buffer, "CLUI")) { if (!(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); - if(tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { + if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { COLORREF clr; newItem = reinterpret_cast(malloc(sizeof(ImageItem))); @@ -940,7 +940,7 @@ done_with_glyph: clr = HexStringToLong(buffer); cfg::dat.colorkey = clr; cfg::writeDword("CLUI", "ColorKey", clr); - if(g_CLUISkinnedBkColor) + if (g_CLUISkinnedBkColor) DeleteObject(g_CLUISkinnedBkColor); g_CLUISkinnedBkColor = CreateSolidBrush(clr); g_CLUISkinnedBkColorRGB = clr; @@ -952,12 +952,12 @@ done_with_glyph: if (!alloced) { if (!(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); - if(tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { + if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { newItem = reinterpret_cast(malloc(sizeof(ImageItem))); ZeroMemory(newItem, sizeof(ImageItem)); *newItem = tmpItem; StatusItems[i].imageItem = newItem; - if(g_ImageItems == NULL) + if (g_ImageItems == NULL) g_ImageItems = newItem; else { ImageItem *pItem = g_ImageItems; @@ -969,7 +969,7 @@ done_with_glyph: alloced = TRUE; } } - else if(newItem != NULL) + else if (newItem != NULL) StatusItems[i].imageItem = newItem; } } @@ -1001,13 +1001,13 @@ void IMG_DeleteItems() } g_ButtonItems = NULL; - if(g_CLUIImageItem) { + if (g_CLUIImageItem) { IMG_DeleteItem(g_CLUIImageItem); free(g_CLUIImageItem); } g_CLUIImageItem = NULL; - if(g_glyphItem) { + if (g_glyphItem) { IMG_DeleteItem(g_glyphItem); free(g_glyphItem); } @@ -1100,7 +1100,7 @@ static void BTN_ReadItem(char *itemName, char *file) if (!_stricmp(szBuffer, "service")) { tmpItem.szService[0] = 0; GetPrivateProfileStringA(itemName, "Service", "None", szBuffer, 1000, file); - if(_stricmp(szBuffer, "None")) { + if (_stricmp(szBuffer, "None")) { mir_snprintf(tmpItem.szService, 256, "%s", szBuffer); tmpItem.dwFlags |= BUTTON_ISSERVICE; tmpItem.uId = nextButtonID++; @@ -1109,7 +1109,7 @@ static void BTN_ReadItem(char *itemName, char *file) else if (!_stricmp(szBuffer, "protoservice")) { tmpItem.szService[0] = 0; GetPrivateProfileStringA(itemName, "Service", "None", szBuffer, 1000, file); - if(_stricmp(szBuffer, "None")) { + if (_stricmp(szBuffer, "None")) { mir_snprintf(tmpItem.szService, 256, "%s", szBuffer); tmpItem.dwFlags |= BUTTON_ISPROTOSERVICE; tmpItem.uId = nextButtonID++; @@ -1119,12 +1119,12 @@ static void BTN_ReadItem(char *itemName, char *file) int n; GetPrivateProfileStringA(itemName, "Module", "None", szBuffer, 1000, file); - if(_stricmp(szBuffer, "None")) + if (_stricmp(szBuffer, "None")) mir_snprintf(tmpItem.szModule, 256, "%s", szBuffer); GetPrivateProfileStringA(itemName, "Setting", "None", szBuffer, 1000, file); - if(_stricmp(szBuffer, "None")) + if (_stricmp(szBuffer, "None")) mir_snprintf(tmpItem.szSetting, 256, "%s", szBuffer); - if(GetPrivateProfileIntA(itemName, "contact", 0, file) != 0) + if (GetPrivateProfileIntA(itemName, "contact", 0, file) != 0) tmpItem.dwFlags |= BUTTON_DBACTIONONCONTACT; for (n = 0; n <= 1; n++) { @@ -1165,24 +1165,24 @@ static void BTN_ReadItem(char *itemName, char *file) } } } - if(tmpItem.szModule[0] && tmpItem.szSetting[0]) { + if (tmpItem.szModule[0] && tmpItem.szSetting[0]) { tmpItem.dwFlags |= BUTTON_ISDBACTION; - if(tmpItem.szModule[0] == '$' && (tmpItem.szModule[1] == 'c' || tmpItem.szModule[1] == 'C')) + if (tmpItem.szModule[0] == '$' && (tmpItem.szModule[1] == 'c' || tmpItem.szModule[1] == 'C')) tmpItem.dwFlags |= BUTTON_ISCONTACTDBACTION; tmpItem.uId = nextButtonID++; } } GetPrivateProfileStringA(itemName, "PassContact", "None", szBuffer, 1000, file); - if(_stricmp(szBuffer, "None")) { - if(szBuffer[0] == 'w' || szBuffer[0] == 'W') + if (_stricmp(szBuffer, "None")) { + if (szBuffer[0] == 'w' || szBuffer[0] == 'W') tmpItem.dwFlags |= BUTTON_PASSHCONTACTW; - else if(szBuffer[0] == 'l' || szBuffer[0] == 'L') + else if (szBuffer[0] == 'l' || szBuffer[0] == 'L') tmpItem.dwFlags |= BUTTON_PASSHCONTACTL; } GetPrivateProfileStringA(itemName, "Tip", "None", szBuffer, 1000, file); - if(strcmp(szBuffer, "None")) { + if (strcmp(szBuffer, "None")) { MultiByteToWideChar(cfg::dat.langPackCP, 0, szBuffer, -1, tmpItem.szTip, 256); tmpItem.szTip[255] = 0; @@ -1195,7 +1195,7 @@ static void BTN_ReadItem(char *itemName, char *file) newItem = (ButtonItem *)malloc(sizeof(ButtonItem)); ZeroMemory(newItem, sizeof(ButtonItem)); - if(g_ButtonItems == NULL) { + if (g_ButtonItems == NULL) { g_ButtonItems = newItem; *newItem = tmpItem; newItem->nextItem = 0; @@ -1228,7 +1228,7 @@ void IMG_LoadItems() TCHAR tszFileName[MAX_PATH]; int i = 0; - if(cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) + if (cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) return; MY_pathToAbsolute(dbv.ptszVal, tszFileName); @@ -1254,24 +1254,24 @@ void IMG_LoadItems() szSections[3001] = szSections[3000] = 0; p = szSections; while(lstrlenA(p) > 1) { - if(p[0] == '$' || p[0] == '@') + if (p[0] == '$' || p[0] == '@') IMG_ReadItem(p, szFileName); p += (lstrlenA(p) + 1); } nextButtonID = IDC_TBFIRSTUID; p = szSections; while(lstrlenA(p) > 1) { - if(p[0] == '!') + if (p[0] == '!') BTN_ReadItem(p, szFileName); p += (lstrlenA(p) + 1); } free(szSections); - if(g_ImageItems) { + if (g_ImageItems) { cfg::writeByte("CLCExt", "bskinned", 1); SetButtonToSkinned(); } - if(g_CLUIImageItem) { + if (g_CLUIImageItem) { cfg::dat.bFullTransparent = TRUE; cfg::dat.dwFlags &= ~CLUI_FRAME_CLISTSUNKEN; cfg::writeByte("CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent); @@ -1303,7 +1303,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) szSections[3001] = szSections[3000] = 0; p = szSections; while(lstrlenA(p) > 1) { - if(p[0] == '%') { + if (p[0] == '%') { p += (lstrlenA(p) + 1); continue; } @@ -1323,14 +1323,14 @@ void LoadPerContactSkins(TCHAR *tszFileName) i++; } - if(items) { + if (items) { hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while(hContact) { char UIN[40]; int j; szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if(szProto) { + if (szProto) { uid = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR) uid != CALLSERVICE_NOTFOUND && uid != NULL) { DBVARIANT dbv = {0}; @@ -1374,8 +1374,8 @@ void LoadPerContactSkins(TCHAR *tszFileName) break; } } - if(j == i - 1) { // disable the db copy if it has been disabled in the skin .ini file - if(cfg::getByte(hContact, "EXTBK", "VALID", 0)) + if (j == i - 1) { // disable the db copy if it has been disabled in the skin .ini file + if (cfg::getByte(hContact, "EXTBK", "VALID", 0)) cfg::writeByte(hContact, "EXTBK", "VALID", 0); } } @@ -1428,7 +1428,7 @@ void extbk_import(char *file, HWND hwndDlg) data = 0; GetPrivateProfileStructA("Global", "Version", &version, 4, file); - if(version >= 2) { + if (version >= 2) { for (n = 0; n <= FONTID_LAST; n++) { mir_snprintf(szSection, 255, "Font%d", n); @@ -1468,7 +1468,7 @@ void extbk_import(char *file, HWND hwndDlg) } } i = 0; - if(version >= 3) { + if (version >= 3) { char szString[MAX_PATH]; szString[0] = 0; @@ -1489,20 +1489,20 @@ void extbk_import(char *file, HWND hwndDlg) i++; } GetPrivateProfileStringA("Global", "BkBitmap", "", szString, MAX_PATH, file); - if(lstrlenA(szString) > 0) + if (lstrlenA(szString) > 0) cfg::writeString(NULL, "CLC", "BkBitmap", szString); } Reload3dBevelColors(); ReloadThemedOptions(); // refresh - if(hwndDlg && ServiceExists(MS_CLNSE_FILLBYCURRENTSEL)) + if (hwndDlg && ServiceExists(MS_CLNSE_FILLBYCURRENTSEL)) CallService(MS_CLNSE_FILLBYCURRENTSEL, (WPARAM)hwndDlg, 0); pcli->pfnClcOptionsChanged(); ConfigureCLUIGeometry(1); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN); - if(oldexIconScale != cfg::dat.exIconScale) { + if (oldexIconScale != cfg::dat.exIconScale) { ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale); IcoLibReloadIcons(); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); @@ -1519,7 +1519,7 @@ static void ApplyCLUISkin() WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, 0, 0); - if(cfg::getByte("CLUI", "skin_changed", 0)) { + if (cfg::getByte("CLUI", "skin_changed", 0)) { extbk_import(szFinalName, 0); SaveCompleteStructToDB(); cfg::writeByte("CLUI", "skin_changed", 0); @@ -1608,12 +1608,12 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (!GetOpenFileName(&ofn)) break; MY_pathToRelative(str, final_path); - if(PathFileExists(str)) { + if (PathFileExists(str)) { int skinChanged = 0; DBVARIANT dbv = {0}; if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { - if(_tcscmp(dbv.ptszVal, final_path)) + if (_tcscmp(dbv.ptszVal, final_path)) skinChanged = TRUE; DBFreeVariant(&dbv); } @@ -1636,7 +1636,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, MAX_PATH); tszFilename[MAX_PATH - 1] = 0; MY_pathToAbsolute(tszFilename, tszFinalPath); - if(PathFileExists(tszFinalPath)) { + if (PathFileExists(tszFinalPath)) { LoadPerContactSkins(tszFinalPath); ReloadSkinItemsToCache(); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); @@ -1689,10 +1689,10 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara TabCtrl_InsertItem(GetDlgItem(hwnd, IDC_OPTIONSTAB), 0, &tci); MoveWindow((HWND)tci.lParam,5,25,rcClient.right-9,rcClient.bottom-60,1); ShowWindow((HWND)tci.lParam, oPage == 0 ? SW_SHOW : SW_HIDE); - if(IS_THEMED) + if (IS_THEMED) API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); - if(ServiceExists(MS_CLNSE_INVOKE)) { + if (ServiceExists(MS_CLNSE_INVOKE)) { ZeroMemory(&sd, sizeof(sd)); sd.cbSize = sizeof(sd); sd.StatusItems = StatusItems; @@ -1706,10 +1706,10 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara hwndSkinEdit = (HWND)CallService(MS_CLNSE_INVOKE, 0, (LPARAM)&sd); } - if(hwndSkinEdit) { + if (hwndSkinEdit) { ShowWindow(hwndSkinEdit, oPage == 1 ? SW_SHOW : SW_HIDE); TabCtrl_SetCurSel(GetDlgItem(hwnd, IDC_OPTIONSTAB), oPage); - if(IS_THEMED) + if (IS_THEMED) API::pfnEnableThemeDialogTexture(hwndSkinEdit, ETDT_ENABLETAB); } @@ -1845,12 +1845,12 @@ int CoolSB_SetupScrollBar() cfg::dat.bSkinnedScrollbar = FALSE; - if(cfg::getByte("CLC", "NoVScrollBar", 0)) { + if (cfg::getByte("CLC", "NoVScrollBar", 0)) { UninitializeCoolSB(pcli->hwndContactTree); return 0; } - if(cfg::dat.bSkinnedScrollbar) { + if (cfg::dat.bSkinnedScrollbar) { InitializeCoolSB(pcli->hwndContactTree); CoolSB_SetStyle(pcli->hwndContactTree, SB_VERT, CSBS_HOTTRACKED); } diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index ee95e2e701..63fed7fbce 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -152,7 +152,7 @@ void _DebugTraceA(const char *fmt, ...) CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szDataPath); mir_snprintf(szLogFileName, MAX_PATH, "%s\\%s", szDataPath, "clist_nicer.log"); f = fopen(szLogFileName, "a+"); - if(f) { + if (f) { fputs(debug, f); fputs("\n", f); fclose(f); @@ -185,17 +185,17 @@ static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) GetSystemTime(&cfg::dat.st); SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft); cfg::dat.bMetaAvail = ServiceExists(MS_MC_GETDEFAULTCONTACT) ? TRUE : FALSE; - if(cfg::dat.bMetaAvail) + if (cfg::dat.bMetaAvail) mir_snprintf(cfg::dat.szMetaName, 256, "%s", (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0)); else strncpy(cfg::dat.szMetaName, "MetaContacts", 255); - if(ServiceExists(MS_MC_DISABLEHIDDENGROUP)) + if (ServiceExists(MS_MC_DISABLEHIDDENGROUP)) CallService(MS_MC_DISABLEHIDDENGROUP, 1, 0); cfg::dat.bMetaEnabled = cfg::getByte(cfg::dat.szMetaName, "Enabled", 1); cfg::dat.bAvatarServiceAvail = ServiceExists(MS_AV_GETAVATARBITMAP) ? TRUE : FALSE; - if(cfg::dat.bAvatarServiceAvail) + if (cfg::dat.bAvatarServiceAvail) HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); cfg::dat.tabSRMM_Avail = ServiceExists("SRMsg_MOD/GetWindowFlags") ? TRUE : FALSE; @@ -274,16 +274,16 @@ extern "C" int __declspec(dllexport) CListInitialise() cfg::dat.sortOrder[1] = HIBYTE(LOWORD(sortOrder)); cfg::dat.sortOrder[2] = LOBYTE(HIWORD(sortOrder)); - if(cfg::dat.bFirstRun) + if (cfg::dat.bFirstRun) cfg::writeByte("CLUI", "firstrun", 0); if (!cfg::getString(NULL, "CLUI", "exIconOrder", &dbv)) { - if(lstrlenA(dbv.pszVal) < EXICON_COUNT) { + if (lstrlenA(dbv.pszVal) < EXICON_COUNT) { for (i = 1; i <= EXICON_COUNT; i++) cfg::dat.exIconOrder[i - 1] = i; } else { for (i = 0; i < EXICON_COUNT; i++) - if(dbv.pszVal[i] < EXICON_COUNT+1 && dbv.pszVal[i] >0) + if (dbv.pszVal[i] < EXICON_COUNT+1 && dbv.pszVal[i] >0) cfg::dat.exIconOrder[i] = dbv.pszVal[i]; else cfg::dat.exIconOrder[i] = i+1; diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 25a7b6b68d..3ef0bef92e 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -161,7 +161,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) { group=group->parent; indent--; - if(group==NULL) break; // Finished list + if (group==NULL) break; // Finished list group->scanIndex++; continue; } @@ -173,7 +173,7 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) // Calc row height getRowHeight(dat, hwnd, Drawing, line_num, dwStyle); - if(group->cl.items[group->scanIndex]->type==CLCIT_GROUP && /*!IsBadCodePtr((FARPROC)group->cl.items[group->scanIndex]->group) && */ (group->cl.items[group->scanIndex]->group->expanded & 0x0000ffff)) { + if (group->cl.items[group->scanIndex]->type==CLCIT_GROUP && /*!IsBadCodePtr((FARPROC)group->cl.items[group->scanIndex]->group) && */ (group->cl.items[group->scanIndex]->group->expanded & 0x0000ffff)) { group=group->cl.items[group->scanIndex]->group; indent++; group->scanIndex=0; @@ -271,7 +271,7 @@ int RowHeight::getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *c if (!dat->bisEmbedded) { if (!(dwFlags & FLT_SIMPLE)) { - if(dwFlags & FLT_DUALROW) { + if (dwFlags & FLT_DUALROW) { height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); } // Avatar size diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index 09036b2ed7..c603953f2c 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -64,13 +64,13 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_NCHITTEST: { LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam); - if(lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT + if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) return HTTRANSPARENT; break; } case WM_ERASEBKGND: - if(cfg::dat.bSkinnedStatusBar) + if (cfg::dat.bSkinnedStatusBar) return 1; return CallWindowProc(OldStatusBarProc, hwnd, msg, wParam, lParam); @@ -83,10 +83,10 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case WM_PAINT: - if(cfg::shutDown || !StatusItems) + if (cfg::shutDown || !StatusItems) return 0; - if(cfg::dat.bSkinnedStatusBar) { + if (cfg::dat.bSkinnedStatusBar) { PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); HDC hdcMem = CreateCompatibleDC(hdc); @@ -136,7 +136,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SendMessage(pcli->hwndContactList, WM_DRAWITEM, 0, (LPARAM)&dis); } BitBlt(hdc, 0, 0, rcClient.right, rcClient.bottom, hdcMem, 0, 0, SRCCOPY); - if(hOldFont) + if (hOldFont) SelectObject(hdcMem, hOldFont); SelectObject(hdcMem, hbmOld); DeleteObject(hbmMem); @@ -150,7 +150,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case WM_TIMER: - if(wParam == TIMERID_HOVER) { + if (wParam == TIMERID_HOVER) { POINT pt; KillTimer(hwnd, TIMERID_HOVER); @@ -163,14 +163,14 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM nParts = SendMessage(hwnd, SB_GETPARTS, 0, 0); for (i = 0; i < nParts; i++) { SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc); - if(PtInRect(&rc,pt)) { + if (PtInRect(&rc,pt)) { ProtocolData *PD; PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0); - if(PD) { - if(NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event + if (PD) { + if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event tooltip_active = TRUE; - else if(cfg::getDword("mToolTip", "ShowStatusTip", 0)) { + else if (cfg::getDword("mToolTip", "ShowStatusTip", 0)) { CLCINFOTIP ti = {0}; BYTE isLocked = 0; char szTipText[256], *szStatus = NULL; diff --git a/plugins/Clist_nicer/src/statusfloater.cpp b/plugins/Clist_nicer/src/statusfloater.cpp index d07196ee16..392fe90d2a 100644 --- a/plugins/Clist_nicer/src/statusfloater.cpp +++ b/plugins/Clist_nicer/src/statusfloater.cpp @@ -98,7 +98,7 @@ static struct ContactFloater *FLT_RemoveFromList(struct ContactFloater *pFloater struct ContactFloater *pCurrent = pFirstFloater; if (pFloater == pFirstFloater) { - if(pFloater->pNextFloater != NULL) + if (pFloater->pNextFloater != NULL) pFirstFloater = pFloater->pNextFloater; else pFirstFloater = NULL; @@ -363,7 +363,7 @@ INT_PTR CALLBACK DlgProcFloatingContacts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_FLT_PADTOP: { - if(HIWORD(wParam) == EN_CHANGE){ + if (HIWORD(wParam) == EN_CHANGE){ int value = SendDlgItemMessage(hwndDlg, IDC_FLT_PADTOPSPIN, UDM_GETPOS, 0, 0); SendDlgItemMessage(hwndDlg, IDC_FLT_PADBOTTOMSPIN, UDM_SETPOS, 0, (LPARAM)value); } @@ -394,7 +394,7 @@ INT_PTR CALLBACK DlgProcFloatingContacts(HWND hwndDlg, UINT msg, WPARAM wParam, g_floatoptions.enabled = IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED) ? 1 : 0; g_floatoptions.dwFlags = 0; - if(IsDlgButtonChecked(hwndDlg, IDC_FLT_SIMPLELAYOUT)) + if (IsDlgButtonChecked(hwndDlg, IDC_FLT_SIMPLELAYOUT)) g_floatoptions.dwFlags = FLT_SIMPLE; g_floatoptions.dwFlags |= (IsDlgButtonChecked(hwndDlg, IDC_FLT_AVATARS) ? FLT_AVATARS : 0) | @@ -490,7 +490,7 @@ LRESULT CALLBACK StatusFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR switch(msg) { case WM_DESTROY: Utils_SaveWindowPosition(hwnd, 0, "CLUI", "sfl"); - if(g_SFLCachedDC) { + if (g_SFLCachedDC) { SelectObject(g_SFLCachedDC, g_SFLhbmOld); DeleteObject(g_SFLhbm); DeleteDC(g_SFLCachedDC); @@ -529,8 +529,8 @@ LRESULT CALLBACK StatusFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR GetCursorPos(&pt); GetWindowRect(hwnd, &rcWindow); - if(cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) { - if(pt.y > rcWindow.top + ((rcWindow.bottom - rcWindow.top) / 2)) + if (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) { + if (pt.y > rcWindow.top + ((rcWindow.bottom - rcWindow.top) / 2)) SendMessage(g_hwndEventArea, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0); else TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL); @@ -581,7 +581,7 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA INT_PTR iEntry = GetWindowLongPtr(hwnd, GWLP_USERDATA); struct TExtraCache *centry = NULL; - if(iEntry >= 0 && iEntry < cfg::nextCacheEntry) + if (iEntry >= 0 && iEntry < cfg::nextCacheEntry) centry = &cfg::eCache[iEntry]; switch(msg) { @@ -590,12 +590,12 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA CREATESTRUCT *cs = (CREATESTRUCT *)lParam; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams); iEntry = (int)cs->lpCreateParams; - if(iEntry >= 0 && iEntry < cfg::nextCacheEntry) + if (iEntry >= 0 && iEntry < cfg::nextCacheEntry) centry = &cfg::eCache[iEntry]; return TRUE; } case WM_DESTROY: - if(centry) { + if (centry) { WINDOWPLACEMENT wp = {0}; SelectObject(centry->floater->hdc, centry->floater->hbmOld); @@ -620,7 +620,7 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA return TRUE; } case WM_LBUTTONDBLCLK: - if(centry) + if (centry) CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)centry->hContact, 0); return 0; case WM_LBUTTONDOWN: @@ -664,7 +664,7 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA while(pCurrent->hwnd != hwnd) pCurrent = pCurrent->pNextFloater; - if(FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) { g_floatoptions.trans = g_floatoptions.act_trans; FLT_Update(cfg::clcdat, contact); g_floatoptions.trans = oldTrans; @@ -680,7 +680,7 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA while(pCurrent->hwnd != hwnd) pCurrent = pCurrent->pNextFloater; - if(FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) + if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) FLT_Update(cfg::clcdat, contact); if (hTooltipTimer) @@ -703,7 +703,7 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (g_floatoptions.dwFlags & FLT_SNAP) FLT_SnapToEdges(hwnd); - if(GetKeyState(VK_CONTROL) < 0) + if (GetKeyState(VK_CONTROL) < 0) FLT_SnapToFloater(hwnd); break; @@ -716,7 +716,7 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKELONG(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)centry->hContact)); case WM_CONTEXTMENU: { - if(centry) { + if (centry) { HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)centry->hContact, 0); RECT rcWindow; @@ -761,7 +761,7 @@ void SFL_UnregisterWindowClass() void SFL_Destroy() { - if(g_hwndSFL) + if (g_hwndSFL) DestroyWindow(g_hwndSFL); g_hwndSFL = 0; } @@ -781,7 +781,7 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO RECT rcStatusArea; LONG cy; - if(g_hwndSFL == 0) + if (g_hwndSFL == 0) return; GetClientRect(g_hwndSFL, &rcClient); @@ -792,7 +792,7 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO szDest.cx = rcWindow.right - rcWindow.left; szDest.cy = rcWindow.bottom - rcWindow.top; - if(item->IGNORED) { + if (item->IGNORED) { FillRect(g_SFLCachedDC, &rcClient, GetSysColorBrush(COLOR_3DFACE)); SetTextColor(g_SFLCachedDC, GetSysColor(COLOR_BTNTEXT)); } @@ -808,12 +808,12 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO rcStatusArea = rcClient; - if(cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) + if (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) rcStatusArea.bottom = 20; cy = rcStatusArea.bottom - rcStatusArea.top; - if(szText != NULL && refresh) { + if (szText != NULL && refresh) { _tcsncpy(sfl_statustext, szText, 100); sfl_statustext[99] = 0; } @@ -821,18 +821,18 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO if (!hIcon) { HICON p_hIcon; - if(refresh) + if (refresh) sfl_iIcon = iIcon; - if(sfl_iIcon != -1) { + if (sfl_iIcon != -1) { p_hIcon = ImageList_ExtractIcon(0, hCListImages, sfl_iIcon); DrawIconEx(g_SFLCachedDC, 5, (cy - 16) / 2, p_hIcon, 16, 16, 0, 0, DI_NORMAL); DestroyIcon(p_hIcon); } } else { - if(refresh) + if (refresh) sfl_hIcon = hIcon; - if(sfl_hIcon != (HICON)-1) + if (sfl_hIcon != (HICON)-1) DrawIconEx(g_SFLCachedDC, 5, (cy - 16) / 2, sfl_hIcon, 16, 16, 0, 0, DI_NORMAL); } @@ -841,7 +841,7 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO GetTextExtentPoint32(g_SFLCachedDC, sfl_statustext, lstrlen(sfl_statustext), &szT); TextOut(g_SFLCachedDC, 24, (cy - szT.cy) / 2, sfl_statustext, lstrlen(sfl_statustext)); - if(cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) { + if (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) { RECT rcNA = rcClient; rcNA.top = 18; @@ -850,7 +850,7 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO SelectObject(g_SFLCachedDC, hOldFont); - if(API::pfnUpdateLayeredWindow) + if (API::pfnUpdateLayeredWindow) API::pfnUpdateLayeredWindow(g_hwndSFL, 0, &ptDest, &szDest, g_SFLCachedDC, &ptSrc, GetSysColor(COLOR_3DFACE), &bf, ULW_ALPHA | ULW_COLORKEY); } @@ -865,11 +865,11 @@ void SFL_SetState(int uMode) { BYTE bClistState; - if(g_hwndSFL == 0 || !(cfg::dat.bUseFloater & CLUI_USE_FLOATER)) + if (g_hwndSFL == 0 || !(cfg::dat.bUseFloater & CLUI_USE_FLOATER)) return; - if(uMode == -1) { - if(cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE) { + if (uMode == -1) { + if (cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE) { bClistState = cfg::getByte("CList", "State", SETTING_STATE_NORMAL); ShowWindow(g_hwndSFL, bClistState == SETTING_STATE_NORMAL ? SW_SHOW : SW_HIDE); } @@ -905,7 +905,7 @@ void SFL_SetSize() SetWindowPos(g_hwndSFL, HWND_TOPMOST, rcWindow.left, rcWindow.top, lWidth, max(cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS ? 36 : 20, sz.cy + 4), SWP_SHOWWINDOW); GetWindowRect(g_hwndSFL, &rcWindow); - if(g_SFLCachedDC) { + if (g_SFLCachedDC) { SelectObject(g_SFLCachedDC, g_SFLhbmOld); DeleteObject(g_SFLhbm); DeleteDC(g_SFLCachedDC); @@ -922,7 +922,7 @@ void SFL_SetSize() void SFL_Create() { - if(g_hwndSFL == 0 && cfg::dat.bUseFloater & CLUI_USE_FLOATER && API::pfnUpdateLayeredWindow != NULL) + if (g_hwndSFL == 0 && cfg::dat.bUseFloater & CLUI_USE_FLOATER && API::pfnUpdateLayeredWindow != NULL) g_hwndSFL = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_LAYERED, _T("StatusFloaterClass"), _T("sfl"), WS_VISIBLE, 0, 0, 0, 0, 0, 0, g_hInst, 0); else return; @@ -944,14 +944,14 @@ void FLT_SetSize(struct TExtraCache *centry, LONG width, LONG height) if ((g_floatoptions.dwFlags & FLT_AUTOHIDE) && (iVis == 2 || iVis == 4)) //2 = GWVS_VISIBLE, 4 = GWVS_PARTIALLY_COVERED flags = SWP_NOMOVE | SWP_NOACTIVATE; - if(centry->floater) { + if (centry->floater) { hdc = GetDC(centry->floater->hwnd); oldFont = reinterpret_cast(SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT))); SetWindowPos(centry->floater->hwnd, HWND_TOPMOST, 0, 0, width, height, flags); GetWindowRect(centry->floater->hwnd, &rcWindow); - if(centry->floater->hdc) { + if (centry->floater->hdc) { SelectObject(centry->floater->hdc, centry->floater->hbmOld); DeleteObject(centry->floater->hbm); DeleteDC(centry->floater->hdc); @@ -970,35 +970,35 @@ void FLT_Create(int iEntry) { struct TExtraCache *centry = NULL; - if(iEntry >= 0 && iEntry < cfg::nextCacheEntry) { + if (iEntry >= 0 && iEntry < cfg::nextCacheEntry) { struct ClcContact *contact = NULL; struct ClcGroup *group = NULL; centry = &cfg::eCache[iEntry]; - if(centry->floater == 0 && API::pfnUpdateLayeredWindow != NULL) { + if (centry->floater == 0 && API::pfnUpdateLayeredWindow != NULL) { centry->floater = (struct ContactFloater *)malloc(sizeof(struct ContactFloater)); - if(centry->floater == NULL) + if (centry->floater == NULL) return; FLT_AddToList(centry->floater); centry->floater->hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_LAYERED, _T("ContactFloaterClass"), _T("sfl"), WS_VISIBLE, 0, 0, 0, 0, 0, 0, g_hInst, (LPVOID)iEntry); centry->floater->hContact = centry->hContact; } - else if(centry->floater != NULL) { + else if (centry->floater != NULL) { ShowWindow(centry->floater->hwnd, SW_SHOWNOACTIVATE); return; } SetWindowLongPtr(centry->floater->hwnd, GWL_STYLE, GetWindowLongPtr(centry->floater->hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_OVERLAPPEDWINDOW | WS_POPUPWINDOW)); - if(Utils_RestoreWindowPosition(centry->floater->hwnd, centry->hContact, "CList", "flt")) - if(Utils_RestoreWindowPositionNoMove(centry->floater->hwnd, centry->hContact, "CList", "flt")) + if (Utils_RestoreWindowPosition(centry->floater->hwnd, centry->hContact, "CList", "flt")) + if (Utils_RestoreWindowPositionNoMove(centry->floater->hwnd, centry->hContact, "CList", "flt")) SetWindowPos(centry->floater->hwnd, 0, 50, 50, 150, 30, SWP_NOZORDER | SWP_NOACTIVATE); //FLT_SetSize(centry, 100, 20); ShowWindow(centry->floater->hwnd, SW_SHOWNOACTIVATE); - if(FindItem(pcli->hwndContactTree, cfg::clcdat, centry->hContact, &contact, &group, 0)) { - if(contact) + if (FindItem(pcli->hwndContactTree, cfg::clcdat, centry->hContact, &contact, &group, 0)) { + if (contact) FLT_Update(cfg::clcdat, contact); } } @@ -1026,13 +1026,13 @@ void FLT_Update(struct ClcData *dat, struct ClcContact *contact) HBRUSH brKey; float greyLevel; - if(contact == NULL || dat == NULL) + if (contact == NULL || dat == NULL) return; - if(contact->extraCacheEntry < 0 || contact->extraCacheEntry >= cfg::nextCacheEntry) + if (contact->extraCacheEntry < 0 || contact->extraCacheEntry >= cfg::nextCacheEntry) return; - if(cfg::eCache[contact->extraCacheEntry].floater == NULL) + if (cfg::eCache[contact->extraCacheEntry].floater == NULL) return; FLT_SetSize(&cfg::eCache[contact->extraCacheEntry], g_floatoptions.width, RowHeight::getFloatingRowHeight(dat, pcli->hwndContactTree, contact, g_floatoptions.dwFlags) + (2*g_floatoptions.pad_top)); @@ -1040,7 +1040,7 @@ void FLT_Update(struct ClcData *dat, struct ClcContact *contact) hwnd = cfg::eCache[contact->extraCacheEntry].floater->hwnd; hdc = cfg::eCache[contact->extraCacheEntry].floater->hdc; - if(hwnd == 0) + if (hwnd == 0) return; GetClientRect(hwnd, &rcClient); @@ -1066,17 +1066,17 @@ void FLT_Update(struct ClcData *dat, struct ClcContact *contact) SetBkMode(hdc, TRANSPARENT); - if(g_floatoptions.dwFlags & FLT_ROUNDED){ + if (g_floatoptions.dwFlags & FLT_ROUNDED){ rgn = CreateRoundRectRgn(0, 0, rcClient.right, rcClient.bottom, g_floatoptions.radius, g_floatoptions.radius); SelectClipRgn(hdc, rgn); - if(g_floatoptions.dwFlags & FLT_FILLSTDCOLOR) { + if (g_floatoptions.dwFlags & FLT_FILLSTDCOLOR) { HBRUSH br = CreateSolidBrush(cfg::clcdat->bkColour); FillRect(hdc, &rcClient, br); DeleteObject(br); } } - if(FindItem(pcli->hwndContactTree, dat, contact->hContact, &newContact, &group, 0)) { + if (FindItem(pcli->hwndContactTree, dat, contact->hContact, &newContact, &group, 0)) { DWORD oldFlags = cfg::dat.dwFlags; BYTE oldPadding = cfg::dat.avatarPadding; DWORD oldExtraImageMask = cfg::eCache[contact->extraCacheEntry].dwXMask; @@ -1086,7 +1086,7 @@ void FLT_Update(struct ClcData *dat, struct ClcContact *contact) int oldLeftMargin = dat->leftMargin; int oldRightMargin = dat->rightMargin; - if(g_floatoptions.dwFlags & FLT_SIMPLE) { + if (g_floatoptions.dwFlags & FLT_SIMPLE) { contact->ace = 0; contact->bSecondLine = MULTIROW_NEVER; cfg::dat.dwFlags &= ~(CLUI_SHOWCLIENTICONS | CLUI_SHOWVISI); @@ -1141,9 +1141,9 @@ void FLT_Update(struct ClcData *dat, struct ClcContact *contact) dat->rightMargin = oldRightMargin; } - if(g_floatoptions.dwFlags & FLT_BORDER){ + if (g_floatoptions.dwFlags & FLT_BORDER){ hbrBorder = CreateSolidBrush(g_floatoptions.border_colour); - if(g_floatoptions.dwFlags & FLT_ROUNDED) + if (g_floatoptions.dwFlags & FLT_ROUNDED) FrameRgn(hdc, rgn, hbrBorder, 1, 1); else FrameRect(hdc, &rcClient, hbrBorder); @@ -1151,14 +1151,14 @@ void FLT_Update(struct ClcData *dat, struct ClcContact *contact) DeleteObject(hbrBorder); } - if(g_floatoptions.dwFlags & FLT_ROUNDED) + if (g_floatoptions.dwFlags & FLT_ROUNDED) DeleteObject(rgn); bf.BlendOp = AC_SRC_OVER; bf.AlphaFormat = 0; bf.SourceConstantAlpha = g_floatoptions.trans; - if(API::pfnUpdateLayeredWindow) + if (API::pfnUpdateLayeredWindow) API::pfnUpdateLayeredWindow(hwnd, 0, &ptDest, &szDest, hdc, &ptSrc, clrKey /*GetSysColor(COLOR_3DFACE)*/, &bf, ULW_COLORKEY | ULW_ALPHA); } @@ -1175,11 +1175,11 @@ void FLT_SyncWithClist() HWND hwnd; int iVis = pcli->pfnGetWindowVisibleState(pcli->hwndContactList, 0, 0); - if(g_floatoptions.dwFlags & FLT_SYNCWITHCLIST){ + if (g_floatoptions.dwFlags & FLT_SYNCWITHCLIST){ while(pCurrent) { hwnd = pCurrent->hwnd; - if(hwnd && IsWindow(hwnd)) { - if(FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) { + if (hwnd && IsWindow(hwnd)) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) { FLT_Update(cfg::clcdat, contact); if (((g_floatoptions.dwFlags & FLT_AUTOHIDE) && (iVis == 2 || iVis == 4)) || !(g_floatoptions.dwFlags & FLT_AUTOHIDE)) ShowWindow(hwnd, SW_SHOWNOACTIVATE); @@ -1205,13 +1205,13 @@ void FLT_ShowHideAll(int showCmd) struct ContactFloater *pCurrent = pFirstFloater; HWND hwnd; - if(g_floatoptions.dwFlags & FLT_AUTOHIDE){ + if (g_floatoptions.dwFlags & FLT_AUTOHIDE){ while(pCurrent) { hwnd = pCurrent->hwnd; - if(hwnd && IsWindow(hwnd)) { - if(showCmd == SW_SHOWNOACTIVATE && FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) + if (hwnd && IsWindow(hwnd)) { + if (showCmd == SW_SHOWNOACTIVATE && FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) ShowWindow(hwnd, SW_SHOWNOACTIVATE); - else if(showCmd != SW_SHOWNOACTIVATE) + else if (showCmd != SW_SHOWNOACTIVATE) ShowWindow(hwnd, showCmd); } pCurrent = pCurrent->pNextFloater; @@ -1229,9 +1229,9 @@ void FLT_RefreshAll() struct ContactFloater *pCurrent = pFirstFloater; while(pCurrent) { - if(FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) { HWND hwnd = pCurrent->hwnd; - if(hwnd && IsWindow(hwnd)) + if (hwnd && IsWindow(hwnd)) FLT_Update(cfg::clcdat, contact); } pCurrent = pCurrent->pNextFloater; diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index f9961578f8..68608b67c3 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -84,7 +84,7 @@ void CLVM_EnumModes(pfnEnumCallback EnumCallback) int FillModes(char *szsetting) { - if(szsetting[0] == 'ö') + if (szsetting[0] == 'ö') return 1; SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szsetting); return 1; @@ -95,13 +95,13 @@ static void ShowPage(HWND hwnd, int page) int i = 0; int pageChange = 0; - if(page == 0 && IsWindowVisible(GetDlgItem(hwnd, _page2Controls[0]))) + if (page == 0 && IsWindowVisible(GetDlgItem(hwnd, _page2Controls[0]))) pageChange = 1; - if(page == 1 && IsWindowVisible(GetDlgItem(hwnd, _page1Controls[0]))) + if (page == 1 && IsWindowVisible(GetDlgItem(hwnd, _page1Controls[0]))) pageChange = 1; - if(pageChange) + if (pageChange) SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); switch(page) { @@ -120,7 +120,7 @@ static void ShowPage(HWND hwnd, int page) ShowWindow(GetDlgItem(hwnd, _page2Controls[i++]), SW_SHOW); break; } - if(pageChange) { + if (pageChange) { SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE); } @@ -157,7 +157,7 @@ static void UpdateStickies() while(hContact) { hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); - if(hItem) + if (hItem) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, cfg::getByte(hContact, "CLVM", g_szModename, 0) ? 1 : 0); localMask = HIWORD(cfg::getDword(hContact, "CLVM", g_szModename, 0)); UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask); @@ -229,7 +229,7 @@ static int FillDialog(HWND hwnd) for (i = 0;;i++) { mir_snprintf(buf, 20, "%d", i); - if(cfg::getTString(NULL, "CListGroups", buf, &dbv)) + if (cfg::getTString(NULL, "CListGroups", buf, &dbv)) break; item.pszText = &dbv.ptszVal[1]; @@ -276,20 +276,20 @@ static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iIm typeOfFirst=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hFirstItem,0); //check groups - if(typeOfFirst==CLCIT_GROUP) hItem=hFirstItem; + if (typeOfFirst==CLCIT_GROUP) hItem=hFirstItem; else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hFirstItem); while(hItem) { hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if(hChildItem) + if (hChildItem) SetAllChildIcons(hwndList,hChildItem,iColumn,iImage); hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); } //check contacts - if(typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem; + if (typeOfFirst==CLCIT_CONTACT) hItem=hFirstItem; else hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hFirstItem); while(hItem) { iOldIcon=SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); - if(iOldIcon!=0xFF && iOldIcon!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); + if (iOldIcon!=0xFF && iOldIcon!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTCONTACT,(LPARAM)hItem); } } @@ -299,26 +299,26 @@ static void SetIconsForColumn(HWND hwndList,HANDLE hItem,HANDLE hItemAll,int iCo int itemType; itemType=SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hItem,0); - if(itemType==CLCIT_CONTACT) { + if (itemType==CLCIT_CONTACT) { int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); if (oldiImage!=0xFF&&oldiImage!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); } - else if(itemType==CLCIT_INFO) { + else if (itemType==CLCIT_INFO) { int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); if (oldiImage!=0xFF&&oldiImage!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); - if(hItem == hItemAll) + if (hItem == hItemAll) SetAllChildIcons(hwndList,hItem,iColumn,iImage); else SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); //hItemUnknown } - else if(itemType==CLCIT_GROUP) { + else if (itemType==CLCIT_GROUP) { int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); if (oldiImage!=0xFF&&oldiImage!=iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); - if(hItem) + if (hItem) SetAllChildIcons(hwndList,hItem,iColumn,iImage); } } @@ -359,7 +359,7 @@ void SaveState() HANDLE hContact, hItem; DWORD operators = 0; - if(clvm_curItem == -1) + if (clvm_curItem == -1) return; { @@ -368,7 +368,7 @@ void SaveState() hwndList = GetDlgItem(clvmHwnd, IDC_PROTOCOLS); for (i = 0; i < ListView_GetItemCount(hwndList); i++) { - if(ListView_GetCheckState(hwndList, i)) { + if (ListView_GetCheckState(hwndList, i)) { item.mask = LVIF_TEXT; item.pszText = szTemp; item.cchTextMax = 255; @@ -390,7 +390,7 @@ void SaveState() operators |= ListView_GetCheckState(hwndList, 0) ? CLVM_INCLUDED_UNGROUPED : 0; for (i = 0; i < ListView_GetItemCount(hwndList); i++) { - if(ListView_GetCheckState(hwndList, i)) { + if (ListView_GetCheckState(hwndList, i)) { item.mask = LVIF_TEXT; item.pszText = szTemp; item.cchTextMax = 255; @@ -404,37 +404,37 @@ void SaveState() } hwndList = GetDlgItem(clvmHwnd, IDC_STATUSMODES); for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { - if(ListView_GetCheckState(hwndList, i - ID_STATUS_OFFLINE)) + if (ListView_GetCheckState(hwndList, i - ID_STATUS_OFFLINE)) statusMask |= (1 << (i - ID_STATUS_OFFLINE)); } iLen = SendMessageA(GetDlgItem(clvmHwnd, IDC_VIEWMODES), LB_GETTEXTLEN, clvm_curItem, 0); - if(iLen) { + if (iLen) { unsigned int stickies = 0; DWORD dwGlobalMask, dwLocalMask; BOOL translated; szModeName = ( char* )malloc(iLen + 1); - if(szModeName) { + if (szModeName) { DWORD options, lmdat; //char *vastring = NULL; //int len = GetWindowTextLengthA(GetDlgItem(clvmHwnd, IDC_VARIABLES)) + 1; //vastring = (char *)malloc(len); - //if(vastring) + //if (vastring) // GetDlgItemTextA(clvmHwnd, IDC_VARIABLES, vastring, len); SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szModeName); dwGlobalMask = GetMaskForItem(hInfoItem); hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while(hContact) { hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); - if(hItem) { - if(SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { + if (hItem) { + if (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { dwLocalMask = GetMaskForItem(hItem); cfg::writeDword(hContact, "CLVM", szModeName, MAKELONG(1, (unsigned short)dwLocalMask)); stickies++; } else { - if(cfg::getDword(hContact, "CLVM", szModeName, 0)) + if (cfg::getDword(hContact, "CLVM", szModeName, 0)) cfg::writeDword(hContact, "CLVM", szModeName, 0); } } @@ -477,12 +477,12 @@ void UpdateFilters() DWORD opt; char szTemp[100]; - if(clvm_curItem == LB_ERR) + if (clvm_curItem == LB_ERR) return; iLen = SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXTLEN, clvm_curItem, 0); - if(iLen == 0) + if (iLen == 0) return; szBuf = (char *)malloc(iLen + 1); @@ -492,10 +492,10 @@ void UpdateFilters() mir_snprintf(szTemp, 100, Translate("Current view mode: %s"), g_szModename); SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp); mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf); - if(DBGetContactSetting(NULL, CLVM_MODULE, szSetting, &dbv_pf)) + if (DBGetContactSetting(NULL, CLVM_MODULE, szSetting, &dbv_pf)) goto cleanup; mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf); - if(cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv_gf)) + if (cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv_gf)) goto cleanup; mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf); if ((opt = cfg::getDword(NULL, CLVM_MODULE, szSetting, -1)) != -1) { @@ -521,7 +521,7 @@ void UpdateFilters() item.iItem = i; SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item); mir_snprintf(szMask, 256, "%s|", szTemp); - if(dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask)) + if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask)) ListView_SetCheckState(hwndList, i, TRUE) else ListView_SetCheckState(hwndList, i, FALSE); @@ -544,7 +544,7 @@ void UpdateFilters() item.iItem = i; SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item); _sntprintf(szMask, 256, _T("%s|"), szTemp); - if(dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask)) + if (dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask)) ListView_SetCheckState(hwndList, i, TRUE) else ListView_SetCheckState(hwndList, i, FALSE); @@ -606,7 +606,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP CLCINFOITEM cii = {0}; HICON hIcon; - if(IS_THEMED) + if (IS_THEMED) API::pfnEnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB); himlViewModes = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 12, 0); @@ -639,7 +639,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP cii.pszText = _T("*** All contacts ***"); hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0); - if(SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) { + if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) { clvm_curItem = 0; UpdateFilters(); } @@ -678,17 +678,17 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP } case IDC_AUTOCLEARVAL: case IDC_LASTMSGVALUE: - if(HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam) + if (HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam) Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE); break; case IDC_DELETEVIEWMODE: { - if(MessageBoxA(0, Translate("Really delete this view mode? This cannot be undone"), Translate("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) { + if (MessageBoxA(0, Translate("Really delete this view mode? This cannot be undone"), Translate("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) { char szSetting[256]; int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0); - if(iLen) { + if (iLen) { char *szBuf = ( char* )malloc(iLen + 1); - if(szBuf) { + if (szBuf) { HANDLE hContact; SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), (LPARAM)szBuf); @@ -710,12 +710,12 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP } hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while(hContact) { - if(cfg::getDword(hContact, "CLVM", szBuf, -1) != -1) + if (cfg::getDword(hContact, "CLVM", szBuf, -1) != -1) cfg::writeDword(hContact, "CLVM", szBuf, 0); hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); } SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_DELETESTRING, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0); - if(SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) { + if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) { clvm_curItem = 0; UpdateFilters(); } @@ -735,12 +735,12 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, 256); szBuf[255] = 0; - if(lstrlenA(szBuf) > 2) { - if(cfg::getDword(CLVM_MODULE, szBuf, -1) != -1) + if (lstrlenA(szBuf) > 2) { + if (cfg::getDword(CLVM_MODULE, szBuf, -1) != -1) MessageBox(0, TranslateT("A view mode with this name does alredy exist"), TranslateT("Duplicate name"), MB_OK); else { int iNewItem = SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf); - if(iNewItem != LB_ERR) { + if (iNewItem != LB_ERR) { SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, (WPARAM)iNewItem, 0); SaveViewMode(szBuf, _T(""), "", -1, -1, 0, 0, 0, 0); clvm_curItem = iNewItem; @@ -761,7 +761,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP while(hContact) { hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); - if(hItem) + if (hItem) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0); hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); } @@ -769,18 +769,18 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDOK: case IDC_APPLY: SaveState(); - if(cfg::dat.bFilterEffective) + if (cfg::dat.bFilterEffective) ApplyViewMode(cfg::dat.current_viewmode); - if(LOWORD(wParam) == IDOK) + if (LOWORD(wParam) == IDOK) DestroyWindow(hwndDlg); break; case IDCANCEL: DestroyWindow(hwndDlg); break; } - if(LOWORD(wParam) == IDC_NEWVIEMODE && HIWORD(wParam) == EN_CHANGE) + if (LOWORD(wParam) == IDC_NEWVIEMODE && HIWORD(wParam) == EN_CHANGE) Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, TRUE); - if(LOWORD(wParam) == IDC_VIEWMODES && HIWORD(wParam) == LBN_SELCHANGE) { + if (LOWORD(wParam) == IDC_VIEWMODES && HIWORD(wParam) == LBN_SELCHANGE) { SaveState(); clvm_curItem = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0); UpdateFilters(); @@ -822,16 +822,16 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP DWORD hitFlags; int iImage; - if(nm->iColumn==-1) + if (nm->iColumn==-1) break; hItem = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_CLIST,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y)); - if(hItem==NULL) break; + if (hItem==NULL) break; if (!(hitFlags&CLCHT_ONITEMEXTRA)) break; iImage = SendDlgItemMessage(hwndDlg,IDC_CLIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn,0)); - if(iImage == nullImage) + if (iImage == nullImage) iImage = nm->iColumn; - else if(iImage!=0xFF) + else if (iImage!=0xFF) iImage = nullImage; SetIconsForColumn(GetDlgItem(hwndDlg,IDC_CLIST),hItem,hInfoItem,nm->iColumn,iImage); //SetListGroupIcons(GetDlgItem(hwndDlg,IDC_CLIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hInfoItem,NULL); @@ -842,7 +842,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TAB: if (((LPNMHDR) lParam)->code == TCN_SELCHANGE) { int id = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB)); - if(id == 0) + if (id == 0) ShowPage(hwndDlg, 0); else ShowPage(hwndDlg, 1); @@ -865,7 +865,7 @@ static int menuCounter = 0; static int FillMenuCallback(char *szSetting) { - if(szSetting[0] == (char)246) + if (szSetting[0] == (char)246) return 1; AppendMenuA(hViewModeMenu, MF_STRING, menuCounter++, szSetting); @@ -874,14 +874,14 @@ static int FillMenuCallback(char *szSetting) void BuildViewModeMenu() { - if(hViewModeMenu) + if (hViewModeMenu) DestroyMenu(hViewModeMenu); menuCounter = 100; hViewModeMenu = CreatePopupMenu(); CLVM_EnumModes(FillMenuCallback); - if(GetMenuItemCount(hViewModeMenu) > 0) + if (GetMenuItemCount(hViewModeMenu) > 0) AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, NULL); AppendMenu(hViewModeMenu, MF_STRING, 10001, TranslateT("Setup View Modes...")); @@ -949,7 +949,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM CustomizeButton(hwnd, bSkinned, !bSkinned, bSkinned); } - if(cfg::dat.bFilterEffective) + if (cfg::dat.bFilterEffective) SetWindowTextA(GetDlgItem(hwnd, IDC_SELECTMODE), cfg::dat.current_viewmode); else SetWindowText(GetDlgItem(hwnd, IDC_SELECTMODE), TranslateT("No view mode")); @@ -971,7 +971,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM hbm = CreateCompatibleBitmap(hdc, rc.right, rc.bottom); hbmold = (HBITMAP)SelectObject(hdcMem, hbm); - if(cfg::dat.bWallpaperMode) + if (cfg::dat.bWallpaperMode) SkinDrawBg(hwnd, hdcMem); else FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE)); @@ -996,7 +996,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM GetWindowRect(pcli->hwndContactList, &rcCLUI); GetCursorPos(&pt); - if(PtInRect(&rcCLUI, pt)) + if (PtInRect(&rcCLUI, pt)) break; KillTimer(hwnd, wParam); @@ -1025,11 +1025,11 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM pt.x = rc.left; pt.y = rc.bottom; selection = TrackPopupMenu(hViewModeMenu,TPM_RETURNCMD|TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); - if(selection) { + if (selection) { - if(selection == 10001) + if (selection == 10001) goto clvm_config_command; - else if(selection == 10002) + else if (selection == 10002) goto clvm_reset_command; mii.cbSize = sizeof(mii); @@ -1112,7 +1112,7 @@ void ApplyViewMode(const char *name) mir_snprintf(szSetting, 256, "%c%s_PF", 246, name); if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) { - if(lstrlenA(dbv.pszVal) >= 2) { + if (lstrlenA(dbv.pszVal) >= 2) { strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter)); cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0; cfg::dat.bFilterEffective |= CLVM_FILTER_PROTOS; @@ -1121,7 +1121,7 @@ void ApplyViewMode(const char *name) } mir_snprintf(szSetting, 256, "%c%s_GF", 246, name); if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) { - if(lstrlen(dbv.ptszVal) >= 2) { + if (lstrlen(dbv.ptszVal) >= 2) { _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, safe_sizeof(cfg::dat.groupFilter)); cfg::dat.groupFilter[safe_sizeof(cfg::dat.groupFilter) - 1] = 0; cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS; @@ -1130,12 +1130,12 @@ void ApplyViewMode(const char *name) } mir_snprintf(szSetting, 256, "%c%s_SM", 246, name); cfg::dat.statusMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1); - if(cfg::dat.statusMaskFilter >= 1) + if (cfg::dat.statusMaskFilter >= 1) cfg::dat.bFilterEffective |= CLVM_FILTER_STATUS; mir_snprintf(szSetting, 256, "%c%s_SSM", 246, name); cfg::dat.stickyMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1); - if(cfg::dat.stickyMaskFilter != -1) + if (cfg::dat.stickyMaskFilter != -1) cfg::dat.bFilterEffective |= CLVM_FILTER_STICKYSTATUS; /* @@ -1143,10 +1143,10 @@ void ApplyViewMode(const char *name) if (!DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv)) { strncpy(g_CluiData.varFilter, dbv.pszVal, sizeof(g_CluiData.varFilter)); g_CluiData.varFilter[sizeof(g_CluiData.varFilter) - 1] = 0; - if(lstrlenA(g_CluiData.varFilter) > 10 && ServiceExists(MS_VARS_FORMATSTRING)) + if (lstrlenA(g_CluiData.varFilter) > 10 && ServiceExists(MS_VARS_FORMATSTRING)) g_CluiData.bFilterEffective |= CLVM_FILTER_VARIABLES; mir_free(dbv.ptszVal); - if(g_CluiData.bFilterEffective & CLVM_FILTER_VARIABLES) { + if (g_CluiData.bFilterEffective & CLVM_FILTER_VARIABLES) { HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); char UIN[256]; char *id, *szProto; @@ -1156,11 +1156,11 @@ void ApplyViewMode(const char *name) while(hContact) { szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if(szProto) { + if (szProto) { id = (char*) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if(id) { + if (id) { if (!DBGetContactSetting(hContact, szProto, id, &dbv)) { - if(dbv.type == DBVT_ASCIIZ) { + if (dbv.type == DBVT_ASCIIZ) { mir_snprintf(UIN, 256, "<%s:%s>", szProto, dbv.pszVal); } else { @@ -1173,7 +1173,7 @@ void ApplyViewMode(const char *name) fi.szSource = ""; fi.hContact = 0; temp = (char *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); - if(temp && atol(temp) > 0) + if (temp && atol(temp) > 0) _DebugPopup(hContact, "%s, %d, %d, %d", temp, temp, fi.pCount, fi.eCount); variables_free(temp); DBFreeVariant(&dbv); @@ -1189,7 +1189,7 @@ void ApplyViewMode(const char *name) KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE); - if(cfg::dat.filterFlags & CLVM_AUTOCLEAR) { + if (cfg::dat.filterFlags & CLVM_AUTOCLEAR) { DWORD timerexpire; mir_snprintf(szSetting, 256, "%c%s_OPT", 246, name); timerexpire = LOWORD(cfg::getDword(CLVM_MODULE, szSetting, 0)); @@ -1200,7 +1200,7 @@ void ApplyViewMode(const char *name) strncpy(cfg::dat.current_viewmode, name, 256); cfg::dat.current_viewmode[255] = 0; - if(cfg::dat.filterFlags & CLVM_USELASTMSG) { + if (cfg::dat.filterFlags & CLVM_USELASTMSG) { DWORD unit; int i; BYTE bSaved = cfg::dat.sortOrder[0]; @@ -1214,7 +1214,7 @@ void ApplyViewMode(const char *name) cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG; mir_snprintf(szSetting, 256, "%c%s_LM", 246, name); cfg::dat.lastMsgFilter = cfg::getDword(CLVM_MODULE, szSetting, 0); - if(LOBYTE(HIWORD(cfg::dat.lastMsgFilter))) + if (LOBYTE(HIWORD(cfg::dat.lastMsgFilter))) cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN; else cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG_OLDERTHAN; @@ -1233,10 +1233,10 @@ void ApplyViewMode(const char *name) cfg::dat.lastMsgFilter = unit; } - if(HIWORD(cfg::dat.filterFlags) > 0) + if (HIWORD(cfg::dat.filterFlags) > 0) cfg::dat.bFilterEffective |= CLVM_STICKY_CONTACTS; - if(cfg::dat.boldHideOffline == (BYTE)-1) + if (cfg::dat.boldHideOffline == (BYTE)-1) cfg::dat.boldHideOffline = cfg::getByte("CList", "HideOffline", 0); CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0); diff --git a/plugins/Clist_nicer/src/wallpaper.cpp b/plugins/Clist_nicer/src/wallpaper.cpp index 1e16afe50a..73c513db74 100644 --- a/plugins/Clist_nicer/src/wallpaper.cpp +++ b/plugins/Clist_nicer/src/wallpaper.cpp @@ -37,7 +37,7 @@ void GetWallpaperPattern() { // \Control Panel\Desktop char wpbuf[MAX_PATH]; - if(hPattern) {DeleteObject(hPattern); hPattern=NULL;} + if (hPattern) {DeleteObject(hPattern); hPattern=NULL;} SystemParametersInfo(SPI_GETDESKWALLPAPER,MAX_PATH,wpbuf,NULL); if (strlen(wpbuf)>0) -- cgit v1.2.3