From 0c8a93e6411035f6a1ca9e6537a6d569711cf4c3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Dec 2014 13:42:27 +0000 Subject: garbage collection: dead params, unused variables etc git-svn-id: http://svn.miranda-ng.org/main/trunk@11328 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/clist_nicer_12.vcxproj | 8 +- plugins/Clist_nicer/src/CLCButton.cpp | 2 - plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 93 +++--- plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp | 6 +- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 39 ++- plugins/Clist_nicer/src/Coolsb/coolsblib.cpp | 342 ++++++++-------------- plugins/Clist_nicer/src/Coolsb/coolscroll.cpp | 93 ++---- plugins/Clist_nicer/src/Docking.cpp | 2 +- plugins/Clist_nicer/src/Include/clc.h | 42 +-- plugins/Clist_nicer/src/Include/rowheight_funcs.h | 71 ++--- plugins/Clist_nicer/src/alphablend.cpp | 167 +++++------ plugins/Clist_nicer/src/clc.cpp | 7 +- plugins/Clist_nicer/src/clcitems.cpp | 78 +++-- plugins/Clist_nicer/src/clcopts.cpp | 5 +- plugins/Clist_nicer/src/clcpaint.cpp | 151 +++++----- plugins/Clist_nicer/src/clcutils.cpp | 16 +- plugins/Clist_nicer/src/clistmenus.cpp | 33 +-- plugins/Clist_nicer/src/clistmod.cpp | 13 +- plugins/Clist_nicer/src/clistopts.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 123 +++----- plugins/Clist_nicer/src/cluiopts.cpp | 4 +- plugins/Clist_nicer/src/cluiservices.cpp | 6 +- plugins/Clist_nicer/src/config.cpp | 8 +- plugins/Clist_nicer/src/contact.cpp | 133 +++++---- plugins/Clist_nicer/src/extBackg.cpp | 85 +++--- plugins/Clist_nicer/src/init.cpp | 6 +- plugins/Clist_nicer/src/rowheight_funcs.cpp | 100 +++---- plugins/Clist_nicer/src/viewmodes.cpp | 8 +- 28 files changed, 696 insertions(+), 947 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_nicer/clist_nicer_12.vcxproj b/plugins/Clist_nicer/clist_nicer_12.vcxproj index 8e6c636203..9755034498 100644 --- a/plugins/Clist_nicer/clist_nicer_12.vcxproj +++ b/plugins/Clist_nicer/clist_nicer_12.vcxproj @@ -81,7 +81,7 @@ MultiThreadedDebugDLL Disabled Use - Level3 + Level4 _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) @@ -112,7 +112,7 @@ true Fast commonheaders.h - Level3 + Level4 false Use @@ -140,7 +140,7 @@ commonheaders.h Disabled Use - Level3 + Level4 _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) @@ -171,7 +171,7 @@ Fast false OnlyExplicitInline - Level3 + Level4 ..\..\include;..\..\include\msapi diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 3bf670e9de..4936c913da 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -183,7 +183,6 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) if (ctl->buttonItem) { RECT rcParent; POINT pt; - HWND hwndParent = pcli->hwndContactList; ImageItem *imgItem = ctl->stateId == PBS_HOT ? ctl->buttonItem->imgHover : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->imgPressed : ctl->buttonItem->imgNormal); LONG *glyphMetrics = ctl->stateId == PBS_HOT ? ctl->buttonItem->hoverGlyphMetrics : (ctl->stateId == PBS_PRESSED ? ctl->buttonItem->pressedGlyphMetrics : ctl->buttonItem->normalGlyphMetrics); @@ -206,7 +205,6 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) else if (ctl->bIsSkinned) { // skinned RECT rcParent; POINT pt; - HWND hwndParent = pcli->hwndContactList; StatusItems_t *item; int item_id; diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index 2a3d4829ee..c5be657bcc 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -143,7 +143,6 @@ static FRAMEWND *FindFrameByWnd(HWND hwnd) if (hwnd == NULL) return NULL; - BOOL bFound = FALSE; for (int i = 0; i < nFramescount; i++) if ((Frames[i].floating) && (Frames[i].ContainerWnd == hwnd)) return (&Frames[i]); @@ -151,7 +150,7 @@ static FRAMEWND *FindFrameByWnd(HWND hwnd) return NULL; } -static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL bMoveLeft) +static void DockThumbs(FRAMEWND *pThumbLeft, FRAMEWND *pThumbRight, BOOL) { if ((pThumbRight->dockOpt.hwndLeft == NULL) && (pThumbLeft->dockOpt.hwndRight == NULL)) { pThumbRight->dockOpt.hwndLeft = pThumbLeft->ContainerWnd; @@ -767,7 +766,7 @@ int ModifyMItem(WPARAM wParam, LPARAM lParam) return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam); } -static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) +static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -825,7 +824,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -883,7 +882,7 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesGetFrameOptions(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1098,7 +1097,7 @@ INT_PTR CLUIFramesSetFrameOptions(WPARAM wParam, LPARAM lParam) return -1; } -static INT_PTR CLUIFramesShowAll(WPARAM wParam, LPARAM lParam) +static INT_PTR CLUIFramesShowAll(WPARAM, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1110,7 +1109,7 @@ static INT_PTR CLUIFramesShowAll(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR CLUIFramesShowAllTitleBars(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesShowAllTitleBars(WPARAM, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1125,7 +1124,7 @@ INT_PTR CLUIFramesShowAllTitleBars(WPARAM wParam, LPARAM lParam) } //wparam=lparam=0 -INT_PTR CLUIFramesHideAllTitleBars(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesHideAllTitleBars(WPARAM, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1140,7 +1139,7 @@ INT_PTR CLUIFramesHideAllTitleBars(WPARAM wParam, LPARAM lParam) } //wparam=frameid -INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1166,7 +1165,7 @@ INT_PTR CLUIFramesShowHideFrame(WPARAM wParam, LPARAM lParam) } //wparam=frameid -INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesShowHideFrameTitleBar(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1200,7 +1199,6 @@ INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam) if (pos < 0 || pos >= nFramescount) return 0; - int curpos = Frames[pos].order; int curalign = Frames[pos].align; int v = 0; memset(g_sd, 0, sizeof(SortData) * MAX_FRAMES); @@ -1241,17 +1239,16 @@ INT_PTR CLUIFramesMoveUpDown(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR CLUIFramesMoveUp(WPARAM wParam, LPARAM lParam) +static INT_PTR CLUIFramesMoveUp(WPARAM wParam, LPARAM) { - return(CLUIFramesMoveUpDown(wParam, -1)); + return CLUIFramesMoveUpDown(wParam, -1); } -static INT_PTR CLUIFramesMoveDown(WPARAM wParam, LPARAM lParam) +static INT_PTR CLUIFramesMoveDown(WPARAM wParam, LPARAM) { - return(CLUIFramesMoveUpDown(wParam, 1)); + return CLUIFramesMoveUpDown(wParam, 1); } - //wparam=frameid //lparam=alignment INT_PTR CLUIFramesSetAlign(WPARAM wParam, LPARAM lParam) @@ -1263,28 +1260,30 @@ INT_PTR CLUIFramesSetAlign(WPARAM wParam, LPARAM lParam) RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return 0; } -INT_PTR CLUIFramesSetAlignalTop(WPARAM wParam, LPARAM lParam) + +INT_PTR CLUIFramesSetAlignalTop(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; return CLUIFramesSetAlign(wParam, alTop); } -INT_PTR CLUIFramesSetAlignalBottom(WPARAM wParam, LPARAM lParam) + +INT_PTR CLUIFramesSetAlignalBottom(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; return CLUIFramesSetAlign(wParam, alBottom); } -INT_PTR CLUIFramesSetAlignalClient(WPARAM wParam, LPARAM lParam) + +INT_PTR CLUIFramesSetAlignalClient(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; return CLUIFramesSetAlign(wParam, alClient); } - //wparam=frameid -INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1299,7 +1298,7 @@ INT_PTR CLUIFramesLockUnlockFrame(WPARAM wParam, LPARAM lParam) } //wparam=frameid -INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1327,7 +1326,7 @@ INT_PTR CLUIFramesSetUnSetBorder(WPARAM wParam, LPARAM lParam) } //wparam=frameid -INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1355,7 +1354,7 @@ INT_PTR CLUIFramesSetUnSetSkinned(WPARAM wParam, LPARAM lParam) } //wparam=frameid -INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -1585,27 +1584,27 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO rc.right = rcWindow.right - rcWindow.left; rc.bottom = rcWindow.bottom - rcWindow.top; - HBITMAP hbmDraw, hbmOld; - HDC realDC = hdc = GetWindowDC(hwnd); + HDC hdc = GetWindowDC(hwnd); if (hwnd == pcli->hwndContactTree) { - realDC = CreateCompatibleDC(hdc); - hbmDraw = CreateCompatibleBitmap(hdc, rc.right, rc.bottom); - hbmOld = reinterpret_cast(SelectObject(realDC, hbmDraw)); - } - - ExcludeClipRect(realDC, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); - - BitBlt(realDC, 0, 0, rc.right - rc.left, rc.bottom - rc.top, cfg::dat.hdcBg, rcWindow.left - cfg::dat.ptW.x, rcWindow.top - cfg::dat.ptW.y, SRCCOPY); + HDC realDC = CreateCompatibleDC(hdc); + HBITMAP hbmDraw = CreateCompatibleBitmap(hdc, rc.right, rc.bottom); + HBITMAP hbmOld = reinterpret_cast(SelectObject(realDC, hbmDraw)); - DrawAlpha(realDC, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); + ExcludeClipRect(realDC, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); + BitBlt(realDC, 0, 0, rc.right - rc.left, rc.bottom - rc.top, cfg::dat.hdcBg, rcWindow.left - cfg::dat.ptW.x, rcWindow.top - cfg::dat.ptW.y, SRCCOPY); + DrawAlpha(realDC, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); - if (hwnd == pcli->hwndContactTree) { ExcludeClipRect(hdc, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); BitBlt(hdc, 0, 0, rc.right, rc.bottom, realDC, 0, 0, SRCCOPY); SelectObject(realDC, hbmOld); DeleteObject(hbmDraw); DeleteDC(realDC); } + else { + ExcludeClipRect(hdc, item->MARGIN_LEFT, item->MARGIN_TOP, rc.right - item->MARGIN_RIGHT, rc.bottom - item->MARGIN_BOTTOM); + BitBlt(hdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top, cfg::dat.hdcBg, rcWindow.left - cfg::dat.ptW.x, rcWindow.top - cfg::dat.ptW.y, SRCCOPY); + DrawAlpha(hdc, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); + } ReleaseDC(hwnd, hdc); return 0; } @@ -1720,10 +1719,9 @@ static int CLUIFramesReSort() } //wparam=(CLISTFrame*)clfrm -INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) +INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM) { int style; - char * CustomName = NULL; CLISTFrame *clfrm = (CLISTFrame *)wParam; if (pcli->hwndContactList == 0) return -1; @@ -1854,7 +1852,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) return retval; } -static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM lParam) +static INT_PTR CLUIFramesRemoveFrame(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) return -1; @@ -2238,7 +2236,6 @@ int SizeFramesByWindowRect(RECT *r) } } else { - int res = 0; // set frame position SetWindowPos(Frames[i].hWnd, NULL, Frames[i].wndSize.left + cfg::dat.bCLeft, Frames[i].wndSize.top + cfg::dat.topOffset, (Frames[i].wndSize.right - Frames[i].wndSize.left), @@ -2253,10 +2250,10 @@ int SizeFramesByWindowRect(RECT *r) //UpdateWindow(Frames[i].hWnd); if (Frames[i].TitleBar.ShowTitleBar) UpdateWindow(Frames[i].TitleBar.hwnd); - }; + } } - } + if (GetTickCount() - LastStoreTick > 1000) { CLUIFramesStoreAllFrames(); LastStoreTick = GetTickCount(); @@ -2418,11 +2415,11 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) 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, mir_tstrlen(Frames[pos].TitleBar.tbname)); + TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_tstrlen(Frames[pos].TitleBar.tbname)); } - else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, mir_tstrlen(Frames[pos].TitleBar.tbname)); + else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_tstrlen(Frames[pos].TitleBar.tbname)); } - else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, mir_tstrlen(Frames[pos].TitleBar.tbname)); + else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, (int)mir_tstrlen(Frames[pos].TitleBar.tbname)); 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); @@ -2882,7 +2879,7 @@ int CLUIFrameResizeFloatingFrame(int framepos) return 0; } -static int CLUIFrameOnMainMenuBuild(WPARAM wParam, LPARAM lParam) +static int CLUIFrameOnMainMenuBuild(WPARAM, LPARAM) { CLUIFramesLoadMainMenu(); return 0; @@ -3090,7 +3087,7 @@ INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam) TCHAR g_ptszEventName[100]; -static int CLUIFrameOnModulesLoad(WPARAM wParam, LPARAM lParam) +static int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { mir_sntprintf(g_ptszEventName, SIZEOF(g_ptszEventName), _T("mf_update_evt_%d"), GetCurrentThreadId()); g_hEventThread = CreateEvent(NULL, TRUE, FALSE, g_ptszEventName); @@ -3101,7 +3098,7 @@ static int CLUIFrameOnModulesLoad(WPARAM wParam, LPARAM lParam) return 0; } -static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam) +static int CLUIFrameOnModulesUnload(WPARAM, LPARAM) { mf_updatethread_running = FALSE; diff --git a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp index 0169a29957..c23a472b98 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp @@ -13,7 +13,7 @@ typedef struct{ INT_PTR param1; } FrameMenuExecParam, *lpFrameMenuExecParam; -INT_PTR FreeOwnerDataFrameMenu(WPARAM wParam, LPARAM lParam) +INT_PTR FreeOwnerDataFrameMenu(WPARAM, LPARAM lParam) { lpFrameMenuExecParam cmep = (lpFrameMenuExecParam)lParam; if (cmep != NULL){ @@ -23,7 +23,7 @@ INT_PTR FreeOwnerDataFrameMenu(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR AddContextFrameMenuItem(WPARAM wParam, LPARAM lParam) +static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam) { CLISTMENUITEM *mi = (CLISTMENUITEM *)lParam; @@ -60,7 +60,7 @@ INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam) } //true - ok,false ignore -INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM lParam) +INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM) { PCheckProcParam pcpp = (PCheckProcParam)wParam; if (pcpp == NULL) diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index f4c8b2ed89..d7ccb88a71 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -51,7 +51,7 @@ typedef struct { int Param1,Param2; } GroupMenuExecParam, *lpGroupMenuExecParam; -static INT_PTR BuildGroupMenu(WPARAM wParam, LPARAM lParam) +static INT_PTR BuildGroupMenu(WPARAM, LPARAM) { int tick; HMENU hMenu; @@ -103,7 +103,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam) return (INT_PTR)op.Handle; } -INT_PTR GroupMenuCheckService(WPARAM wParam, LPARAM lParam) +INT_PTR GroupMenuCheckService(WPARAM, LPARAM) { return 0; } @@ -163,7 +163,7 @@ INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam) return 1; } -INT_PTR FreeOwnerDataGroupMenu(WPARAM wParam, LPARAM lParam) +INT_PTR FreeOwnerDataGroupMenu(WPARAM, LPARAM lParam) { lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)lParam; if (mmep != NULL) { @@ -173,7 +173,7 @@ INT_PTR FreeOwnerDataGroupMenu(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR HideGroupsHelper(WPARAM wParam, LPARAM lParam) +INT_PTR HideGroupsHelper(WPARAM, LPARAM) { int newVal = !(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), GWL_STYLE) & CLS_HIDEEMPTYGROUPS); cfg::writeByte("CList", "HideEmptyGroups", (BYTE)newVal); @@ -181,7 +181,7 @@ INT_PTR HideGroupsHelper(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR UseGroupsHelper(WPARAM wParam, LPARAM lParam) +INT_PTR UseGroupsHelper(WPARAM, LPARAM) { int newVal = !(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), GWL_STYLE) & CLS_USEGROUPS); cfg::writeByte("CList", "UseGroups", (BYTE)newVal); @@ -189,7 +189,7 @@ INT_PTR UseGroupsHelper(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR HideOfflineRootHelper(WPARAM wParam, LPARAM lParam) +INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) { SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEOFFLINEROOT, !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_GETHIDEOFFLINEROOT, 0, 0), @@ -197,7 +197,7 @@ INT_PTR HideOfflineRootHelper(WPARAM wParam, LPARAM lParam) return 0; } -static int OnBuildGroupMenu(WPARAM wParam, LPARAM lParam) +static int OnBuildGroupMenu(WPARAM, LPARAM) { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0); @@ -378,7 +378,7 @@ typedef struct { int Param1, Param2; } SubGroupMenuExecParam, *lpSubGroupMenuExecParam; -static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM lParam) +static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM) { ClcGroup *group = (ClcGroup *)wParam; if (group == 0) @@ -391,7 +391,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM lParam) +static INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM) { ListParam param = {0}; param.MenuObjectHandle = hSubGroupMenuObject; @@ -438,15 +438,14 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam) return (INT_PTR)op.Handle; } -INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM lParam) { - //not used +INT_PTR SubGroupMenuCheckService(WPARAM, LPARAM) +{ return 0; -}; - -INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM lParam) { +} +INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM) +{ MENUITEMINFO *mii = (MENUITEMINFO *)wParam; - if (mii == NULL) return 0; /* @@ -486,7 +485,7 @@ INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) { return 1; } -INT_PTR FreeOwnerDataSubGroupMenu(WPARAM wParam, LPARAM lParam) +INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam) { lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)lParam; if (mmep != NULL) { @@ -496,8 +495,8 @@ INT_PTR FreeOwnerDataSubGroupMenu(WPARAM wParam, LPARAM lParam) return 0; } -//wparam menu handle to pass to clc.c -INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam) +// wparam menu handle to pass to clc.c +INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM) { SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), WM_COMMAND, wParam, 0); return 0; @@ -510,10 +509,6 @@ void InitSubGroupMenus(void) CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService", SubGroupMenuonAddService); CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy); - //CreateServiceFunction("CLISTMENUSSubGroup/HideSubGroupsHelper", HideSubGroupsHelper); - //CreateServiceFunction("CLISTMENUSSubGroup/UseSubGroupsHelper", UseSubGroupsHelper); - //CreateServiceFunction("CLISTMENUSSubGroup/HideOfflineRootHelper", HideOfflineRootHelper); - CreateServiceFunction("CList/AddSubGroupMenuItem", AddSubGroupMenuItem); CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP, BuildSubGroupMenu); hPreBuildSubGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU); diff --git a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp index 87c426d6dc..538f77f2a7 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolsblib.cpp @@ -38,31 +38,29 @@ static TCHAR szPropStr[] = _T("CoolSBSubclassPtr"); LRESULT CALLBACK CoolSBWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -SCROLLWND *GetScrollWndFromHwnd(HWND hwnd) +SCROLLWND* GetScrollWndFromHwnd(HWND hwnd) { return (SCROLLWND *)GetProp(hwnd, szPropStr); } -SCROLLBAR *GetScrollBarFromHwnd(HWND hwnd, UINT nBar) +SCROLLBAR* GetScrollBarFromHwnd(HWND hwnd, UINT nBar) { SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - - if ( !sw) return 0; - + if (!sw) + return 0; + if (nBar == SB_HORZ) return &sw->sbarHorz; - else if (nBar == SB_VERT) + if (nBar == SB_VERT) return &sw->sbarVert; - else - return 0; + return 0; } BOOL WINAPI CoolSB_IsCoolScrollEnabled(HWND hwnd) { if (GetScrollWndFromHwnd(hwnd)) return TRUE; - else - return FALSE; + return FALSE; } BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); @@ -77,7 +75,7 @@ BOOL GetScrollRect(SCROLLWND *sw, UINT nBar, HWND hwnd, RECT *rect); // using Detours (or any other LIB??) // -typedef BOOL (WINAPI *WPROC)(HWND, UINT, UINT); +typedef BOOL(WINAPI *WPROC)(HWND, UINT, UINT); static WPROC pEnableScrollBar = 0; @@ -85,36 +83,32 @@ void WINAPI CoolSB_SetESBProc(WPROC proc) { pEnableScrollBar = proc; } -// -// static void RedrawNonClient(HWND hwnd, BOOL fFrameChanged) { - if (fFrameChanged == FALSE) - { + if (fFrameChanged == FALSE) { /* RECT rect; HRGN hrgn1, hrgn2; - + SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - + GetScrollRect(sw, SB_HORZ, hwnd, &rect); hrgn1 = CreateRectRgnIndirect(&rect); - + GetScrollRect(sw, SB_VERT, hwnd, &rect); hrgn2 = CreateRectRgnIndirect(&rect); - + CombineRgn(hrgn1, hrgn2, hrgn1, RGN_OR); - + SendMessage(hwnd, WM_NCPAINT, (WPARAM)hrgn1, 0); - + DeleteObject(hrgn1); DeleteObject(hrgn2);*/ SendMessage(hwnd, WM_NCPAINT, 1, 0); } - else - { + else { SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_DRAWFRAME); } @@ -134,13 +128,10 @@ int WINAPI CoolSB_GetDefaultMinThumbSize(void) { if (LOBYTE(LOWORD(dwVersion)) >= 5) return MINTHUMBSIZE_2000; - else - return MINTHUMBSIZE_NT4; - } - else - { return MINTHUMBSIZE_NT4; } + + return MINTHUMBSIZE_NT4; } static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) @@ -150,12 +141,10 @@ static SCROLLINFO *GetScrollInfoFromHwnd(HWND hwnd, int fnBar) if (sb == 0) return FALSE; - if (fnBar == SB_HORZ) - { + if (fnBar == SB_HORZ) { return &sb->scrollInfo; } - else if (fnBar == SB_VERT) - { + else if (fnBar == SB_VERT) { return &sb->scrollInfo; } else @@ -182,8 +171,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) //if we have already initialized Cool Scrollbars for this window, //then stop the user from doing it again - if (GetScrollWndFromHwnd(hwnd) != 0) - { + if (GetScrollWndFromHwnd(hwnd) != 0) { return FALSE; } @@ -193,12 +181,12 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) si = &sw->sbarHorz.scrollInfo; si->cbSize = sizeof(SCROLLINFO); - si->fMask = SIF_ALL; + si->fMask = SIF_ALL; GetScrollInfo(hwnd, SB_HORZ, si); si = &sw->sbarVert.scrollInfo; si->cbSize = sizeof(SCROLLINFO); - si->fMask = SIF_ALL; + si->fMask = SIF_ALL; GetScrollInfo(hwnd, SB_VERT, si); //check to see if the window has left-aligned scrollbars @@ -226,20 +214,20 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) //need to be able to distinguish between horizontal and vertical //scrollbars in some instances - sw->sbarHorz.nBarType = SB_HORZ; - sw->sbarVert.nBarType = SB_VERT; + sw->sbarHorz.nBarType = SB_HORZ; + sw->sbarVert.nBarType = SB_VERT; - sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL; - sw->sbarVert.fFlatScrollbar = CSBS_NORMAL; + sw->sbarHorz.fFlatScrollbar = CSBS_NORMAL; + sw->sbarVert.fFlatScrollbar = CSBS_NORMAL; //set the default arrow sizes for the scrollbars - sw->sbarHorz.nArrowLength = SYSTEM_METRIC; - sw->sbarHorz.nArrowWidth = SYSTEM_METRIC; - sw->sbarVert.nArrowLength = SYSTEM_METRIC; - sw->sbarVert.nArrowWidth = SYSTEM_METRIC; + sw->sbarHorz.nArrowLength = SYSTEM_METRIC; + sw->sbarHorz.nArrowWidth = SYSTEM_METRIC; + sw->sbarVert.nArrowLength = SYSTEM_METRIC; + sw->sbarVert.nArrowWidth = SYSTEM_METRIC; + + sw->bPreventStyleChange = FALSE; - sw->bPreventStyleChange = FALSE; - mir_subclassWindow(hwnd, CoolSBWndProc); CoolSB_SetMinThumbSize(hwnd, SB_BOTH, CoolSB_GetDefaultMinThumbSize()); @@ -250,11 +238,11 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) InitCommonControlsEx(&ice); sw->hwndToolTip = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TOOLTIPS_CLASS, _T(""), - WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - hwnd, NULL, GetModuleHandle(0), - NULL); + WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hwnd, NULL, GetModuleHandle(0), + NULL); ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND; @@ -264,7 +252,7 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) ti.hinst = GetModuleHandle(0); SendMessage(sw->hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); - + #else UNREFERENCED_PARAMETER(ice); @@ -272,27 +260,25 @@ BOOL WINAPI InitializeCoolSB(HWND hwnd) sw->hwndToolTip = 0; #endif - + //send the window a frame changed message to update the scrollbars RedrawNonClient(hwnd, TRUE); return TRUE; } -BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) +BOOL WINAPI CoolSB_EnableScrollBar(HWND hwnd, int wSBflags, UINT wArrows) { SCROLLBAR *sbar; UINT oldstate; BOOL bFailed = FALSE; - if ( !CoolSB_IsCoolScrollEnabled(hwnd)) + if (!CoolSB_IsCoolScrollEnabled(hwnd)) return EnableScrollBar(hwnd, wSBflags, wArrows); - if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wSBflags == SB_HORZ || wSBflags == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { oldstate = sbar->fScrollFlags; - + //clear any existing state, and OR in the disabled flags sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; @@ -301,11 +287,9 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) } - if ((wSBflags == SB_VERT || wSBflags == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wSBflags == SB_VERT || wSBflags == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { oldstate = sbar->fScrollFlags; - + //clear any existing state, and OR in the disabled flags sbar->fScrollFlags = (sbar->fScrollFlags & ~ESB_DISABLE_BOTH) | wArrows; @@ -316,45 +300,33 @@ BOOL WINAPI CoolSB_EnableScrollBar (HWND hwnd, int wSBflags, UINT wArrows) return !bFailed; } -BOOL WINAPI CoolSB_GetScrollBarInfo(HWND hwnd) +BOOL WINAPI CoolSB_GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi) { -// SCROLLBARINFO sbi; not defined in winuser.h - return FALSE; -} - -BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) -{ - SCROLLINFO *mysi; BOOL copied = FALSE; - - if ( !lpsi) + + if (!lpsi) return FALSE; - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) - { + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, fnBar); + if (!mysi) return GetScrollInfo(hwnd, fnBar, lpsi); - } - - if (lpsi->fMask & SIF_PAGE) - { + + if (lpsi->fMask & SIF_PAGE) { lpsi->nPage = mysi->nPage; copied = TRUE; } - if (lpsi->fMask & SIF_POS) - { + if (lpsi->fMask & SIF_POS) { lpsi->nPos = mysi->nPos; copied = TRUE; } - if (lpsi->fMask & SIF_TRACKPOS) - { + if (lpsi->fMask & SIF_TRACKPOS) { lpsi->nTrackPos = mysi->nTrackPos; copied = TRUE; } - if (lpsi->fMask & SIF_RANGE) - { + if (lpsi->fMask & SIF_RANGE) { lpsi->nMin = mysi->nMin; lpsi->nMax = mysi->nMax; copied = TRUE; @@ -363,24 +335,22 @@ BOOL WINAPI CoolSB_GetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi) return copied; } -int WINAPI CoolSB_GetScrollPos (HWND hwnd, int nBar) +int WINAPI CoolSB_GetScrollPos(HWND hwnd, int nBar) { - SCROLLINFO *mysi; - - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) return GetScrollPos(hwnd, nBar); return mysi->nPos; } -BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos) +BOOL WINAPI CoolSB_GetScrollRange(HWND hwnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos) { - SCROLLINFO *mysi; - - if ( !lpMinPos || !lpMaxPos) + if (!lpMinPos || !lpMaxPos) return FALSE; - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) return GetScrollRange(hwnd, nBar, lpMinPos, lpMaxPos); *lpMinPos = mysi->nMin; @@ -389,95 +359,73 @@ BOOL WINAPI CoolSB_GetScrollRange (HWND hwnd, int nBar, LPINT lpMinPos, LPINT lp return TRUE; } -int WINAPI CoolSB_SetScrollInfo (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw) +int WINAPI CoolSB_SetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw) { - SCROLLINFO *mysi; - SCROLLBAR *sbar; - BOOL fRecalcFrame = FALSE; + BOOL fRecalcFrame = FALSE; - if ( !lpsi) + if (!lpsi) return FALSE; - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, fnBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, fnBar); + if (!mysi) return SetScrollInfo(hwnd, fnBar, lpsi, fRedraw); - //if (CoolSB_IsThumbTracking(hwnd)) - // return mysi->nPos; - - if (lpsi->fMask & SIF_RANGE) - { + if (lpsi->fMask & SIF_RANGE) { mysi->nMin = lpsi->nMin; mysi->nMax = lpsi->nMax; } //The nPage member must specify a value from 0 to nMax - nMin +1. - if (lpsi->fMask & SIF_PAGE) - { + if (lpsi->fMask & SIF_PAGE) { UINT t = (UINT)(mysi->nMax - mysi->nMin + 1); mysi->nPage = min(lpsi->nPage, t); } //The nPos member must specify a value between nMin and nMax - max(nPage - 1, 0). - if (lpsi->fMask & SIF_POS) - { + if (lpsi->fMask & SIF_POS) { mysi->nPos = max(lpsi->nPos, mysi->nMin); mysi->nPos = min((UINT)mysi->nPos, mysi->nMax - max(mysi->nPage - 1, 0)); } - sbar = GetScrollBarFromHwnd(hwnd, fnBar); + SCROLLBAR *sbar = GetScrollBarFromHwnd(hwnd, fnBar); - if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) - { - if ( !sbar->fScrollVisible) - { + if ((lpsi->fMask & SIF_DISABLENOSCROLL) || (sbar->fScrollFlags & CSBS_THUMBALWAYS)) { + if (!sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); fRecalcFrame = TRUE; } } - else - { - if ( mysi->nPage > (UINT)mysi->nMax + else { + if (mysi->nPage > (UINT)mysi->nMax || mysi->nPage == (UINT)mysi->nMax && mysi->nMax == 0 - || mysi->nMax <= mysi->nMin) - { - if (sbar->fScrollVisible) - { + || mysi->nMax <= mysi->nMin) { + if (sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, FALSE); fRecalcFrame = TRUE; } } - else - { - if ( !sbar->fScrollVisible) - { + else { + if (!sbar->fScrollVisible) { CoolSB_ShowScrollBar(hwnd, fnBar, TRUE); fRecalcFrame = TRUE; } - } - } if (fRedraw && !CoolSB_IsThumbTracking(hwnd)) RedrawNonClient(hwnd, fRecalcFrame); - + return mysi->nPos; } int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) { - SCROLLINFO *mysi; int oldpos; - - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) - { - return SetScrollPos(hwnd, nBar, nPos, fRedraw); - } - //this is what should happen, but real scrollbars don't work like this.. - //if (CoolSB_IsThumbTracking(hwnd)) - // return mysi->nPos; + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) + return SetScrollPos(hwnd, nBar, nPos, fRedraw); //validate and set the scollbar position oldpos = mysi->nPos; @@ -490,11 +438,10 @@ int WINAPI CoolSB_SetScrollPos(HWND hwnd, int nBar, int nPos, BOOL fRedraw) return oldpos; } -int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw) +int WINAPI CoolSB_SetScrollRange(HWND hwnd, int nBar, int nMinPos, int nMaxPos, BOOL fRedraw) { - SCROLLINFO *mysi; - - if ( !(mysi = GetScrollInfoFromHwnd(hwnd, nBar))) + SCROLLINFO *mysi = GetScrollInfoFromHwnd(hwnd, nBar); + if (!mysi) return SetScrollRange(hwnd, nBar, nMinPos, nMaxPos, fRedraw); if (CoolSB_IsThumbTracking(hwnd)) @@ -504,7 +451,7 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, //nMax-nMin must not be greater than MAXLONG mysi->nMin = nMinPos; mysi->nMax = nMaxPos; - + if (fRedraw) RedrawNonClient(hwnd, FALSE); @@ -514,19 +461,17 @@ int WINAPI CoolSB_SetScrollRange (HWND hwnd, int nBar, int nMinPos, int nMaxPos, // // Show or hide the specified scrollbars // -BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) +BOOL WINAPI CoolSB_ShowScrollBar(HWND hwnd, int wBar, BOOL fShow) { SCROLLBAR *sbar; BOOL bFailed = FALSE; DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); - if ( !CoolSB_IsCoolScrollEnabled(hwnd)) + if (!CoolSB_IsCoolScrollEnabled(hwnd)) return ShowScrollBar(hwnd, wBar, fShow); - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { - sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { + sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; sbar->fScrollFlags |= fShow ? CSBS_VISIBLE : 0; //bFailed = TRUE; @@ -534,10 +479,8 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_HSCROLL); } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { - sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { + sbar->fScrollFlags = sbar->fScrollFlags & ~CSBS_VISIBLE; sbar->fScrollFlags |= fShow ? CSBS_VISIBLE : 0; //bFailed = TRUE; @@ -545,22 +488,20 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) else SetWindowLongPtr(hwnd, GWL_STYLE, dwStyle & ~WS_VSCROLL); } - if (bFailed) - { + if (bFailed) { return FALSE; } - else - { + else { //DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); //style |= WS_VSCROLL; - + //if (s //SetWindowLongPtr(hwnd, GWL_STYLE, style); - SetWindowPos(hwnd, 0, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | + SetWindowPos(hwnd, 0, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); - + return TRUE; } } @@ -570,9 +511,9 @@ BOOL WINAPI CoolSB_ShowScrollBar (HWND hwnd, int wBar, BOOL fShow) // HRESULT WINAPI UninitializeCoolSB(HWND hwnd) { - int i = 0; SCROLLWND *sw = GetScrollWndFromHwnd(hwnd); - if ( !sw) return E_FAIL; + if (!sw) + return E_FAIL; RemoveProp(hwnd, szPropStr); //SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); @@ -611,7 +552,7 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p if ( !(sbar = GetScrollBarFromHwnd(hwnd, wSBflags))) return FALSE; - + //check that we havn't reached the maximum allowed buttons yet if (sbar->nButtons == MAX_COOLSB_BUTS) return FALSE; @@ -685,9 +626,9 @@ BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *p We don't use the callback function anymore. The uButType member must now specify SBBT_OWNERDRAW, and a WM_NOTIFY will be sent when a button must be drawn - if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW)) + if ((psb->fMask & SBBF_OWNERDRAW) && ((psb->uButType & SBBT_MASK) == SBBT_OWNERDRAW)) pDrawProc = psb->pDrawProc; - else + else pDrawProc = 0;*/ sbar->nButtons++; @@ -767,7 +708,7 @@ BOOL WINAPI CoolSB_ModifyButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCm if (psb->fMask & SBBF_BITMAP) sbut->hBmp = psb->hBmp; if (psb->fMask & SBBF_ENHMETAFILE) sbut->hEmf = psb->hEmf; if (psb->fMask & SBBF_CURSOR) sbut->hCurs = psb->hCurs; - + if (psb->fMask & SBBF_BUTMINMAX) { sbut->nMinSize = psb->nMinSize; @@ -816,7 +757,7 @@ BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd } sbar->nButtons--; - + RedrawNonClient(hwnd, TRUE); return TRUE; @@ -861,20 +802,20 @@ BOOL WINAPI CoolSB_GetButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, S #else -BOOL WINAPI CoolSB_InsertButton(HWND hwnd, int wSBflags, UINT nPos, SCROLLBUT *psb) { return FALSE; } -BOOL WINAPI CoolSB_ModifyButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } -BOOL WINAPI CoolSB_RemoveButton(HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd) { return FALSE; } -BOOL WINAPI CoolSB_GetButton (HWND hwnd, int wSBflags, UINT uItem, BOOL fByCmd, SCROLLBUT *psb) { return FALSE; } +BOOL WINAPI CoolSB_InsertButton(HWND, int, UINT, SCROLLBUT*) { return FALSE; } +BOOL WINAPI CoolSB_ModifyButton(HWND, int, UINT, BOOL, SCROLLBUT*) { return FALSE; } +BOOL WINAPI CoolSB_RemoveButton(HWND, int, UINT, BOOL) { return FALSE; } +BOOL WINAPI CoolSB_GetButton(HWND, int, UINT, BOOL, SCROLLBUT*) { return FALSE; } #endif //INCLUDE_BUTTONS // // Set the size of the scrollbars // -BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) +BOOL WINAPI CoolSB_SetSize(HWND hwnd, int wBar, int nLength, int nWidth) { SCROLLBAR *sbar; - + if (nLength == 0 || nWidth == 0) return FALSE; @@ -884,29 +825,23 @@ BOOL WINAPI CoolSB_SetSize (HWND hwnd, int wBar, int nLength, int nWidth) if (nLength > 256 || nWidth > 256) return FALSE; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { sbar->nArrowLength = nLength; - sbar->nArrowWidth = nWidth; + sbar->nArrowWidth = nWidth; } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { sbar->nArrowLength = nLength; - sbar->nArrowWidth = nWidth; + sbar->nArrowWidth = nWidth; } RedrawNonClient(hwnd, TRUE); - return TRUE; } - // // Alter the display mode of the scrollbars // wBar - SB_HORZ / SB_VERT / SB_BOTH @@ -916,23 +851,16 @@ BOOL WINAPI CoolSB_SetStyle(HWND hwnd, int wBar, UINT nStyle) { SCROLLBAR *sbar; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) sbar->fFlatScrollbar = nStyle; - } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) sbar->fFlatScrollbar = nStyle; - } RedrawNonClient(hwnd, FALSE); - return TRUE; } @@ -945,23 +873,19 @@ BOOL WINAPI CoolSB_SetThumbAlways(HWND hwnd, int wBar, BOOL fThumbAlways) { SCROLLBAR *sbar; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) { if (fThumbAlways) - sbar->fScrollFlags |= CSBS_THUMBALWAYS; + sbar->fScrollFlags |= CSBS_THUMBALWAYS; else sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) { if (fThumbAlways) - sbar->fScrollFlags |= CSBS_THUMBALWAYS; + sbar->fScrollFlags |= CSBS_THUMBALWAYS; else sbar->fScrollFlags &= ~CSBS_THUMBALWAYS; } @@ -978,23 +902,17 @@ BOOL WINAPI CoolSB_SetMinThumbSize(HWND hwnd, UINT wBar, UINT size) { SCROLLBAR *sbar; - if ( !GetScrollWndFromHwnd(hwnd)) + if (!GetScrollWndFromHwnd(hwnd)) return FALSE; if (size == -1) size = CoolSB_GetDefaultMinThumbSize(); - if ((wBar == SB_HORZ || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) - { + if ((wBar == SB_HORZ || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_HORZ))) sbar->nMinThumbSize = size; - } - if ((wBar == SB_VERT || wBar == SB_BOTH) && - (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) - { + if ((wBar == SB_VERT || wBar == SB_BOTH) && (sbar = GetScrollBarFromHwnd(hwnd, SB_VERT))) sbar->nMinThumbSize = size; - } return TRUE; } diff --git a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp index cb2490ed44..b70587874c 100644 --- a/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp +++ b/plugins/Clist_nicer/src/Coolsb/coolscroll.cpp @@ -535,7 +535,6 @@ static int GetButtonSize(SCROLLBAR *sbar, HWND hwnd, UINT uBeforeAfter) // static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int *pthumbpos) { - SCROLLINFO *si; int scrollsize; //total size of the scrollbar including arrow buttons int workingsize; //working area (where the thumb can slide) int siMaxMin; @@ -543,29 +542,16 @@ static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int int startcoord; int thumbpos = 0, thumbsize = 0; - int adjust=0; static int count=0; //work out the width (for a horizontal) or the height (for a vertical) //of a standard scrollbar button butsize = GetScrollMetric(sbar, SM_SCROLL_LENGTH); - if (1) //sbar->nBarType == SB_HORZ) - { - scrollsize = rect->right - rect->left; - startcoord = rect->left; - } - /*else if (sbar->nBarType == SB_VERT) - { - scrollsize = rect->bottom - rect->top; - startcoord = rect->top; - } - else - { - return 0; - }*/ + scrollsize = rect->right - rect->left; + startcoord = rect->left; - si = &sbar->scrollInfo; + SCROLLINFO *si = &sbar->scrollInfo; siMaxMin = si->nMax - si->nMin + 1; workingsize = scrollsize - butsize * 2; @@ -613,7 +599,7 @@ static int CalcThumbSize(SCROLLBAR *sbar, const RECT *rect, int *pthumbsize, int // the rectangle must not include space for any inserted buttons // (i.e, JUST the scrollbar area) // -static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, int x, int y) +static UINT GetHorzScrollPortion(SCROLLBAR *sbar, const RECT *rect, int x, int y) { int thumbwidth, thumbpos; int butwidth = GetScrollMetric(sbar, SM_SCROLL_LENGTH); @@ -670,12 +656,12 @@ static UINT GetHorzScrollPortion(SCROLLBAR *sbar, HWND hwnd, const RECT *rect, i // For vertical scrollbars, rotate all coordinates by -90 degrees // so that we can use the horizontal version of this function // -static UINT GetVertScrollPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetVertScrollPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { UINT r; RotateRect(rect); - r = GetHorzScrollPortion(sb, hwnd, rect, y, x); + r = GetHorzScrollPortion(sb, rect, y, x); RotateRect(rect); return r; } @@ -750,7 +736,7 @@ static LRESULT PostCustomDrawNotify(HWND hwnd, HDC hdc, UINT nBar, RECT *prect, #endif */ -static LRESULT PostMouseNotify0(HWND hwnd, UINT msg, UINT nBar, RECT *prect, UINT nCmdId, POINT pt) +static LRESULT PostMouseNotify0(HWND hwnd, UINT nBar, RECT *prect, UINT nCmdId, POINT pt) { #ifdef NOTIFY_MOUSE NMCOOLBUTMSG nmcb; @@ -810,7 +796,6 @@ static LRESULT NCDrawHScrollbar(SCROLLBAR *sb, HWND hwnd, HDC hdc, const RECT *r COLORREF crInverse1 = InvertCOLORREF(crCheck1); COLORREF crInverse2 = InvertCOLORREF(crCheck2); - UINT uDFCFlat = sb->fFlatScrollbar ? DFCS_FLAT : 0; UINT uDEFlat = sb->fFlatScrollbar ? BF_FLAT : 0; //drawing flags to modify the appearance of the scrollbar buttons @@ -1380,32 +1365,10 @@ static LRESULT DrawVertButtons(SCROLLBAR *sbar, HDC hdc, const RECT *rect, int l // NOT needed if we don't bother to mask the scrollbars we draw // to prevent the old window procedure from accidently drawing over them // -HDC CoolSB_GetDC(HWND hwnd, WPARAM wParam) +HDC CoolSB_GetDC(HWND hwnd, WPARAM) { // I just can't figure out GetDCEx, so I'll just use this: return GetWindowDC(hwnd); - - /* - RECT rc; - DWORD flags = 0x10000; - HRGN hrgn = (HRGN)wParam; - - if (hrgn == (HRGN)1) - { - GetWindowRect(hwnd, &rc); - OffsetRect(&rc, -rc.left, -rc.top); - hrgn = CreateRectRgnIndirect(&rc); - } - - if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPCHILDREN) - flags |= DCX_CLIPCHILDREN; - - if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CLIPSIBLINGS) - flags |= DCX_CLIPSIBLINGS; - - return GetDCEx(hwnd, hrgn, flags | DCX_CACHE|DCX_NORESETATTRS|DCX_WINDOW | DCX_INTERSECTUPDATE); - */ - //return GetDCEx(hwnd, NULL, flags | DCX_WINDOW| DCX_NORESETATTRS); } static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) @@ -1431,8 +1394,6 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) sb = &sw->sbarHorz; if (sb->fScrollVisible) { - int hbarwidth = 0, leftright = 0; - //get the screen coordinates of the whole horizontal scrollbar area GetHScrollRect(sw, hwnd, &rect); @@ -1451,8 +1412,6 @@ static LRESULT NCPaint(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) sb = &sw->sbarVert; if (sb->fScrollVisible) { - int vbarheight = 0, updown = 0; - //get the screen cooridinates of the whole horizontal scrollbar area GetVScrollRect(sw, hwnd, &rect); @@ -1575,7 +1534,7 @@ static LRESULT NCHitTest(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) // Return a HT* value indicating what part of the scrollbar was clicked // Rectangle is not adjusted // -static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetHorzPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { RECT rc = *rect; @@ -1609,17 +1568,17 @@ static UINT GetHorzPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) //Now we have the rectangle for the scrollbar itself, so work out //what part we clicked on. - return GetHorzScrollPortion(sb, hwnd, &rc, x, y); + return GetHorzScrollPortion(sb, &rc, x, y); } // // Just call the horizontal version, with adjusted coordinates // -static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetVertPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { UINT ret; RotateRect(rect); - ret = GetHorzPortion(sb, hwnd, rect, y, x); + ret = GetHorzPortion(sb, rect, y, x); RotateRect(rect); return ret; } @@ -1627,12 +1586,12 @@ static UINT GetVertPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) // // Wrapper function for GetHorzPortion and GetVertPortion // -static UINT GetPortion(SCROLLBAR *sb, HWND hwnd, RECT *rect, int x, int y) +static UINT GetPortion(SCROLLBAR *sb, RECT *rect, int x, int y) { if (sb->nBarType == SB_HORZ) - return GetHorzPortion(sb, hwnd, rect, x, y); + return GetHorzPortion(sb, rect, x, y); else if (sb->nBarType == SB_VERT) - return GetVertPortion(sb, hwnd, rect, x, y); + return GetVertPortion(sb, rect, x, y); else return HTSCROLL_NONE; } @@ -1847,7 +1806,6 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa RECT rect, winrect; HDC hdc; SCROLLBAR *sb; - SCROLLBUT *sbut = 0; POINT pt; pt.x = LOWORD(lParam); @@ -1866,7 +1824,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //get the total area of the normal Horz scrollbar area GetHScrollRect(sw, hwnd, &rect); - uCurrentScrollPortion = GetHorzPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + uCurrentScrollPortion = GetHorzPortion(sb, &rect, LOWORD(lParam), HIWORD(lParam)); } // // VERTICAL SCROLLBAR PROCESSING @@ -1879,7 +1837,7 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa //get the total area of the normal Horz scrollbar area GetVScrollRect(sw, hwnd, &rect); - uCurrentScrollPortion = GetVertPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); + uCurrentScrollPortion = GetVertPortion(sb, &rect, LOWORD(lParam), HIWORD(lParam)); } // // NORMAL PROCESSING @@ -1991,9 +1949,9 @@ static LRESULT NCLButtonDown(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lPa // If the scroll thumb has moved under the mouse in response to // a call to SetScrollPos etc, then we don't hilight the scrollbar margin if (uCurrentScrollbar == SB_HORZ) - uScrollTimerPortion = GetHorzScrollPortion(sb, hwnd, &rect, pt.x, pt.y); + uScrollTimerPortion = GetHorzScrollPortion(sb, &rect, pt.x, pt.y); else - uScrollTimerPortion = GetVertScrollPortion(sb, hwnd, &rect, pt.x, pt.y); + uScrollTimerPortion = GetVertScrollPortion(sb, &rect, pt.x, pt.y); GetWindowRect(hwnd, &winrect); OffsetRect(&rect, -winrect.left, -winrect.top); @@ -2035,7 +1993,6 @@ static LRESULT LButtonUp(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) HDC hdc; POINT pt; RECT winrect; - UINT buttonIdx = 0; //current scrollportion is the button that we clicked down on if (uCurrentScrollPortion != HTSCROLL_NONE) @@ -2340,7 +2297,6 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) LPARAM nlParam; SCROLLBAR *sb = &sw->sbarHorz; - SCROLLBUT *sbut = 0; nlParam = GetMessagePos(); @@ -2364,7 +2320,7 @@ static LRESULT MouseMove(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam) //see if we clicked in the inserted buttons / normal scrollbar //thisportion = GetPortion(sb, hwnd, &rect, LOWORD(lParam), HIWORD(lParam)); - thisportion = GetPortion(sb, hwnd, &rect, pt.x, pt.y); + thisportion = GetPortion(sb, &rect, pt.x, pt.y); //we need to do different things depending on if the //user is activating the scrollbar itself, or one of @@ -2578,7 +2534,6 @@ static LRESULT NCCalcSize(SCROLLWND *sw, HWND hwnd, WPARAM wParam, LPARAM lParam NCCALCSIZE_PARAMS *nccsp; RECT *rect; RECT oldrect; - BOOL fCalcValidRects = (wParam == TRUE); SCROLLBAR *sb; LRESULT ret; DWORD dwStyle; @@ -2744,12 +2699,12 @@ static LRESULT CoolSB_Timer(SCROLLWND *swnd, HWND hwnd, WPARAM wTimerId, LPARAM if (uMouseOverScrollbar == SB_HORZ) { sbar = &swnd->sbarHorz; - uHitTestPortion = GetHorzPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); + uHitTestPortion = GetHorzPortion(sbar, &MouseOverRect, pt.x, pt.y); } else { sbar = &swnd->sbarVert; - uHitTestPortion = GetVertPortion(sbar, hwnd, &MouseOverRect, pt.x, pt.y); + uHitTestPortion = GetVertPortion(sbar, &MouseOverRect, pt.x, pt.y); } if (uLastHitTestPortion != uHitTestPortion) @@ -2824,7 +2779,7 @@ static LRESULT CoolSB_StyleChange(SCROLLWND *swnd, HWND hwnd, UINT msg, WPARAM w } static UINT curTool = -1; -static LRESULT CoolSB_Notify(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) +static LRESULT CoolSB_Notify(SCROLLWND* /*swnd*/, HWND hwnd, WPARAM wParam, LPARAM lParam) { #ifdef COOLSB_TOOLTIPS @@ -2864,7 +2819,7 @@ static LRESULT SendToolTipMessage0(HWND hwndTT, UINT message, WPARAM wParam, LPA // We must intercept any calls to SetWindowLongPtr, to make sure that // the user does not set the WS_VSCROLL or WS_HSCROLL styles // -static LRESULT CoolSB_SetCursor(SCROLLWND *swnd, HWND hwnd, WPARAM wParam, LPARAM lParam) +static LRESULT CoolSB_SetCursor(SCROLLWND* /*swnd*/, HWND hwnd, WPARAM wParam, LPARAM lParam) { #ifdef INCLUDE_BUTTONS UINT lo = LOWORD(lParam); diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index 62e92dd013..850620d63c 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -84,7 +84,7 @@ static void Docking_AdjustPosition(HWND hwnd, RECT *rcDisplay, RECT *rc) *rc = abd.rc; } -int Docking_IsDocked(WPARAM wParam, LPARAM lParam) +int Docking_IsDocked(WPARAM, LPARAM) { return docked; } diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 9294481495..9e0b3bf50a 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -321,13 +321,15 @@ struct TCluiData { #define SORTBY_FREQUENCY 5 #define SORTBY_PRIOCONTACTS 6 -struct IconDesc { +struct IconDesc +{ char *szName; char *szDesc; int uId; // icon ID }; -struct NotifyMenuItemExData { +struct NotifyMenuItemExData +{ MCONTACT hContact; int iIcon; // icon index in the image list HICON hIcon; // corresponding icon handle @@ -336,7 +338,8 @@ struct NotifyMenuItemExData { // #define NOTIFY_HEIGHT 24 -struct CluiTopButton { +struct CluiTopButton +{ int ctrlid; char *pszButtonID, *pszButtonDn, *pszButtonName; int isPush, isVis, isAction; @@ -344,32 +347,35 @@ struct CluiTopButton { HWND hwndButton; }; -struct TrayIconInfo { - union { +struct TrayIconInfo +{ + union + { HICON hIcon; int iIcon; }; }; -typedef struct { +struct protoMenu +{ char protoName[50]; UINT menuID; BOOL added; HICON hIcon; -} protoMenu; +}; -//clcidents.c +// clcidents.c int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags); -//clcitems.c +// clcitems.c void RebuildEntireList(HWND hwnd, struct ClcData *dat); DWORD INTSORT_GetLastMsgTime(MCONTACT hContact); -//clcmsgs.c +// clcmsgs.c LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); -//clcutils.c +// clcutils.c void SetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState); void DoSelectionDefaultAction(HWND hwnd, struct ClcData *dat); int FindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk); @@ -396,7 +402,7 @@ void GetExtendedInfo(ClcContact *contact, struct ClcData *dat); extern LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); void HideShowNotifyFrame(); DWORD GetCLUIWindowStyle(BYTE style); -void ApplyCLUIBorderStyle(HWND hwnd); +void ApplyCLUIBorderStyle(); int FrameNCCalcSize(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar); int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar); @@ -405,14 +411,14 @@ void FreeProtocolData( void ); void GetClientID(ClcContact *contact, char *client); int LoadCLCButtonModule(void); -void SetButtonStates(HWND hwnd); +void SetButtonStates(); void ConfigureCLUIGeometry(int mode); void IcoLibReloadIcons(); int CompareContacts(const ClcContact* p1, const ClcContact* p2); void PaintNotifyArea(HDC hDC, RECT *rc); int AvatarChanged(WPARAM wParam, LPARAM lParam); void ConfigureFrame(); -void ConfigureEventArea(HWND hwnd); +void ConfigureEventArea(); void ClearIcons(int mode); void SkinDrawBg(HWND hwnd, HDC hdc); int GetBasicFontID(ClcContact * contact); @@ -426,7 +432,7 @@ void ApplyViewMode(const char *name); void ClcSetButtonState(int ctrlId, int status); HWND ClcGetButtonWindow(int ctrlid); -//clcpaint.c +// clcpaint.c void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint); void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int indent, int y, struct ClcData *dat, int index, HWND hwnd, DWORD style, RECT *clRect, BOOL *bFirstNGdrawn, int groupCountsFontTopShift, int rowHeight); void Reload3dBevelColors(); @@ -437,12 +443,12 @@ void RTL_DetectGroupName(ClcContact *group); void CLN_LoadAllIcons(BOOL mode); void ReloadSkinItemsToCache(); -//clcopts.c +// clcopts.c int ClcOptInit(WPARAM wParam, LPARAM lParam); void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); -void CluiProtocolStatusChanged( int parStatus, const char* szProto ); +void CluiProtocolStatusChanged(int, const char*); -void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto); +void LoadSkinItemToCache(struct TExtraCache *cEntry); // debugging support diff --git a/plugins/Clist_nicer/src/Include/rowheight_funcs.h b/plugins/Clist_nicer/src/Include/rowheight_funcs.h index d2292e6e5a..60a0998e1c 100644 --- a/plugins/Clist_nicer/src/Include/rowheight_funcs.h +++ b/plugins/Clist_nicer/src/Include/rowheight_funcs.h @@ -4,58 +4,50 @@ #define ROW_SPACE_BEETWEEN_LINES 0 #define ICON_HEIGHT 16 -class RowHeight { - +class RowHeight +{ public: - static BOOL Alloc (ClcData *dat, int size); - static BOOL Init (ClcData *dat); - static void Free (ClcData *dat); - static void Clear (ClcData *dat); + static BOOL Alloc(ClcData *dat, int size); + static BOOL Init(ClcData *dat); + static void Free(ClcData *dat); + static void Clear(ClcData *dat); // Calc and store max row height - static int getMaxRowHeight (ClcData *dat, const HWND hwnd); - + static int getMaxRowHeight(ClcData *dat, const HWND hwnd); // Calc and store row height - static int getRowHeight (ClcData *dat, const HWND hwnd, ClcContact* contact, int item, DWORD style) + static int getRowHeight(ClcData *dat, ClcContact* contact, int item, DWORD style) { - int height = 0; - //DWORD style=GetWindowLongPtr(hwnd,GWL_STYLE); - - //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; + int height = dat->fontInfo[GetBasicFontID(contact)].fontHeight; - if ( !dat->bisEmbedded) { - if (contact->bSecondLine != MULTIROW_NEVER && contact->bSecondLine != MULTIROW_IFSPACE && contact->type == CLCIT_CONTACT) { - if ((contact->bSecondLine == MULTIROW_ALWAYS || ((cfg::dat.dwFlags & CLUI_FRAME_SHOWSTATUSMSG && contact->bSecondLine == MULTIROW_IFNEEDED) && (contact->xStatus > 0 || contact->pExtra->bStatusMsgValid > STATUSMSG_XSTATUSID)))) - height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); - } + 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 || contact->pExtra->bStatusMsgValid > STATUSMSG_XSTATUSID)))) + height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding); + } - // Avatar size - if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != NULL && !(contact->ace->dwFlags & AVS_HIDEONCLIST)) - height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding); - } + // Avatar size + if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != NULL && !(contact->ace->dwFlags & AVS_HIDEONCLIST)) + height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding); + } - // Checkbox size - if ((style&CLS_CHECKBOXES && contact->type==CLCIT_CONTACT) || - (style&CLS_GROUPCHECKBOXES && contact->type==CLCIT_GROUP) || - (contact->type==CLCIT_INFO && contact->flags&CLCIIF_CHECKBOX)) - { - height = max(height, dat->checkboxSize); - } + // Checkbox size + if ((style & CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) || + (style & CLS_GROUPCHECKBOXES && contact->type == CLCIT_GROUP) || + (contact->type == CLCIT_INFO && contact->flags & CLCIIF_CHECKBOX)) { + height = max(height, dat->checkboxSize); + } - //height += 2 * dat->row_border; - // Min size - height = max(height, contact->type == CLCIT_GROUP ? dat->group_row_height : dat->min_row_heigh); - height += cfg::dat.bRowSpacing; + //height += 2 * dat->row_border; + // Min size + height = max(height, contact->type == CLCIT_GROUP ? dat->group_row_height : dat->min_row_heigh); + height += cfg::dat.bRowSpacing; dat->row_heights[item] = height; - //contact->iRowHeight = item; + //contact->iRowHeight = item; return height; } @@ -77,9 +69,6 @@ public: // Returns the height of the chosen row static int getHeight (ClcData *dat, int item); - - // returns the height for a floating contact - static int getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *contact, DWORD dwFlags); }; #endif // __ROWHEIGHT_FUNCS_H__ diff --git a/plugins/Clist_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index b7e9d2e304..b61dd97446 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -446,98 +446,83 @@ void __inline gradientVertical(UCHAR *ubRedFinal, UCHAR *ubGreenFinal, UCHAR *ub void __fastcall IMG_RenderImageItem(HDC hdc, ImageItem *item, RECT *rc) { - BYTE l = item->bLeft, r = item->bRight, t = item->bTop, b = item->bBottom; - LONG width = rc->right - rc->left; - LONG height = rc->bottom - rc->top; - BOOL isGlyph = (item->dwFlags & IMAGE_GLYPH) && g_glyphItem; - HDC hdcSrc = isGlyph ? g_glyphItem->hdc : item->hdc; - LONG srcOrigX = isGlyph ? item->glyphMetrics[0] : 0; - LONG srcOrigY = isGlyph ? item->glyphMetrics[1] : 0; - - if (item->dwFlags & IMAGE_FLAG_DIVIDED) { - // top 3 items - - GdiAlphaBlend(hdc, rc->left, rc->top, l, t, hdcSrc, srcOrigX, srcOrigY, l, t, item->bf); - GdiAlphaBlend(hdc, rc->left + l, rc->top, width - l - r, t, hdcSrc, srcOrigX + l, srcOrigY, item->inner_width, t, item->bf); - GdiAlphaBlend(hdc, rc->right - r, rc->top, r, t, hdcSrc, srcOrigX + (item->width - r), srcOrigY, r, t, item->bf); - - // middle 3 items - - GdiAlphaBlend(hdc, rc->left, rc->top + t, l, height - t - b, hdcSrc, srcOrigX, srcOrigY + t, l, item->inner_height, item->bf); - - if (item->dwFlags & IMAGE_FILLSOLID && item->fillBrush) { - RECT rcFill; - rcFill.left = rc->left + l; rcFill.top = rc->top +t; - rcFill.right = rc->right - r; rcFill.bottom = rc->bottom - b; - FillRect(hdc, &rcFill, item->fillBrush); - } - else - GdiAlphaBlend(hdc, rc->left + l, rc->top + t, width - l - r, height - t - b, hdcSrc, srcOrigX + l, srcOrigY + t, item->inner_width, item->inner_height, item->bf); + BYTE l = item->bLeft, r = item->bRight, t = item->bTop, b = item->bBottom; + LONG width = rc->right - rc->left; + LONG height = rc->bottom - rc->top; + BOOL isGlyph = (item->dwFlags & IMAGE_GLYPH) && g_glyphItem; + HDC hdcSrc = isGlyph ? g_glyphItem->hdc : item->hdc; + LONG srcOrigX = isGlyph ? item->glyphMetrics[0] : 0; + LONG srcOrigY = isGlyph ? item->glyphMetrics[1] : 0; + + if (item->dwFlags & IMAGE_FLAG_DIVIDED) { + // top 3 items + + GdiAlphaBlend(hdc, rc->left, rc->top, l, t, hdcSrc, srcOrigX, srcOrigY, l, t, item->bf); + GdiAlphaBlend(hdc, rc->left + l, rc->top, width - l - r, t, hdcSrc, srcOrigX + l, srcOrigY, item->inner_width, t, item->bf); + GdiAlphaBlend(hdc, rc->right - r, rc->top, r, t, hdcSrc, srcOrigX + (item->width - r), srcOrigY, r, t, item->bf); + + // middle 3 items + + GdiAlphaBlend(hdc, rc->left, rc->top + t, l, height - t - b, hdcSrc, srcOrigX, srcOrigY + t, l, item->inner_height, item->bf); + + if (item->dwFlags & IMAGE_FILLSOLID && item->fillBrush) { + RECT rcFill; + rcFill.left = rc->left + l; rcFill.top = rc->top + t; + rcFill.right = rc->right - r; rcFill.bottom = rc->bottom - b; + FillRect(hdc, &rcFill, item->fillBrush); + } + else + GdiAlphaBlend(hdc, rc->left + l, rc->top + t, width - l - r, height - t - b, hdcSrc, srcOrigX + l, srcOrigY + t, item->inner_width, item->inner_height, item->bf); - GdiAlphaBlend(hdc, rc->right - r, rc->top + t, r, height - t - b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + t, r, item->inner_height, item->bf); + GdiAlphaBlend(hdc, rc->right - r, rc->top + t, r, height - t - b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + t, r, item->inner_height, item->bf); - // bottom 3 items + // bottom 3 items - GdiAlphaBlend(hdc, rc->left, rc->bottom - b, l, b, hdcSrc, srcOrigX, srcOrigY + (item->height - b), l, b, item->bf); - GdiAlphaBlend(hdc, rc->left + l, rc->bottom - b, width - l - r, b, hdcSrc, srcOrigX + l, srcOrigY + (item->height - b), item->inner_width, b, item->bf); - GdiAlphaBlend(hdc, rc->right - r, rc->bottom - b, r, b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + (item->height - b), r, b, item->bf); - } - else { - switch(item->bStretch) { - case IMAGE_STRETCH_H: - // tile image vertically, stretch to width - { - LONG top = rc->top; - - do { - if (top + item->height <= rc->bottom) { - GdiAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); - top += item->height; - } - else { - GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, item->width, rc->bottom - top, item->bf); - break; - } - } while (TRUE); - break; - } - case IMAGE_STRETCH_V: - // tile horizontally, stretch to height - { - LONG left = rc->left; - - do { - if (left + item->width <= rc->right) { - GdiAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); - left += item->width; - } - else { - GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, item->height, item->bf); - break; - } - } while (TRUE); - break; - } - case IMAGE_STRETCH_B: - // stretch the image in both directions... - GdiAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); - break; - /* - case IMAGE_STRETCH_V: - // stretch vertically, draw 3 horizontal tiles... - AlphaBlend(hdc, rc->left, rc->top, l, height, item->hdc, 0, 0, l, item->height, item->bf); - AlphaBlend(hdc, rc->left + l, rc->top, width - l - r, height, item->hdc, l, 0, item->inner_width, item->height, item->bf); - AlphaBlend(hdc, rc->right - r, rc->top, r, height, item->hdc, item->width - r, 0, r, item->height, item->bf); - break; - case IMAGE_STRETCH_H: - // stretch horizontally, draw 3 vertical tiles... - AlphaBlend(hdc, rc->left, rc->top, width, t, item->hdc, 0, 0, item->width, t, item->bf); - AlphaBlend(hdc, rc->left, rc->top + t, width, height - t - b, item->hdc, 0, t, item->width, item->inner_height, item->bf); - AlphaBlend(hdc, rc->left, rc->bottom - b, width, b, item->hdc, 0, item->height - b, item->width, b, item->bf); - break; - */ - default: - break; - } - } + GdiAlphaBlend(hdc, rc->left, rc->bottom - b, l, b, hdcSrc, srcOrigX, srcOrigY + (item->height - b), l, b, item->bf); + GdiAlphaBlend(hdc, rc->left + l, rc->bottom - b, width - l - r, b, hdcSrc, srcOrigX + l, srcOrigY + (item->height - b), item->inner_width, b, item->bf); + GdiAlphaBlend(hdc, rc->right - r, rc->bottom - b, r, b, hdcSrc, srcOrigX + (item->width - r), srcOrigY + (item->height - b), r, b, item->bf); + } + else { + switch (item->bStretch) { + case IMAGE_STRETCH_H: + // tile image vertically, stretch to width + { + LONG top = rc->top; + + do { + if (top + item->height <= rc->bottom) { + GdiAlphaBlend(hdc, rc->left, top, width, item->height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + top += item->height; + } + else { + GdiAlphaBlend(hdc, rc->left, top, width, rc->bottom - top, hdcSrc, srcOrigX, srcOrigY, item->width, rc->bottom - top, item->bf); + break; + } + } + while (true); + break; + } + case IMAGE_STRETCH_V: // tile horizontally, stretch to height + { + LONG left = rc->left; + + do { + if (left + item->width <= rc->right) { + GdiAlphaBlend(hdc, left, rc->top, item->width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + left += item->width; + } + else { + GdiAlphaBlend(hdc, left, rc->top, rc->right - left, height, hdcSrc, srcOrigX, srcOrigY, rc->right - left, item->height, item->bf); + break; + } + } + while (TRUE); + break; + } + case IMAGE_STRETCH_B: + // stretch the image in both directions... + GdiAlphaBlend(hdc, rc->left, rc->top, width, height, hdcSrc, srcOrigX, srcOrigY, item->width, item->height, item->bf); + break; + } + } } diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 0f58d631b8..0402c3c65b 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -97,7 +97,7 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) return 0; } -static int ClcMetamodeChanged(WPARAM bMetaEnabled, LPARAM lParam) +static int ClcMetamodeChanged(WPARAM bMetaEnabled, LPARAM) { if (bMetaEnabled != cfg::dat.bMetaEnabled) { cfg::dat.bMetaEnabled = (BYTE)bMetaEnabled; @@ -123,7 +123,6 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) ReloadExtraInfo(hContact); } else if (hContact != 0 && (szProto = GetContactProto(hContact)) != NULL) { - char *id = NULL; if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; pcli->pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); @@ -171,11 +170,11 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) else if (!__strcmp(cws->szModule, "Skin") && !__strcmp(cws->szSetting, "UseSound")) { cfg::dat.soundsOff = cfg::getByte(cws->szModule, cws->szSetting, 0) ? 0 : 1; ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED); - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); } else if (!__strcmp(cws->szModule, "CList") && !__strcmp(cws->szSetting, "UseGroups")) { ClcSetButtonState(IDC_TBHIDEGROUPS, cfg::getByte(cws->szModule, cws->szSetting, SETTING_USEGROUPS_DEFAULT)); - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); } else if (!__strcmp(cws->szModule, "TopToolBar") && !__strcmp(cws->szSetting, "UseFlatButton")) { SetButtonToSkinned(); diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 61ebe3587d..38a496c56f 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -24,7 +24,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c, const char *szProto); +/* +* load time zone information for the contact +* if TzName is set, use it. It has to be a standard windows time zone name +* Currently, it can only be set by using UserInfoEx plugin +* +* Fallback: use ordinary GMT offsets (incorrect, in some cases due to DST +* differences. +*/ + +static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c) +{ + DWORD flags = 0; + if (cfg::dat.bShowLocalTimeSelective) + flags |= TZF_DIFONLY; + c->hTimeZone = tmi.createByContact(hContact, 0, flags); +} //routines for managing adding/removal of items in the list, including sorting @@ -223,30 +238,30 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) p->bStatusMsgValid = STATUSMSG_NOTFOUND; MCONTACT hContact = p->hContact; - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; INT_PTR result = cfg::getTString(hContact, "CList", "StatusMsg", &dbv); - if ( !result && mir_tstrlen(dbv.ptszVal) > 0) + if (!result && mir_tstrlen(dbv.ptszVal) > 0) p->bStatusMsgValid = STATUSMSG_CLIST; else { - if ( !szProto) + if (!szProto) szProto = GetContactProto(hContact); if (szProto) { - if ( !result ) - db_free( &dbv ); - if ( !( result = cfg::getTString(hContact, szProto, "YMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0) + if (!result) + db_free(&dbv); + if (!(result = cfg::getTString(hContact, szProto, "YMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0) p->bStatusMsgValid = STATUSMSG_YIM; - else if ( !(result = cfg::getTString(hContact, szProto, "StatusDescr", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0) + else if (!(result = cfg::getTString(hContact, szProto, "StatusDescr", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0) p->bStatusMsgValid = STATUSMSG_GG; - else if ( !(result = cfg::getTString(hContact, szProto, "XStatusMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0) + else if (!(result = cfg::getTString(hContact, szProto, "XStatusMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0) p->bStatusMsgValid = STATUSMSG_XSTATUS; } } if (p->bStatusMsgValid == STATUSMSG_NOTFOUND) { // no status msg, consider xstatus name (if available) - if ( !result ) - db_free( &dbv ); + if (!result) + db_free(&dbv); result = cfg::getTString(hContact, szProto, "XStatusName", &dbv); - if ( !result && mir_tstrlen(dbv.ptszVal) > 1) { + if (!result && mir_tstrlen(dbv.ptszVal) > 1) { size_t iLen = mir_tstrlen(dbv.ptszVal); p->bStatusMsgValid = STATUSMSG_XSTATUSNAME; p->statusMsg = (TCHAR *)realloc(p->statusMsg, (iLen + 2) * sizeof(TCHAR)); @@ -262,9 +277,9 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) cst.status = &xStatus; if (ProtoServiceExists(szProto, PS_GETCUSTOMSTATUSEX) && !ProtoCallService(szProto, PS_GETCUSTOMSTATUSEX, hContact, (LPARAM)&cst) && xStatus > 0) { cst.flags = CSSF_MASK_NAME | CSSF_DEFAULT_NAME | CSSF_TCHAR; - cst.wParam = &xStatus2; + cst.wParam = &xStatus2; cst.ptszName = xStatusName; - if ( !CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, hContact, (LPARAM)&cst)) { + if (!CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, hContact, (LPARAM)&cst)) { TCHAR *szwXstatusName = TranslateTS(xStatusName); p->statusMsg = (TCHAR *)realloc(p->statusMsg, (mir_tstrlen(szwXstatusName) + 2) * sizeof(TCHAR)); _tcsncpy(p->statusMsg, szwXstatusName, mir_tstrlen(szwXstatusName) + 1); @@ -285,8 +300,8 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) } p->statusMsg[j] = 0; } - if ( !result ) - db_free( &dbv ); + if (!result) + db_free(&dbv); if (p->bStatusMsgValid != STATUSMSG_NOTFOUND) { WORD infoTypeC2[12]; @@ -303,35 +318,16 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) } if (p->hTimeZone == NULL) - TZ_LoadTimeZone(hContact, p, szProto); + TZ_LoadTimeZone(hContact, p); return p->bStatusMsgValid; } -/* - * load time zone information for the contact - * if TzName is set, use it. It has to be a standard windows time zone name - * Currently, it can only be set by using UserInfoEx plugin - * - * Fallback: use ordinary GMT offsets (incorrect, in some cases due to DST - * differences. - */ - -static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c, const char *szProto) -{ - DWORD flags = 0; - if (cfg::dat.bShowLocalTimeSelective) - flags |= TZF_DIFONLY; - c->hTimeZone = tmi.createByContact(hContact, 0, flags); -} - void ReloadExtraInfo(MCONTACT hContact) { if (hContact && pcli->hwndContactTree) { TExtraCache *p = cfg::getCache(hContact, NULL); if (p) { - char *szProto = GetContactProto(hContact); - - TZ_LoadTimeZone(hContact, p, szProto); + TZ_LoadTimeZone(hContact, p); InvalidateRect(pcli->hwndContactTree, NULL, FALSE); } } @@ -414,7 +410,7 @@ void GetExtendedInfo(ClcContact *contact, ClcData *dat) p->isChatRoom = cfg::getByte(contact->hContact, contact->proto, "ChatRoom", 0); } -void LoadSkinItemToCache(TExtraCache *cEntry, const char *szProto) +void LoadSkinItemToCache(TExtraCache *cEntry) { MCONTACT hContact = cEntry->hContact; @@ -457,7 +453,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str { int dbHidden = cfg::getByte(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. int filterResult = 1; - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; char szTemp[64]; TCHAR szGroupMask[256]; DWORD dwLocalMask; @@ -467,7 +463,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str if (dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact)) return 1; - if ( !cfg::dat.bFilterEffective) + if (!cfg::dat.bFilterEffective) return dbHidden; if (szProto == NULL) @@ -488,7 +484,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str 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)) { mir_sntprintf(szGroupMask, 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/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index a969811aea..58dd19c2b8 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -420,7 +420,6 @@ static INT_PTR CALLBACK DlgProcDspAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { LRESULT sel = SendDlgItemMessage(hwndDlg, IDC_ALIGNMENT, CB_GETCURSEL, 0, 0); - DWORD flags = 0; if (sel != CB_ERR) { cfg::dat.dwFlags &= ~(CLUI_FRAME_AVATARSLEFT | CLUI_FRAME_AVATARSRIGHT | CLUI_FRAME_AVATARSRIGHTWITHNICK); if (sel == 1) @@ -471,7 +470,7 @@ static INT_PTR CALLBACK DlgProcDspAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam return FALSE; } -static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: @@ -512,7 +511,7 @@ static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE; } -int ClcOptInit(WPARAM wParam, LPARAM lParam) +int ClcOptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = g_hInst; diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 0c2ec8590b..23d0f0c802 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -84,22 +84,22 @@ static void __inline SetHotTrackColour(HDC hdc, struct ClcData *dat) g = GetGValue(dat->hotTextColour) * oldLum / newLum; b = GetBValue(dat->hotTextColour) * oldLum / newLum; if (r > 255) { - g +=(r-255)*3 / 7; - b +=(r-255)*3 / 7; + g += (r - 255) * 3 / 7; + b += (r - 255) * 3 / 7; r = 255; } if (g > 255) { - r +=(g-255)*59 / 41; + r += (g - 255) * 59 / 41; if (r > 255) r = 255; - b +=(g-255)*59 / 41; + b += (g - 255) * 59 / 41; g = 255; } if (b > 255) { - r +=(b-255)*11 / 89; + r += (b - 255) * 11 / 89; if (r > 255) r = 255; - g +=(b-255)*11 / 89; + g += (b - 255) * 11 / 89; if (g > 255) g = 255; b = 255; @@ -161,11 +161,11 @@ static int __fastcall GetGeneralisedStatus(void) static int __fastcall GetRealStatus(ClcContact *contact, int status) { char *szProto = contact->proto; - if ( !szProto) + if (!szProto) return status; for (int i = 0; i < pcli->hClcProtoCount; i++) - if ( !mir_strcmp(pcli->clcProto[i].szProto, szProto)) + if (!mir_strcmp(pcli->clcProto[i].szProto, szProto)) return pcli->clcProto[i].dwStatus; return status; @@ -198,7 +198,6 @@ int GetBasicFontID(ClcContact * contact) void PaintNotifyArea(HDC hDC, RECT *rc) { - struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(pcli->hwndContactTree, 0); static int ev_lastIcon = 0; rc->left += 26; @@ -214,7 +213,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc) ev_lastIcon = cfg::dat.hIconNotify; } else if (iCount > 0) { - MENUITEMINFO mii = {0}; + MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; GetMenuItemInfo(cfg::dat.hMenuNotify, iCount - 1, TRUE, &mii); @@ -236,7 +235,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc) } } -static BLENDFUNCTION bf = {0, 0, AC_SRC_OVER, 0}; +static BLENDFUNCTION bf = { 0, 0, AC_SRC_OVER, 0 }; static BOOL avatar_done = FALSE; HDC g_HDC; static BOOL g_RTL; @@ -265,7 +264,7 @@ 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)) { @@ -306,7 +305,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; } @@ -340,7 +339,7 @@ static int __fastcall DrawAvatar(HDC hdcMem, RECT *rc, ClcContact *contact, int if (cfg::dat.dwFlags & CLUI_FRAME_AVATARBORDER) { if (g_RTL) - OffsetRgn(rgn, -1 , 0); + OffsetRgn(rgn, -1, 0); FrameRgn(hdcMem, rgn, cfg::dat.hBrushAvatarBorder, 1, 1); } @@ -355,10 +354,10 @@ 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; + HDC hdcTemp = 0; HBITMAP hbmOld, hbmTemp; g_inCLCpaint = FALSE; @@ -413,9 +412,7 @@ int g_padding_y = 0; void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int indent, int y, struct ClcData *dat, int index, HWND hwnd, DWORD style, RECT *clRect, BOOL *bFirstNGdrawn, int groupCountsFontTopShift, int rowHeight) { RECT rc; - SIZE textSize, countsSize, spaceSize; - int width; - char *szCounts; + SIZE textSize = { 0 }, countsSize = { 0 }, spaceSize = { 0 }; int fontHeight; BOOL twoRows = FALSE; DWORD leftOffset = 0, rightOffset = 0; @@ -508,9 +505,10 @@ set_bg_l: else ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight); + char *szCounts = NULL; if (type == CLCIT_GROUP) { GetTextExtentPoint32(hdcMem, contact->szText, (int)mir_tstrlen(contact->szText), &textSize); - width = textSize.cx; + int width = textSize.cx; szCounts = pcli->pfnGetGroupCountsText(dat, contact); if (szCounts[0]) { GetTextExtentPoint32(hdcMem, _T(" "), 1, &spaceSize); @@ -547,7 +545,7 @@ set_bg_l: else { FillRect(hdcMem, &rc, cfg::dat.hBrushCLCBk); if (g_hottrack) - SetHotTrackColour(hdcMem,dat); + SetHotTrackColour(hdcMem, dat); } goto bgskipped; } @@ -564,10 +562,10 @@ set_bg_l: else sitem = arStatusItems[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) { @@ -576,7 +574,7 @@ set_bg_l: SetTextColor(hdcMem, sitem->TEXTCOLOR); } } - else if ( !sitem->IGNORED) + else if (!sitem->IGNORED) SetTextColor(hdcMem, sitem->TEXTCOLOR); sevencontact_pos = arStatusItems[ID_EXTBKEVEN_CNTCTPOS - ID_STATUS_OFFLINE]; @@ -596,7 +594,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; @@ -612,7 +610,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; @@ -636,7 +634,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; @@ -661,7 +659,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; @@ -688,7 +686,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; @@ -714,7 +712,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; @@ -740,7 +738,7 @@ 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; @@ -748,7 +746,7 @@ set_bg_l: 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) { @@ -774,7 +772,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; @@ -785,17 +783,17 @@ set_bg_l: } } else if (contact->group->expanded) { - if ( !sexpanded->IGNORED) { + 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; - rc.bottom = y + rowHeight - (char) sexpanded->MARGIN_BOTTOM; + rc.bottom = y + rowHeight - (char)sexpanded->MARGIN_BOTTOM; DrawAlpha(hdcMem, &rc, sexpanded->COLOR, sexpanded->ALPHA, sexpanded->COLOR2, sexpanded->COLOR2_TRANSPARENT, sexpanded->GRADIENT, sexpanded->CORNER, sexpanded->BORDERSTYLE, sexpanded->imageItem); 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; @@ -809,8 +807,8 @@ set_bg_l: if (selected) { StatusItems_t *sselected = arStatusItems[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; @@ -839,10 +837,10 @@ set_bg_l: 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); + ht->CORNER, ht->BORDERSTYLE, ht->imageItem); } if (g_RTL) @@ -948,7 +946,7 @@ bgskipped: 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); 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); + 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; } } @@ -956,7 +954,7 @@ bgskipped: } contact->extraIconRightBegin = 0; - for (int i = dat->extraColumnsCount-1; i >= 0; i--) { + for (int i = dat->extraColumnsCount - 1; i >= 0; i--) { if (contact->iExtraImage[i] == EMPTY_EXTRA_ICON) continue; @@ -966,7 +964,7 @@ bgskipped: rightIcons++; ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, rcContent.right - dat->extraColumnSpacing * rightIcons, - y + (rowHeight - g_cysmIcon)/2, + y + (rowHeight - g_cysmIcon) / 2, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); } @@ -984,15 +982,14 @@ bgskipped: } else if (type == CLCIT_GROUP) { RECT rc; - int leftMargin = 0, countStart = 0, leftLineEnd, rightLineStart; + int leftLineEnd = 0, rightLineStart; fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight; rc.top = y + ((rowHeight - fontHeight) >> 1) + cfg::dat.group_padding; rc.bottom = rc.top + textSize.cy; if (szCounts[0]) { - int required, labelWidth, offset = 0; - int height = 0; COLORREF clr = GetTextColor(hdcMem); + int height = 0; ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &height); if (oldGroupColor != -1) SetTextColor(hdcMem, clr); @@ -1003,14 +1000,13 @@ bgskipped: if (indent == 0 && iconXSpace == 0) rc.left += 2; - required = textSize.cx + countsSize.cx + spaceSize.cx; + int required = textSize.cx + countsSize.cx + spaceSize.cx; if (required > rc.right - rc.left) textSize.cx = (rc.right - rc.left) - countsSize.cx - spaceSize.cx; - labelWidth = textSize.cx + countsSize.cx + spaceSize.cx; - if (g_center) - offset = ((rc.right - rc.left) - labelWidth) / 2; + int labelWidth = textSize.cx + countsSize.cx + spaceSize.cx; + int offset = (g_center) ? ((rc.right - rc.left) - labelWidth) / 2 : 0; TextOutA(hdcMem, rc.left + offset + textSize.cx + spaceSize.cx, rc.top + groupCountsFontTopShift, szCounts, (int)mir_strlen(szCounts)); rightLineStart = rc.left + offset + textSize.cx + spaceSize.cx + countsSize.cx + 2; @@ -1050,7 +1046,7 @@ bgskipped: } 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 - rightIcons*dat->extraColumnSpacing - dat->rightMargin; @@ -1077,7 +1073,7 @@ bgskipped: // avatar - if ( !dat->bisEmbedded) { + if (!dat->bisEmbedded) { if (av_local_wanted && !avatar_done && pi_avatar) { if (av_rightwithnick) { RECT rcAvatar = rcContent; @@ -1093,7 +1089,7 @@ bgskipped: } // 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; @@ -1109,7 +1105,6 @@ bgskipped: fLocalTime = cEntry->dwDFlags & ECF_FORCELOCALTIME ? 1 : 0; if (cEntry->hTimeZone && fLocalTime) { - DWORD now = cfg::dat.t_now; SIZE szTime; RECT rc = rcContent; int fHeight = 0; @@ -1122,7 +1117,7 @@ bgskipped: int idOldFont = dat->currentFontID; ChangeToFont(hdcMem, dat, FONTID_TIMESTAMP, &fHeight); GetTextExtentPoint32(hdcMem, szResult, (int)mir_tstrlen(szResult), &szTime); - verticalfit = (rowHeight - fHeight >= g_cysmIcon+1); + verticalfit = (rowHeight - fHeight >= g_cysmIcon + 1); if (av_right) { if (verticalfit) @@ -1150,15 +1145,15 @@ bgskipped: ChangeToFont(hdcMem, dat, idOldFont, 0); SetTextColor(hdcMem, oldColor); - verticalfit = (rowHeight - fontHeight >= g_cysmIcon+1); + verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1); if (verticalfit && av_right) rcContent.right = min(clRect->right - cfg::dat.avatarSize - 2, rc.left - 2); else if (verticalfit && !av_rightwithnick) rcContent.right = min(clRect->right - dat->rightMargin, rc.left - 3); } else { -nodisplay: - verticalfit = (rowHeight - fontHeight >= g_cysmIcon+1); + nodisplay: + verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1); if (avatar_done) { if (verticalfit && av_right) rcContent.right = clRect->right - cfg::dat.avatarSize - 2; @@ -1199,7 +1194,7 @@ nodisplay: if ((rcContent.bottom - rcContent.top) < (2 * statusFontHeight) - 2) DrawText(hdcMem, szText, -1, &rcContent, dtFlags | dt_2ndrowflags); else { - DRAWTEXTPARAMS dtp = {0}; + DRAWTEXTPARAMS dtp = { 0 }; LONG rightIconsTop = rcContent.bottom - g_cysmIcon; LONG old_right = rcContent.right; ULONG textCounter = 0; @@ -1219,7 +1214,7 @@ nodisplay: rcContent.top += statusFontHeight; textCounter += dtp.uiLengthDrawn; } - while (textCounter <= ulLen && dtp.uiLengthDrawn && rcContent.top + statusFontHeight <= old_bottom); + while (textCounter <= ulLen && dtp.uiLengthDrawn && rcContent.top + statusFontHeight <= old_bottom); } } } @@ -1259,7 +1254,7 @@ nodisplay: void SkinDrawBg(HWND hwnd, HDC hdc) { RECT rcCl; - POINT ptTest = {0}; + POINT ptTest = { 0 }; ClientToScreen(hwnd, &ptTest); GetClientRect(hwnd, &rcCl); @@ -1345,7 +1340,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) SetBkMode(hdcMem, TRANSPARENT); HBRUSH hBrush = CreateSolidBrush(tmpbkcolour); - HBRUSH hoBrush = (HBRUSH) SelectObject(hdcMem, hBrush); + HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBrush); FillRect(hdcMem, rcPaint, hBrush); SelectObject(hdcMem, hoBrush); @@ -1427,17 +1422,17 @@ bgdone: ClcGroup *group = &dat->list; group->scanIndex = 0; - if ( dat->row_heights == NULL ) + if (dat->row_heights == NULL) RowHeight::calcRowHeights(dat, hwnd); group = &dat->list; group->scanIndex = 0; g_list_avatars = 0; - while(TRUE) { - if (group->scanIndex==group->cl.count) { - group=group->parent; - if (group==NULL) break; // Finished list + while (true) { + if (group->scanIndex == group->cl.count) { + group = group->parent; + if (group == NULL) break; // Finished list group->scanIndex++; continue; } @@ -1446,8 +1441,8 @@ bgdone: g_list_avatars++; if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) { - group=group->cl.items[group->scanIndex]->group; - group->scanIndex=0; + group = group->cl.items[group->scanIndex]->group; + group->scanIndex = 0; continue; } group->scanIndex++; @@ -1471,12 +1466,12 @@ bgdone: line_num++; if (cfg::dat.bForceRefetchOnPaint) - group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry*)-1; + group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry*) - 1; if (y > rcPaint->top - dat->row_heights[line_num] && y <= rcPaint->bottom) { - if (group->cl.items[group->scanIndex]->ace == (struct avatarCacheEntry*)-1 ) + if (group->cl.items[group->scanIndex]->ace == (struct avatarCacheEntry*) - 1) group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)group->cl.items[group->scanIndex]->hContact, 0); - RowHeight::getRowHeight(dat, hwnd, group->cl.items[group->scanIndex], line_num, style); + RowHeight::getRowHeight(dat, group->cl.items[group->scanIndex], line_num, style); PaintItem(hdcMem, group, group->cl.items[group->scanIndex], indent, y, dat, index, hwnd, style, &clRect, &bFirstNGdrawn, groupCountsFontTopShift, dat->row_heights[line_num]); } index++; @@ -1509,12 +1504,12 @@ bgdone: pts[7].x = pts[0].x; pts[7].y = pts[4].y; HRGN hRgn = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE); HBRUSH hBrush = CreateSolidBrush(dat->fontInfo[FONTID_CONTACTS].colour); - HBRUSH hoBrush = (HBRUSH) SelectObject(hdcMem, hBrush); + HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBrush); FillRgn(hdcMem, hRgn, hBrush); 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); @@ -1523,7 +1518,7 @@ bgdone: DeleteDC(hdcMem); if (grey) { PBYTE bits; - BITMAPINFOHEADER bmih = {0}; + BITMAPINFOHEADER bmih = { 0 }; int i; int greyRed, greyGreen, greyBlue; @@ -1534,8 +1529,8 @@ bgdone: bmih.biHeight = -clRect.bottom; bmih.biPlanes = 1; bmih.biWidth = clRect.right; - bits = (PBYTE) mir_alloc(4 * bmih.biWidth * -bmih.biHeight); - GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *) &bmih, DIB_RGB_COLORS); + bits = (PBYTE)mir_alloc(4 * bmih.biWidth * -bmih.biHeight); + GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *)&bmih, DIB_RGB_COLORS); greyColour = GetSysColor(COLOR_3DFACE); greyRed = GetRValue(greyColour) * 2; greyGreen = GetGValue(greyColour) * 2; @@ -1549,7 +1544,7 @@ bgdone: bits[i + 1] = divide3[bits[i + 1] + greyGreen]; bits[i + 2] = divide3[bits[i + 2] + greyRed]; } - SetDIBitsToDevice(hdc, 0, 0, clRect.right, clRect.bottom, 0, 0, 0, clRect.bottom, bits, (BITMAPINFO *) &bmih, DIB_RGB_COLORS); + SetDIBitsToDevice(hdc, 0, 0, clRect.right, clRect.bottom, 0, 0, 0, clRect.bottom, bits, (BITMAPINFO *)&bmih, DIB_RGB_COLORS); mir_free(bits); } DeleteObject(hBmpOsb); diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 4f90f28bdf..86e9ae8c5e 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -102,7 +102,7 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) * shares all the init stuff with HitTest() */ -int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *hitcontact, DWORD *flags, int indent, int hit) +int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, ClcContact *hitcontact, DWORD *flags, int indent, int hit) { RECT clRect; int right, checkboxWidth, width; @@ -196,9 +196,9 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags) { - ClcContact *hitcontact; - ClcGroup *hitgroup; - int hit, indent, width, i; + ClcContact *hitcontact = NULL; + ClcGroup *hitgroup = NULL; + int indent, width, i; int checkboxWidth; SIZE textSize; RECT clRect; @@ -227,7 +227,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c *flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE; return -1; } - hit = RowHeight::hitTest(dat, dat->yScroll + testy); + int hit = RowHeight::hitTest(dat, dat->yScroll + testy); if (hit != -1) hit = pcli->pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup); @@ -241,17 +241,17 @@ 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 (hitcontact->type == CLCIT_CONTACT) { if (mirror_mode == 1 || (mirror_mode == 2 && hitcontact->pExtra->dwCFlags & ECF_RTLNICK)) - return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit); + return RTL_HitTest(hwnd, dat, testx, hitcontact, flags, indent, hit); } else if (hitcontact->type == CLCIT_GROUP) { if (cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO)) - return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit); + return RTL_HitTest(hwnd, dat, testx, hitcontact, flags, indent, hit); } } diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 70a4938446..4b983cf631 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -48,7 +48,7 @@ void DestroyTrayMenu(HMENU hMenu) DestroyMenu(hMenu); } -INT_PTR CloseAction(WPARAM wParam, LPARAM lParam) +INT_PTR CloseAction(WPARAM, LPARAM) { int k; cfg::shutDown = 1; @@ -117,8 +117,6 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA TCHAR szTitle[512]; DWORD dwFlags = cfg::getDword(hContact, "CList", "CLN_Flags", 0); BYTE bSecondLine = cfg::getByte(hContact, "CList", "CLN_2ndline", -1); - DWORD dwXMask = cfg::getDword(hContact, "CList", "CLN_xmask", 0); - int i = 0; mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("Contact list display and ignore options for %s"), contact ? contact->szText : (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)); @@ -168,23 +166,29 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case IDC_IGN_PRIORITY: SendMessage(pcli->hwndContactTree, CLM_TOGGLEPRIORITYCONTACT, hContact, 0); return 0; + case IDC_IGN_ALL: SendMessage(hWnd, WM_USER + 100, hContact, (LPARAM)0xffffffff); return 0; + case IDC_IGN_NONE: SendMessage(hWnd, WM_USER + 100, hContact, 0); return 0; + case IDC_IGN_ALWAYSONLINE: if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSONLINE)) CheckDlgButton(hWnd, IDC_IGN_ALWAYSOFFLINE, FALSE); break; + case IDC_IGN_ALWAYSOFFLINE: if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE)) CheckDlgButton(hWnd, IDC_IGN_ALWAYSONLINE, FALSE); break; + case IDC_HIDECONTACT: cfg::writeByte(hContact, "CList", "Hidden", (BYTE)(IsDlgButtonChecked(hWnd, IDC_HIDECONTACT) ? 1 : 0)); break; + case IDC_IGN_ADDPERMANENTLY: { ADDCONTACTSTRUCT acs = {0}; @@ -192,18 +196,16 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA acs.handleType = HANDLE_CONTACT; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hWnd, (LPARAM)&acs); Utils::enableDlgControl(hWnd, IDC_IGN_ADDPERMANENTLY, cfg::getByte(hContact, "CList", "NotOnList", 0)); - break; } + break; + case IDC_DSP_LOADDEFAULT: - { - int i = 0; + SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 0, 0); + 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); + break; - SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_SETCURSEL, 0, 0); - 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); - break; - } case IDOK: { DWORD newMask = 0; @@ -217,7 +219,6 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA LRESULT iSel = SendDlgItemMessage(hWnd, IDC_AVATARDISPMODE, CB_GETCURSEL, 0, 0); DWORD dwFlags = cfg::getDword(hContact, "CList", "CLN_Flags", 0), dwXMask = 0; LRESULT checked = 0; - int i = 0; FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL); if (iSel != CB_ERR) { @@ -322,15 +323,13 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA if (FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL)) { if (contact) { - WORD wApparentMode = 0, oldApparentMode = cfg::getWord(hContact, contact->proto, "ApparentMode", 0); + WORD wApparentMode = 0; if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSONLINE)) wApparentMode = ID_STATUS_ONLINE; else if (IsDlgButtonChecked(hWnd, IDC_IGN_ALWAYSOFFLINE)) wApparentMode = ID_STATUS_OFFLINE; - //db_set_w(hContact, contact->proto, "ApparentMode", wApparentMode); - //if (oldApparentMode != wApparentMode) CallContactService(hContact, PSS_SETAPPARENTMODE, (WPARAM)wApparentMode, 0); SendMessage(hWnd, WM_USER + 120, 0, 0); } @@ -356,7 +355,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA * * if dialog is already open, focus it. */ -static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM lParam) +static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM) { HWND hWnd = 0; diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 897f6cfc00..170a35c1b7 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -39,7 +39,7 @@ extern int g_maxStatus; extern HANDLE hSvc_GetContactStatusMsg; extern ImageItem *g_CLUIImageItem; -static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) +static INT_PTR GetStatusMode(WPARAM, LPARAM) { return(g_maxStatus == ID_STATUS_OFFLINE ? pcli->currentDesiredStatusMode : g_maxStatus); } @@ -74,12 +74,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON return coreCli.pfnIconFromStatusMode(szFinalProto, finalStatus, hContact); } -static int MenuItem_LockAvatar(WPARAM wParam, LPARAM lParam) -{ - return 0; -} - -static int ContactListShutdownProc(WPARAM wParam, LPARAM lParam) +static int ContactListShutdownProc(WPARAM, LPARAM) { UninitCustomMenus(); return 0; @@ -124,7 +119,7 @@ Begin of Hrk's code for bug int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) { - RECT rc = { 0 }, rcUpdate = { 0 }; + RECT rc = { 0 }; POINT pt = { 0 }; register int i = 0, j = 0, width = 0, height = 0, iCountedDots = 0, iNotCoveredDots = 0; BOOL bPartiallyCovered = FALSE; @@ -201,7 +196,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) return GWVS_PARTIALLY_COVERED; } -int ShowHide(WPARAM wParam, LPARAM lParam) +int ShowHide(WPARAM, LPARAM) { BOOL bShow = FALSE; diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index 25334d1839..522e52109c 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -196,7 +196,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP cfg::writeDword("CLUI", "Frameflags", cfg::dat.dwFlags); ConfigureFrame(); ConfigureCLUIGeometry(1); - ConfigureEventArea(pcli->hwndContactList); + ConfigureEventArea(); HideShowNotifyFrame(); SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 9db9a3bfa1..17e455a182 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -116,7 +116,6 @@ static void Tweak_It(COLORREF clr) static void LayoutButtons(HWND hwnd, RECT *rc) { RECT rect; - BYTE rightButton = 1, leftButton = 0; BYTE left_offset = cfg::dat.bCLeft - (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? 3 : 0); BYTE right_offset = cfg::dat.bCRight - (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? 3 : 0); BYTE delta = left_offset + right_offset; @@ -147,7 +146,7 @@ static void LayoutButtons(HWND hwnd, RECT *rc) } -static int FS_FontsChanged(WPARAM wParam, LPARAM lParam) +static int FS_FontsChanged(WPARAM, LPARAM) { COLORREF clr_cluiframes = cfg::getDword("CLUI", "clr_frameborder", RGB(40, 40, 40)); @@ -178,14 +177,13 @@ static HWND PreCreateCLC(HWND parent) } // create internal frames, including the last frame (actual CLC control) -static int CreateCLC(HWND parent) +static int CreateCLC() { pcli->pfnReloadExtraIcons(); CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)oldhideoffline, 0); disableautoupd = 0; - { - CLISTFrame frame = {0}; + CLISTFrame frame = { 0 }; frame.cbSize = sizeof(frame); frame.tname = _T("EventArea"); frame.TBtname = TranslateT("Event area"); @@ -200,10 +198,8 @@ static int CreateCLC(HWND parent) HideShowNotifyFrame(); CreateViewModeFrame(); } - { - CLISTFrame Frame = {0}; - memset(&Frame, 0, sizeof(Frame)); + CLISTFrame Frame = { 0 }; Frame.cbSize = sizeof(CLISTFrame); Frame.hWnd = pcli->hwndContactTree; Frame.align = alClient; @@ -213,7 +209,6 @@ static int CreateCLC(HWND parent) Frame.TBtname = TranslateT("My contacts"); Frame.height = 200; hFrameContactTree = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0); - //free(Frame.name); CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_TBTIPNAME, hFrameContactTree), (LPARAM)Translate("My contacts")); // ugly, but working hack. Prevent that annoying little scroll bar from appearing in the "My Contacts" title bar @@ -315,7 +310,7 @@ void CLN_LoadAllIcons(BOOL mode) CacheClientIcons(); } -void ConfigureEventArea(HWND hwnd) +void ConfigureEventArea() { int iCount = GetMenuItemCount(cfg::dat.hMenuNotify); DWORD dwFlags = cfg::dat.dwFlags; @@ -368,8 +363,7 @@ void ConfigureCLUIGeometry(int mode) GetWindowRect(pcli->hwndStatus, &rcStatus); cfg::dat.statusBarHeight = (rcStatus.bottom - rcStatus.top); } - else - cfg::dat.statusBarHeight = 0; + else cfg::dat.statusBarHeight = 0; } cfg::dat.topOffset = cfg::dat.bCTop; @@ -430,21 +424,20 @@ void SetDBButtonStates(MCONTACT hPassedContact) } else { switch (buttonItem->type) { - case DBVT_BYTE: { - BYTE val = cfg::getByte(hFinalContact, szModule, szSetting, 0); - result = (val == buttonItem->bValuePush[0]); - break; - } - case DBVT_WORD: { - WORD val = cfg::getWord(hFinalContact, szModule, szSetting, 0); - result = (val == *((WORD *)&buttonItem->bValuePush)); - break; - } - case DBVT_DWORD: { - DWORD val = cfg::getDword(hFinalContact, szModule, szSetting, 0); - result = (val == *((DWORD *)&buttonItem->bValuePush)); - break; - } + case DBVT_BYTE: { + BYTE val = cfg::getByte(hFinalContact, szModule, szSetting, 0); + result = (val == buttonItem->bValuePush[0]); + break; + } + case DBVT_WORD: { + WORD val = cfg::getWord(hFinalContact, szModule, szSetting, 0); + result = (val == *((WORD *)&buttonItem->bValuePush)); + break; + } + case DBVT_DWORD: + DWORD val = cfg::getDword(hFinalContact, szModule, szSetting, 0); + result = (val == *((DWORD *)&buttonItem->bValuePush)); + break; } } SendMessage(buttonItem->hWnd, BM_SETCHECK, (WPARAM)result, 0); @@ -453,7 +446,7 @@ void SetDBButtonStates(MCONTACT hPassedContact) } // set states of standard buttons (pressed/unpressed) -void SetButtonStates(HWND hwnd) +void SetButtonStates() { ButtonItem *buttonItem = g_ButtonItems; @@ -461,15 +454,15 @@ void SetButtonStates(HWND hwnd) while (buttonItem) { if (buttonItem->dwFlags & BUTTON_ISINTERNAL) { switch (buttonItem->uId) { - case IDC_STBSOUND: - SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED, 0); - break; - case IDC_STBHIDEOFFLINE: - SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::getByte("CList", "HideOffline", 0) ? BST_CHECKED : BST_UNCHECKED, 0); - break; - case IDC_STBHIDEGROUPS: - SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::getByte("CList", "UseGroups", 0) ? BST_CHECKED : BST_UNCHECKED, 0); - break; + case IDC_STBSOUND: + SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED, 0); + break; + case IDC_STBHIDEOFFLINE: + SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::getByte("CList", "HideOffline", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + break; + case IDC_STBHIDEGROUPS: + SendMessage(buttonItem->hWnd, BM_SETCHECK, cfg::getByte("CList", "UseGroups", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + break; } } buttonItem = buttonItem->nextItem; @@ -477,7 +470,7 @@ void SetButtonStates(HWND hwnd) } } -void BlitWallpaper(HDC hdc, RECT *rc, RECT *rcPaint, struct ClcData *dat) +void BlitWallpaper(HDC hdc, RECT *rc, struct ClcData *dat) { int x, y; int bitx, bity; @@ -803,7 +796,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~WS_VISIBLE); SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | WS_CLIPCHILDREN); if (!cfg::dat.bFirstRun) - ConfigureEventArea(hwnd); + ConfigureEventArea(); ConfigureCLUIGeometry(0); CluiProtocolStatusChanged(0, 0); @@ -858,7 +851,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, style); - ApplyCLUIBorderStyle(pcli->hwndContactList); + ApplyCLUIBorderStyle(); SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); } @@ -866,9 +859,9 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (cfg::dat.bSkinnedButtonMode) SetButtonToSkinned(); ConfigureFrame(); - SetButtonStates(hwnd); + SetButtonStates(); - CreateCLC(hwnd); + CreateCLC(); cfg::clcdat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); if (cfg::dat.bFullTransparent) { @@ -1000,7 +993,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { InflateRect(&rcFrame, -1, -1); if (cfg::dat.bmpBackground) - BlitWallpaper(hdc, &rcFrame, &ps.rcPaint, cfg::clcdat); + BlitWallpaper(hdc, &rcFrame, cfg::clcdat); cfg::dat.ptW.x = cfg::dat.ptW.y = 0; ClientToScreen(hwnd, &cfg::dat.ptW); } @@ -1011,7 +1004,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } else if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) { if (cfg::dat.bmpBackground) - BlitWallpaper(hdc, &rcFrame, &ps.rcPaint, cfg::clcdat); + BlitWallpaper(hdc, &rcFrame, cfg::clcdat); cfg::dat.ptW.x = cfg::dat.ptW.y = 0; ClientToScreen(hwnd, &cfg::dat.ptW); } @@ -1051,17 +1044,6 @@ skipbg: case WM_SIZING: break; - /* - RECT *szrect = (RECT *)lParam; - if (Docking_IsDocked(0, 0)) - break; - g_SizingRect = *((RECT *)lParam); - if (wParam != WMSZ_BOTTOM && wParam != WMSZ_BOTTOMRIGHT && wParam != WMSZ_BOTTOMLEFT) - szrect->bottom = g_PreSizeRect.bottom; - if (wParam != WMSZ_RIGHT && wParam != WMSZ_BOTTOMRIGHT && wParam != WMSZ_TOPRIGHT) - szrect->right = g_PreSizeRect.right; - */ - return TRUE; case WM_WINDOWPOSCHANGED: if (Docking_IsDocked(0, 0)) @@ -1200,7 +1182,6 @@ skipbg: LRESULT result; RECT r; POINT pt; - int k = 0; int clip = cfg::dat.bClipBorder; GetWindowRect(hwnd, &r); @@ -1276,17 +1257,8 @@ skipbg: if (cfg::dat.forceResize && wParam != SW_HIDE) { cfg::dat.forceResize = FALSE; - if (0) { //!g_CluiData.fadeinout && MySetLayeredWindowAttributes && g_CluiData.bLayeredHack) { - SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), 0, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); - SendMessage(hwnd, WM_SIZE, 0, 0); - ShowWindow(hwnd, SW_SHOW); - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); - SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), 255, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); - } - else { - SendMessage(hwnd, WM_SIZE, 0, 0); - PostMessage(hwnd, CLUIINTM_REDRAW, 0, 0); - } + SendMessage(hwnd, WM_SIZE, 0, 0); + PostMessage(hwnd, CLUIINTM_REDRAW, 0, 0); } PostMessage(hwnd, CLUIINTM_REMOVEFROMTASKBAR, 0, 0); @@ -1321,9 +1293,7 @@ skipbg: } SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(sourceAlpha + (destAlpha - sourceAlpha) * (int)(thisTick - startTick) / 200), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } - SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)destAlpha, LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0)); } - return DefWindowProc(hwnd, msg, wParam, lParam); case WM_SYSCOMMAND: { @@ -1563,7 +1533,7 @@ buttons_done: cfg::writeByte("CList", "UseGroups", (BYTE)newVal); SendMessage(pcli->hwndContactTree, CLM_SETUSEGROUPS, newVal, 0); ClcSetButtonState(IDC_TBHIDEGROUPS, newVal); - SetButtonStates(hwnd); + SetButtonStates(); } break; case POPUP_HIDEMIRANDA: @@ -1590,7 +1560,7 @@ buttons_done: ConfigureFrame(); ConfigureCLUIGeometry(1); } - ConfigureEventArea(pcli->hwndContactList); + ConfigureEventArea(); PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); } @@ -1691,8 +1661,6 @@ buttons_done: LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; if (hbmLockedPoint == 0) { - RECT rc = {0, 0, 5, 5}; - hdcLockedPoint = CreateCompatibleDC(dis->hDC); hbmLockedPoint = CreateCompatibleBitmap(dis->hDC, 5, 5); hbmOldLockedPoint = reinterpret_cast(SelectObject(hdcLockedPoint, hbmLockedPoint)); @@ -1860,9 +1828,6 @@ static BOOL g_AboutDlgActive = 0; INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - COLORREF url_visited = RGB(128, 0, 128); - COLORREF url_unvisited = RGB(0, 0, 255); - switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -1944,14 +1909,14 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return FALSE; } -static INT_PTR CLN_ShowAbout(WPARAM wParam, LPARAM lParam) +static INT_PTR CLN_ShowAbout(WPARAM, LPARAM) { if (!g_AboutDlgActive) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CLNABOUT), 0, DlgProcAbout, 0); return 0; } -static INT_PTR CLN_ShowMainMenu(WPARAM wParam, LPARAM lParam) +static INT_PTR CLN_ShowMainMenu(WPARAM, LPARAM) { HMENU hMenu; POINT pt; @@ -1962,7 +1927,7 @@ static INT_PTR CLN_ShowMainMenu(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR CLN_ShowStatusMenu(WPARAM wParam, LPARAM lParam) +static INT_PTR CLN_ShowStatusMenu(WPARAM, LPARAM) { HMENU hMenu; POINT pt; diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp index 63690bd155..a178c49ae3 100644 --- a/plugins/Clist_nicer/src/cluiopts.cpp +++ b/plugins/Clist_nicer/src/cluiopts.cpp @@ -232,7 +232,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l cfg::writeByte("CLUI", "ShowMainMenu", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); cfg::writeByte("CLUI", "ClientAreaDrag", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); - ApplyCLUIBorderStyle(pcli->hwndContactList); + ApplyCLUIBorderStyle(); if (!IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList, NULL); @@ -431,7 +431,7 @@ DWORD GetCLUIWindowStyle(BYTE style) return dwBasic; } -void ApplyCLUIBorderStyle(HWND hwnd) +void ApplyCLUIBorderStyle() { BYTE windowStyle = cfg::getByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_TOOLWINDOW); WINDOWPLACEMENT p; diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 0e00590c7d..a03ec9a2d6 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -29,7 +29,7 @@ extern HIMAGELIST hCListImages; extern ButtonItem *g_ButtonItems; extern PLUGININFOEX pluginInfo; -static INT_PTR GetClistVersion(WPARAM wParam, LPARAM lParam) +static INT_PTR GetClistVersion(WPARAM, LPARAM lParam) { static char g_szVersionString[256]; @@ -58,7 +58,7 @@ void FreeProtocolData(void) int g_maxStatus = ID_STATUS_OFFLINE; char g_maxProto[100] = ""; -void CluiProtocolStatusChanged(int parStatus, const char* szProto) +void CluiProtocolStatusChanged(int, const char*) { int maxOnline = 0, onlineness = 0; WORD maxStatus = ID_STATUS_OFFLINE; @@ -198,7 +198,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) } // update the clui button - WORD wStatus; + WORD wStatus = 0; if (!db_get(NULL, "CList", "PrimaryStatus", &dbv)) { if (dbv.type == DBVT_ASCIIZ && mir_strlen(dbv.pszVal) > 1) { wStatus = (WORD)CallProtoService(dbv.pszVal, PS_GETSTATUS, 0, 0); diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 6332c2879f..682a1b85ed 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -163,7 +163,7 @@ TExtraCache* cfg::getCache(const MCONTACT hContact, const char *szProto) mir_cslock lck(cachecs); TExtraCache *p = (TExtraCache*)calloc(sizeof(TExtraCache), 1); p->hContact = hContact; - LoadSkinItemToCache(p, szProto); + LoadSkinItemToCache(p); p->dwDFlags = db_get_dw(hContact, "CList", "CLN_Flags", 0); GetCachedStatusMsg(p, const_cast(szProto)); p->dwLastMsgTime = INTSORT_GetLastMsgTime(hContact); @@ -175,9 +175,7 @@ void ReloadSkinItemsToCache() { for (int i = 0; i < cfg::arCache.getCount(); i++) { TExtraCache *p = cfg::arCache[i]; - char *szProto = GetContactProto(p->hContact); - if (szProto) - LoadSkinItemToCache(p, szProto); + LoadSkinItemToCache(p); } } @@ -253,7 +251,7 @@ void API::Ex_CopyEditToClipboard(HWND hWnd) SendMessage(hWnd, EM_SETSEL, 0, 0); } -INT_PTR CALLBACK API::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK API::Ex_DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM) { WORD wNotifyCode, wID; diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index be94835dbd..6ac29ee5df 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -24,19 +24,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -struct { - int status,order; -} statusModeOrder[]={ - {ID_STATUS_OFFLINE,500}, - {ID_STATUS_ONLINE,10}, - {ID_STATUS_AWAY,200}, - {ID_STATUS_DND,110}, - {ID_STATUS_NA,450}, - {ID_STATUS_OCCUPIED,100}, - {ID_STATUS_FREECHAT,0}, - {ID_STATUS_INVISIBLE,20}, - {ID_STATUS_ONTHEPHONE,150}, - {ID_STATUS_OUTTOLUNCH,425} +struct +{ + int status, order; +} statusModeOrder[] = { + { ID_STATUS_OFFLINE, 500 }, + { ID_STATUS_ONLINE, 10 }, + { ID_STATUS_AWAY, 200 }, + { ID_STATUS_DND, 110 }, + { ID_STATUS_NA, 450 }, + { ID_STATUS_OCCUPIED, 100 }, + { ID_STATUS_FREECHAT, 0 }, + { ID_STATUS_INVISIBLE, 20 }, + { ID_STATUS_ONTHEPHONE, 150 }, + { ID_STATUS_OUTTOLUNCH, 425 } }; static int GetContactStatus(MCONTACT hContact) @@ -63,40 +64,39 @@ HANDLE hThreadMFUpdate = 0; static void MF_CalcFrequency(MCONTACT hContact, DWORD dwCutoffDays, int doSleep) { - DWORD curTime = time(NULL); - DWORD frequency, eventCount; - HANDLE hEvent = db_event_last(hContact); - DWORD firstEventTime = 0, lastEventTime = 0; - - eventCount = 0; - - DBEVENTINFO dbei = { sizeof(dbei) }; - while(hEvent) { - db_event_get(hEvent, &dbei); - - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { // record time of last event - eventCount++; - } - if (eventCount >= 100 || dbei.timestamp < curTime - (dwCutoffDays * 86400)) - break; - hEvent = db_event_prev(hContact, hEvent); - if (doSleep && mf_updatethread_running == FALSE) - return; - if (doSleep) - Sleep(100); - } - - if (eventCount == 0) { - frequency = 0x7fffffff; - cfg::writeDword(hContact, "CList", "mf_firstEvent", curTime - (dwCutoffDays * 86400)); - } - else { - frequency = (curTime - dbei.timestamp) / eventCount; - cfg::writeDword(hContact, "CList", "mf_firstEvent", dbei.timestamp); - } - - cfg::writeDword(hContact, "CList", "mf_freq", frequency); - cfg::writeDword(hContact, "CList", "mf_count", eventCount); + DWORD curTime = time(NULL); + DWORD frequency, eventCount; + HANDLE hEvent = db_event_last(hContact); + + eventCount = 0; + + DBEVENTINFO dbei = { sizeof(dbei) }; + while (hEvent) { + db_event_get(hEvent, &dbei); + + if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { // record time of last event + eventCount++; + } + if (eventCount >= 100 || dbei.timestamp < curTime - (dwCutoffDays * 86400)) + break; + hEvent = db_event_prev(hContact, hEvent); + if (doSleep && mf_updatethread_running == FALSE) + return; + if (doSleep) + Sleep(100); + } + + if (eventCount == 0) { + frequency = 0x7fffffff; + cfg::writeDword(hContact, "CList", "mf_firstEvent", curTime - (dwCutoffDays * 86400)); + } + else { + frequency = (curTime - dbei.timestamp) / eventCount; + cfg::writeDword(hContact, "CList", "mf_firstEvent", dbei.timestamp); + } + + cfg::writeDword(hContact, "CList", "mf_freq", frequency); + cfg::writeDword(hContact, "CList", "mf_count", eventCount); } extern TCHAR g_ptszEventName[]; @@ -108,7 +108,7 @@ void MF_UpdateThread(LPVOID) WaitForSingleObject(hEvent, 20000); ResetEvent(hEvent); - while(mf_updatethread_running) { + while (mf_updatethread_running) { for (MCONTACT hContact = db_find_first(); hContact && mf_updatethread_running; hContact = db_find_next(hContact)) { MF_CalcFrequency(hContact, 50, 1); if (mf_updatethread_running) @@ -126,10 +126,9 @@ void LoadContactTree(void) { int i, status, hideOffline; BYTE bMsgFrequency = cfg::getByte("CList", "fhistdata", 0); - DBVARIANT dbv = { 0 }; CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0); - for (i = 1; ; i++) { + for (i = 1;; i++) { if (pcli->pfnGetGroupName(i, NULL) == NULL) break; CallService(MS_CLUI_GROUPADDED, i, 0); @@ -143,7 +142,7 @@ void LoadContactTree(void) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(GetContactProto(hContact), status, hContact, NULL), 1); // build initial data for message frequency - if ( !bMsgFrequency) + if (!bMsgFrequency) MF_CalcFrequency(hContact, 100, 0); } cfg::writeByte("CList", "fhistdata", 1); @@ -163,11 +162,11 @@ DWORD INTSORT_GetLastMsgTime(MCONTACT hContact) int __forceinline GetProtoIndex(char * szName) { - if ( !szName ) + if (!szName) return -1; - PROTOACCOUNT *pa = ProtoGetAccount( szName ); - return ( pa == NULL ) ? -1 : pa->iOrder; + PROTOACCOUNT *pa = ProtoGetAccount(szName); + return (pa == NULL) ? -1 : pa->iOrder; } int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact* c2, UINT bywhat) @@ -209,11 +208,11 @@ int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact return 0; } - // separate contacts treated as "offline" - if ( !cfg::dat.bDontSeparateOffline && ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE ))) + // separate contacts treated as "offline" + if (!cfg::dat.bDontSeparateOffline && ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE))) return 2 * (statusa == ID_STATUS_OFFLINE) - 1; - switch( bywhat ) { + switch (bywhat) { case SORTBY_NAME: namea = (TCHAR *)c1->szText; nameb = (TCHAR *)c2->szText; @@ -229,20 +228,20 @@ int __forceinline INTSORT_CompareContacts(const ClcContact* c1, const ClcContact } case SORTBY_FREQUENCY: - if ( c1->pExtra && c2->pExtra) + if (c1->pExtra && c2->pExtra) return c1->pExtra->msgFrequency - c2->pExtra->msgFrequency; break; case SORTBY_PROTO: - if (c1->bIsMeta) - szProto1 = c1->metaProto ? c1->metaProto : c1->proto; - if (c2->bIsMeta) - szProto2 = c2->metaProto ? c2->metaProto : c2->proto; + if (c1->bIsMeta) + szProto1 = c1->metaProto ? c1->metaProto : c1->proto; + if (c2->bIsMeta) + szProto2 = c2->metaProto ? c2->metaProto : c2->proto; - rc = GetProtoIndex(szProto1) - GetProtoIndex(szProto2); + rc = GetProtoIndex(szProto1) - GetProtoIndex(szProto2); - if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) - return rc; + if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) + return rc; } return 0; } @@ -265,7 +264,7 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) #undef SAFESTRING -int SetHideOffline(WPARAM wParam, LPARAM lParam) +int SetHideOffline(WPARAM wParam, LPARAM) { int newVal = (int)wParam; switch ((int)wParam) { @@ -278,7 +277,7 @@ int SetHideOffline(WPARAM wParam, LPARAM lParam) cfg::writeByte("CList", "HideOffline", (BYTE)newVal); break; } - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); ClcSetButtonState(IDC_TBHIDEOFFLINE, newVal); LoadContactTree(); return 0; diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 5dca791388..229169fc46 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -562,64 +562,54 @@ static StatusItems_t default_item = { static void PreMultiply(HBITMAP hBitmap, int mode) { - BYTE *p = NULL; - DWORD dwLen; - int width, height, x, y; BITMAP bmp; - BYTE alpha; - GetObject(hBitmap, sizeof(bmp), &bmp); - width = bmp.bmWidth; - height = bmp.bmHeight; - dwLen = width * height * 4; - p = (BYTE *)malloc(dwLen); - if (p) { - GetBitmapBits(hBitmap, dwLen, p); - for (y = 0; y < height; ++y) { - BYTE *px = p + width * 4 * y; - - for (x = 0; x < width; ++x) { - if (mode) { - alpha = px[3]; - px[0] = px[0] * alpha/255; - px[1] = px[1] * alpha/255; - px[2] = px[2] * alpha/255; - } - else - px[3] = 255; - px += 4; + + int width = bmp.bmWidth; + int height = bmp.bmHeight; + DWORD dwLen = width * height * 4; + BYTE *p = (BYTE *)malloc(dwLen); + if (p == NULL) + return; + + GetBitmapBits(hBitmap, dwLen, p); + for (int y = 0; y < height; ++y) { + BYTE *px = p + width * 4 * y; + + for (int x = 0; x < width; ++x) { + if (mode) { + BYTE alpha = px[3]; + px[0] = px[0] * alpha/255; + px[1] = px[1] * alpha/255; + px[2] = px[2] * alpha/255; } + else px[3] = 255; + px += 4; } - dwLen = SetBitmapBits(hBitmap, dwLen, p); - free(p); } + SetBitmapBits(hBitmap, dwLen, p); + free(p); } static void CorrectBitmap32Alpha(HBITMAP hBitmap) { BITMAP bmp; - DWORD dwLen; - BYTE *p; - int x, y; - BOOL fixIt = TRUE; - GetObject(hBitmap, sizeof(bmp), &bmp); - if (bmp.bmBitsPixel != 32) return; - dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); - p = (BYTE *)malloc(dwLen); + DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); + BYTE *p = (BYTE*)calloc(1, dwLen); if (p == NULL) return; - memset(p, 0, dwLen); GetBitmapBits(hBitmap, dwLen, p); - for (y = 0; y < bmp.bmHeight; ++y) { + BOOL fixIt = TRUE; + for (int y = 0; y < bmp.bmHeight; ++y) { BYTE *px = p + bmp.bmWidth * 4 * y; - for (x = 0; x < bmp.bmWidth; ++x) { + for (int x = 0; x < bmp.bmWidth; ++x) { if (px[3] != 0) fixIt = FALSE; else @@ -634,11 +624,9 @@ static void CorrectBitmap32Alpha(HBITMAP hBitmap) free(p); } -static HBITMAP LoadPNG(const char *szFilename, ImageItem *item) +static HBITMAP LoadPNG(const char *szFilename) { - HBITMAP hBitmap = 0; - - hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFilename); + HBITMAP hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFilename); if (hBitmap != 0) CorrectBitmap32Alpha(hBitmap); @@ -647,15 +635,14 @@ static HBITMAP LoadPNG(const char *szFilename, ImageItem *item) static void IMG_CreateItem(ImageItem *item, const char *fileName, HDC hdc) { - HBITMAP hbm = LoadPNG(fileName, item); - BITMAP bm; - + HBITMAP hbm = LoadPNG(fileName); if (hbm) { item->hbm = hbm; item->bf.BlendFlags = 0; item->bf.BlendOp = AC_SRC_OVER; item->bf.AlphaFormat = 0; + BITMAP bm; GetObject(hbm, sizeof(bm), &bm); if (bm.bmBitsPixel == 32) { PreMultiply(hbm, 1); @@ -849,8 +836,6 @@ done_with_glyph: if (!(tmpItem.dwFlags & IMAGE_GLYPH)) IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { - ImageItem *pItem = g_ImageItems; - newItem = reinterpret_cast(malloc(sizeof(ImageItem))); memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; @@ -1192,8 +1177,6 @@ void IMG_LoadItems() if (!PathFileExists(tszFileName)) return; - int i = 0; - IMG_DeleteItems(); char *szSections = reinterpret_cast(malloc(3002)); @@ -1215,7 +1198,7 @@ void IMG_LoadItems() p += (mir_strlen(p) + 1); } if (pcli && pcli->hwndContactList) - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); free(szSections); if (g_ImageItems) { @@ -1227,7 +1210,7 @@ void IMG_LoadItems() cfg::dat.dwFlags &= ~CLUI_FRAME_CLISTSUNKEN; cfg::writeByte("CLUI", "fulltransparent", (BYTE)cfg::dat.bFullTransparent); cfg::writeByte("CLUI", "WindowStyle", SETTING_WINDOWSTYLE_NOBORDER); - ApplyCLUIBorderStyle(pcli->hwndContactList); + ApplyCLUIBorderStyle(); SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(pcli->hwndContactList, cfg::dat.colorkey, 0, LWA_COLORKEY); } @@ -1518,7 +1501,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_UNLOAD: IMG_DeleteItems(); ConfigureFrame(); - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); PostMessage(pcli->hwndContactList, CLUIINTM_REDRAW, 0, 0); break; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 8e7ea1f6c1..11761c64c5 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -127,14 +127,14 @@ void _DebugTraceA(const char *fmt, ...) #endif } -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved) +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID) { g_hInst = hInstDLL; DisableThreadLibraryCalls(g_hInst); return TRUE; } -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) { return &pluginInfo; } @@ -147,7 +147,7 @@ int LoadCLCModule(void); void LoadCLUIModule(void); void OnCreateClc(void); -static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) +static int systemModulesLoaded(WPARAM, LPARAM) { GetSystemTime(&cfg::dat.st); SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft); diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 0d3de22840..c7b01862b9 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -37,8 +37,7 @@ BOOL RowHeight::Init(ClcData *dat) void RowHeight::Free(ClcData *dat) { - if (dat->row_heights != NULL) - { + if (dat->row_heights != NULL) { free(dat->row_heights); dat->row_heights = NULL; } @@ -55,15 +54,14 @@ void RowHeight::Clear(ClcData *dat) BOOL RowHeight::Alloc(ClcData *dat, int size) { - if (size > dat->row_heights_size) - { + if (size > dat->row_heights_size) { if (size > dat->row_heights_allocated) { int size_grow = size; size_grow += 100 - (size_grow % 100); if (dat->row_heights != NULL) { - int *tmp = (int *) realloc((void *)dat->row_heights, sizeof(int) * size_grow); + int *tmp = (int *)realloc((void *)dat->row_heights, sizeof(int) * size_grow); if (tmp == NULL) { Free(dat); @@ -73,7 +71,7 @@ BOOL RowHeight::Alloc(ClcData *dat, int size) dat->row_heights = tmp; } else { - dat->row_heights = (int *) malloc(sizeof(int) * size_grow); + dat->row_heights = (int *)malloc(sizeof(int) * size_grow); if (dat->row_heights == NULL) { Free(dat); @@ -91,26 +89,24 @@ BOOL RowHeight::Alloc(ClcData *dat, int size) int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd) { int max_height = 0, i; - DWORD style=GetWindowLongPtr(hwnd,GWL_STYLE); + DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - int contact_fonts[] = {FONTID_CONTACTS, FONTID_INVIS, FONTID_OFFLINE, FONTID_NOTONLIST, FONTID_OFFINVIS}; - int other_fonts[] = {FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS}; + int contact_fonts[] = { FONTID_CONTACTS, FONTID_INVIS, FONTID_OFFLINE, FONTID_NOTONLIST, FONTID_OFFINVIS }; + int other_fonts[] = { FONTID_GROUPS, FONTID_GROUPCOUNTS, FONTID_DIVIDERS }; - // Get contact font size - for (i = 0 ; i < SIZEOF(contact_fonts) ; i++) - { - if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight) - max_height = dat->fontInfo[contact_fonts[i]].fontHeight; - } + // Get contact font size + for (i = 0; i < SIZEOF(contact_fonts); i++) + if (max_height < dat->fontInfo[contact_fonts[i]].fontHeight) + max_height = dat->fontInfo[contact_fonts[i]].fontHeight; - if (cfg::dat.dualRowMode == 1 && !dat->bisEmbedded) - max_height += ROW_SPACE_BEETWEEN_LINES + dat->fontInfo[FONTID_STATUS].fontHeight; + if (cfg::dat.dualRowMode == 1 && !dat->bisEmbedded) + max_height += ROW_SPACE_BEETWEEN_LINES + dat->fontInfo[FONTID_STATUS].fontHeight; - // Get other font sizes - for (i = 0 ; i < SIZEOF(other_fonts) ; i++) { - if (max_height < dat->fontInfo[other_fonts[i]].fontHeight) - max_height = dat->fontInfo[other_fonts[i]].fontHeight; - } + // Get other font sizes + for (i = 0; i < SIZEOF(other_fonts); i++) { + if (max_height < dat->fontInfo[other_fonts[i]].fontHeight) + max_height = dat->fontInfo[other_fonts[i]].fontHeight; + } // Avatar size if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS && !dat->bisEmbedded) @@ -123,7 +119,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd) //max_height += 2 * dat->row_border; // Min size max_height = max(max_height, dat->min_row_heigh); - max_height += cfg::dat.bRowSpacing; + max_height += cfg::dat.bRowSpacing; dat->rowHeight = max_height; @@ -136,24 +132,22 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) int indent, subindex, line_num; ClcContact *Drawing; ClcGroup *group; - DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); // Draw lines - group=&dat->list; - group->scanIndex=0; - indent=0; + group = &dat->list; + group->scanIndex = 0; + indent = 0; //subindex=-1; line_num = -1; Clear(dat); - while(TRUE) - { - if (group->scanIndex==group->cl.count) - { - group=group->parent; + while (true) { + if (group->scanIndex == group->cl.count) { + group = group->parent; indent--; - if (group==NULL) break; // Finished list + if (group == NULL) break; // Finished list group->scanIndex++; continue; } @@ -163,20 +157,19 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) line_num++; // Calc row height - getRowHeight(dat, hwnd, Drawing, line_num, dwStyle); + getRowHeight(dat, Drawing, line_num, dwStyle); - if (group->cl.items[group->scanIndex]->type==CLCIT_GROUP && /*!IsBadCodePtr((FARPROC)group->cl.items[group->scanIndex]->group) && */ (group->cl.items[group->scanIndex]->group->expanded & 0x0000ffff)) { - group=group->cl.items[group->scanIndex]->group; + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && /*!IsBadCodePtr((FARPROC)group->cl.items[group->scanIndex]->group) && */ (group->cl.items[group->scanIndex]->group->expanded & 0x0000ffff)) { + group = group->cl.items[group->scanIndex]->group; indent++; - group->scanIndex=0; - subindex=-1; + group->scanIndex = 0; + subindex = -1; continue; } group->scanIndex++; } } - // Calc item top Y (using stored data) int RowHeight::getItemTopY(ClcData *dat, int item) { @@ -186,8 +179,7 @@ int RowHeight::getItemTopY(ClcData *dat, int item) if (item >= dat->row_heights_size) return -1; - for (i = 0 ; i < item ; i++) - { + for (i = 0; i < item; i++) { y += dat->row_heights[i]; } @@ -204,8 +196,7 @@ int RowHeight::getItemBottomY(ClcData *dat, int item) if (item >= dat->row_heights_size) return -1; - for (i = 0 ; i <= item ; i++) - { + for (i = 0; i <= item; i++) { y += dat->row_heights[i]; } @@ -216,13 +207,10 @@ int RowHeight::getItemBottomY(ClcData *dat, int item) // Calc total height of rows (using stored data) int RowHeight::getTotalHeight(ClcData *dat) { - int i; int y = 0; - for (i = 0 ; i < dat->row_heights_size ; i++) - { + for (int i = 0; i < dat->row_heights_size; i++) y += dat->row_heights[i]; - } return y; } @@ -230,16 +218,12 @@ int RowHeight::getTotalHeight(ClcData *dat) // Return the line that pos_y is at or -1 (using stored data) int RowHeight::hitTest(ClcData *dat, int pos_y) { - int i; - int y = 0; - if (pos_y < 0) return -1; - for (i = 0 ; i < dat->row_heights_size ; i++) - { + int y = 0; + for (int i = 0; i < dat->row_heights_size; i++) { y += dat->row_heights[i]; - if (pos_y < y) return i; } @@ -249,14 +233,8 @@ int RowHeight::hitTest(ClcData *dat, int pos_y) int RowHeight::getHeight(ClcData *dat, int item) { - if ( dat->row_heights == 0 ) + if (dat->row_heights == 0) return 0; - return dat->row_heights[ item ]; -} - -int RowHeight::getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *contact, DWORD dwFlags) -{ - int height = max(dat->fontInfo[GetBasicFontID(contact)].fontHeight, dat->min_row_heigh); - return height + cfg::dat.bRowSpacing; + return dat->row_heights[item]; } diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 714d8447da..b0a480b210 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -432,7 +432,7 @@ void UpdateFilters() char szSetting[128]; char *szBuf = NULL; int iLen; - DWORD statusMask = 0, localMask = 0; + DWORD statusMask = 0; DWORD dwFlags; DWORD opt; char szTemp[100]; @@ -797,7 +797,7 @@ static int menuCounter = 0; static int FillMenuCallback(char *szSetting) { - if (szSetting[0] == (char)246) + if ((BYTE)szSetting[0] == 246) return 1; AppendMenuA(hViewModeMenu, MF_STRING, menuCounter++, szSetting); @@ -984,7 +984,7 @@ clvm_reset_command: SetWindowTextA(GetDlgItem(hwnd, IDC_SELECTMODE), Translate("No view mode")); CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)cfg::dat.boldHideOffline, 0); cfg::dat.boldHideOffline = (BYTE)-1; - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); cfg::dat.current_viewmode[0] = 0; cfg::dat.old_viewmode[0] = 0; cfg::writeString(NULL, "CList", "LastViewMode", ""); @@ -1134,7 +1134,7 @@ void ApplyViewMode(const char *name) CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0); SetWindowTextA(hwndSelector, name); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); - SetButtonStates(pcli->hwndContactList); + SetButtonStates(); cfg::writeString(NULL, "CList", "LastViewMode", cfg::dat.current_viewmode); } -- cgit v1.2.3