From c274523d9bc253461a3c337d66e09532edae6edd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 9 Nov 2012 22:04:23 +0000 Subject: clist nicer+, part III, final: - standard icons (visible, invisible, chat active) removed from clist due to duplicates; - icon clicks work again; - fix for double extra icons drawing; - tons of various cleanups git-svn-id: http://svn.miranda-ng.org/main/trunk@2265 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/res/invisible.ico | Bin 2550 -> 0 bytes plugins/Clist_nicer/res/overlay/chat.ico | Bin 2550 -> 0 bytes plugins/Clist_nicer/res/resource.rc | 18 +- plugins/Clist_nicer/res/visible.ico | Bin 2550 -> 0 bytes plugins/Clist_nicer/src/CLCButton.cpp | 14 +- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 82 ++-- plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp | 4 +- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 9 +- plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp | 2 +- plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 56 +-- plugins/Clist_nicer/src/Coolsb/coolscroll.cpp | 16 +- plugins/Clist_nicer/src/Docking.cpp | 6 +- plugins/Clist_nicer/src/Include/clc.h | 11 +- plugins/Clist_nicer/src/Include/resource.h | 6 +- plugins/Clist_nicer/src/Include/rowheight_funcs.h | 4 +- plugins/Clist_nicer/src/alphablend.cpp | 6 +- plugins/Clist_nicer/src/clc.cpp | 420 ++++++++-------- plugins/Clist_nicer/src/clcidents.cpp | 4 +- plugins/Clist_nicer/src/clcitems.cpp | 16 +- plugins/Clist_nicer/src/clcmsgs.cpp | 10 +- plugins/Clist_nicer/src/clcopts.cpp | 10 +- plugins/Clist_nicer/src/clcpaint.cpp | 229 ++++----- plugins/Clist_nicer/src/clcutils.cpp | 89 ++-- plugins/Clist_nicer/src/clistevents.cpp | 2 +- plugins/Clist_nicer/src/clistmenus.cpp | 17 +- plugins/Clist_nicer/src/clistmod.cpp | 6 +- plugins/Clist_nicer/src/clistopts.cpp | 10 +- plugins/Clist_nicer/src/clistsettings.cpp | 2 +- plugins/Clist_nicer/src/clisttray.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 92 ++-- plugins/Clist_nicer/src/cluiopts.cpp | 18 +- plugins/Clist_nicer/src/cluiservices.cpp | 8 +- plugins/Clist_nicer/src/contact.cpp | 6 +- plugins/Clist_nicer/src/extBackg.cpp | 66 +-- plugins/Clist_nicer/src/rowheight_funcs.cpp | 4 +- plugins/Clist_nicer/src/statusbar.cpp | 6 +- plugins/Clist_nicer/src/statusfloater.cpp | 532 ++++++++++----------- plugins/Clist_nicer/src/viewmodes.cpp | 10 +- 38 files changed, 800 insertions(+), 993 deletions(-) delete mode 100644 plugins/Clist_nicer/res/invisible.ico delete mode 100644 plugins/Clist_nicer/res/overlay/chat.ico delete mode 100644 plugins/Clist_nicer/res/visible.ico diff --git a/plugins/Clist_nicer/res/invisible.ico b/plugins/Clist_nicer/res/invisible.ico deleted file mode 100644 index 7094fd8abb..0000000000 Binary files a/plugins/Clist_nicer/res/invisible.ico and /dev/null differ diff --git a/plugins/Clist_nicer/res/overlay/chat.ico b/plugins/Clist_nicer/res/overlay/chat.ico deleted file mode 100644 index 0239c56093..0000000000 Binary files a/plugins/Clist_nicer/res/overlay/chat.ico and /dev/null differ diff --git a/plugins/Clist_nicer/res/resource.rc b/plugins/Clist_nicer/res/resource.rc index 2f5a42e7c7..ab9a470993 100644 --- a/plugins/Clist_nicer/res/resource.rc +++ b/plugins/Clist_nicer/res/resource.rc @@ -275,16 +275,15 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Icons",IDC_STATIC,1,0,224,99 CONTROL "Show status icons",IDC_SHOWSTATUSICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,10,106,10 - CONTROL "Show visibility icons",IDC_SHOWVISIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,22,214,10 - CONTROL "When possible, draw status icons in avatar space",IDC_SELECTIVEICONS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,34,214,10 CONTROL "Centered when possible",IDC_STATUSICONSCENTERED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,10,100,11 + CONTROL "When possible, draw status icons in avatar space",IDC_SELECTIVEICONS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,22,214,10 CONTROL "Use metacontact protocol icons instead of subcontacts",IDC_SHOWMETA, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,46,214,10 - CONTROL "Use Overlay icons on avatars",IDC_OVERLAYICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,58,214,10 - CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,70,214,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,34,214,10 + CONTROL "Use Overlay icons on avatars",IDC_OVERLAYICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,46,214,10 + CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,58,214,10 CONTROL "Replace status icons with xStatus",IDC_XSTATUSASSTATUS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,214,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,70,214,10 END IDD_OPT_CLUI DIALOGEX 0, 0, 305, 226 @@ -554,7 +553,6 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,284,228,65,14 CONTROL "Draw overlay icon on avatar",IDC_OVERLAYICON,"Button",BS_AUTO3STATE | WS_TABSTOP,219,82,127,10 CONTROL "Show local time",IDC_SHOWLOCALTIME1,"Button",BS_AUTO3STATE | WS_TABSTOP,219,94,127,10 - CONTROL "Show visibility icon",IDC_SHOWVISIBILITY,"Button",BS_AUTO3STATE | WS_TABSTOP,219,107,127,10 CONTROL "",IDC_DSP_LOADDEFAULT,"MButtonClass",WS_TABSTOP,213,202,135,15,WS_EX_NOACTIVATE | 0x10000000L END @@ -606,7 +604,6 @@ IDI_OVL_AWAY ICON "overlay/away.ico" IDI_OVL_DND ICON "overlay/dnd.ico" IDI_OVL_NA ICON "overlay/na.ico" IDI_OVL_OCCUPIED ICON "overlay/occupied.ico" -IDI_OVL_FREEFORCHAT ICON "overlay/chat.ico" IDI_OVL_INVISIBLE ICON "overlay/invisible.ico" IDI_OVL_ONTHEPHONE ICON "overlay/phone.ico" IDI_OVL_OUTTOLUNCH ICON "overlay/lunch.ico" @@ -619,8 +616,6 @@ IDI_MINIMIZE ICON "minimize.ico" IDI_SOUNDSOFF ICON "sounds_off.ico" IDI_TABSRMMSESSIONLIST ICON "slist.ico" IDI_TABSRMMMENU ICON "tabsrmm_menu.ico" -IDI_CLVISIBLE ICON "visible.ico" -IDI_CLINVISIBLE ICON "invisible.ico" IDI_PROTOCONNECTING ICON "connecting.ico" IDI_TBTOPMENU ICON "menu.ico" IDI_TBACCOUNTS ICON "accounts.ico" @@ -694,7 +689,6 @@ BEGIN POPUP "Appearance" BEGIN MENUITEM "Show Status Icons", POPUP_SHOWSTATUSICONS - MENUITEM "Show Visibility Icons", POPUP_VISIBILITY MENUITEM "Show Metacontact proto Icons", POPUP_SHOWMETAICONS MENUITEM SEPARATOR MENUITEM "Show additional Buttons", POPUP_BUTTONS diff --git a/plugins/Clist_nicer/res/visible.ico b/plugins/Clist_nicer/res/visible.ico deleted file mode 100644 index 9ea2aefcf6..0000000000 Binary files a/plugins/Clist_nicer/res/visible.ico and /dev/null differ diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 53f4698a31..93f1275bb7 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -257,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); @@ -345,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); @@ -378,7 +378,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_SYSKEYUP: if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int) wParam)) { - if (!bct->bSendOnDown) + if ( !bct->bSendOnDown) SendMessage(pcli->hwndContactList, WM_COMMAND, MAKELONG(bct->iCtrlID, BN_CLICKED), (LPARAM) hwnd); bct->lResult = 0; return 1; @@ -393,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; @@ -460,7 +460,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case WM_LBUTTONDOWN: - if (!bct->iCtrlID) return 0; + if ( !bct->iCtrlID) return 0; if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) { bct->stateId = PBS_PRESSED; InvalidateRect(bct->hwnd, NULL, TRUE); @@ -473,7 +473,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return 1; case WM_LBUTTONUP: - if (!bct->iCtrlID) return 0; + if ( !bct->iCtrlID) return 0; if (bct->bIsPushBtn) bct->bIsPushed = !bct->bIsPushed; @@ -532,7 +532,7 @@ static void CustomizeToolbar(HANDLE hButton, HWND hWnd, LPARAM) bct->iCtrlID = BTNS[idx].ctrlid; if (BTNS[idx].isAction) bct->bSendOnDown = TRUE; - if (!BTNS[idx].isPush) + if ( !BTNS[idx].isPush) bct->bIsPushBtn = TRUE; } } diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index 1462f5114d..f65341ad9a 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -314,7 +314,6 @@ static void PositionThumb(wndFrame *pThumb, short nX, short nY) if (PtInRect(&rcBottom, pt)) { nNewY = rc.bottom; - if (PtInRect(&rcLeft, pt)) nNewX = rc.left; } @@ -329,11 +328,12 @@ static void PositionThumb(wndFrame *pThumb, short nX, short nY) pt.y = rcThumb.top; bDocked = FALSE; - if (!bLeading && PtInRect(&rcLeft, pt)) { - if (!bDockedLeft) { + if ( !bLeading && PtInRect(&rcLeft, pt)) { + if ( !bDockedLeft) { nNewX = rc.left - nWidth; bDocked = TRUE; - } else if (rc.right == rcThumb.left) + } + else if (rc.right == rcThumb.left) bDocked = TRUE; } @@ -345,35 +345,31 @@ static void PositionThumb(wndFrame *pThumb, short nX, short nY) nNewX = rc.right - nWidth; } - if (!bLeading && PtInRect(&rcTop, pt)) { + if ( !bLeading && PtInRect(&rcTop, pt)) { nNewY = rc.top; bDockedRight = bDocked; } if (bMoveTogether) { - if (bDockedRight) { + if (bDockedRight) DockThumbs(pThumb, pCurThumb, TRUE); - } - if (bDockedLeft) { + if (bDockedLeft) DockThumbs(pCurThumb, pThumb, FALSE); - } } // Lower-left pt.x = rcThumb.left; pt.y = rcThumb.bottom; - if (PtInRect(&rcRight, pt)) { + if (PtInRect(&rcRight, pt)) nNewX = rc.right; - } if (PtInRect(&rcTop, pt)) { nNewY = rc.top - nHeight; - if (PtInRect(&rcLeft, pt)) { + if (PtInRect(&rcLeft, pt)) nNewX = rc.left; - } } @@ -381,16 +377,14 @@ static void PositionThumb(wndFrame *pThumb, short nX, short nY) pt.x = rcThumb.right; pt.y = rcThumb.bottom; - if (!bLeading && PtInRect(&rcLeft, pt)) { + if ( !bLeading && PtInRect(&rcLeft, pt)) nNewX = rc.left - nWidth; - } - if (!bLeading && PtInRect(&rcTop, pt)) { + if ( !bLeading && PtInRect(&rcTop, pt)) { nNewY = rc.top - nHeight; - if (PtInRect(&rcRight, pt)) { + if (PtInRect(&rcRight, pt)) nNewX = rc.right - nWidth; - } } } @@ -895,7 +889,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (!Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; + if ( !Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; if ((!Frames[pos].visible) || (Frames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; ModifyMItem((WPARAM)contMIColl, (LPARAM)&mi); } @@ -958,7 +952,7 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIAlignBottom, (LPARAM)&mi); mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (!Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; + if ( !Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; if ((!Frames[pos].visible) || Frames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)Frames[pos].MenuHandles.MIColl, (LPARAM)&mi); } @@ -984,12 +978,12 @@ INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam, LPARAM lParam) case FO_FLAGS: retval = 0; if (Frames[pos].visible) retval |= F_VISIBLE; - if (!Frames[pos].collapsed) retval |= F_UNCOLLAPSED; + if ( !Frames[pos].collapsed) retval |= F_UNCOLLAPSED; if (Frames[pos].Locked) retval |= F_LOCKED; if (Frames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; if (Frames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; if (Frames[pos].Skinned) retval |= F_SKINNED; - if (!(GetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; + if ( !(GetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; break; case FO_NAME: @@ -1086,7 +1080,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) if (flag & F_SKINNED) Frames[pos].Skinned = TRUE; - if (!(flag & F_SKINNED)) + if ( !(flag & F_SKINNED)) style &= ~CLS_SKINNEDFRAME; SetWindowLongPtr(Frames[pos].hWnd, GWL_STYLE, (LONG)style); @@ -1160,7 +1154,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) int oldHeight = Frames[pos].height; retval = Frames[pos].height; Frames[pos].height = lParam; - if (!CLUIFramesFitInSize()) + if ( !CLUIFramesFitInSize()) Frames[pos].height = retval; retval = Frames[pos].height; @@ -1173,7 +1167,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) else { retval = Frames[pos].HeightWhenCollapsed; Frames[pos].HeightWhenCollapsed = lParam; - if (!CLUIFramesFitInSize()) + if ( !CLUIFramesFitInSize()) Frames[pos].HeightWhenCollapsed = retval; retval = Frames[pos].HeightWhenCollapsed; } @@ -1195,7 +1189,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) return(wParam); } case FO_ALIGN: - if (!(lParam&alTop || lParam&alBottom || lParam&alClient)) { + if ( !(lParam&alTop || lParam&alBottom || lParam&alClient)) { ulockfrm(); return(-1); } @@ -1275,7 +1269,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM lParam) CLUIFrameResizeFloatingFrame(pos); } ulockfrm(); - if (!Frames[pos].floating) + if ( !Frames[pos].floating) CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; @@ -1546,9 +1540,9 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM lParam) Frames[FrameId].collapsed = TRUE; } - if (!Frames[FrameId].floating) { + if ( !Frames[FrameId].floating) { - if (!CLUIFramesFitInSize()) { + if ( !CLUIFramesFitInSize()) { //cant collapse,we can resize only for heighthwndContactList, 0); else { RECT contwnd; @@ -2048,7 +2042,7 @@ static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM lParam) RemoveItemFromList(pos, &Frames, &nFramescount); ulockfrm(); - if (!cfg::shutDown) { + if ( !cfg::shutDown) { InvalidateRect(pcli->hwndContactList, NULL, TRUE); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); @@ -2203,7 +2197,7 @@ int CLUIFramesResize(const RECT newsize) tbh = (TitleBarH) * btoint(Frames[clientfrm].TitleBar.ShowTitleBar); for (i = 0;i < nFramescount;i++) { - if (!Frames[i].floating) { + if ( !Frames[i].floating) { Frames[i].needhide = FALSE; Frames[i].wndSize.left = 0; Frames[i].wndSize.right = newsize.right - newsize.left; @@ -2379,7 +2373,7 @@ int SizeFramesByWindowRect(RECT *r) int dy; dx = new_window_rect.left - old_window_rect.left; dy = new_window_rect.top - old_window_rect.top; - if (!Frames[i].floating) { + 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 && @@ -2507,7 +2501,7 @@ int OnFrameTitleBarBackgroundChange() hBmpBackground = NULL; } if (cfg::getByte("FrameTitleBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - if (!DBGetContactSetting(NULL, "FrameTitleBar", "BkBitmap", &dbv)) { + if ( !DBGetContactSetting(NULL, "FrameTitleBar", "BkBitmap", &dbv)) { hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal); mir_free(dbv.pszVal); } @@ -2561,7 +2555,7 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) if (cfg::dat.bWallpaperMode && !Frames[pos].floating) SkinDrawBg(Frames[pos].TitleBar.hwnd, hdcMem); - if (!item->IGNORED) { + if ( !item->IGNORED) { RECT rc = Frames[pos].TitleBar.wndSize; rc.top += item->MARGIN_TOP; rc.bottom -= item->MARGIN_BOTTOM; @@ -2579,7 +2573,7 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) } - if (!AlignCOLLIconToLeft) { + if ( !AlignCOLLIconToLeft) { if (Frames[pos].TitleBar.hicon != NULL) { DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); @@ -2589,7 +2583,7 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); - if (!AlignCOLLIconToLeft) + if ( !AlignCOLLIconToLeft) DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); else DrawIconEx(hdcMem, 0, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); @@ -2830,7 +2824,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA ); oldflags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, Frames[pos].id), 0); - if (!(oldflags&F_SHOWTBTIP)) + if ( !(oldflags&F_SHOWTBTIP)) oldflags |= F_SHOWTBTIP; } ulockfrm(); @@ -2883,7 +2877,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA GetWindowRect(pcli->hwndContactList, &rcMiranda); - if (!IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { + if ( !IntersectRect(&rcOverlap, &rcwnd, &rcMiranda)) { ulockfrm(); GetCursorPos(&curpt); GetWindowRect(Frames[pos].hWnd, &rcwnd); @@ -2954,7 +2948,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA nLeft += (short)dX; nTop += (short)dY; - if (!(wParam&MK_CONTROL)) { + if ( !(wParam&MK_CONTROL)) { PositionThumb(&Frames[pos], nLeft, nTop); } else { @@ -3015,7 +3009,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (newh > 0) { prevold = Frames[Framemod].height; Frames[Framemod].height = newh; - if (!CLUIFramesFitInSize()) { + if ( !CLUIFramesFitInSize()) { Frames[Framemod].height = prevold; ulockfrm(); return TRUE; @@ -3085,7 +3079,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) int width, height, floatingHeight; RECT rect; - if (!Frames[framepos].floating) + if ( !Frames[framepos].floating) return(0); if (Frames[framepos].ContainerWnd == 0) return(0); @@ -3156,7 +3150,7 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L ulockfrm(); break; } - if (!Frames[framepos].minmaxenabled) { + if ( !Frames[framepos].minmaxenabled) { ulockfrm(); break; } @@ -3286,7 +3280,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) GetWindowRect(Frames[wParam].hWnd, &rectw); GetWindowRect(Frames[wParam].TitleBar.hwnd, &recttb); - if (!Frames[wParam].TitleBar.ShowTitleBar) { + if ( !Frames[wParam].TitleBar.ShowTitleBar) { recttb.top = recttb.bottom = recttb.left = recttb.right = 0; } Frames[wParam].ContainerWnd = CreateContainerWindow(pcli->hwndContactList, Frames[wParam].FloatingPos.x, Frames[wParam].FloatingPos.y, 10, 10); diff --git a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp index ac722ca5a6..2876e49d33 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp @@ -20,7 +20,7 @@ void FreeAndNil( void **p ) { if (*p!=NULL) { - if (!IsBadCodePtr((FARPROC)*p)) + if ( !IsBadCodePtr((FARPROC)*p)) { mir_free(*p); } @@ -188,7 +188,7 @@ int InitFramesMenus(void) { TMenuParam tmp; - if (!ServiceExists(MO_REMOVEMENUOBJECT)) + if ( !ServiceExists(MO_REMOVEMENUOBJECT)) InternalGenMenuModule=TRUE; if (ServiceExists(MO_REMOVEMENUOBJECT)) diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 7c5251f823..8d11eddac5 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -122,8 +122,8 @@ INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam) return 0; } -INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam) { - +INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam) +{ MENUITEMINFO *mii=(MENUITEMINFO* )wParam; if (mii==NULL) return 0; @@ -147,7 +147,6 @@ INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam) { hMenuOldContext = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3); TranslateMenu(hMenuOldContext); - CheckMenuItem(hMenuOldContext, POPUP_VISIBILITY, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_SHOWVISI ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(hMenuOldContext, POPUP_FRAME, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(hMenuOldContext, POPUP_BUTTONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(hMenuOldContext, POPUP_SHOWMETAICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_USEMETAICONS ? MF_CHECKED : MF_UNCHECKED)); @@ -175,7 +174,7 @@ INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam) { INT_PTR GroupMenuExecService(WPARAM wParam,LPARAM lParam) { if (wParam!=0) { lpGroupMenuExecParam mmep=(lpGroupMenuExecParam)wParam; - if (!strcmp(mmep->szServiceName,"Help/AboutCommand")) { + if ( !strcmp(mmep->szServiceName,"Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1=0; CallService(mmep->szServiceName,mmep->Param1,lParam); @@ -580,7 +579,7 @@ INT_PTR SubGroupMenuonAddService(WPARAM wParam,LPARAM lParam) { INT_PTR SubGroupMenuExecService(WPARAM wParam,LPARAM lParam) { if (wParam!=0) { lpSubGroupMenuExecParam mmep=(lpSubGroupMenuExecParam)wParam; - if (!strcmp(mmep->szServiceName,"Help/AboutCommand")) { + if ( !strcmp(mmep->szServiceName,"Help/AboutCommand")) { //bug in help.c,it used wparam as parent window handle without reason. mmep->Param1=0; CallService(mmep->szServiceName,mmep->Param1,lParam); diff --git a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp index 89bc2a42e4..ee867b0a48 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp @@ -25,7 +25,7 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam) } hFloatingItem = Menu_AddContactMenuItem(&mi); } - else if (!bSetting && hFloatingItem) + else if ( !bSetting && hFloatingItem) { CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hFloatingItem, 0); hFloatingItem = 0; diff --git a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp index 51eefa1f91..beb4d164e8 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp @@ -47,7 +47,7 @@ SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) { SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - if (!sw) return 0; + if ( !sw) return 0; if (nBar == SB_HORZ) return &sw->sbarHorz; @@ -285,7 +285,7 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) UINT oldstate; BOOL bFailed = FALSE; - if (!CoolSB_IsCoolScrollEnabled(hwnd)) + if ( !CoolSB_IsCoolScrollEnabled(hwnd)) return EnableScrollBar(hwnd, wSBflags, wArrows); if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && @@ -327,10 +327,10 @@ BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) SCROLLINFO *mysi; BOOL copied = FALSE; - if (!lpsi) + if ( !lpsi) return FALSE; - if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) + if ( !(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) { return GetScrollInfo(hwnd, fnBar, lpsi); } @@ -367,7 +367,7 @@ int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar) { SCROLLINFO *mysi; - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) return GetScrollPos(hwnd, nBar); return mysi->nPos; @@ -377,10 +377,10 @@ BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lp { SCROLLINFO *mysi; - if (!lpMinPos || !lpMaxPos) + if ( !lpMinPos || !lpMaxPos) return FALSE; - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) return GetScrollRange(hwnd, nBar, lpMinPos, lpMaxPos); *lpMinPos = mysi->nMin; @@ -395,10 +395,10 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f SCROLLBAR *sbar; BOOL fRecalcFrame = FALSE; - if (!lpsi) + if ( !lpsi) return FALSE; - if (!(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) + if ( !(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) return SetScrollInfo(hwnd, fnBar, lpsi, fRedraw); //if (CoolSB_IsThumbTracking(hwnd)) @@ -428,7 +428,7 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) { - if (!sbar->fScrollVisible) + if ( !sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); fRecalcFrame = TRUE; @@ -448,7 +448,7 @@ int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL f } else { - if (!sbar->fScrollVisible) + if ( !sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); fRecalcFrame = TRUE; @@ -470,7 +470,7 @@ int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) SCROLLINFO *mysi; int oldpos; - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) { return SetScrollPos(hwnd, nBar, nPos, fRedraw); } @@ -494,7 +494,7 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, { SCROLLINFO *mysi; - if (!(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) return SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, fRedraw); if (CoolSB_IsThumbTracking(hwnd)) @@ -520,7 +520,7 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) BOOL bFailed = FALSE; DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - if (!CoolSB_IsCoolScrollEnabled(hwnd)) + if ( !CoolSB_IsCoolScrollEnabled(hwnd)) return ShowScrollBar(hwnd, wBar, fShow); if ((wBar == SB_HORZ || wBar == SB_BOTH) && @@ -572,7 +572,7 @@ HRESULT WINAPI UninitializeCoolSB(HWND hwnd) { int i = 0; SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - if (!sw) return E_FAIL; + if ( !sw) return E_FAIL; //restore the window procedure with the original one SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)sw->oldproc); @@ -610,9 +610,9 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p SCROLLBUT *sbut; UINT i; - if (!psb) return FALSE; + if ( !psb) return FALSE; - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) return FALSE; //check that we havn't reached the maximum allowed buttons yet @@ -739,10 +739,10 @@ BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCm SCROLLBAR *sbar; SCROLLBUT *sbut; - if (!psb) return FALSE; + if ( !psb) return FALSE; //find if this window is CoolScroll enabled - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) return FALSE; //find the button to modify, depending on if we @@ -758,7 +758,7 @@ BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCm else if (fByCmd == TRUE) { //button from command identifier - if (!(sbut = GetButtonFromId(sbar, uItem))) + if ( !(sbut = GetButtonFromId(sbar, uItem))) return FALSE; } @@ -786,7 +786,7 @@ BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd SCROLLBAR *sbar; //find if this window is CoolScroll enabled - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) return FALSE; //find the button to modify, depending on if we @@ -833,10 +833,10 @@ BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, S SCROLLBAR *sbar; SCROLLBUT *sbut; - if (!psb) return FALSE; + if ( !psb) return FALSE; //find if this window is CoolScroll enabled - if (!(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) + if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) return FALSE; //find the button to modify, depending on if we @@ -852,7 +852,7 @@ BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, S else if (fByCmd == TRUE) { //button from command identifier - if (!(sbut = GetButtonFromId(sbar, uItem))) + if ( !(sbut = GetButtonFromId(sbar, uItem))) return FALSE; } @@ -887,7 +887,7 @@ BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) if (nLength > 256 || nWidth > 256) return FALSE; - if (!GetScrollWndFromHwnd(hwnd)) + if ( !GetScrollWndFromHwnd(hwnd)) return FALSE; if ((wBar == SB_HORZ || wBar == SB_BOTH) && @@ -919,7 +919,7 @@ BOOL WINAPI CoolSB_SetStyle(HWND hwnd, int wBar, UINT nStyle) { SCROLLBAR *sbar; - if (!GetScrollWndFromHwnd(hwnd)) + if ( !GetScrollWndFromHwnd(hwnd)) return FALSE; if ((wBar == SB_HORZ || wBar == SB_BOTH) && @@ -948,7 +948,7 @@ BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) { SCROLLBAR *sbar; - if (!GetScrollWndFromHwnd(hwnd)) + if ( !GetScrollWndFromHwnd(hwnd)) return FALSE; if ((wBar == SB_HORZ || wBar == SB_BOTH) && @@ -981,7 +981,7 @@ BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size) { SCROLLBAR *sbar; - if (!GetScrollWndFromHwnd(hwnd)) + if ( !GetScrollWndFromHwnd(hwnd)) return FALSE; if (size == -1) diff --git a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp index becee0c91c..b3fde57c58 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp @@ -832,7 +832,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r 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)) + if ( !IsScrollInfoActive(si) && !(sb->fScrollFlags & CSBS_THUMBALWAYS)) { uLeftButFlags |= DFCS_INACTIVE; uRightButFlags |= DFCS_INACTIVE; @@ -954,7 +954,7 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r //if we always show the thumb covering the whole scrollbar, //then draw it that way - if (!IsScrollInfoActive(si) && (sb->fScrollFlags & CSBS_THUMBALWAYS) + if ( !IsScrollInfoActive(si) && (sb->fScrollFlags & CSBS_THUMBALWAYS) && ctrl.right - ctrl.left > sb->nMinThumbSize) { //leave a 1-pixel gap between the thumb + right button @@ -1603,7 +1603,7 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) CopyRect(&rect2, &rect); OffsetRect(&rect2, winrect.left, winrect.top); - if (!sw->fLeftScrollbar && parent.right == rect2.right+sw->cxRightEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge + if ( !sw->fLeftScrollbar && parent.right == rect2.right+sw->cxRightEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge || sw->fLeftScrollbar && parent.left == rect2.left -sw->cxLeftEdge && parent.bottom == rect2.bottom+sw->cyBottomEdge) DrawFrameControl(hdc, &rect, DFC_SCROLL, sw->fLeftScrollbar ? DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP ); else @@ -1770,7 +1770,7 @@ static UINT GetHorzButtonFromPt(SCROLLBAR *sb, RECT *rect, POINT pt, BOOL fRetur int butwidth; SCROLLBUT *sbut = sb->sbButtons; - if (!PtInRect(rect, pt)) + if ( !PtInRect(rect, pt)) return -1; if (sb->fButVisibleAfter) @@ -2007,7 +2007,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa case HTSCROLL_THUMB: //if the scrollbar is disabled, then do no further processing - if (!IsScrollbarActive(sb)) + if ( !IsScrollbarActive(sb)) return 0; GetRealScrollRect(sb, &rect); @@ -2056,7 +2056,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa target1: //if the scrollbar is disabled, then do no further processing - if (!IsScrollbarActive(sb)) + if ( !IsScrollbarActive(sb)) break; //ajust the horizontal rectangle to NOT include @@ -2274,7 +2274,7 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) //if the mouse is not in a suitable distance of the scrollbar, //then "snap" the thumb back to its initial position #ifdef SNAP_THUMB_BACK - if (!PtInRect(&rc2, pt)) + if ( !PtInRect(&rc2, pt)) { thumbpos = nThumbPos0; } @@ -2822,7 +2822,7 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM //then kill the timer.. GetCursorPos(&pt); - if (!PtInRect(&MouseOverRect, pt)) + if ( !PtInRect(&MouseOverRect, pt)) { KillTimer(hwnd, uMouseOverId); uMouseOverId = 0; diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index cfbbe7caeb..e821ed4118 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -100,7 +100,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (msg->message == WM_DESTROY) cfg::writeByte("CList", "Docked", (BYTE) docked); - if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING && msg->message != WM_CREATEDOCKED && msg->message != WM_MOVE) + if ( !docked && msg->message != WM_CREATE && msg->message != WM_MOVING && msg->message != WM_CREATEDOCKED && msg->message != WM_MOVE) return 0; switch (msg->message) { case WM_CREATE: @@ -152,7 +152,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_GetMonitorRectFromPoint(ptCursor, &rcMonitor); if ((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) { - if (!(GetWindowLongPtr(msg->hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) { + if ( !(GetWindowLongPtr(msg->hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) { SendMessage(msg->hwnd, CLUIINTM_REDRAW, 0, 0); MessageBox(0, TranslateT("The clist cannot be docked when using the default title bar and border. Use a toolwindow or borderless style instead."), TranslateT("Clist docking"), MB_OK); @@ -241,7 +241,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) *((LRESULT *) lParam) = 0; return TRUE; case WM_MOUSEMOVE: - if (!draggingTitle) + if ( !draggingTitle) return 0; { RECT rc; POINT pt; diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 1936dfcd3b..0b968796ab 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -53,8 +53,8 @@ #define TIMERID_PAINT 19 #define CONTACTF_ONLINE 1 -#define CONTACTF_INVISTO 2 -#define CONTACTF_VISTO 4 +//#define CONTACTF_INVISTO 2 +//#define CONTACTF_VISTO 4 #define CONTACTF_NOTONLIST 8 #define CONTACTF_CHECKED 16 #define CONTACTF_IDLE 32 @@ -84,8 +84,6 @@ #define ECF_HIDEOVERLAY 32 #define ECF_FORCELOCALTIME 64 #define ECF_HIDELOCALTIME 128 -#define ECF_FORCEVISIBILITY 256 -#define ECF_HIDEVISIBILITY 512 #define ECF_HASREALTIMEZONE 1024 // other contact flags (struct ClCContact; @@ -197,7 +195,7 @@ struct ClcData : public ClcDataBase //#define CLUI_FRAME_SHOWTOPBUTTONS 1 #define CLUI_FRAME_SHOWBOTTOMBUTTONS 2 #define CLUI_SHOWCLIENTICONS 4 -#define CLUI_SHOWVISI 8 +//#define CLUI_SHOWVISI 8 #define CLUI_FRAME_CLISTSUNKEN 16 #define CLUI_SHOWXSTATUS 32 #define CLUI_FRAME_BUTTONSFLAT 64 @@ -248,7 +246,7 @@ struct TCluiData { BYTE tabSRMM_Avail; BYTE bMetaAvail; BYTE bAvatarServiceAvail; - HICON hIconVisible, hIconInvisible, hIconChatactive, hIconConnecting; + HICON hIconConnecting; DWORD winFlags; DWORD winFlagsEx; int notifyActive; @@ -520,7 +518,6 @@ int CoolSB_SetupScrollBar(); #define SETTING_WINDOWSTYLE_THINBORDER 2 #define SETTING_WINDOWSTYLE_NOBORDER 3 -#define CLCHT_ONITEMEXTRAEX 0x1000 //on an extra icon, HIBYTE(HIWORD()) says which #define CLCHT_ONAVATAR 0x2000 #define CLCHT_ONITEMSPACE 0x4000 diff --git a/plugins/Clist_nicer/src/Include/resource.h b/plugins/Clist_nicer/src/Include/resource.h index a6f229e4f8..56fa48d236 100644 --- a/plugins/Clist_nicer/src/Include/resource.h +++ b/plugins/Clist_nicer/src/Include/resource.h @@ -131,7 +131,6 @@ #define IDC_INACTIVEPERC 1187 #define IDC_SHOWSTATUSMSG 1188 #define IDC_SHOWLOCALTIME 1189 -#define IDC_SHOWVISIBILITY 1190 #define IDC_SHOWLOCALTIMEONLYWHENDIFFERENT 1191 #define IDC_TITLETEXT 1196 #define IDC_EXCEPTION_DETAILS 1200 @@ -275,7 +274,6 @@ #define IDI_OVL_DND 2053 #define IDI_OVL_NA 2054 #define IDI_OVL_OCCUPIED 2055 -#define IDI_OVL_FREEFORCHAT 2056 #define IDI_OVL_INVISIBLE 2057 #define IDI_OVL_ONTHEPHONE 2058 #define IDI_OVL_OUTTOLUNCH 2059 @@ -288,8 +286,6 @@ #define IDI_SOUNDSOFF 2106 #define IDI_TABSRMMSESSIONLIST 2107 #define IDI_TABSRMMMENU 2108 -#define IDI_CLVISIBLE 2109 -#define IDI_CLINVISIBLE 2110 #define IDI_PROTOCONNECTING 2111 #define IDI_TBTOPMENU 2112 #define IDI_TBACCOUNTS 2113 @@ -318,7 +314,7 @@ #define IDC_STATIC1 40018 #define IDC_STATIC2 40019 #define IDC_STATIC3 40020 -#define POPUP_VISIBILITY 40021 +//#define POPUP_VISIBILITY 40021 #define IDC_STATIC16 40021 #define IDC_STATIC4 40022 #define IDC_STATIC5 40023 diff --git a/plugins/Clist_nicer/src/Include/rowheight_funcs.h b/plugins/Clist_nicer/src/Include/rowheight_funcs.h index b7e69382d4..89bc2f4ad2 100644 --- a/plugins/Clist_nicer/src/Include/rowheight_funcs.h +++ b/plugins/Clist_nicer/src/Include/rowheight_funcs.h @@ -25,12 +25,12 @@ public: //if (contact->iRowHeight == item) // return(dat->row_heights[item]); - if (!Alloc(dat, item + 1)) + if ( !Alloc(dat, item + 1)) return -1; height = dat->fontInfo[GetBasicFontID(contact)].fontHeight; - if (!dat->bisEmbedded) { + if ( !dat->bisEmbedded) { 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 79b3f8353d..eb46d4c437 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -141,7 +141,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor TRIVERTEX tvtx[2]; int orig = 1, dest = 0; - if (!(FLG_GRADIENT & GRADIENT_ACTIVE)) { + if ( !(FLG_GRADIENT & GRADIENT_ACTIVE)) { tvtx[0].Red = tvtx[1].Red = (COLOR16)GetRValue(basecolor) << 8; tvtx[0].Blue = tvtx[1].Blue = (COLOR16)GetBValue(basecolor) << 8; tvtx[0].Green = tvtx[1].Green = (COLOR16)GetGValue(basecolor) << 8; @@ -185,7 +185,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor bf.SourceConstantAlpha = percent_to_byte((UINT32)alpha); bf.AlphaFormat = 0; // so it will use our specified alpha value hdc = CreateCompatibleDC(hdcwnd); - if (!hdc) + if ( !hdc) return; hbm = CreateCompatibleBitmap(hdcwnd, width, height); hbmOld = reinterpret_cast(SelectObject(hdc, hbm)); @@ -209,7 +209,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor } hdc = CreateCompatibleDC(hdcwnd); - if (!hdc) + if ( !hdc) return; ZeroMemory(&bmi, sizeof(BITMAPINFO)); diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 88b37628ad..07838053c1 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -115,43 +115,43 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; if (wParam) { - if (!__strcmp(cws->szModule, "CList")) { - if (!__strcmp(cws->szSetting, "StatusMsg")) + if ( !__strcmp(cws->szModule, "CList")) { + if ( !__strcmp(cws->szSetting, "StatusMsg")) SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, wParam, lParam); } - else if (!__strcmp(cws->szModule, "UserInfo")) { - if (!__strcmp(cws->szSetting, "ANSIcodepage")) + else if ( !__strcmp(cws->szModule, "UserInfo")) { + if ( !__strcmp(cws->szSetting, "ANSIcodepage")) pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, wParam, lParam); - else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) + else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo((HANDLE)wParam); } else if (wParam != 0 && (szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0)) != NULL) { char *id = NULL; - if (!__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { + if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; pcli->pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam); if (cws->value.type == DBVT_DELETED) szProto_s = NULL; else szProto_s = cws->value.pszVal; - pcli->pfnChangeContactIcon((HANDLE) wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord((HANDLE) wParam, szProto_s, "Status", ID_STATUS_OFFLINE), (HANDLE) wParam, NULL), 0); + pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord((HANDLE)wParam, szProto_s, "Status", ID_STATUS_OFFLINE), (HANDLE)wParam, NULL), 0); } // something is being written to a protocol module - if (!__strcmp(szProto, cws->szModule)) { + if ( !__strcmp(szProto, cws->szModule)) { // was a unique setting key written? - pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE) wParam); - if (!__strcmp(cws->szSetting, "Status")) { - if (!cfg::getByte((HANDLE) wParam, "CList", "Hidden", 0)) { + pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + if ( !__strcmp(cws->szSetting, "Status")) { + if ( !cfg::getByte((HANDLE)wParam, "CList", "Hidden", 0)) { if (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing if (cws->value.wVal == ID_STATUS_OFFLINE) { - pcli->pfnChangeContactIcon((HANDLE) wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE) wParam, NULL), 0); + pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 0); CallService(MS_CLUI_CONTACTDELETED, wParam, 0); return 0; } - pcli->pfnChangeContactIcon((HANDLE) wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE) wParam, NULL), 1); + pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 1); } - pcli->pfnChangeContactIcon((HANDLE) wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE) wParam, NULL), 0); + pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 0); } SendMessage(pcli->hwndContactTree, INTM_STATUSCHANGED, wParam, lParam); return 0; @@ -160,7 +160,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, wParam, lParam); else if (strstr(cws->szSetting, "XStatus")) SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, wParam, lParam); - else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) + else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo((HANDLE)wParam); if (cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, cfg::dat.szMetaName)) { @@ -184,7 +184,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff ? BST_UNCHECKED : BST_CHECKED); } else if (szProto == NULL && wParam == 0) { - if (!__strcmp(cws->szSetting, "XStatusId")) + if ( !__strcmp(cws->szSetting, "XStatusId")) CluiProtocolStatusChanged(0, cws->szModule); } return 0; @@ -205,13 +205,6 @@ static int ClcPreshutdown(WPARAM wParam, LPARAM lParam) int ClcShutdown(WPARAM wParam, LPARAM lParam) { - if (cfg::dat.hIconInvisible) - DestroyIcon(cfg::dat.hIconInvisible); - if (cfg::dat.hIconVisible) - DestroyIcon(cfg::dat.hIconVisible); - if (cfg::dat.hIconChatactive) - DestroyIcon(cfg::dat.hIconChatactive); - DeleteObject(cfg::dat.hPen3DBright); DeleteObject(cfg::dat.hPen3DDark); DeleteObject(cfg::dat.hBrushColorKey); @@ -266,13 +259,14 @@ extern LRESULT(CALLBACK *saveContactListControlWndProc)(HWND hwnd, UINT msg, WPA LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - struct ClcData *dat; - BOOL frameHasTitlebar = FALSE; + ClcContact *contact; + ClcGroup *group; + BOOL frameHasTitlebar = FALSE; if (wndFrameCLC) frameHasTitlebar = wndFrameCLC->TitleBar.ShowTitleBar; - dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0); + ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0); if (msg >= CLM_FIRST && msg < CLM_LAST) return ProcessExternalMessages(hwnd, dat, msg, wParam, lParam); @@ -300,6 +294,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->bisEmbedded = TRUE; } break; + case WM_SIZE: pcli->pfnEndRename(hwnd, dat, 1); KillTimer(hwnd, TIMERID_INFOTIP); @@ -308,111 +303,111 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L LBL_Def: return DefWindowProc(hwnd, msg, wParam, lParam); - case WM_NCCALCSIZE: { + case WM_NCCALCSIZE: return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar); - } /* * scroll bar handling */ case WM_NCPAINT: return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar); - case INTM_GROUPCHANGED: { - ClcContact *contact; - WORD iExtraImage[EXTRA_ICON_COUNT]; - BYTE flags = 0; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) - memset(iExtraImage, 0xFF, sizeof(iExtraImage)); - else { - memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); - flags = contact->flags; - } - pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam); - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, NULL, dat)) { - NMCLISTCONTROL nm; - pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1); - if (FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) { - memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); - if (flags & CONTACTF_CHECKED) - contact->flags |= CONTACTF_CHECKED; + + case INTM_GROUPCHANGED: + { + WORD iExtraImage[EXTRA_ICON_COUNT]; + BYTE flags = 0; + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + memset(iExtraImage, 0xFF, sizeof(iExtraImage)); + else { + memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); + flags = contact->flags; + } + pcli->pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, NULL, dat)) { + pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1); + if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); + if (flags & CONTACTF_CHECKED) + contact->flags |= CONTACTF_CHECKED; + } + + NMCLISTCONTROL nm; + nm.hdr.code = CLN_CONTACTMOVED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = (HANDLE)wParam; + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm); } - nm.hdr.code = CLN_CONTACTMOVED; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = (HANDLE) wParam; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm); + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, 1); } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, 1); goto LBL_Def; - } - case INTM_ICONCHANGED: { - ClcContact *contact = NULL; - ClcGroup *group = NULL; - int recalcScrollBar = 0, shouldShow; - WORD status = ID_STATUS_OFFLINE; - char *szProto; - int contactRemoved = 0; - HANDLE hSelItem = NULL; - ClcContact *selcontact = NULL; - - szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); - if (szProto == NULL) - status = ID_STATUS_OFFLINE; - else - status = cfg::getWord((HANDLE) wParam, szProto, "Status", ID_STATUS_OFFLINE); - - shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam);// XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) { - if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 0, 0); - recalcScrollBar = 1; - FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL); - if (contact) { + case INTM_ICONCHANGED: + { + int recalcScrollBar = 0; + WORD status = ID_STATUS_OFFLINE; + int contactRemoved = 0; + HANDLE hSelItem = NULL; + ClcContact *selcontact = NULL; + + char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); + if (szProto == NULL) + status = ID_STATUS_OFFLINE; + else + status = cfg::getWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); + + int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam);// XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown + + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { + if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = pcli->pfnContactToHItem(selcontact); + pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 0, 0); + recalcScrollBar = 1; + FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL); + if (contact) { + contact->iImage = (WORD) lParam; + pcli->pfnNotifyNewContact(hwnd, (HANDLE)wParam); + } + } + } else { + //item in list already + DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); + if (contact->iImage == (WORD) lParam) + break; + if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = pcli->pfnContactToHItem(selcontact); + pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); + contactRemoved = TRUE; + recalcScrollBar = 1; + } else { contact->iImage = (WORD) lParam; - pcli->pfnNotifyNewContact(hwnd, (HANDLE) wParam); + if ( !pcli->pfnIsHiddenMode(dat, status)) + contact->flags |= CONTACTF_ONLINE; + else + contact->flags &= ~CONTACTF_ONLINE; } } - } else { - //item in list already - DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - if (contact->iImage == (WORD) lParam) - break; - if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); - contactRemoved = TRUE; - recalcScrollBar = 1; - } else { - contact->iImage = (WORD) lParam; - if (!pcli->pfnIsHiddenMode(dat, status)) - contact->flags |= CONTACTF_ONLINE; + if (hSelItem) { + ClcGroup *selgroup; + if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*) & selgroup->cl, selcontact)); else - contact->flags &= ~CONTACTF_ONLINE; + dat->selection = -1; } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); + if (recalcScrollBar) + pcli->pfnRecalcScrollBar(hwnd, dat); + goto LBL_Def; } - if (hSelItem) { - ClcGroup *selgroup; - if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*) & selgroup->cl, selcontact)); - else - dat->selection = -1; - } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); - if (recalcScrollBar) - pcli->pfnRecalcScrollBar(hwnd, dat); - goto LBL_Def; - } - case INTM_METACHANGED: { - ClcContact *contact; - if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + + case INTM_METACHANGED: + if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { @@ -434,18 +429,17 @@ LBL_Def: } SendMessage(hwnd, INTM_NAMEORDERCHANGED, wParam, lParam); goto LBL_Def; - } - case INTM_METACHANGEDEVENT: { - ClcContact *contact; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + + case INTM_METACHANGEDEVENT: + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (lParam == 0) SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0); goto LBL_Def; - } - case INTM_NAMECHANGED: { + + case INTM_NAMECHANGED: ClcContact *contact; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText)); @@ -454,71 +448,69 @@ LBL_Def: dat->needsResort = TRUE; PostMessage(hwnd, INTM_SORTCLC, 0, 0); goto LBL_Def; - } - case INTM_CODEPAGECHANGED: { - ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + case INTM_CODEPAGECHANGED: + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; - contact->codePage = cfg::getDword((HANDLE) wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HANDLE)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); + contact->codePage = cfg::getDword((HANDLE)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HANDLE)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); PostMessage(hwnd, INTM_INVALIDATE, 0, 0); goto LBL_Def; - } - case INTM_AVATARCHANGED: { - struct avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; - ClcContact *contact = NULL; - if (wParam == 0) { - //RemoveFromImgCache(0, cEntry); - cfg::dat.bForceRefetchOnPaint = TRUE; - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - cfg::dat.bForceRefetchOnPaint = FALSE; - goto LBL_Def; - } + case INTM_AVATARCHANGED: + { + avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; + contact = NULL; + + if (wParam == 0) { + //RemoveFromImgCache(0, cEntry); + cfg::dat.bForceRefetchOnPaint = TRUE; + RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + cfg::dat.bForceRefetchOnPaint = FALSE; + goto LBL_Def; + } - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - return 0; - contact->ace = cEntry; - if (cEntry == NULL) - contact->cFlags &= ~ECF_AVATAR; - else { - DWORD dwFlags; - - if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) - dwFlags = cfg::eCache[contact->extraCacheEntry].dwDFlags; - else - dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); - if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) - contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); - else - contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + return 0; + contact->ace = cEntry; + if (cEntry == NULL) + contact->cFlags &= ~ECF_AVATAR; + else { + DWORD dwFlags; + + if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) + dwFlags = cfg::eCache[contact->extraCacheEntry].dwDFlags; + else + dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); + if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) + contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); + else + contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); + } + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); } - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); goto LBL_Def; - } - case INTM_STATUSMSGCHANGED: { - ClcContact *contact = NULL; - int index = -1; - char *szProto = NULL; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) - index = cfg::getCache((HANDLE)wParam, NULL); - else { - index = contact->extraCacheEntry; - szProto = contact->proto; + case INTM_STATUSMSGCHANGED: + { + int index = -1; + char *szProto = NULL; + + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + index = cfg::getCache((HANDLE)wParam, NULL); + else { + index = contact->extraCacheEntry; + szProto = contact->proto; + } + GetCachedStatusMsg(index, szProto); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); } - GetCachedStatusMsg(index, szProto); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); goto LBL_Def; - } - case INTM_STATUSCHANGED: { - ClcContact *contact = NULL; - WORD wStatus; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + case INTM_STATUSCHANGED: { + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; - wStatus = cfg::getWord((HANDLE)wParam, contact->proto, "Status", ID_STATUS_OFFLINE); + WORD wStatus = cfg::getWord((HANDLE)wParam, contact->proto, "Status", ID_STATUS_OFFLINE); if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) { contact->wStatus = wStatus; if (cfg::dat.bAvatarServiceAvail && contact->ace == NULL) @@ -526,13 +518,11 @@ LBL_Def: } contact->wStatus = wStatus; goto LBL_Def; - } - case INTM_PROTOCHANGED: { - DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam; - ClcContact *contact = NULL; - - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + } + case INTM_PROTOCHANGED: + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; + contact->proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0); lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText)); @@ -542,18 +532,15 @@ LBL_Def: dat->needsResort = TRUE; PostMessage(hwnd, INTM_SORTCLC, 0, 0); goto LBL_Def; - } case INTM_INVALIDATE: - if (!dat->bNeedPaint) { + if ( !dat->bNeedPaint) { KillTimer(hwnd, TIMERID_PAINT); SetTimer(hwnd, TIMERID_PAINT, 100, NULL); dat->bNeedPaint = TRUE; } if (lParam && !dat->bisEmbedded) { - ClcContact *contact = NULL; - if (FindItem(hwnd, dat, (HANDLE)lParam, &contact, NULL, 0)) { if (contact && contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[contact->extraCacheEntry].floater) FLT_Update(dat, contact); @@ -561,24 +548,23 @@ LBL_Def: } goto LBL_Def; - case INTM_INVALIDATECONTACT: { - ClcContact *contact = 0; - ClcGroup *group = 0; - int iItem; - - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) - break; + case INTM_INVALIDATECONTACT: + { + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + break; - if (contact == 0 || group == 0) - break; + if (contact == 0 || group == 0) + break; - iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact)); - pcli->pfnInvalidateItem(hwnd, dat, iItem); + int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact)); + pcli->pfnInvalidateItem(hwnd, dat, iItem); + } goto LBL_Def; - } + case INTM_FORCESORT: dat->needsResort = TRUE; return SendMessage(hwnd, INTM_SORTCLC, wParam, lParam); + case INTM_SORTCLC: if (dat->needsResort) { pcli->pfnSortCLC(hwnd, dat, TRUE); @@ -593,13 +579,13 @@ LBL_Def: char *szProto; ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; szProto = (char*)cws->szModule; if (szProto == NULL) break; contact->flags &= ~CONTACTF_IDLE; - if (cfg::getDword((HANDLE) wParam, szProto, "IdleTS", 0)) { + if (cfg::getDword((HANDLE)wParam, szProto, "IdleTS", 0)) { contact->flags |= CONTACTF_IDLE; } PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); @@ -613,9 +599,9 @@ LBL_Def: szProto = (char *)cws->szModule; - if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) { + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { index = cfg::getCache((HANDLE)wParam, szProto); - if (!dat->bisEmbedded && cfg::dat.bMetaAvail && szProto) { // may be a subcontact, forward the xstatus + if ( !dat->bisEmbedded && cfg::dat.bMetaAvail && szProto) { // may be a subcontact, forward the xstatus if (cfg::getByte((HANDLE)wParam, cfg::dat.szMetaName, "IsSubcontact", 0)) { HANDLE hMasterContact = (HANDLE)cfg::getDword((HANDLE)wParam, cfg::dat.szMetaName, "Handle", 0); if (hMasterContact && hMasterContact != (HANDLE)wParam) // avoid recursive call of settings handler @@ -625,7 +611,7 @@ LBL_Def: } } } else { - contact->xStatus = cfg::getByte((HANDLE) wParam, szProto, "XStatusId", 0); + contact->xStatus = cfg::getByte((HANDLE)wParam, szProto, "XStatusId", 0); index = contact->extraCacheEntry; } if (szProto == NULL) @@ -678,37 +664,9 @@ LBL_Def: KillTimer(hwnd, TIMERID_INFOTIP); dat->szQuickSearch[0] = 0; dat->selection = HitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags); - if (hitFlags & CLCHT_ONITEMEXTRAEX && hwnd == pcli->hwndContactTree && contact != 0) { - int column = hitFlags >> 24; - if (column-- > 0) { - if (contact->type == CLCIT_CONTACT) { - CONTACTINFO ci; - ZeroMemory(&ci,sizeof(CONTACTINFO)); - ci.cbSize = sizeof(CONTACTINFO); - ci.hContact = contact->hContact; - ci.szProto = contact->proto; - - if (column == 0) { - ci.dwFlag = CNF_EMAIL; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) { - char buf[4096]; - mir_snprintf(buf, sizeof(buf), "mailto:%s", (LPCSTR)ci.pszVal); - mir_free(ci.pszVal); - ShellExecuteA(hwnd, "open", buf, NULL, NULL, SW_SHOW); - } - return TRUE; - } - if (column == 1) { - ci.dwFlag = CNF_HOMEPAGE; - if (!CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci)) { - ShellExecuteA(hwnd, "open", (LPCSTR)ci.pszVal, NULL, NULL, SW_SHOW); - mir_free(ci.pszVal); - } - return TRUE; - } - } - } - } + if (hitFlags & CLCHT_ONITEMEXTRA) + break; + InvalidateRect(hwnd, NULL, FALSE); if (dat->selection != -1) pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); @@ -791,7 +749,7 @@ LBL_Def: case WM_DESTROY: { int i; - if (!dat->bisEmbedded) { + if ( !dat->bisEmbedded) { for (i = 0; i < cfg::nextCacheEntry; i++) { if (cfg::eCache[i].floater && cfg::eCache[i].floater->hwnd) DestroyWindow(cfg::eCache[i].floater->hwnd); diff --git a/plugins/Clist_nicer/src/clcidents.cpp b/plugins/Clist_nicer/src/clcidents.cpp index e56157d9b5..f649029c9d 100644 --- a/plugins/Clist_nicer/src/clcidents.cpp +++ b/plugins/Clist_nicer/src/clcidents.cpp @@ -54,7 +54,7 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, break; nowVisible = 1; for (tgroup = group; tgroup; tgroup = tgroup->parent) { - if (!(group->expanded)) { + if ( !(group->expanded)) { nowVisible = 0; break; } } @@ -65,7 +65,7 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, index++; if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR) hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE) ((UINT_PTR) hItem & ~HCONTACT_ISINFO))) { if (isVisible) { - if (!nowVisible) + if ( !nowVisible) *isVisible = 0; else { int posy = RowHeight::getItemTopY(dat,index+1); diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 4d3741a06d..4099b03c08 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -206,13 +206,13 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) if (group != NULL) { group->totalMembers++; - if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { + if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if (szProto == NULL) { - if (!pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) + if ( !pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE)) AddContactToGroup(dat, group, hContact); } - else if (!pcli->pfnIsHiddenMode(dat, (WORD) cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) + else if ( !pcli->pfnIsHiddenMode(dat, (WORD) cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE))) AddContactToGroup(dat, group, hContact); } else AddContactToGroup(dat, group, hContact); @@ -246,7 +246,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) pcli->pfnSortCLC(hwnd, dat, 0); pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0); - if (!dat->bisEmbedded) + if ( !dat->bisEmbedded) FLT_SyncWithClist(); } @@ -271,7 +271,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) if ( !result && lstrlen(dbv.ptszVal) > 1) cEntry->bStatusMsgValid = STATUSMSG_CLIST; else { - if (!szProto) + if ( !szProto) szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto) { if ( !result ) @@ -311,7 +311,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto) cst.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_TCHAR; cst.wParam = &xStatus2; cst.ptszName = xStatusName; - if (!CallService(szServiceName, (WPARAM)hContact, (LPARAM)&cst)) { + if ( !CallService(szServiceName, (WPARAM)hContact, (LPARAM)&cst)) { TCHAR *szwXstatusName = TranslateTS(xStatusName); cEntry->statusMsg = (TCHAR *)realloc(cEntry->statusMsg, (lstrlen(szwXstatusName) + 2) * sizeof(TCHAR)); _tcsncpy(cEntry->statusMsg, szwXstatusName, lstrlen(szwXstatusName) + 1); @@ -528,7 +528,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc 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 ( !cfg::dat.bFilterEffective) return dbHidden; if (szProto == NULL) @@ -549,7 +549,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc filterResult = strstr(cfg::dat.protoFilter, szTemp) ? 1 : 0; } if (cfg::dat.bFilterEffective & CLVM_FILTER_GROUPS) { - if (!cfg::getTString(hContact, "CList", "Group", &dbv)) { + 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); diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 0b3dd76d22..ddfefc3c64 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -43,7 +43,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM { ClcContact *contact; ClcGroup *group; - if (wParam == 0 || !FindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) + if (wParam == 0 || !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) return 0; if (lParam) @@ -56,7 +56,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_GETSTATUSMSG: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) @@ -75,7 +75,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -88,7 +88,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_QUERYPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -99,7 +99,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEFLOATINGCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 7d0f126399..5f397fccdf 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -489,7 +489,6 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg, IDC_XSTATUSASSTATUS, cfg::dat.dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS ? 1 : 0); CheckDlgButton(hwndDlg, IDC_SHOWSTATUSICONS, (cfg::dat.dwFlags & CLUI_FRAME_STATUSICONS) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWVISIBILITY, (cfg::dat.dwFlags & CLUI_SHOWVISI) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWMETA, (cfg::dat.dwFlags & CLUI_USEMETAICONS) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_OVERLAYICONS, (cfg::dat.dwFlags & CLUI_FRAME_OVERLAYICONS) ? BST_CHECKED : BST_UNCHECKED); @@ -507,7 +506,6 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: cfgSetFlag(hwndDlg, IDC_SHOWSTATUSICONS, CLUI_FRAME_STATUSICONS); - cfgSetFlag(hwndDlg, IDC_SHOWVISIBILITY, CLUI_SHOWVISI); cfgSetFlag(hwndDlg, IDC_SHOWMETA, CLUI_USEMETAICONS); cfgSetFlag(hwndDlg, IDC_OVERLAYICONS, CLUI_FRAME_OVERLAYICONS); cfgSetFlag(hwndDlg, IDC_XSTATUSASSTATUS, CLUI_FRAME_USEXSTATUSASSTATUS); @@ -675,7 +673,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam case 0: if (((LPNMHDR) lParam)->code == PSN_APPLY) { - if (!opt_clc_main_changed) + if ( !opt_clc_main_changed) return TRUE; int i; @@ -738,7 +736,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { DBVARIANT dbv; - if (!cfg::getTString(NULL, "CLC", "BkBitmap", &dbv)) { + if ( !cfg::getTString(NULL, "CLC", "BkBitmap", &dbv)) { TCHAR szPath[MAX_PATH]; if (CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM) dbv.ptszVal, (LPARAM)szPath)) SetDlgItemText(hwndDlg, IDC_FILENAME, szPath); @@ -794,7 +792,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.nMaxFile = sizeof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "bmp"; - if (!GetOpenFileNameA(&ofn)) + if ( !GetOpenFileNameA(&ofn)) break; SetDlgItemTextA(hwndDlg, IDC_FILENAME, str); } @@ -817,7 +815,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: - if (!opt_clc_bkg_changed) + if ( !opt_clc_bkg_changed) return TRUE; cfg::writeByte("CLC", "UseBitmap", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BITMAP)); { diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 9ddd2f3f05..5376e02024 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -169,10 +169,10 @@ static int __fastcall GetRealStatus(ClcContact *contact, int status) { int i; char *szProto = contact->proto; - if (!szProto) + if ( !szProto) return status; for (i = 0; i < pcli->hClcProtoCount; i++) { - if (!lstrcmpA(pcli->clcProto[i].szProto, szProto)) { + if ( !lstrcmpA(pcli->clcProto[i].szProto, szProto)) { return pcli->clcProto[i].dwStatus; } } @@ -181,42 +181,34 @@ static int __fastcall GetRealStatus(ClcContact *contact, int status) int GetBasicFontID(ClcContact * contact) { - switch (contact->type) - { + switch (contact->type) { case CLCIT_GROUP: return FONTID_GROUPS; - break; + case CLCIT_INFO: - if (contact->flags & CLCIIF_GROUPFONT) - return FONTID_GROUPS; - else - return FONTID_CONTACTS; - break; + return (contact->flags & CLCIIF_GROUPFONT) ? FONTID_GROUPS : FONTID_CONTACTS; + case CLCIT_DIVIDER: return FONTID_DIVIDERS; - break; + case CLCIT_CONTACT: if (contact->flags & CONTACTF_NOTONLIST) return FONTID_NOTONLIST; else if ((contact->flags&CONTACTF_INVISTO && GetRealStatus(contact, ID_STATUS_OFFLINE) != ID_STATUS_INVISIBLE) || (contact->flags&CONTACTF_VISTO && GetRealStatus(contact, ID_STATUS_OFFLINE) == ID_STATUS_INVISIBLE)) return contact->flags & CONTACTF_ONLINE ? FONTID_INVIS : FONTID_OFFINVIS; - else - return contact->flags & CONTACTF_ONLINE ? FONTID_CONTACTS : FONTID_OFFLINE; - break; - default: - return FONTID_CONTACTS; + return contact->flags & CONTACTF_ONLINE ? FONTID_CONTACTS : FONTID_OFFLINE; } + return FONTID_CONTACTS; } void PaintNotifyArea(HDC hDC, RECT *rc) { struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(pcli->hwndContactTree, 0); - int iCount; static int ev_lastIcon = 0; - rc->left += 26; // button - iCount = GetMenuItemCount(cfg::dat.hMenuNotify); + rc->left += 26; + int iCount = GetMenuItemCount(cfg::dat.hMenuNotify); if (cfg::dat.hUpdateContact != 0) { TCHAR *szName = pcli->pfnGetContactDisplayName(cfg::dat.hUpdateContact, 0); int iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) cfg::dat.hUpdateContact, 0); @@ -282,16 +274,13 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int BOOL fOverlay = (cfg::dat.dwFlags & CLUI_FRAME_OVERLAYICONS); contact->avatarLeft = -1; - if (!cfg::dat.bAvatarServiceAvail || dat->bisEmbedded) + 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 (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) - return avatar_size + 2; - else - return 0; - } + if (contact->ace->dwFlags & AVS_HIDEONCLIST) + return (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? avatar_size + 2 : 0; + bmHeight = contact->ace->bmHeight; bmWidth = contact->ace->bmWidth; if (bmWidth != 0) @@ -301,10 +290,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int hbm = contact->ace->hbmPic; contact->ace->t_lastAccess = cfg::dat.t_now; } - else if (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) - return avatar_size + 2; - else - return 0; + else return (cfg::dat.dwFlags & CLUI_FRAME_ALWAYSALIGNNICK) ? avatar_size + 2 : 0; if (bmHeight == 0 || bmWidth == 0 || hbm == 0) return 0; @@ -312,7 +298,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int 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) { skinMarginY = item->IGNORED ? 0 : (item->MARGIN_TOP + item->MARGIN_BOTTOM); skinMarginX = item->IGNORED ? 0 : (item->MARGIN_LEFT + item->MARGIN_RIGHT); @@ -329,7 +315,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int newHeight = (float)(bmHeight * dScale) - skinMarginY; } topoffset = rowHeight > (int)newHeight ? (rowHeight - (int)newHeight) / 2 : 0; - if (!item->IGNORED) { + if ( !item->IGNORED) { //topoffset += item->MARGIN_TOP; leftoffset = item->MARGIN_LEFT; } @@ -345,7 +331,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int rgn = CreateRectRgn(leftoffset + rc->left, y + topoffset, leftoffset + rc->left + (int)newWidth, y + topoffset + (int)newHeight); hbmOldAV = reinterpret_cast(SelectObject(hdcAV, hbm)); - bf.SourceConstantAlpha = 255; //(g_CluiData.dwFlags & CLUI_FRAME_TRANSPARENTAVATAR && (UCHAR)saved_alpha > 20) ? (UCHAR)saved_alpha : 255; + bf.SourceConstantAlpha = 255; bf.AlphaFormat = contact->ace->dwFlags & AVS_PREMULTIPLIED ? AC_SRC_ALPHA : 0; SelectClipRgn(hdcMem, rgn); @@ -378,7 +364,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int SelectClipRgn(hdcMem, NULL); DeleteObject(rgn); - if (!item->IGNORED) { + if ( !item->IGNORED) { RECT rcFrame; BOOL inClCPaint_save = g_inCLCpaint; HDC hdcTemp = 0, hdcSaved = 0; @@ -390,12 +376,13 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int 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) { - RECT rcTemp; - OffsetRect(&rcFrame, 1, 0); + + RECT rcTemp; rcTemp.left = rcTemp.top = 0; rcTemp.right = rcFrame.right - rcFrame.left; rcTemp.bottom = rcFrame.bottom - rcFrame.top; + hdcTemp = CreateCompatibleDC(g_HDC); hbmTemp = CreateCompatibleBitmap(g_HDC, rcTemp.right, rcTemp.bottom); hbmOld = reinterpret_cast(SelectObject(hdcTemp, hbmTemp)); @@ -588,10 +575,10 @@ set_bg_l: else sitem = &StatusItems[cstatus - ID_STATUS_OFFLINE]; - if (!dat->bisEmbedded) { + if ( !dat->bisEmbedded) { pp_item = cEntry->status_item ? cEntry->status_item : cEntry->proto_status_item; - if (!(perstatus_ignored = sitem->IGNORED) && !(flags & CONTACTF_NOTONLIST)) + if ( !(perstatus_ignored = sitem->IGNORED) && !(flags & CONTACTF_NOTONLIST)) SetTextColor(hdcMem, sitem->TEXTCOLOR); if (cfg::dat.bUsePerProto && pp_item && !pp_item->IGNORED) { @@ -600,7 +587,7 @@ set_bg_l: SetTextColor(hdcMem, sitem->TEXTCOLOR); } } - else if (!sitem->IGNORED) + else if ( !sitem->IGNORED) SetTextColor(hdcMem, sitem->TEXTCOLOR); sevencontact_pos = &StatusItems[ID_EXTBKEVEN_CNTCTPOS - ID_STATUS_OFFLINE]; @@ -620,7 +607,7 @@ set_bg_l: // check for special cases (first item, single item, last item) // this will only change the shape for this status. Color will be blended over with ALPHA value - if (!ssingleitem->IGNORED && scanIndex == 0 && group->cl.count == 1 && group->parent != NULL) { + if ( !ssingleitem->IGNORED && scanIndex == 0 && group->cl.count == 1 && group->parent != NULL) { rc.left = ssingleitem->MARGIN_LEFT + bg_indent_l; rc.top = y + ssingleitem->MARGIN_TOP; rc.right = clRect->right - ssingleitem->MARGIN_RIGHT - bg_indent_r; @@ -635,7 +622,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, ssingleitem->CORNER, ssingleitem->BORDERSTYLE, soddcontact_pos->imageItem); } - if (!sitem->IGNORED) { + if ( !sitem->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sitem->COLOR, sitem->ALPHA, sitem->COLOR2, sitem->COLOR2_TRANSPARENT, sitem->GRADIENT, ssingleitem->CORNER, sitem->BORDERSTYLE, sitem->imageItem); savedCORNER = ssingleitem->CORNER; @@ -657,7 +644,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, sfirstitem->CORNER, soddcontact_pos->BORDERSTYLE, soddcontact_pos->imageItem); } - if (!sitem->IGNORED) { + if ( !sitem->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sitem->COLOR, sitem->ALPHA, sitem->COLOR2, sitem->COLOR2_TRANSPARENT, sitem->GRADIENT, sfirstitem->CORNER, sitem->BORDERSTYLE, sitem->imageItem); savedCORNER = sfirstitem->CORNER; @@ -681,7 +668,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, slastitem->CORNER, soddcontact_pos->BORDERSTYLE, soddcontact_pos->imageItem); } - if (!sitem->IGNORED) { + if ( !sitem->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sitem->COLOR, sitem->ALPHA, sitem->COLOR2, sitem->COLOR2_TRANSPARENT, sitem->GRADIENT, slastitem->CORNER, sitem->BORDERSTYLE, sitem->imageItem); savedCORNER = slastitem->CORNER; @@ -709,7 +696,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, sfirstitem_NG->CORNER, soddcontact_pos->BORDERSTYLE, soddcontact_pos->imageItem); } - if (!sitem->IGNORED) { + if ( !sitem->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sitem->COLOR, sitem->ALPHA, sitem->COLOR2, sitem->COLOR2_TRANSPARENT, sitem->GRADIENT, sfirstitem_NG->CORNER, sitem->BORDERSTYLE, sitem->imageItem); savedCORNER = sfirstitem_NG->CORNER; @@ -734,7 +721,7 @@ set_bg_l: DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, slastitem_NG->CORNER, soddcontact_pos->BORDERSTYLE, soddcontact_pos->imageItem); } - if (!sitem->IGNORED) { + if ( !sitem->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sitem->COLOR, sitem->ALPHA, sitem->COLOR2, sitem->COLOR2_TRANSPARENT, sitem->GRADIENT, slastitem_NG->CORNER, sitem->BORDERSTYLE, sitem->imageItem); savedCORNER = slastitem_NG->CORNER; @@ -759,14 +746,14 @@ set_bg_l: DrawAlpha(hdcMem, &rc, soddcontact_pos->COLOR, soddcontact_pos->ALPHA, soddcontact_pos->COLOR2, soddcontact_pos->COLOR2_TRANSPARENT, soddcontact_pos->GRADIENT, ssingleitem_NG->CORNER, soddcontact_pos->BORDERSTYLE, soddcontact_pos->imageItem); } - if (!sitem->IGNORED) { + if ( !sitem->IGNORED) { if (check_selected) DrawAlpha(hdcMem, &rc, sitem->COLOR, sitem->ALPHA, sitem->COLOR2, sitem->COLOR2_TRANSPARENT, sitem->GRADIENT, ssingleitem_NG->CORNER, sitem->BORDERSTYLE, sitem->imageItem); savedCORNER = ssingleitem_NG->CORNER; } if (check_selected) DrawAlpha(hdcMem, &rc, ssingleitem_NG->COLOR, ssingleitem_NG->ALPHA, ssingleitem_NG->COLOR2, ssingleitem_NG->COLOR2_TRANSPARENT, ssingleitem_NG->GRADIENT, ssingleitem_NG->CORNER, ssingleitem->BORDERSTYLE, ssingleitem->imageItem); - } else if (!sitem->IGNORED) { + } else if ( !sitem->IGNORED) { // draw default grouped // draw odd/even contact underlay if ((scanIndex == 0 || scanIndex % 2 == 0) && !sevencontact_pos->IGNORED) { @@ -790,7 +777,7 @@ set_bg_l: ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight); if (contact->group->cl.count == 0) { - if (!sempty->IGNORED) { + if ( !sempty->IGNORED) { rc.left = sempty->MARGIN_LEFT + bg_indent_l; rc.top = y + sempty->MARGIN_TOP; rc.right = clRect->right - sempty->MARGIN_RIGHT - bg_indent_r; @@ -799,8 +786,9 @@ set_bg_l: savedCORNER = sempty->CORNER; oldGroupColor = SetTextColor(hdcMem, sempty->TEXTCOLOR); } - } else if (contact->group->expanded) { - if (!sexpanded->IGNORED) { + } + else if (contact->group->expanded) { + if ( !sexpanded->IGNORED) { rc.left = sexpanded->MARGIN_LEFT + bg_indent_l; rc.top = y + sexpanded->MARGIN_TOP; rc.right = clRect->right - sexpanded->MARGIN_RIGHT - bg_indent_r; @@ -809,8 +797,9 @@ set_bg_l: savedCORNER = sexpanded->CORNER; oldGroupColor = SetTextColor(hdcMem, sexpanded->TEXTCOLOR); } - } else { - if (!scollapsed->IGNORED) { + } + else { + if ( !scollapsed->IGNORED) { // collapsed but not empty rc.left = scollapsed->MARGIN_LEFT + bg_indent_l; rc.top = y + scollapsed->MARGIN_TOP; @@ -825,8 +814,8 @@ set_bg_l: if (selected) { StatusItems_t *sselected = &StatusItems[ID_EXTBKSELECTION - ID_STATUS_OFFLINE]; - if (!g_ignoreselforgroups || type != CLCIT_GROUP) { - if (!sselected->IGNORED) { + if ( !g_ignoreselforgroups || type != CLCIT_GROUP) { + if ( !sselected->IGNORED) { rc.left = sselected->MARGIN_LEFT + bg_indent_l; rc.top = y + sselected->MARGIN_TOP; rc.right = clRect->right - sselected->MARGIN_RIGHT - bg_indent_r; @@ -854,7 +843,7 @@ set_bg_l: SetHotTrackColour(hdcMem,dat); if (ht->IGNORED == 0) SetTextColor(hdcMem, ht->TEXTCOLOR); - if (!g_hottrack_done) + if ( !g_hottrack_done) if (ht->IGNORED == 0) DrawAlpha(hdcMem, &rc, ht->COLOR, ht->ALPHA, ht->COLOR2, ht->COLOR2_TRANSPARENT, ht->GRADIENT, ht->CORNER, ht->BORDERSTYLE, ht->imageItem); @@ -874,12 +863,11 @@ bgskipped: //checkboxes if (checkboxWidth) { - RECT rc; - HANDLE hTheme = 0; - + HANDLE hTheme = 0; if (IS_THEMED) hTheme = API::pfnOpenThemeData(hwnd, L"BUTTON"); + RECT rc; rc.left = leftX; rc.right = rc.left + dat->checkboxSize; rc.top = y + ((rowHeight - dat->checkboxSize) >> 1); @@ -889,8 +877,8 @@ bgskipped: API::pfnCloseThemeData(hTheme); hTheme = 0; } - else - DrawFrameControl(hdcMem, &rc, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0)); + else DrawFrameControl(hdcMem, &rc, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0)); + rcContent.left += checkboxWidth; leftX += checkboxWidth; } @@ -925,8 +913,8 @@ bgskipped: if (av_left) rcContent.left += (cfg::dat.avatarSize + 2); } - //icon + // icon // skip icon for groups if the option is enabled... if (type == CLCIT_GROUP && dwFlags & CLUI_FRAME_NOGROUPICON) { @@ -959,45 +947,28 @@ bgskipped: else { LONG offset = 0; BOOL centered = FALSE; - offset += (type != CLCIT_CONTACT || avatar_done || !(av_local_wanted) ? 20 : dwFlags & CLUI_FRAME_ALWAYSALIGNNICK && av_left && g_selectiveIcon ? cfg::dat.avatarSize + 2 : 20); + offset += (type != CLCIT_CONTACT || avatar_done || !(av_local_wanted) ? 20 : dwFlags & CLUI_FRAME_ALWAYSALIGNNICK && av_left && g_selectiveIcon ? cfg::dat.avatarSize + 2 : 20); centered = (cfg::dat.bCenterStatusIcons && offset == cfg::dat.avatarSize + 2); ImageList_DrawEx(hImgList, iImage, hdcMem, centered ? rcContent.left + offset / 2 - 10 : rcContent.left, (twoRows && type == CLCIT_CONTACT && !cfg::dat.bCenterStatusIcons) ? y + 2 : y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode); rcContent.left += offset; } } - else - iconXSpace = 0; + else iconXSpace = 0; + 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)) { - for (int i = EXTRA_ICON_COUNT - 1; i >= 0; i--) { - if (contact->iExtraImage[i] != EMPTY_EXTRA_ICON) { - if (contact->extraIconRightBegin == 0 && i != (EXTRA_ICON_COUNT - 1)) - contact->extraIconRightBegin = rcContent.right; - ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], 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); - rcContent.right -= g_exIconSpacing; - rightIcons++; - } - } - } - if (!bApparentModeDontCare && (dwFlags & CLUI_SHOWVISI) && contact->proto) { - BOOL fVisi; - - if (dwFlags & CLUI_SHOWVISI) - fVisi = cEntry->dwDFlags & ECF_HIDEVISIBILITY ? 0 : 1; - else - fVisi = cEntry->dwDFlags & ECF_FORCEVISIBILITY ? 1 : 0; + for (int i = dat->extraColumnsCount-1; i >= 0; i--) { + if (contact->iExtraImage[i] == EMPTY_EXTRA_ICON) + continue; - 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 - DrawIconEx(hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1), - flags & CONTACTF_VISTO ? cfg::dat.hIconVisible : cfg::dat.hIconInvisible, cfg::dat.exIconScale, cfg::dat.exIconScale, 0, 0, DI_NORMAL | DI_COMPAT); - rcContent.right -= g_exIconSpacing; + if (contact->extraIconRightBegin == 0) + contact->extraIconRightBegin = rcContent.right; + ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, + rcContent.right - cfg::dat.exIconScale, + y + ((rowHeight - cfg::dat.exIconScale) >> 1), + 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); + rcContent.right -= dat->extraColumnSpacing; rightIcons++; } } @@ -1085,7 +1056,7 @@ text: } if (dat->exStyle & CLS_EX_LINEWITHGROUPS) { - if (!g_center) { + if ( !g_center) { rc.top = y + ((rowHeight) >> 1); rc.bottom = rc.top + 2; rc.left = rightLineStart; rc.right = clRect->right - 1 - dat->rightMargin; @@ -1112,7 +1083,7 @@ text: // avatar - if (!dat->bisEmbedded) { + if ( !dat->bisEmbedded) { if (av_local_wanted && !avatar_done && pi_avatar) { if (av_rightwithnick) { RECT rcAvatar = rcContent; @@ -1129,7 +1100,7 @@ text: } // nickname - if (!twoRows) + if ( !twoRows) DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE | dt_nickflags); else { int statusFontHeight; @@ -1152,7 +1123,6 @@ text: COLORREF oldColor; int fHeight = 0; - TCHAR szResult[80]; if (tmi.printDateTime(cEntry->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) goto nodisplay; @@ -1221,7 +1191,6 @@ nodisplay: if ((dwFlags & CLUI_FRAME_SHOWSTATUSMSG && smsgValid > STATUSMSG_XSTATUSID) || smsgValid == STATUSMSG_XSTATUSNAME) szText = cEntry->statusMsg; else - szText = &statusNames[cstatus - ID_STATUS_OFFLINE][0]; if (cEntry->dwCFlags & ECF_RTLSTATUSMSG && cfg::dat.bUseDCMirroring == 3) @@ -1292,23 +1261,6 @@ nodisplay: } } - //extra icons - for (int i = dat->extraColumnsCount-1; i >= 0; i--) { - COLORREF colourFg = dat->selBkColour; - int mode = ILD_NORMAL; - if (contact->iExtraImage[i] == EMPTY_EXTRA_ICON) - continue; - - if (selected) - mode = ILD_SELECTED; - else if (g_hottrack) - mode = ILD_FOCUS, colourFg = dat->hotTextColour; - else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST) - colourFg = dat->fontInfo[FONTID_NOTONLIST].colour, mode = ILD_BLEND50; - - rightOffset += dat->extraColumnSpacing; - ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, clRect->right - rightOffset, y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode); - } if (g_RTL) API::pfnSetLayout(hdcMem, 0); } @@ -1420,21 +1372,17 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) goto bgdone; } if (dat->hBmpBackground) { - BITMAP bmp; - HDC hdcBmp; - int x, y; - int bitx, bity; - int maxx, maxy; int destw, desth; // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. SetStretchBltMode(hdcMem, HALFTONE); + BITMAP bmp; GetObject(dat->hBmpBackground, sizeof(bmp), &bmp); - hdcBmp = CreateCompatibleDC(hdcMem); + HDC hdcBmp = CreateCompatibleDC(hdcMem); SelectObject(hdcBmp, dat->hBmpBackground); - y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0; - maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1; - maxy = dat->backgroundBmpUse & CLBF_TILEV ? maxy = rcPaint->bottom : y + 1; + int y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0; + int maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1; + int maxy = dat->backgroundBmpUse & CLBF_TILEV ? maxy = rcPaint->bottom : y + 1; switch (dat->backgroundBmpUse & CLBM_TYPE) { case CLB_STRETCH: if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { @@ -1475,15 +1423,13 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) break; } - bitx = 0; - bity = 0; + int bitx = 0, bity = 0; for (; y < maxy; y += desth) { - if (y< rcPaint->top - desth) + if (y < rcPaint->top - desth) continue; - for (x = 0; x < maxx; x += destw) { + for (int x = 0; x < maxx; x += destw) StretchBlt(hdcMem, x, y, destw, desth, cfg::dat.hdcPic, bitx, bity, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - } } DeleteDC(hdcBmp); } @@ -1500,10 +1446,8 @@ bgdone: group->scanIndex = 0; g_list_avatars = 0; - while(TRUE) - { - if (group->scanIndex==group->cl.count) - { + while(TRUE) { + if (group->scanIndex==group->cl.count) { group=group->parent; if (group==NULL) break; // Finished list group->scanIndex++; @@ -1530,9 +1474,9 @@ bgdone: if (group->scanIndex == group->cl.count) { group = group->parent; indent--; - if (group == NULL) { + if (group == NULL) break; - } + group->scanIndex++; continue; } @@ -1570,15 +1514,14 @@ bgdone: POINT pts[8]; HRGN hRgn; - pts[0].x=dat->leftMargin; pts[0].y = RowHeight::getItemTopY(dat, dat->iInsertionMark) - dat->yScroll - 4; - //pts[0]. x = dat->leftMargin; pts[0]. y = dat->iInsertionMark * rowHeight - dat->yScroll - 4; - pts[1]. x = pts[0].x + 2; pts[1]. y = pts[0].y + 3; - pts[2]. x = clRect.right - 4; pts[2]. y = pts[1].y; - pts[3]. x = clRect.right - 1; pts[3]. y = pts[0].y - 1; - pts[4]. x = pts[3].x; pts[4]. y = pts[0].y + 7; - pts[5]. x = pts[2].x + 1; pts[5]. y = pts[1].y + 2; - pts[6]. x = pts[1].x; pts[6]. y = pts[5].y; - pts[7]. x = pts[0].x; pts[7]. y = pts[4].y; + pts[0].x=dat->leftMargin; pts[0].y = RowHeight::getItemTopY(dat, dat->iInsertionMark) - dat->yScroll - 4; + pts[1].x = pts[0].x + 2; pts[1].y = pts[0].y + 3; + pts[2].x = clRect.right - 4; pts[2].y = pts[1].y; + pts[3].x = clRect.right - 1; pts[3].y = pts[0].y - 1; + pts[4].x = pts[3].x; pts[4].y = pts[0].y + 7; + pts[5].x = pts[2].x + 1; pts[5].y = pts[1].y + 2; + pts[6].x = pts[1].x; pts[6].y = pts[5].y; + pts[7].x = pts[0].x; pts[7].y = pts[4].y; hRgn = CreatePolygonRgn(pts, sizeof(pts) / sizeof(pts[0]), ALTERNATE); hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour); hoBrush = (HBRUSH) SelectObject(hdcMem, hBrush); @@ -1586,7 +1529,7 @@ bgdone: SelectObject(hdcMem, hoBrush); DeleteObject(hBrush); } - if (!grey) + if ( !grey) BitBlt(hdc, rcPaint->left, rcPaint->top, rcPaint->right - rcPaint->left, rcPaint->bottom - rcPaint->top, hdcMem, rcPaint->left, rcPaint->top, SRCCOPY); SelectObject(hdcMem, hOldBitmap); diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 98a7f81fe2..fc98a70894 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -38,7 +38,7 @@ extern void ( *saveRecalcScrollBar )(HWND hwnd, struct ClcData *dat); static int MY_pathIsAbsolute(const TCHAR *path) { - if (!path || !(lstrlen(path) > 2)) + if ( !path || !(lstrlen(path) > 2)) return 0; if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\')) @@ -49,7 +49,7 @@ static int MY_pathIsAbsolute(const TCHAR *path) size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut) { - if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH) + if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH) return 0; if ( !MY_pathIsAbsolute(pSrc)) { @@ -72,7 +72,7 @@ size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut) size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) { - if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH) + if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH) return 0; if (MY_pathIsAbsolute(pSrc)&&pSrc[0]!='.') @@ -91,7 +91,7 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *hitcontact, DWORD *flags, int indent, int hit) { RECT clRect; - int right, checkboxWidth, cxSmIcon, i, width; + int right, checkboxWidth, width; DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); SIZE textSize; HDC hdc; @@ -101,11 +101,11 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact right = clRect.right; // avatar check - if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) { + 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; - } + if (testx > right - (dat->leftMargin + indent * dat->groupIndent)) { if (flags) *flags |= CLCHT_ONITEMINDENT; @@ -123,33 +123,23 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *flags |= CLCHT_ONITEMCHECK; return hit; } + if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace)) { if (flags) *flags |= CLCHT_ONITEMICON; return hit; } - cxSmIcon = GetSystemMetrics(SM_CXSMICON); - for (i = 0; i< dat->extraColumnsCount; i++) { - if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) - continue; - if (testx >= dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx < dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) { - if (flags) - *flags |= CLCHT_ONITEMEXTRA | (i << 24); - return hit; - } - } - if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry) { - int rightOffset = hitcontact->extraIconRightBegin; - int images_present = 0; - for (i = EXTRA_ICON_COUNT-1; i >= 0; i--) { + int rightOffset = hitcontact->extraIconRightBegin; + if (rightOffset) { + for (int i = dat->extraColumnsCount-1; i >= 0; i--) { if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; - images_present++; - if (testx < right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx > right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) { + rightOffset -= cfg::dat.exIconScale + 2; + if (testx > rightOffset && testx < rightOffset + cfg::dat.exIconScale ) { if (flags) - *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24)); + *flags |= (CLCHT_ONITEMEXTRA | (i << 24)); return hit; } } @@ -194,10 +184,9 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c { ClcContact *hitcontact; ClcGroup *hitgroup; - int hit, indent, width, i, cxSmIcon; + int hit, indent, width, i; int checkboxWidth; SIZE textSize; - HDC hdc; RECT clRect; HFONT hFont; DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); @@ -219,7 +208,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c } return -1; } - if (testx< dat->leftMargin) { + if (testx < dat->leftMargin) { if (flags) *flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE; return -1; @@ -238,11 +227,10 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c if (group) *group = hitgroup; - for (indent = 0; hitgroup->parent; indent++,hitgroup = hitgroup->parent) { + for (indent = 0; hitgroup->parent; indent++,hitgroup = hitgroup->parent) ; - } - if (!dat->bisEmbedded) { + if ( !dat->bisEmbedded) { 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); @@ -260,7 +248,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c *flags |= CLCHT_ONAVATAR; } } - if (testx< dat->leftMargin + indent * dat->groupIndent) { + if (testx < dat->leftMargin + indent * dat->groupIndent) { if (flags) *flags |= CLCHT_ONITEMINDENT; return hit; @@ -272,44 +260,33 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c checkboxWidth = dat->checkboxSize + 2; if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX) checkboxWidth = dat->checkboxSize + 2; - if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth) { + if (testx < dat->leftMargin + indent * dat->groupIndent + checkboxWidth) { if (flags) *flags |= CLCHT_ONITEMCHECK; return hit; } - if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace) { + if (testx < dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace) { if (flags) *flags |= CLCHT_ONITEMICON; return hit; } - cxSmIcon = GetSystemMetrics(SM_CXSMICON); - for (i = 0; i< dat->extraColumnsCount; i++) { - if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) - continue; - if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx< clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) { - if (flags) - *flags |= CLCHT_ONITEMEXTRA | (i << 24); - return hit; - } - } - if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry) { - //int rightOffset = clRect.right; - int rightOffset = hitcontact->extraIconRightBegin; - int images_present = 0; - for (i = EXTRA_ICON_COUNT; i >= 0; i--) { + int rightOffset = hitcontact->extraIconRightBegin; + if (rightOffset) { + for (i = dat->extraColumnsCount-1; i >= 0; i--) { if (hitcontact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; - images_present++; - if (testx > (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx < (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) { + rightOffset -= cfg::dat.exIconScale+2; + if (testx > rightOffset && testx < rightOffset + cfg::dat.exIconScale) { if (flags) - *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24)); + *flags |= (CLCHT_ONITEMEXTRA | (i << 24)); return hit; } } } - hdc = GetDC(hwnd); + + HDC hdc = GetDC(hwnd); if (hitcontact->type == CLCIT_GROUP) hFont = reinterpret_cast(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont)); else @@ -334,7 +311,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c *flags |= CLCHT_ONITEMSPACE; return hit; } - if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) { + if (testx < dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) { if (flags) *flags |= CLCHT_ONITEMLABEL; return hit; @@ -366,10 +343,10 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) desty = 0; if (abs(desty - dat->yScroll) < 4) noSmooth = 1; - if (!noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) + if ( !noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING) noSmooth = 1; previousy = dat->yScroll; - if (!noSmooth) { + if ( !noSmooth) { startTick = GetTickCount(); for (; ;) { nowTick = GetTickCount(); @@ -390,7 +367,7 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) } dat->yScroll = desty; if (dat->backgroundBmpUse & CLBF_SCROLL || dat->hBmpBackground == NULL) { - if (!noSmooth) + if ( !noSmooth) ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); else InvalidateRect(hwnd, NULL, FALSE); @@ -581,7 +558,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) dat->rightMargin = cfg::getByte("CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN); dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ? GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR); - if (!dat->bkChanged) { + if ( !dat->bkChanged) { if (cfg::dat.hBrushCLCBk) DeleteObject(cfg::dat.hBrushCLCBk); cfg::dat.hBrushCLCBk = CreateSolidBrush(dat->bkColour); diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index de98aebffe..277eb29db1 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -75,7 +75,7 @@ void HideShowNotifyFrame() desired = dwVisible; if (desired) { - if (!dwVisible) + if ( !dwVisible) CallService(MS_CLIST_FRAMES_SHFRAME, (WPARAM)hNotifyFrame, 0); } else { diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 9dd464115a..801fc644ba 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -152,13 +152,6 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA else SendDlgItemMessage(hWnd, IDC_SHOWLOCALTIME1, BM_SETCHECK, BST_INDETERMINATE, 0); - if (dwFlags & ECF_FORCEVISIBILITY) - SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_CHECKED, 0); - else if (dwFlags & ECF_HIDEVISIBILITY) - SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_UNCHECKED, 0); - else - SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_INDETERMINATE, 0); - if (bSecondLine == 0xff) SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_SETCURSEL, 0, 0); else @@ -211,7 +204,6 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_SETCURSEL, 0, 0); SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_SETCHECK, BST_INDETERMINATE, 0); SendDlgItemMessage(hWnd, IDC_LOCALTIME, BM_SETCHECK, BST_INDETERMINATE, 0); - SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_SETCHECK, BST_INDETERMINATE, 0); break; } case IDOK: @@ -241,8 +233,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA LoadAvatarForContact(contact); } - dwFlags &= ~(ECF_FORCEOVERLAY | ECF_HIDEOVERLAY | ECF_FORCELOCALTIME | ECF_HIDELOCALTIME | - ECF_FORCEVISIBILITY | ECF_HIDEVISIBILITY); + dwFlags &= ~(ECF_FORCEOVERLAY | ECF_HIDEOVERLAY | ECF_FORCELOCALTIME | ECF_HIDELOCALTIME); checked = SendDlgItemMessage(hWnd, IDC_OVERLAYICON, BM_GETCHECK, 0, 0); if (checked == BST_CHECKED) @@ -256,12 +247,6 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA else if (checked == BST_UNCHECKED) dwFlags |= ECF_HIDELOCALTIME; - checked = SendDlgItemMessage(hWnd, IDC_SHOWVISIBILITY, BM_GETCHECK, 0, 0); - if (checked == BST_CHECKED) - dwFlags |= ECF_FORCEVISIBILITY; - 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) { diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 2092413e71..9065d52d9e 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -194,7 +194,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) /*if (rgn) { ptTest.x = j; ptTest.y = i; - if (!PtInRegion(rgn, ptTest.x, ptTest.y)) { + if ( !PtInRegion(rgn, ptTest.x, ptTest.y)) { continue; } }*/ @@ -235,7 +235,7 @@ int ShowHide(WPARAM wParam, LPARAM lParam) switch (iVisibleState) { case GWVS_PARTIALLY_COVERED: //If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it. - if (!cfg::getByte("CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) + if ( !cfg::getByte("CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) break; case GWVS_COVERED: //Fall through (and we're already falling) case GWVS_HIDDEN: @@ -253,7 +253,7 @@ int ShowHide(WPARAM wParam, LPARAM lParam) RECT rcWindow; SetWindowPos(pcli->hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOCOPYBITS); - if (!cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT)) + if ( !cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT)) SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOCOPYBITS); SetForegroundWindow(pcli->hwndContactList); //SetActiveWindow(pcli->hwndContactList); diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index b23cc5a1c6..fdb9c527f1 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -40,7 +40,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch (msg) { case WM_USER+1: { - HANDLE hContact = (HANDLE) wParam; + HANDLE hContact = (HANDLE)wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); @@ -62,9 +62,9 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, cfg::getByte("CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); { DWORD caps = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS1, 0); - if (!(caps & CLUIF_HIDEEMPTYGROUPS)) + if ( !(caps & CLUIF_HIDEEMPTYGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_HIDEEMPTYGROUPS), SW_HIDE); - if (!(caps & CLUIF_DISABLEGROUPS)) + if ( !(caps & CLUIF_DISABLEGROUPS)) ShowWindow(GetDlgItem(hwndDlg, IDC_DISABLEGROUPS), SW_HIDE); if (caps & CLUIF_HASONTOPOPTION) ShowWindow(GetDlgItem(hwndDlg, IDC_ONTOP), SW_HIDE); @@ -153,7 +153,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: - if (!opt_gen_opts_changed) + if ( !opt_gen_opts_changed) return TRUE; cfg::writeByte("CList", "HideOffline", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE)); @@ -163,7 +163,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP cfg::writeByte("CList", "HideEmptyGroups", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS)); if (caps & CLUIF_DISABLEGROUPS) cfg::writeByte("CList", "UseGroups", (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS)); - if (!(caps & CLUIF_HASONTOPOPTION)) { + if ( !(caps & CLUIF_HASONTOPOPTION)) { cfg::writeByte("CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } diff --git a/plugins/Clist_nicer/src/clistsettings.cpp b/plugins/Clist_nicer/src/clistsettings.cpp index 708abb0853..9f380bc219 100644 --- a/plugins/Clist_nicer/src/clistsettings.cpp +++ b/plugins/Clist_nicer/src/clistsettings.cpp @@ -27,7 +27,7 @@ UNICODE done INT_PTR GetContactStatusMessage(WPARAM wParam, LPARAM lParam) { - if (!cfg::shutDown) + if ( !cfg::shutDown) return SendMessage(pcli->hwndContactTree, CLM_GETSTATUSMSG, wParam, lParam); return 0; } diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index f7d6c297c3..24edcfe047 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -50,7 +50,7 @@ void TrayIconUpdateBase(const char *szChangedProto) if ( !pcli->pfnGetProtocolVisibility( accs[i]->szModuleName )) continue; netProtoCount++; - if (!lstrcmpA(szChangedProto, accs[i]->szModuleName )) + if ( !lstrcmpA(szChangedProto, accs[i]->szModuleName )) pcli->cycleStep = i; if (averageMode == 0) averageMode = CallProtoService( accs[i]->szModuleName, PS_GETSTATUS, 0, 0); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 8dea08ad8b..63c8953588 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -313,19 +313,6 @@ static void InitIcoLib() Skin_AddIcon(&sid); } - sid.pszName = "CLN_visible"; - sid.pszDescription = LPGEN("Contact on visible list"); - sid.iDefaultIndex = -IDI_CLVISIBLE; - Skin_AddIcon(&sid); - sid.pszName = "CLN_invisible"; - sid.pszDescription = LPGEN("Contact on invisible list or blocked"); - sid.iDefaultIndex = -IDI_CLINVISIBLE; - Skin_AddIcon(&sid); - sid.pszName = "CLN_chatactive"; - sid.pszDescription = LPGEN("Chat room/IRC channel activity"); - sid.iDefaultIndex = -IDI_OVL_FREEFORCHAT; - Skin_AddIcon(&sid); - sid.flags = SIDF_ALL_TCHAR; sid.ptszSection = LPGENT("CList - Nicer/Overlay Icons"); for (i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) { @@ -385,9 +372,6 @@ void CLN_LoadAllIcons(BOOL mode) if (mode) { InitIcoLib(); hIcoLibChanged = HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibChanged); - cfg::dat.hIconVisible = Skin_GetIcon("CLN_visible"); - cfg::dat.hIconInvisible = Skin_GetIcon("CLN_invisible"); - cfg::dat.hIconChatactive = Skin_GetIcon("CLN_chatactive"); } CacheClientIcons(); } @@ -420,9 +404,6 @@ void ConfigureFrame() void IcoLibReloadIcons() { - cfg::dat.hIconVisible = Skin_GetIcon("CLN_visible"); - cfg::dat.hIconInvisible = Skin_GetIcon("CLN_invisible"); - cfg::dat.hIconChatactive = Skin_GetIcon("CLN_chatactive"); CacheClientIcons(); pcli->pfnReloadExtraIcons(); pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0); @@ -483,7 +464,7 @@ void SetDBButtonStates(HANDLE hPassedContact) while (buttonItem) { BOOL result = FALSE; - if (!(buttonItem->dwFlags & BUTTON_ISTOGGLE && buttonItem->dwFlags & BUTTON_ISDBACTION)) { + if ( !(buttonItem->dwFlags & BUTTON_ISTOGGLE && buttonItem->dwFlags & BUTTON_ISDBACTION)) { buttonItem = buttonItem->nextItem; continue; } @@ -504,7 +485,7 @@ void SetDBButtonStates(HANDLE hPassedContact) if (buttonItem->type == DBVT_ASCIIZ) { DBVARIANT dbv = {0}; - if (!cfg::getString(hFinalContact, szModule, szSetting, &dbv)) { + if ( !cfg::getString(hFinalContact, szModule, szSetting, &dbv)) { result = !strcmp((char *)buttonItem->bValuePush, dbv.pszVal); DBFreeVariant(&dbv); } @@ -644,7 +625,7 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc) if (disableautoupd) return; - if (!cfg::getByte("CLUI", "AutoSize", 0)) + if ( !cfg::getByte("CLUI", "AutoSize", 0)) return; if (Docking_IsDocked(0, 0)) @@ -754,7 +735,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) uItemID -= ID_STATUS_OFFLINE; item = &StatusItems[uItemID]; - if (!item->IGNORED) { + if ( !item->IGNORED) { int alpha = nmcsbcd->uState == CDIS_DISABLED ? item->ALPHA - 50 : item->ALPHA; DrawAlpha(hdcScroll, &nmcsbcd->rect, item->COLOR, alpha, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); @@ -809,7 +790,7 @@ static void ShowCLUI(HWND hwnd) int onTop = cfg::getByte("CList", "OnTop", SETTING_ONTOP_DEFAULT); SendMessage(hwnd, WM_SETREDRAW, FALSE, FALSE); - if (!cfg::getByte("CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) + if ( !cfg::getByte("CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) SetMenu(pcli->hwndContactList, NULL); if (state == SETTING_STATE_NORMAL) { SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); @@ -866,7 +847,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l cfg::writeByte("CList", "State", SETTING_STATE_HIDDEN); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VISIBLE); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); - if (!cfg::dat.bFirstRun) + if ( !cfg::dat.bFirstRun) ConfigureEventArea(hwnd); CluiProtocolStatusChanged(0, 0); ConfigureCLUIGeometry(0); @@ -947,7 +928,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (cfg::getByte("CList", "AutoApplyLastViewMode", 0)) { DBVARIANT dbv = {0}; - if (!DBGetContactSetting(NULL, "CList", "LastViewMode", &dbv)) { + if ( !DBGetContactSetting(NULL, "CList", "LastViewMode", &dbv)) { if (lstrlenA(dbv.pszVal) > 2) { if (cfg::getDword(NULL, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff) ApplyViewMode((char *)dbv.pszVal); @@ -955,7 +936,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l DBFreeVariant(&dbv); } } - if (!cfg::dat.autosize) + if ( !cfg::dat.autosize) ShowCLUI(hwnd); else { show_on_first_autosize = TRUE; @@ -981,7 +962,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l GetClientRect(hwnd, &rcClient); CopyRect(&rc, &rcClient); - if (!cfg::dat.hdcBg || rc.right > cfg::dat.dcSize.cx || rc.bottom + cfg::dat.statusBarHeight > cfg::dat.dcSize.cy) { + if ( !cfg::dat.hdcBg || rc.right > cfg::dat.dcSize.cx || rc.bottom + cfg::dat.statusBarHeight > cfg::dat.dcSize.cy) { RECT rcWorkArea; SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, FALSE); @@ -1030,7 +1011,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int docked = CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0); int clip = cfg::dat.bClipBorder; - if (!g_CLUISkinnedBkColor) + if ( !g_CLUISkinnedBkColor) FillRect(hdc, &rcClient, cfg::dat.hBrushColorKey); if (cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME) rgn = CreateRoundRectRgn(clip, docked ? 0 : clip, rcClient.right - clip + 1, rcClient.bottom - (docked ? 0 : clip - 1), 8 + clip, 8 + clip); @@ -1123,7 +1104,7 @@ skipbg: } case WM_WINDOWPOSCHANGED: - if (!Docking_IsDocked(0, 0)) + if ( !Docking_IsDocked(0, 0)) return(0); else break; @@ -1196,11 +1177,11 @@ skipbg: } } case WM_MOVE: - if (!IsIconic(hwnd)) { + if ( !IsIconic(hwnd)) { RECT rc; GetWindowRect(hwnd, &rc); - if (!Docking_IsDocked(0, 0)) { + if ( !Docking_IsDocked(0, 0)) { cluiPos.bottom = (DWORD)(rc.bottom - rc.top); cluiPos.left = rc.left; cluiPos.top = rc.top; @@ -1211,7 +1192,7 @@ skipbg: GetWindowRect(hwnd, &rc); // if docked, dont remember pos (except for width) - if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { + if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { cfg::writeDword("CList", "Height", (DWORD)(rc.bottom - rc.top)); cfg::writeDword("CList", "x", (DWORD) rc.left); cfg::writeDword("CList", "y", (DWORD) rc.top); @@ -1255,7 +1236,7 @@ skipbg: case WM_SETCURSOR: if (cfg::dat.isTransparent) { - if (!transparentFocus && GetForegroundWindow() != hwnd) { + if ( !transparentFocus && GetForegroundWindow() != hwnd) { API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.alpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); transparentFocus = 1; SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); @@ -1323,7 +1304,7 @@ skipbg: else API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), cfg::dat.autoalpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } - if (!transparentFocus) + if ( !transparentFocus) KillTimer(hwnd, TM_AUTOALPHA); } else if (wParam == TIMERID_AUTOSIZE) { KillTimer(hwnd, wParam); @@ -1360,13 +1341,13 @@ skipbg: FLT_ShowHideAll(SW_SHOWNOACTIVATE); } - if (!cfg::dat.fadeinout) + if ( !cfg::dat.fadeinout) SFL_SetState(-1); if (lParam) return DefWindowProc(hwnd, msg, wParam, lParam); if (noRecurse) return DefWindowProc(hwnd, msg, wParam, lParam); - if (!cfg::dat.fadeinout || !IsWinVer2000Plus()) + if ( !cfg::dat.fadeinout || !IsWinVer2000Plus()) return DefWindowProc(hwnd, msg, wParam, lParam); g_fading_active = 1; @@ -1521,7 +1502,7 @@ skipbg: } else if (item->dwFlags & BUTTON_ISTOGGLE) SendMessage(item->hWnd, BM_SETCHECK, 0, 0); } - if (!contactOK) + if ( !contactOK) MessageBox(0, _T("The requested action requires a valid contact selection. Please select a contact from the contact list and repeat"), _T("Parameter mismatch"), MB_OK); if (serviceFailure) { char szError[512]; @@ -1616,26 +1597,25 @@ buttons_done: case POPUP_HIDEOFFLINEROOT: SendMessage(pcli->hwndContactTree, CLM_SETHIDEOFFLINEROOT, !SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0), 0); break; - case POPUP_HIDEEMPTYGROUPS: { - int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS); - cfg::writeByte("CList", "HideEmptyGroups", (BYTE) newVal); - SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0); + case POPUP_HIDEEMPTYGROUPS: + { + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS); + cfg::writeByte("CList", "HideEmptyGroups", (BYTE) newVal); + SendMessage(pcli->hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0); + } break; - } case IDC_TBHIDEGROUPS: - case POPUP_DISABLEGROUPS: { - int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS); - cfg::writeByte("CList", "UseGroups", (BYTE) newVal); - SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal, 0); - CheckDlgButton(hwnd, IDC_TBHIDEGROUPS, newVal ? BST_CHECKED : BST_UNCHECKED); + case POPUP_DISABLEGROUPS: + { + int newVal = !(GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS); + cfg::writeByte("CList", "UseGroups", (BYTE) newVal); + SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal, 0); + CheckDlgButton(hwnd, IDC_TBHIDEGROUPS, newVal ? BST_CHECKED : BST_UNCHECKED); + } break; - } case POPUP_HIDEMIRANDA: pcli->pfnShowHide(0, 0); break; - case POPUP_VISIBILITY: - cfg::dat.dwFlags ^= CLUI_SHOWVISI; - break; case POPUP_SHOWMETAICONS: cfg::dat.dwFlags ^= CLUI_USEMETAICONS; SendMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0); @@ -1740,7 +1720,7 @@ buttons_done: // all this is done in screen-coords! GetCursorPos(&pt); // the mouse isnt near the window, so put it in the middle of the window - if (!PtInRect(&rc, pt)) { + if ( !PtInRect(&rc, pt)) { pt.x = rc.left + (rc.right - rc.left) / 2; pt.y = rc.top + (rc.bottom - rc.top) / 2; } @@ -1823,7 +1803,7 @@ buttons_done: } else hIcon = LoadSkinnedProtoIcon(szProto, status); - if (!(showOpts & 6) && cfg::dat.bEqualSections) + if ( !(showOpts & 6) && cfg::dat.bEqualSections) x = (dis->rcItem.left + dis->rcItem.right - 16) >> 1; if (pd->statusbarpos == 0) x += (cfg::dat.bEqualSections ? (cfg::dat.bCLeft / 2) : cfg::dat.bCLeft); @@ -1928,7 +1908,7 @@ buttons_done: * indicates that clist is shutting down and prevents various things * from happening at shutdown. */ - if (!cfg::shutDown) + if ( !cfg::shutDown) cfg::shutDown = 1; CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)hFrameContactTree, 0); break; @@ -2037,7 +2017,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar static INT_PTR CLN_ShowAbout(WPARAM wParam, LPARAM lParam) { - if (!g_AboutDlgActive) + if ( !g_AboutDlgActive) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CLNABOUT), 0, DlgProcAbout, 0); return 0; } diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index d355ce641e..c01e634e74 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -84,7 +84,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Utils::enableDlgControl(hwndDlg, IDC_HIDETIME, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); Utils::enableDlgControl(hwndDlg, IDC_HIDETIMESPIN, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); Utils::enableDlgControl(hwndDlg, IDC_STATIC01, IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); - if (!IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)) { + if ( !IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)) { Utils::enableDlgControl(hwndDlg, IDC_STATIC21, FALSE); Utils::enableDlgControl(hwndDlg, IDC_STATIC22, FALSE); Utils::enableDlgControl(hwndDlg, IDC_MAXSIZEHEIGHT, FALSE); @@ -92,14 +92,14 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Utils::enableDlgControl(hwndDlg, IDC_AUTOSIZEUPWARD, FALSE); } { DBVARIANT dbv; - if (!cfg::getTString(NULL, "CList", "TitleText", &dbv)) { + if ( !cfg::getTString(NULL, "CList", "TitleText", &dbv)) { SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal); DBFreeVariant(&dbv); } else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); } - if (!API::sysConfig.isWin2KPlus) { + if ( !API::sysConfig.isWin2KPlus) { Utils::enableDlgControl(hwndDlg, IDC_FADEINOUT, FALSE); Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENT, FALSE); Utils::enableDlgControl(hwndDlg, IDC_DROPSHADOW, FALSE); @@ -109,7 +109,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CheckDlgButton(hwndDlg, IDC_TRANSPARENT, cfg::dat.isTransparent ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_FULLTRANSPARENT, cfg::dat.bFullTransparent ? BST_CHECKED : BST_UNCHECKED); } - if (!IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { + if ( !IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { Utils::enableDlgControl(hwndDlg, IDC_STATIC11, FALSE); Utils::enableDlgControl(hwndDlg, IDC_STATIC12, FALSE); Utils::enableDlgControl(hwndDlg, IDC_TRANSACTIVE, FALSE); @@ -182,7 +182,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l BYTE windowStyle = (BYTE)SendDlgItemMessage(hwndDlg, IDC_BORDERSTYLE, CB_GETCURSEL, 0, 0); COLORREF clr_cluiframes; - if (!opt_clui_changed) + if ( !opt_clui_changed) return TRUE; cfg::writeByte("CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); @@ -256,7 +256,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ApplyCLUIBorderStyle(pcli->hwndContactList); - if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) + if ( !IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList, NULL); else SetMenu(pcli->hwndContactList, pcli->hMenuMain); @@ -323,7 +323,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } } else { API::SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)255, LWA_ALPHA); - if (!cfg::dat.bLayeredHack) + if ( !cfg::dat.bLayeredHack) SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); } @@ -371,7 +371,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CheckDlgButton(hwndDlg, IDC_SHOWXSTATUS, cfg::dat.bShowXStatusOnSbar); CheckDlgButton(hwndDlg, IDC_MARKLOCKED, cfg::getByte("CLUI", "sbar_showlocked", 1)); - if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) { + if ( !IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) { Utils::enableDlgControl(hwndDlg, IDC_SHOWICON, FALSE); Utils::enableDlgControl(hwndDlg, IDC_SHOWPROTO, FALSE); Utils::enableDlgControl(hwndDlg, IDC_SHOWSTATUS, FALSE); @@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: - if (!opt_sbar_changed) + if ( !opt_sbar_changed) return TRUE; cfg::writeByte("CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index f4b8b29e7d..6bba347513 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -36,7 +36,7 @@ static INT_PTR GetClistVersion(WPARAM wParam, LPARAM lParam) static char g_szVersionString[256]; mir_snprintf(g_szVersionString, 256, "%s, %d.%d.%d.%d", pluginInfo.shortName, HIBYTE(HIWORD(pluginInfo.version)), LOBYTE(HIWORD(pluginInfo.version)), HIBYTE(LOWORD(pluginInfo.version)), LOBYTE(LOBYTE(pluginInfo.version))); - if (!IsBadWritePtr((LPVOID)lParam, 4)) + if ( !IsBadWritePtr((LPVOID)lParam, 4)) *((DWORD *)lParam) = pluginInfo.version; return (INT_PTR)g_szVersionString; @@ -211,7 +211,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) } // update the clui button - if (!DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv)) { + if ( !DBGetContactSetting(NULL, "CList", "PrimaryStatus", &dbv)) { if (dbv.type == DBVT_ASCIIZ && lstrlenA(dbv.pszVal) > 1) { wStatus = (WORD) CallProtoService(dbv.pszVal, PS_GETSTATUS, 0, 0); iIcon = IconFromStatusMode(dbv.pszVal, (int) wStatus, 0, &hIcon); @@ -244,7 +244,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) HWND hwndClistBtn = GetDlgItem(pcli->hwndContactList, IDC_TBGLOBALSTATUS); if ( IsWindow(hwndClistBtn)) { SendMessage(hwndClistBtn, WM_SETTEXT, 0, (LPARAM) szStatus); - if (!hIcon) + if ( !hIcon) SendMessage(hwndClistBtn, BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); else SendMessage(hwndClistBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); @@ -254,7 +254,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) HWND hwndTtbStatus = ClcGetButtonWindow(IDC_TBTOPSTATUS); if ( IsWindow(hwndTtbStatus)) { if (g_ButtonItems == NULL) { - if (!hIcon) + if ( !hIcon) SendMessage(hwndTtbStatus, BUTTONSETIMLICON, (WPARAM) hCListImages, (LPARAM) iIcon); else SendMessage(hwndTtbStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM) hIcon); diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index 99be0ebcf8..2d54120e8b 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -164,15 +164,15 @@ void LoadContactTree(void) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode((char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0), status, hContact, NULL), 1); if (mc_disablehgh && !mc_hgh_removed) { - if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) { - if (!strcmp(dbv.pszVal, "MetaContacts Hidden Group")) + if ( !DBGetContactSetting(hContact, "CList", "Group", &dbv)) { + if ( !strcmp(dbv.pszVal, "MetaContacts Hidden Group")) DBDeleteContactSetting(hContact, "CList", "Group"); mir_free(dbv.pszVal); } } // build initial data for message frequency - if (!bMsgFrequency) + if ( !bMsgFrequency) MF_CalcFrequency(hContact, 100, 0); hContact = db_find_next(hContact); diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 0a7a7cefc5..504bcfa974 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -258,7 +258,7 @@ StatusItems_t *GetProtocolStatusItem(const char *szProto) return NULL; for (i = ID_EXTBK_LAST_D - ID_STATUS_OFFLINE + 1; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) { - if (!strcmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, szProto)) + if ( !strcmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, szProto)) return &StatusItems[i]; } return NULL; @@ -535,7 +535,7 @@ void extbk_export(char *file) mir_snprintf(szSection, 255, "Font%d", n); mir_snprintf(szKey, 255, "Font%dName", n); - if (!cfg::getString(NULL, "CLC", szKey, &dbv)) { + if ( !cfg::getString(NULL, "CLC", szKey, &dbv)) { WritePrivateProfileStringA(szSection, "Name", dbv.pszVal, file); mir_free(dbv.pszVal); } @@ -580,7 +580,7 @@ void extbk_export(char *file) WritePrivateProfileStructA("Global", _tagSettings[i].szSetting, &data, _tagSettings[i].size, file); i++; } - if (!cfg::getString(NULL, "CLC", "BkBitmap", &dbv)) { + if ( !cfg::getString(NULL, "CLC", "BkBitmap", &dbv)) { WritePrivateProfileStringA("Global", "BkBitmap", dbv.pszVal, file); DBFreeVariant(&dbv); } @@ -733,7 +733,7 @@ static void IMG_CreateItem(ImageItem *item, const char *fileName, HDC hdc) static void IMG_DeleteItem(ImageItem *item) { - if (!(item->dwFlags & IMAGE_GLYPH)) { + if ( !(item->dwFlags & IMAGE_GLYPH)) { SelectObject(item->hdc, item->hbmOld); DeleteObject(item->hbm); DeleteDC(item->hdc); @@ -755,7 +755,7 @@ static void ReadItem(StatusItems_t *this_item, char *szItem, char *file) int i; for (i = 0; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) { - if (!_stricmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, buffer)) { + if ( !_stricmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, buffer)) { defaults = &StatusItems[i]; break; } @@ -887,7 +887,7 @@ done_with_glyph: tmpItem.bStretch = IMAGE_STRETCH_H; tmpItem.hbm = 0; - if (!_stricmp(itemname, "$glyphs")) { + if ( !_stricmp(itemname, "$glyphs")) { IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm) { newItem = reinterpret_cast(malloc(sizeof(ImageItem))); @@ -898,7 +898,7 @@ done_with_glyph: goto imgread_done; } if (itemname[0] == '@') { - if (!(tmpItem.dwFlags & IMAGE_GLYPH)) + if ( !(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { ImageItem *pItem = g_ImageItems; @@ -922,10 +922,10 @@ done_with_glyph: for (n = 0;;n++) { mir_snprintf(szItemNr, 30, "Item%d", n); GetPrivateProfileStringA(itemname, szItemNr, "None", buffer, 500, szFileName); - if (!strcmp(buffer, "None")) + if ( !strcmp(buffer, "None")) break; - if (!strcmp(buffer, "CLUI")) { - if (!(tmpItem.dwFlags & IMAGE_GLYPH)) + if ( !strcmp(buffer, "CLUI")) { + if ( !(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { COLORREF clr; @@ -946,9 +946,9 @@ done_with_glyph: continue; } for (i = 0; i <= ID_EXTBK_LAST - ID_STATUS_OFFLINE; i++) { - if (!_stricmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, buffer)) { - if (!alloced) { - if (!(tmpItem.dwFlags & IMAGE_GLYPH)) + if ( !_stricmp(StatusItems[i].szName[0] == '{' ? &StatusItems[i].szName[3] : StatusItems[i].szName, buffer)) { + if ( !alloced) { + if ( !(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { newItem = reinterpret_cast(malloc(sizeof(ImageItem))); @@ -1033,11 +1033,11 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.dwFlags |= GetPrivateProfileIntA(itemName, "toggle", 0, file) ? BUTTON_ISTOGGLE : 0; GetPrivateProfileStringA(itemName, "Pressed", "None", szBuffer, 1000, file); - if (!_stricmp(szBuffer, "default")) + if ( !_stricmp(szBuffer, "default")) tmpItem.imgPressed = StatusItems[ID_EXTBKTBBUTTONSPRESSED - ID_STATUS_OFFLINE].imageItem; else { while(imgItem) { - if (!_stricmp(imgItem->szName, szBuffer)) { + if ( !_stricmp(imgItem->szName, szBuffer)) { tmpItem.imgPressed = imgItem; break; } @@ -1047,11 +1047,11 @@ static void BTN_ReadItem(char *itemName, char *file) imgItem = g_ImageItems; GetPrivateProfileStringA(itemName, "Normal", "None", szBuffer, 1000, file); - if (!_stricmp(szBuffer, "default")) + if ( !_stricmp(szBuffer, "default")) tmpItem.imgNormal = StatusItems[ID_EXTBKTBBUTTONSNPRESSED - ID_STATUS_OFFLINE].imageItem; else { while(imgItem) { - if (!_stricmp(imgItem->szName, szBuffer)) { + if ( !_stricmp(imgItem->szName, szBuffer)) { tmpItem.imgNormal = imgItem; break; } @@ -1061,11 +1061,11 @@ static void BTN_ReadItem(char *itemName, char *file) imgItem = g_ImageItems; GetPrivateProfileStringA(itemName, "Hover", "None", szBuffer, 1000, file); - if (!_stricmp(szBuffer, "default")) + if ( !_stricmp(szBuffer, "default")) tmpItem.imgHover = StatusItems[ID_EXTBKTBBUTTONMOUSEOVER - ID_STATUS_OFFLINE].imageItem; else { while(imgItem) { - if (!_stricmp(imgItem->szName, szBuffer)) { + if ( !_stricmp(imgItem->szName, szBuffer)) { tmpItem.imgHover = imgItem; break; } @@ -1095,7 +1095,7 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.uId = IDC_TBFIRSTUID - 1; GetPrivateProfileStringA(itemName, "Action", "Custom", szBuffer, 1000, file); - if (!_stricmp(szBuffer, "service")) { + if ( !_stricmp(szBuffer, "service")) { tmpItem.szService[0] = 0; GetPrivateProfileStringA(itemName, "Service", "None", szBuffer, 1000, file); if (_stricmp(szBuffer, "None")) { @@ -1104,7 +1104,7 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.uId = nextButtonID++; } } - else if (!_stricmp(szBuffer, "protoservice")) { + else if ( !_stricmp(szBuffer, "protoservice")) { tmpItem.szService[0] = 0; GetPrivateProfileStringA(itemName, "Service", "None", szBuffer, 1000, file); if (_stricmp(szBuffer, "None")) { @@ -1113,7 +1113,7 @@ static void BTN_ReadItem(char *itemName, char *file) tmpItem.uId = nextButtonID++; } } - else if (!_stricmp(szBuffer, "database")) { + else if ( !_stricmp(szBuffer, "database")) { int n; GetPrivateProfileStringA(itemName, "Module", "None", szBuffer, 1000, file); @@ -1239,7 +1239,7 @@ void IMG_LoadItems() DBFreeVariant(&dbv); - if (!PathFileExists(tszFileName)) + if ( !PathFileExists(tszFileName)) return; IMG_DeleteItems(); @@ -1347,7 +1347,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) break; } for (j = 0; j < i - 1; j++) { - if (!strcmp(szProto, items[j].szName) && !strcmp(UIN, items[j].szDBname) + if ( !strcmp(szProto, items[j].szName) && !strcmp(UIN, items[j].szDBname) && lstrlenA(szProto) == lstrlenA(items[j].szName) && lstrlenA(UIN) == lstrlenA(items[j].szDBname)) { //_DebugPopup(hContact, "Found: %s, %s", szProto, UIN); @@ -1511,7 +1511,7 @@ static void ApplyCLUISkin() DBVARIANT dbv = {0}; TCHAR tszFinalName[MAX_PATH]; char szFinalName[MAX_PATH]; - if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { + if ( !cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { MY_pathToAbsolute(dbv.ptszVal, tszFinalName); WideCharToMultiByte(CP_ACP, 0, tszFinalName, MAX_PATH, szFinalName, MAX_PATH, 0, 0); @@ -1557,7 +1557,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_FASTGRADIENT, cfg::dat.bWantFastGradients); CheckDlgButton(hwndDlg, IDC_IGNORESELFORGROUPS, cfg::getByte("CLC", "IgnoreSelforGroups", 0) ? BST_CHECKED : BST_UNCHECKED); - if (!cfg::getString(NULL, "CLC", "ContactSkins", &dbv)) { + if ( !cfg::getString(NULL, "CLC", "ContactSkins", &dbv)) { SetDlgItemTextA(hwndDlg, IDC_SKINFILE, dbv.pszVal); DBFreeVariant(&dbv); Utils::enableDlgControl(hwndDlg, IDC_RELOAD, TRUE); @@ -1565,7 +1565,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L else Utils::enableDlgControl(hwndDlg, IDC_RELOAD, FALSE); CheckDlgButton(hwndDlg, IDC_USESKIN, cfg::getByte("CLUI", "useskin", 0) ? BST_CHECKED : BST_UNCHECKED); - if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { + if ( !cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { SetDlgItemText(hwndDlg, IDC_SKINFILENAME, dbv.ptszVal); DBFreeVariant(&dbv); } @@ -1602,14 +1602,14 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.nMaxFile = MAX_PATH; ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = _T(""); - if (!GetOpenFileName(&ofn)) + if ( !GetOpenFileName(&ofn)) break; MY_pathToRelative(str, final_path); if (PathFileExists(str)) { int skinChanged = 0; DBVARIANT dbv = {0}; - if (!cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { + if ( !cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv)) { if (_tcscmp(dbv.ptszVal, final_path)) skinChanged = TRUE; DBFreeVariant(&dbv); @@ -1718,7 +1718,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } case PSM_CHANGED: // used so tabs dont have to call SendMessage(GetParent(GetParent(hwnd)), PSM_CHANGED, 0, 0); - if (!iInit) + if ( !iInit) SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case WM_COMMAND: @@ -1736,7 +1736,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ofn.nMaxFile = sizeof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "clist"; - if (!GetSaveFileNameA(&ofn)) + if ( !GetSaveFileNameA(&ofn)) break; extbk_export(str); break; @@ -1755,7 +1755,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ofn.nMaxFile = sizeof(str); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = ""; - if (!GetOpenFileNameA(&ofn)) + if ( !GetOpenFileNameA(&ofn)) break; extbk_import(str, hwndSkinEdit); SendMessage(hwndSkinEdit, WM_USER + 101, 0, 0); @@ -1831,7 +1831,7 @@ int CoolSB_SetupScrollBar() !StatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE].IGNORED; - if (!StatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE].imageItem || + if ( !StatusItems[ID_EXTBKSCROLLBACK - ID_STATUS_OFFLINE].imageItem || !StatusItems[ID_EXTBKSCROLLBACKLOWER - ID_STATUS_OFFLINE].imageItem || !StatusItems[ID_EXTBKSCROLLTHUMB - ID_STATUS_OFFLINE].imageItem || !StatusItems[ID_EXTBKSCROLLTHUMBHOVER - ID_STATUS_OFFLINE].imageItem || diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index f89a1a90c8..918d600348 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -269,8 +269,8 @@ int RowHeight::getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *c height = dat->fontInfo[GetBasicFontID(contact)].fontHeight; - if (!dat->bisEmbedded) { - if (!(dwFlags & FLT_SIMPLE)) { + if ( !dat->bisEmbedded) { + if ( !(dwFlags & FLT_SIMPLE)) { if (dwFlags & FLT_DUALROW) { height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); } diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index c603953f2c..ae6b847bef 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -53,7 +53,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ptMouse = pt; if (tooltip_active){ KillTimer(hwnd, TIMERID_HOVER); - if (!NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) + if ( !NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) CallService("mToolTip/HideTip", 0, 0); tooltip_active = FALSE; } @@ -77,7 +77,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: KillTimer(hwnd, TIMERID_HOVER); - if (!NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) + if ( !NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) CallService("mToolTip/HideTip", 0, 0); tooltip_active = FALSE; break; @@ -113,7 +113,7 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM hOldFont = reinterpret_cast(SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT))); BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY); item = &StatusItems[ID_EXTBKSTATUSBAR - ID_STATUS_OFFLINE]; - if (!item->IGNORED) { + if ( !item->IGNORED) { RECT rc = rcClient; rc.left += item->MARGIN_LEFT; rc.right -= item->MARGIN_RIGHT; diff --git a/plugins/Clist_nicer/src/statusfloater.cpp b/plugins/Clist_nicer/src/statusfloater.cpp index 4074606901..f605bc1329 100644 --- a/plugins/Clist_nicer/src/statusfloater.cpp +++ b/plugins/Clist_nicer/src/statusfloater.cpp @@ -82,7 +82,7 @@ static ContactFloater *FLT_AddToList(ContactFloater *pFloater) { ContactFloater *pCurrent = pFirstFloater; - if (!pFirstFloater) { + if ( !pFirstFloater) { pFirstFloater = pFloater; pFirstFloater->pNextFloater = NULL; return pFirstFloater; @@ -428,13 +428,11 @@ INT_PTR CALLBACK DlgProcFloatingContacts(HWND hwndDlg, UINT msg, WPARAM wParam, void FLT_ReadOptions() { - DWORD dwPad; - ZeroMemory(&g_floatoptions, sizeof(FLOATINGOPTIONS)); g_floatoptions.enabled = cfg::getByte("CList", "flt_enabled", 0); g_floatoptions.dwFlags = cfg::getDword("CList", "flt_flags", FLT_SIMPLE); - dwPad = cfg::getDword("CList", "flt_padding", 0); + DWORD dwPad = cfg::getDword("CList", "flt_padding", 0); g_floatoptions.pad_top = LOBYTE(LOWORD(dwPad)); g_floatoptions.pad_right = HIBYTE(LOWORD(dwPad)); @@ -446,23 +444,20 @@ void FLT_ReadOptions() g_floatoptions.trans = cfg::getByte("CList", "flt_trans", 255); g_floatoptions.radius = cfg::getByte("CList", "flt_radius", 3); g_floatoptions.border_colour = cfg::getDword("CList", "flt_bordercolour", 0); - g_floatoptions.def_hover_time = cfg::getByte("CList", "flt_defhovertime", 1); - - if (g_floatoptions.def_hover_time) - g_floatoptions.hover_time = cfg::getWord("CLC", "InfoTipHoverTime", 200); - else - g_floatoptions.hover_time = cfg::getWord("CList", "flt_hovertime", 200); + g_floatoptions.def_hover_time = cfg::getByte("CList", "flt_defhovertime", 1); + if (g_floatoptions.def_hover_time) + g_floatoptions.hover_time = cfg::getWord("CLC", "InfoTipHoverTime", 200); + else + g_floatoptions.hover_time = cfg::getWord("CList", "flt_hovertime", 200); } void FLT_WriteOptions() { - DWORD dwPad; - cfg::writeByte("CList", "flt_enabled", g_floatoptions.enabled); cfg::writeDword("CList", "flt_flags", g_floatoptions.dwFlags); - dwPad = MAKELONG(MAKEWORD(g_floatoptions.pad_top, g_floatoptions.pad_right), - MAKEWORD(g_floatoptions.pad_bottom, g_floatoptions.pad_left)); + DWORD dwPad = MAKELONG(MAKEWORD(g_floatoptions.pad_top, g_floatoptions.pad_right), + MAKEWORD(g_floatoptions.pad_bottom, g_floatoptions.pad_left)); cfg::writeDword("CList", "flt_padding", dwPad); cfg::writeDword("CList", "flt_width", g_floatoptions.width); cfg::writeByte("CList", "flt_acttrans", g_floatoptions.act_trans); @@ -470,80 +465,83 @@ void FLT_WriteOptions() cfg::writeByte("CList", "flt_radius", g_floatoptions.radius); cfg::writeDword("CList", "flt_bordercolour", g_floatoptions.border_colour); cfg::writeByte("CList", "flt_defhovertime", g_floatoptions.def_hover_time); - if (!g_floatoptions.def_hover_time) - cfg::writeWord("CList", "flt_hovertime", g_floatoptions.hover_time); - + if ( !g_floatoptions.def_hover_time) + cfg::writeWord("CList", "flt_hovertime", g_floatoptions.hover_time); } LRESULT CALLBACK StatusFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { - case WM_DESTROY: - Utils_SaveWindowPosition(hwnd, 0, "CLUI", "sfl"); - if (g_SFLCachedDC) { - SelectObject(g_SFLCachedDC, g_SFLhbmOld); - DeleteObject(g_SFLhbm); - DeleteDC(g_SFLCachedDC); - g_SFLCachedDC = 0; - } - break; - case WM_ERASEBKGND: - return TRUE; - case WM_PAINT: - { - HDC hdc; - PAINTSTRUCT ps; + case WM_DESTROY: + Utils_SaveWindowPosition(hwnd, 0, "CLUI", "sfl"); + if (g_SFLCachedDC) { + SelectObject(g_SFLCachedDC, g_SFLhbmOld); + DeleteObject(g_SFLhbm); + DeleteDC(g_SFLCachedDC); + g_SFLCachedDC = 0; + } + break; - hdc = BeginPaint(hwnd, &ps); - ps.fErase = FALSE; - EndPaint(hwnd, &ps); - return TRUE; - } - case WM_LBUTTONDOWN: - { - POINT ptMouse; - RECT rcWindow; + case WM_ERASEBKGND: + return TRUE; - GetCursorPos(&ptMouse); - GetWindowRect(hwnd, &rcWindow); - rcWindow.right = rcWindow.left + 25; - if (!PtInRect(&rcWindow, ptMouse)) - return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(ptMouse.x, ptMouse.y)); - break; - } - case WM_LBUTTONUP: - { - HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); - RECT rcWindow; - POINT pt; + case WM_PAINT: + { + HDC hdc; + PAINTSTRUCT ps; - GetCursorPos(&pt); - GetWindowRect(hwnd, &rcWindow); - 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); - } + hdc = BeginPaint(hwnd, &ps); + ps.fErase = FALSE; + EndPaint(hwnd, &ps); + } + return TRUE; + + case WM_LBUTTONDOWN: + { + POINT ptMouse; + RECT rcWindow; + + GetCursorPos(&ptMouse); + GetWindowRect(hwnd, &rcWindow); + rcWindow.right = rcWindow.left + 25; + if ( !PtInRect(&rcWindow, ptMouse)) + return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(ptMouse.x, ptMouse.y)); + } + break; + + case WM_LBUTTONUP: + { + HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + RECT rcWindow; + POINT pt; + + GetCursorPos(&pt); + GetWindowRect(hwnd, &rcWindow); + 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); - return 0; } - case WM_CONTEXTMENU: - { - HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); - RECT rcWindow; + else TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL); + } + return 0; - GetWindowRect(hwnd, &rcWindow); - TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL); - return 0; - } + case WM_CONTEXTMENU: + { + HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); + RECT rcWindow; + GetWindowRect(hwnd, &rcWindow); + TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL); + } + return 0; } return DefWindowProc(hwnd, msg, wParam, lParam); } -void CALLBACK ShowTooltip(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime){ +void CALLBACK ShowTooltip(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ ContactFloater *pCurrent = pFirstFloater; POINT pt; CLCINFOTIP ti = {0}; @@ -553,10 +551,10 @@ void CALLBACK ShowTooltip(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime){ GetCursorPos(&pt); if ((abs(pt.x - start_pos.x) > 3) && (abs(pt.y - start_pos.y) > 3)) return; - + while(pCurrent->hwnd != hwnd) pCurrent = pCurrent->pNextFloater; - + ti.cbSize = sizeof(ti); ti.isGroup = 0; ti.isTreeFocused = 0; @@ -575,148 +573,148 @@ LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA centry = &cfg::eCache[iEntry]; switch(msg) { - case WM_NCCREATE: - { - CREATESTRUCT *cs = (CREATESTRUCT *)lParam; - SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams); - iEntry = (int)cs->lpCreateParams; - if (iEntry >= 0 && iEntry < cfg::nextCacheEntry) - centry = &cfg::eCache[iEntry]; - return TRUE; - } - case WM_DESTROY: - if (centry) { - WINDOWPLACEMENT wp = {0}; - - SelectObject(centry->floater->hdc, centry->floater->hbmOld); - DeleteObject(centry->floater->hbm); - DeleteDC(centry->floater->hdc); - FLT_RemoveFromList(centry->floater); - free(centry->floater); - centry->floater = 0; - Utils_SaveWindowPosition(hwnd, centry->hContact, "CList", "flt"); - break; - } - case WM_ERASEBKGND: + case WM_NCCREATE: + { + CREATESTRUCT *cs = (CREATESTRUCT *)lParam; + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams); + iEntry = (int)cs->lpCreateParams; + if (iEntry >= 0 && iEntry < cfg::nextCacheEntry) + centry = &cfg::eCache[iEntry]; return TRUE; - case WM_PAINT: - { - HDC hdc; - PAINTSTRUCT ps; + } + case WM_DESTROY: + if (centry) { + WINDOWPLACEMENT wp = {0}; - hdc = BeginPaint(hwnd, &ps); - ps.fErase = FALSE; - EndPaint(hwnd, &ps); - return TRUE; + SelectObject(centry->floater->hdc, centry->floater->hbmOld); + DeleteObject(centry->floater->hbm); + DeleteDC(centry->floater->hdc); + FLT_RemoveFromList(centry->floater); + free(centry->floater); + centry->floater = 0; + Utils_SaveWindowPosition(hwnd, centry->hContact, "CList", "flt"); + break; + } + case WM_ERASEBKGND: + return TRUE; + case WM_PAINT: + { + HDC hdc; + PAINTSTRUCT ps; + + hdc = BeginPaint(hwnd, &ps); + ps.fErase = FALSE; + EndPaint(hwnd, &ps); + return TRUE; + } + case WM_LBUTTONDBLCLK: + if (centry) + CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)centry->hContact, 0); + return 0; + case WM_LBUTTONDOWN: + { + POINT ptMouse; + RECT rcWindow; + + GetCursorPos(&ptMouse); + GetWindowRect(hwnd, &rcWindow); + rcWindow.right = rcWindow.left + 25; + if ( !PtInRect(&rcWindow, ptMouse)) + return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(ptMouse.x, ptMouse.y)); + break; + } + case WM_MOUSEMOVE: + if ( API::pfnTrackMouseEvent && !hover ) { + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = TME_HOVER | TME_LEAVE; + tme.hwndTrack = hwnd; + tme.dwHoverTime = 5; + API::pfnTrackMouseEvent(&tme); + hover = TRUE; + } + if ( ServiceExists( MS_TOOLTIP_SHOWTIP )) { + if ((g_floatoptions.dwFlags & FLT_SHOWTOOLTIPS) && !tooltip) { + GetCursorPos(&start_pos); + if (hTooltipTimer) KillTimer(hwnd, TOOLTIP_TIMER); + hTooltipTimer = SetTimer(hwnd, TOOLTIP_TIMER, g_floatoptions.hover_time, ShowTooltip); } - case WM_LBUTTONDBLCLK: - if (centry) - CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)centry->hContact, 0); - return 0; - case WM_LBUTTONDOWN: - { - POINT ptMouse; - RECT rcWindow; + } - GetCursorPos(&ptMouse); - GetWindowRect(hwnd, &rcWindow); - rcWindow.right = rcWindow.left + 25; - if (!PtInRect(&rcWindow, ptMouse)) - return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(ptMouse.x, ptMouse.y)); - break; - } - case WM_MOUSEMOVE: - if ( API::pfnTrackMouseEvent && !hover ) { - TRACKMOUSEEVENT tme; - tme.cbSize = sizeof(TRACKMOUSEEVENT); - tme.dwFlags = TME_HOVER | TME_LEAVE; - tme.hwndTrack = hwnd; - tme.dwHoverTime = 5; - API::pfnTrackMouseEvent(&tme); - hover = TRUE; - } - if ( ServiceExists( MS_TOOLTIP_SHOWTIP )) { - if ((g_floatoptions.dwFlags & FLT_SHOWTOOLTIPS) && !tooltip) { - GetCursorPos(&start_pos); - if (hTooltipTimer) KillTimer(hwnd, TOOLTIP_TIMER); - hTooltipTimer = SetTimer(hwnd, TOOLTIP_TIMER, g_floatoptions.hover_time, ShowTooltip); - } - } + return FALSE; - return FALSE; + case WM_MOUSEHOVER: + { + ClcContact *contact = NULL; + ContactFloater *pCurrent = pFirstFloater; + int oldTrans = g_floatoptions.trans; - case WM_MOUSEHOVER: - { - ClcContact *contact = NULL; - ContactFloater *pCurrent = pFirstFloater; - int oldTrans = g_floatoptions.trans; + while(pCurrent->hwnd != hwnd) + pCurrent = pCurrent->pNextFloater; - while(pCurrent->hwnd != hwnd) - pCurrent = pCurrent->pNextFloater; + 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; + } - 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; - } + break; + } + case WM_MOUSELEAVE: + { + ClcContact *contact = NULL; + ContactFloater *pCurrent = pFirstFloater; - break; - } - case WM_MOUSELEAVE: - { - ClcContact *contact = NULL; - ContactFloater *pCurrent = pFirstFloater; + while(pCurrent->hwnd != hwnd) + pCurrent = pCurrent->pNextFloater; - while(pCurrent->hwnd != hwnd) - pCurrent = pCurrent->pNextFloater; + if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) + FLT_Update(cfg::clcdat, contact); - if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) - FLT_Update(cfg::clcdat, contact); + if (hTooltipTimer) + { + KillTimer(hwnd, TOOLTIP_TIMER); + hTooltipTimer = 0; + } - if (hTooltipTimer) - { - KillTimer(hwnd, TOOLTIP_TIMER); - hTooltipTimer = 0; - } + if (tooltip) CallService(MS_TOOLTIP_HIDETIP, 0, 0); - if (tooltip) CallService(MS_TOOLTIP_HIDETIP, 0, 0); + hover = FALSE; + tooltip = FALSE; - hover = FALSE; - tooltip = FALSE; + break; + } - break; - } + case WM_MOVE: + { + if (g_floatoptions.dwFlags & FLT_SNAP) + FLT_SnapToEdges(hwnd); - case WM_MOVE: - { - if (g_floatoptions.dwFlags & FLT_SNAP) - FLT_SnapToEdges(hwnd); + if (GetKeyState(VK_CONTROL) < 0) + FLT_SnapToFloater(hwnd); - if (GetKeyState(VK_CONTROL) < 0) - FLT_SnapToFloater(hwnd); + break; + } + case WM_MEASUREITEM: + return(CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam)); + case WM_DRAWITEM: + return(CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam)); + case WM_COMMAND: + return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKELONG(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)centry->hContact)); + case WM_CONTEXTMENU: + { + if (centry) { + HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)centry->hContact, 0); + RECT rcWindow; - break; - } - case WM_MEASUREITEM: - return(CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam)); - case WM_DRAWITEM: - return(CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam)); - case WM_COMMAND: - return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKELONG(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)centry->hContact)); - case WM_CONTEXTMENU: - { - if (centry) { - HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)centry->hContact, 0); - RECT rcWindow; - - GetWindowRect(hwnd, &rcWindow); - TrackPopupMenu(hContactMenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, hwnd, NULL); - DestroyMenu(hContactMenu); - return 0; - } - break; + GetWindowRect(hwnd, &rcWindow); + TrackPopupMenu(hContactMenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, hwnd, NULL); + DestroyMenu(hContactMenu); + return 0; } + break; + } } return DefWindowProc(hwnd, msg, wParam, lParam); } @@ -725,22 +723,22 @@ void SFL_RegisterWindowClass() { WNDCLASS wndclass; - wndclass.style = 0; - wndclass.lpfnWndProc = StatusFloaterClassProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = g_hInst; - wndclass.hIcon = 0; - wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wndclass.hbrBackground = (HBRUSH) (COLOR_3DFACE); - wndclass.lpszMenuName = 0; - wndclass.lpszClassName = _T("StatusFloaterClass"); - RegisterClass(&wndclass); - - wndclass.style = CS_DBLCLKS; + wndclass.style = 0; + wndclass.lpfnWndProc = StatusFloaterClassProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = g_hInst; + wndclass.hIcon = 0; + wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); + wndclass.hbrBackground = (HBRUSH) (COLOR_3DFACE); + wndclass.lpszMenuName = 0; + wndclass.lpszClassName = _T("StatusFloaterClass"); + RegisterClass(&wndclass); + + wndclass.style = CS_DBLCLKS; wndclass.lpszClassName = _T("ContactFloaterClass"); - wndclass.lpfnWndProc = ContactFloaterClassProc; - RegisterClass(&wndclass); + wndclass.lpfnWndProc = ContactFloaterClassProc; + RegisterClass(&wndclass); } void SFL_UnregisterWindowClass() @@ -808,7 +806,7 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO sfl_statustext[99] = 0; } - if (!hIcon) { + if ( !hIcon) { HICON p_hIcon; if (refresh) @@ -845,11 +843,11 @@ void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BO } /* - * set the floater - * mode = 0/1 forced hide/show - * OR -1 to set it depending on the clist state (visible/hidden) (this is actually reversed, because the function - * is called *before* the clist is shown or hidden) - */ +* set the floater +* mode = 0/1 forced hide/show +* OR -1 to set it depending on the clist state (visible/hidden) (this is actually reversed, because the function +* is called *before* the clist is shown or hidden) +*/ void SFL_SetState(int uMode) { @@ -964,7 +962,7 @@ void FLT_Create(int iEntry) ClcContact *contact = NULL; ClcGroup *group = NULL; - centry = &cfg::eCache[iEntry]; + centry = &cfg::eCache[iEntry]; if (centry->floater == 0 && API::pfnUpdateLayeredWindow != NULL) { centry->floater = (ContactFloater *)malloc(sizeof(ContactFloater)); @@ -981,7 +979,7 @@ void FLT_Create(int iEntry) 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_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); @@ -1002,19 +1000,10 @@ extern LONG g_maxAV_X, g_maxAV_Y; void FLT_Update(struct ClcData *dat, ClcContact *contact) { RECT rcClient, rcWindow; - POINT ptDest, ptSrc = {0}; - SIZE szDest; - BLENDFUNCTION bf = {0}; - HWND hwnd; - HDC hdc; - BOOL firstDrawn = TRUE; + POINT ptSrc = {0}; ClcGroup *group = NULL; ClcContact *newContact = NULL; HRGN rgn; - HBRUSH hbrBorder; - COLORREF clrKey; - HBRUSH brKey; - float greyLevel; if (contact == NULL || dat == NULL) return; @@ -1027,8 +1016,8 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) FLT_SetSize(&cfg::eCache[contact->extraCacheEntry], g_floatoptions.width, RowHeight::getFloatingRowHeight(dat, pcli->hwndContactTree, contact, g_floatoptions.dwFlags) + (2*g_floatoptions.pad_top)); - hwnd = cfg::eCache[contact->extraCacheEntry].floater->hwnd; - hdc = cfg::eCache[contact->extraCacheEntry].floater->hdc; + HWND hwnd = cfg::eCache[contact->extraCacheEntry].floater->hwnd; + HDC hdc = cfg::eCache[contact->extraCacheEntry].floater->hdc; if (hwnd == 0) return; @@ -1036,34 +1025,32 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) GetClientRect(hwnd, &rcClient); GetWindowRect(hwnd, &rcWindow); - ptDest.x = rcWindow.left; - ptDest.y = rcWindow.top; - szDest.cx = rcWindow.right - rcWindow.left; - szDest.cy = rcWindow.bottom - rcWindow.top; + POINT ptDest = {rcWindow.left, rcWindow.top }; + SIZE szDest = {rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top}; - /* - * fill with a DESATURATED representation of the clist bg color and use this later as a color key - */ + /* + * fill with a DESATURATED representation of the clist bg color and use this later as a color key + */ - greyLevel = (float)(GetRValue(cfg::clcdat->bkColour) * 0.299 + GetGValue(cfg::clcdat->bkColour) * 0.587 + GetBValue(cfg::clcdat->bkColour) * 0.144); - if (greyLevel > 255) - greyLevel = 255; + float greyLevel = (float)(GetRValue(cfg::clcdat->bkColour) * 0.299 + GetGValue(cfg::clcdat->bkColour) * 0.587 + GetBValue(cfg::clcdat->bkColour) * 0.144); + if (greyLevel > 255) + greyLevel = 255; - clrKey = RGB((BYTE)greyLevel, (BYTE)greyLevel, (BYTE)greyLevel); - brKey = CreateSolidBrush(clrKey); + COLORREF clrKey = RGB((BYTE)greyLevel, (BYTE)greyLevel, (BYTE)greyLevel); + HBRUSH brKey = CreateSolidBrush(clrKey); FillRect(hdc, &rcClient, brKey); - DeleteObject(brKey); + DeleteObject(brKey); SetBkMode(hdc, TRANSPARENT); 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) { - HBRUSH br = CreateSolidBrush(cfg::clcdat->bkColour); - FillRect(hdc, &rcClient, br); - DeleteObject(br); - } + 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)) { @@ -1078,23 +1065,22 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) if (g_floatoptions.dwFlags & FLT_SIMPLE) { contact->ace = 0; contact->bSecondLine = MULTIROW_NEVER; - cfg::dat.dwFlags &= ~(CLUI_SHOWCLIENTICONS | CLUI_SHOWVISI); + cfg::dat.dwFlags &= ~CLUI_SHOWCLIENTICONS; } else { - if (!(g_floatoptions.dwFlags & FLT_AVATARS)) { + if ( !(g_floatoptions.dwFlags & FLT_AVATARS)) { contact->ace = 0; g_list_avatars = 0; } - else - g_list_avatars = 1; + else g_list_avatars = 1; - if (!(g_floatoptions.dwFlags & FLT_DUALROW)) + if ( !(g_floatoptions.dwFlags & FLT_DUALROW)) contact->bSecondLine = MULTIROW_NEVER; else contact->bSecondLine = MULTIROW_ALWAYS; - if (!(g_floatoptions.dwFlags & FLT_EXTRAICONS)) - cfg::dat.dwFlags &= ~(CLUI_SHOWCLIENTICONS | CLUI_SHOWVISI); + if ( !(g_floatoptions.dwFlags & FLT_EXTRAICONS)) + cfg::dat.dwFlags &= ~CLUI_SHOWCLIENTICONS; } dat->leftMargin = g_floatoptions.pad_left; @@ -1108,6 +1094,7 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) hbmTempOldAV = reinterpret_cast(SelectObject(hdcTempAV, hbmTempAV)); g_padding_y = g_floatoptions.pad_top; + BOOL firstDrawn = TRUE; PaintItem(hdc, group, contact, 0, 0, dat, -4, pcli->hwndContactTree, 0, &rcClient, &firstDrawn, 0, rcClient.bottom - rcClient.top); g_padding_y = 0; @@ -1124,9 +1111,9 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) dat->leftMargin = oldLeftMargin; dat->rightMargin = oldRightMargin; } - + if (g_floatoptions.dwFlags & FLT_BORDER){ - hbrBorder = CreateSolidBrush(g_floatoptions.border_colour); + HBRUSH hbrBorder = CreateSolidBrush(g_floatoptions.border_colour); if (g_floatoptions.dwFlags & FLT_ROUNDED) FrameRgn(hdc, rgn, hbrBorder, 1, 1); else @@ -1134,10 +1121,11 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) DeleteObject(hbrBorder); } - + if (g_floatoptions.dwFlags & FLT_ROUNDED) DeleteObject(rgn); + BLENDFUNCTION bf = {0}; bf.BlendOp = AC_SRC_OVER; bf.AlphaFormat = 0; bf.SourceConstantAlpha = g_floatoptions.trans; @@ -1147,22 +1135,21 @@ void FLT_Update(struct ClcData *dat, ClcContact *contact) } /* - * syncs the floating contacts with clist contact visibility. - * will hide all floating contacts which are not visible on the list - * needed after a list rebuild - */ +* syncs the floating contacts with clist contact visibility. +* will hide all floating contacts which are not visible on the list +* needed after a list rebuild +*/ void FLT_SyncWithClist() { - ClcContact *contact; ContactFloater *pCurrent = pFirstFloater; - HWND hwnd; int iVis = pcli->pfnGetWindowVisibleState(pcli->hwndContactList, 0, 0); if (g_floatoptions.dwFlags & FLT_SYNCWITHCLIST){ while(pCurrent) { - hwnd = pCurrent->hwnd; + HWND hwnd = pCurrent->hwnd; if (hwnd && IsWindow(hwnd)) { + ClcContact *contact; 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)) @@ -1170,8 +1157,7 @@ void FLT_SyncWithClist() else ShowWindow(hwnd, SW_HIDE); } - else - ShowWindow(hwnd, SW_HIDE); + else ShowWindow(hwnd, SW_HIDE); } pCurrent = pCurrent->pNextFloater; } @@ -1179,9 +1165,9 @@ void FLT_SyncWithClist() } /* - * quickly show or hide all floating contacts - * used by autohide/show feature - */ +* quickly show or hide all floating contacts +* used by autohide/show feature +*/ void FLT_ShowHideAll(int showCmd) { @@ -1189,7 +1175,7 @@ void FLT_ShowHideAll(int showCmd) 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)) { @@ -1204,8 +1190,8 @@ void FLT_ShowHideAll(int showCmd) } /* - * update/repaint all contact floaters - */ +* update/repaint all contact floaters +*/ void FLT_RefreshAll() { diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index cf6a09e9e9..3f9bd90de8 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -695,7 +695,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szBuf); DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting); DBDeleteContactSetting(NULL, CLVM_MODULE, szBuf); - if (!strcmp(cfg::dat.current_viewmode, szBuf) && lstrlenA(szBuf) == lstrlenA(cfg::dat.current_viewmode)) { + if ( !strcmp(cfg::dat.current_viewmode, szBuf) && lstrlenA(szBuf) == lstrlenA(cfg::dat.current_viewmode)) { cfg::dat.bFilterEffective = 0; pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); SetWindowTextA(hwndSelector, Translate("No view mode")); @@ -964,7 +964,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; KillTimer(hwnd, wParam); - if (!cfg::dat.old_viewmode[0]) + if ( !cfg::dat.old_viewmode[0]) SendMessage(hwnd, WM_COMMAND, IDC_RESETMODES, 0); else ApplyViewMode((const char *)cfg::dat.old_viewmode); @@ -1018,7 +1018,7 @@ clvm_reset_command: break; case IDC_CONFIGUREMODES: clvm_config_command: - if (!g_ViewModeOptDlg) + if ( !g_ViewModeOptDlg) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0); break; } @@ -1076,7 +1076,7 @@ void ApplyViewMode(const char *name) cfg::dat.bFilterEffective = 0; mir_snprintf(szSetting, 256, "%c%s_PF", 246, name); - if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) { + if ( !cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) { if (lstrlenA(dbv.pszVal) >= 2) { strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter)); cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0; @@ -1085,7 +1085,7 @@ void ApplyViewMode(const char *name) mir_free(dbv.pszVal); } mir_snprintf(szSetting, 256, "%c%s_GF", 246, name); - if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) { + if ( !cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) { 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; -- cgit v1.2.3