From 9d5df5c08b85b0537d1bc0d26055a08fb7ff4c4a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 29 Jun 2014 20:46:04 +0000 Subject: - unused fields and functions removed; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@9623 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp | 15 +- plugins/Clist_modern/src/hdr/modern_clist.h | 1 - .../Clist_modern/src/hdr/modern_commonheaders.h | 1 - plugins/Clist_modern/src/modern_cachefuncs.cpp | 42 +++--- plugins/Clist_modern/src/modern_clc.cpp | 4 +- plugins/Clist_modern/src/modern_clcitems.cpp | 13 +- plugins/Clist_modern/src/modern_clistmod.cpp | 153 ++++++++++----------- plugins/Clist_modern/src/modern_clistsettings.cpp | 14 +- plugins/Clist_modern/src/modern_contact.cpp | 29 ++-- 9 files changed, 128 insertions(+), 144 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index f55a911520..a4acecf17e 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -1029,7 +1029,6 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam) if (g_pfwFrames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; ModifyMItem((WPARAM)_hmiAlignBottom,(LPARAM)&mi); - mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED; if ((!g_pfwFrames[pos].visible) || (g_pfwFrames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; @@ -1217,19 +1216,19 @@ static int _us_DoSetFrameOptions(WPARAM wParam, LPARAM lParam) fw.TitleBar.ShowTitleBarTip = FALSE; if (lParam & F_SHOWTBTIP) fw.TitleBar.ShowTitleBarTip = TRUE; - SendMessageA(fw.TitleBar.hwndTip,TTM_ACTIVATE,(WPARAM)fw.TitleBar.ShowTitleBarTip,0); + SendMessageA(fw.TitleBar.hwndTip, TTM_ACTIVATE, (WPARAM)fw.TitleBar.ShowTitleBarTip, 0); { - LONG_PTR style = GetWindowLongPtr(fw.hWnd,GWL_STYLE); + LONG_PTR style = GetWindowLongPtr(fw.hWnd, GWL_STYLE); style &= (~WS_BORDER); - if (!(lParam & F_NOBORDER ) && !g_CluiData.fLayered ) + if (!(lParam & F_NOBORDER) && !g_CluiData.fLayered) style |= WS_BORDER; - SetWindowLongPtr(fw.hWnd,GWL_STYLE,style); - SetWindowLongPtr(fw.TitleBar.hwnd,GWL_STYLE,style& ~(WS_VSCROLL | WS_HSCROLL)); + SetWindowLongPtr(fw.hWnd, GWL_STYLE, style); + SetWindowLongPtr(fw.TitleBar.hwnd, GWL_STYLE, style& ~(WS_VSCROLL | WS_HSCROLL)); } - CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); - SetWindowPos(fw.TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED|SWP_NOACTIVATE); + CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); + SetWindowPos(fw.TitleBar.hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_NOACTIVATE); return 0; case FO_NAME: diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h index 064c7c3501..ef89b2b92b 100644 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ b/plugins/Clist_modern/src/hdr/modern_clist.h @@ -81,7 +81,6 @@ struct ClcCacheEntry : public ClcCacheEntryBase bool m_bProtoNotExists, m_bIsSub; bool isUnknown; - int i; int ApparentMode; int NotOnList; int IdleTS; diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 07d0d510a7..006c5541b0 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -270,7 +270,6 @@ int AniAva_RenderAvatar(MCONTACT hContact, HDC hdcMem, RECT *rc ); void CListSettings_FreeCacheItemData(ClcCacheEntry *pDst); int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam); WORD pdnce___GetStatus(ClcCacheEntry *pdnce); -void pdnce___SetStatus( ClcCacheEntry *pdnce, WORD wStatus ); /* move to list module */ typedef void (*ItemDestuctor)(void*); diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index e8b27596a8..2caf524487 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -290,16 +290,16 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus BOOL noAwayMsg = FALSE; BOOL noXstatus = FALSE; // Hide status text if Offline /// no offline - WORD nStatus = pdnce___GetStatus( pdnce ); + WORD nStatus = pdnce___GetStatus(pdnce); if ((nStatus == ID_STATUS_OFFLINE || nStatus == 0) && g_CluiData.bRemoveAwayMessageForOffline) noAwayMsg = TRUE; if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE; text[0] = '\0'; // Get XStatusName - if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { - DBVARIANT dbv = {0}; + if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { + DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') @@ -316,9 +316,9 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus // Get XStatusName if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') @@ -333,17 +333,17 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus * Get Listening to information */ -void GetListeningTo(TCHAR *text, int text_size, ClcCacheEntry *pdnce) +void GetListeningTo(TCHAR *text, int text_size, ClcCacheEntry *pdnce) { - DBVARIANT dbv = {0}; - WORD wStatus = pdnce___GetStatus( pdnce ); + DBVARIANT dbv = { 0 }; + WORD wStatus = pdnce___GetStatus(pdnce); text[0] = _T('\0'); if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) return; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) { - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); } } @@ -353,11 +353,11 @@ void GetListeningTo(TCHAR *text, int text_size, ClcCacheEntry *pdnce) * -1 for XStatus, 1 for Status */ -int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus_has_priority) +int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus_has_priority) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; BOOL noAwayMsg = FALSE; - WORD wStatus = pdnce___GetStatus( pdnce ); + WORD wStatus = pdnce___GetStatus(pdnce); text[0] = '\0'; // Hide status text if Offline /// no offline @@ -367,7 +367,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst // Try to get XStatusMsg if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') @@ -379,7 +379,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst if (pdnce->hContact && text[0] == '\0') { if (!db_get_ts(pdnce->hContact, "CList", "StatusMsg", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') @@ -392,7 +392,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xst // Try to get XStatusMsg if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); if (text[0] != '\0') @@ -517,9 +517,9 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) return; ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(contact->hContact); - TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0); + TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact, 0); if (dat->first_line_append_nick && (!dat->force_in_dialog)) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { TCHAR nick[SIZEOF(contact->szText)]; lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText)); @@ -537,8 +537,8 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) else lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); if (!dat->force_in_dialog) { - struct SHORTDATA data = {0}; - Sync(CLUI_SyncGetShortData,(WPARAM)pcli->hwndContactTree,(LPARAM)&data); + struct SHORTDATA data = { 0 }; + Sync(CLUI_SyncGetShortData, (WPARAM)pcli->hwndContactTree, (LPARAM)&data); contact->ssText.ReplaceSmileys(&data, pdnce, contact->szText, dat->first_line_draw_smileys); } } @@ -604,7 +604,7 @@ void Cache_GetThirdLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce) void RemoveTag(TCHAR *to, TCHAR *tag) { - TCHAR * st = to; + TCHAR *st = to; int len = (int)_tcslen(tag); int lastsize = (int)_tcslen(to)+1; while (st = _tcsstr(st,tag)) { diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index bc3b73e6dc..371fa6e79a 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1663,7 +1663,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM if (wParam != 0) { ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(wParam); if (pdnce && pdnce->m_cache_cszProto) { - pdnce___SetStatus(pdnce, GetStatusForContact(pdnce->hContact, pdnce->m_cache_cszProto)); + pdnce->m_cache_nStatus = GetStatusForContact(pdnce->hContact, pdnce->m_cache_cszProto); if (!dat->force_in_dialog && (dat->second_line_show || dat->third_line_show)) gtaRenewText(pdnce->hContact); SendMessage(hwnd, INTM_ICONCHANGED, wParam, corecli.pfnGetContactIcon(wParam)); @@ -1674,7 +1674,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM if (!contact->image_is_special && pdnce___GetStatus(pdnce) > ID_STATUS_OFFLINE) contact->iImage = corecli.pfnGetContactIcon(wParam); if (contact->isSubcontact && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT) - pcli->pfnClcBroadcast(INTM_STATUSCHANGED, (WPARAM)contact->subcontacts->hContact, 0); //forward status changing to host meta contact + pcli->pfnClcBroadcast(INTM_STATUSCHANGED, contact->subcontacts->hContact, 0); //forward status changing to host meta contact } } } diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 8de05ac9cd..02812c1d09 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -101,7 +101,7 @@ int cli_AddItemToGroup(ClcGroup *group, int iAboveItem) return iAboveItem; } -ClcGroup *cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers) +ClcGroup* cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers) { ClearRowByIndexCache(); if (!dat->force_in_dialog && !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN)) @@ -594,16 +594,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) WORD pdnce___GetStatus(ClcCacheEntry *pdnce) { - if (!pdnce) - return ID_STATUS_OFFLINE; - else - return pdnce->m_cache_nStatus; -} - -void pdnce___SetStatus(ClcCacheEntry *pdnce, WORD wStatus) -{ - if (pdnce) - pdnce->m_cache_nStatus = wStatus; + return (!pdnce) ? ID_STATUS_OFFLINE : pdnce->m_cache_nStatus; } ClcContact* cliCreateClcContact() diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index c0f616ca7c..7b9b62d0bf 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -49,13 +49,14 @@ INT_PTR TrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); void InitTrayMenus(void); void UninitTrayMenu(); -//returns normal icon or combined with status overlay. Needs to be destroyed. -HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto,int status) +// returns normal icon or combined with status overlay. Needs to be destroyed. + +HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status) { // check if options is turned on - BYTE trayOption = db_get_b(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT); + BYTE trayOption = db_get_b(NULL, "CLUI", "XStatusTray", SETTING_TRAYOPTION_DEFAULT); if ((trayOption & 3) && szProto != NULL) { - if ( ProtoServiceExists(szProto, PS_GETCUSTOMSTATUSICON)) { + if (ProtoServiceExists(szProto, PS_GETCUSTOMSTATUSICON)) { // check status is online if (status > ID_STATUS_OFFLINE) { // get xicon @@ -65,7 +66,7 @@ HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto,int status if (trayOption & 2) { // get overlay HICON MainOverlay = (HICON)GetMainStatusOverlay(status); - HICON hIcon = ske_CreateJoinedIcon(hXIcon,MainOverlay,(trayOption&4)?192:0); + HICON hIcon = ske_CreateJoinedIcon(hXIcon, MainOverlay, (trayOption & 4) ? 192 : 0); DestroyIcon_protect(hXIcon); DestroyIcon_protect(MainOverlay); return hIcon; @@ -76,7 +77,7 @@ HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto,int status } } - return ske_ImageList_GetIcon(g_himlCListClc,pcli->pfnIconFromStatusMode(szProto,status,hContact),ILD_NORMAL); + return ske_ImageList_GetIcon(g_himlCListClc, pcli->pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL); } int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) @@ -85,26 +86,26 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact) char *szActProto = (char*)szProto; int nActStatus = nStatus; MCONTACT hActContact = hContact; - if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && !mir_strcmp(szActProto, META_PROTO)) { + if (!db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) && !mir_strcmp(szActProto, META_PROTO)) { // substitute params by mostonline contact datas MCONTACT hMostOnlineContact = db_mc_getMostOnline(hActContact); if (hMostOnlineContact) { ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->m_cache_cszProto) { szActProto = cacheEntry->m_cache_cszProto; - nActStatus = pdnce___GetStatus( cacheEntry ); + nActStatus = cacheEntry->m_cache_nStatus; hActContact = hMostOnlineContact; } } } int result = -1; - if ( ProtoServiceExists(szActProto, PS_GETADVANCEDSTATUSICON)) + if (ProtoServiceExists(szActProto, PS_GETADVANCEDSTATUSICON)) result = ProtoCallService(szActProto, PS_GETADVANCEDSTATUSICON, (WPARAM)hActContact, 0); if (result == -1 || !(LOWORD(result))) { //Get normal Icon - int basicIcon = corecli.pfnIconFromStatusMode(szActProto,nActStatus,NULL); + int basicIcon = corecli.pfnIconFromStatusMode(szActProto, nActStatus, NULL); if (result != -1 && basicIcon != 1) result |= basicIcon; else @@ -126,7 +127,7 @@ int cli_GetContactIcon(MCONTACT hContact) int GetContactIconC(ClcCacheEntry *p) { - return pcli->pfnIconFromStatusMode(p->m_cache_cszProto,p->m_cache_cszProto == NULL ? ID_STATUS_OFFLINE : pdnce___GetStatus(p), p->hContact); + return pcli->pfnIconFromStatusMode(p->m_cache_cszProto, p->m_cache_cszProto == NULL ? ID_STATUS_OFFLINE : p->m_cache_nStatus, p->hContact); } //lParam @@ -164,21 +165,21 @@ INT_PTR SvcApplySkin(WPARAM wParam, LPARAM lParam); HRESULT CluiLoadModule() { InitDisplayNameCache(); - HookEvent(ME_SYSTEM_SHUTDOWN,CListMod_ContactListShutdownProc); - HookEvent(ME_OPT_INITIALISE,CListOptInit); - HookEvent(ME_OPT_INITIALISE,SkinOptInit); + HookEvent(ME_SYSTEM_SHUTDOWN, CListMod_ContactListShutdownProc); + HookEvent(ME_OPT_INITIALISE, CListOptInit); + HookEvent(ME_OPT_INITIALISE, SkinOptInit); CreateServiceFunction("ModernSkinSel/Active", SvcActiveSkin); CreateServiceFunction("ModernSkinSel/Preview", SvcPreviewSkin); CreateServiceFunction("ModernSkinSel/Apply", SvcApplySkin); - HookEvent(ME_DB_CONTACT_ADDED,ContactAdded); + HookEvent(ME_DB_CONTACT_ADDED, ContactAdded); - CreateServiceFunction(MS_CLIST_TOGGLEHIDEOFFLINE,ToggleHideOffline); + CreateServiceFunction(MS_CLIST_TOGGLEHIDEOFFLINE, ToggleHideOffline); - CreateServiceFunction(MS_CLIST_TOGGLEGROUPS,ToggleGroups); - CreateServiceFunction(MS_CLIST_TOGGLESOUNDS,ToggleSounds); - CreateServiceFunction(MS_CLIST_SETUSEGROUPS,SetUseGroups); + CreateServiceFunction(MS_CLIST_TOGGLEGROUPS, ToggleGroups); + CreateServiceFunction(MS_CLIST_TOGGLESOUNDS, ToggleSounds); + CreateServiceFunction(MS_CLIST_SETUSEGROUPS, SetUseGroups); InitCustomMenus(); InitTrayMenus(); @@ -200,7 +201,7 @@ __inline DWORD GetDIBPixelColor(int X, int Y, int Width, int Height, int ByteWid { DWORD res = 0; if (X >= 0 && X < Width && Y >= 0 && Y < Height && ptr) - res = *((DWORD*)(ptr+ByteWidth*(Height-Y-1)+X*4)); + res = *((DWORD*)(ptr + ByteWidth*(Height - Y - 1) + X * 4)); return res; } @@ -222,63 +223,59 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) HWND hwndFocused = GetFocus(); - if ( IsIconic(hWnd) || !IsWindowVisible(hWnd)) + if (IsIconic(hWnd) || !IsWindowVisible(hWnd)) return GWVS_HIDDEN; - if ( db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT) || !db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) + if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT) || !db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT)) return GWVS_VISIBLE; - if ( hwndFocused == pcli->hwndContactList || GetParent(hwndFocused) == pcli->hwndContactList ) + if (hwndFocused == pcli->hwndContactList || GetParent(hwndFocused) == pcli->hwndContactList) return GWVS_VISIBLE; - int hstep,vstep; + int hstep, vstep; BITMAP bmp; HBITMAP WindowImage; int maxx = 0; int maxy = 0; int wx = 0; - int dx,dy; + int dx, dy; BYTE *ptr = NULL; HRGN rgn = NULL; - WindowImage = g_CluiData.fLayered?ske_GetCurrentWindowImage():0; - if (WindowImage && g_CluiData.fLayered) - { - GetObject(WindowImage,sizeof(BITMAP),&bmp); + WindowImage = g_CluiData.fLayered ? ske_GetCurrentWindowImage() : 0; + if (WindowImage && g_CluiData.fLayered) { + GetObject(WindowImage, sizeof(BITMAP), &bmp); ptr = (BYTE*)bmp.bmBits; maxx = bmp.bmWidth; maxy = bmp.bmHeight; wx = bmp.bmWidthBytes; } - else - { + else { RECT rc; - int i=0; - rgn = CreateRectRgn(0, 0, 1,1); - GetWindowRect(hWnd,&rc); - GetWindowRgn(hWnd,rgn); - OffsetRgn(rgn,rc.left,rc.top); - GetRgnBox(rgn,&rc); - i = i; + rgn = CreateRectRgn(0, 0, 1, 1); + GetWindowRect(hWnd, &rc); + GetWindowRgn(hWnd, rgn); + OffsetRgn(rgn, rc.left, rc.top); + GetRgnBox(rgn, &rc); //maxx = rc.right; //maxy = rc.bottom; } GetWindowRect(hWnd, &rc); { - RECT rcMonitor = {0}; - Docking_GetMonitorRectFromWindow(hWnd,&rcMonitor); - rc.top = rc.top < rcMonitor.top?rcMonitor.top:rc.top; - rc.left = rc.left < rcMonitor.left?rcMonitor.left:rc.left; - rc.bottom = rc.bottom>rcMonitor.bottom?rcMonitor.bottom:rc.bottom; - rc.right = rc.right>rcMonitor.right?rcMonitor.right:rc.right; + RECT rcMonitor = { 0 }; + Docking_GetMonitorRectFromWindow(hWnd, &rcMonitor); + rc.top = rc.top < rcMonitor.top ? rcMonitor.top : rc.top; + rc.left = rc.left < rcMonitor.left ? rcMonitor.left : rc.left; + rc.bottom = rc.bottom > rcMonitor.bottom ? rcMonitor.bottom : rc.bottom; + rc.right = rc.right > rcMonitor.right ? rcMonitor.right : rc.right; } width = rc.right - rc.left; - height = rc.bottom- rc.top; + height = rc.bottom - rc.top; dx = -rc.left; dy = -rc.top; - hstep = width/iStepX; - vstep = height/iStepY; - hstep = hstep>0?hstep:1; - vstep = vstep>0?vstep:1; + hstep = width / iStepX; + vstep = height / iStepY; + hstep = hstep > 0 ? hstep : 1; + vstep = vstep > 0 ? vstep : 1; for (i = rc.top; i < rc.bottom; i += vstep) { pt.y = i; @@ -286,12 +283,11 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) BOOL po = FALSE; pt.x = j; if (rgn) - po = PtInRegion(rgn,j,i); - else - { - DWORD a = (GetDIBPixelColor(j+dx,i+dy,maxx,maxy,wx,ptr)&0xFF000000)>>24; - a = ((a*g_CluiData.bCurrentAlpha)>>8); - po = (a>16); + po = PtInRegion(rgn, j, i); + else { + DWORD a = (GetDIBPixelColor(j + dx, i + dy, maxx, maxy, wx, ptr) & 0xFF000000) >> 24; + a = ((a*g_CluiData.bCurrentAlpha) >> 8); + po = (a > 16); } if (po || (!rgn && ptr == 0)) { @@ -306,18 +302,16 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) //hAux = GetParent(hAux); hAuxOld = hAux; hAux = GetAncestor(hAux, GA_ROOTOWNER); - if (hAuxOld == hAux) - { + if (hAuxOld == hAux) { TCHAR buf[255]; - GetClassName(hAux,buf,SIZEOF(buf)); - if (!lstrcmp(buf,CLUIFrameSubContainerClassName)) - { + GetClassName(hAux, buf, SIZEOF(buf)); + if (!lstrcmp(buf, CLUIFrameSubContainerClassName)) { hWndFound = TRUE; break; } } } - while(hAux != NULL && hAuxOld != hAux); + while (hAux != NULL && hAuxOld != hAux); if (hWndFound) //There's window! iNotCoveredDots++; //Let's count the not covered dots. @@ -325,9 +319,10 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) } } } - if (rgn) DeleteObject(rgn); + if (rgn) + DeleteObject(rgn); - if ( iCountedDots - iNotCoveredDots < 2) //Every dot was not covered: the window is visible. + if (iCountedDots - iNotCoveredDots < 2) //Every dot was not covered: the window is visible. return GWVS_VISIBLE; if (iNotCoveredDots == 0) //They're all covered! @@ -346,7 +341,7 @@ int cliShowHide(WPARAM wParam, LPARAM lParam) int iVisibleState = GetWindowVisibleState(pcli->hwndContactList, 0, 0); int method = db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT); //(0-none, 1-leftedge, 2-rightedge); if (method) { - if ( db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) == 0 && lParam != 1) + if (db_get_b(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) == 0 && lParam != 1) CLUI_HideBehindEdge(); //hide else CLUI_ShowFromBehindEdge(); @@ -378,54 +373,54 @@ int cliShowHide(WPARAM wParam, LPARAM lParam) } if (bShow || lParam == 1) { - Sync( CLUIFrames_ActivateSubContainers, TRUE ); + Sync(CLUIFrames_ActivateSubContainers, TRUE); CLUI_ShowWindowMod(pcli->hwndContactList, SW_RESTORE); - if (!db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT)) { - Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1); //TO BE PROXIED - SetWindowPos(pcli->hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |SWP_NOACTIVATE); + if (!db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT)) { + Sync(CLUIFrames_OnShowHide, pcli->hwndContactList, 1); //TO BE PROXIED + SetWindowPos(pcli->hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); g_bCalledFromShowHide = 1; - if (!db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT)) + if (!db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT)) SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); g_bCalledFromShowHide = 0; } else { SetWindowPos(pcli->hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1); + Sync(CLUIFrames_OnShowHide, pcli->hwndContactList, 1); SetForegroundWindow(pcli->hwndContactList); } - db_set_b(NULL,"CList","State",SETTING_STATE_NORMAL); + db_set_b(NULL, "CList", "State", SETTING_STATE_NORMAL); RECT rcWindow; - GetWindowRect(pcli->hwndContactList,&rcWindow); + GetWindowRect(pcli->hwndContactList, &rcWindow); if (Utils_AssertInsideScreen(&rcWindow) == 1) MoveWindow(pcli->hwndContactList, rcWindow.left, rcWindow.top, - rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE); + rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE); } else { //It needs to be hidden if (GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) { CListMod_HideWindow(pcli->hwndContactList, SW_HIDE); - db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN); + db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); } else { - if ( db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT)) { + if (db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) { CLUI_ShowWindowMod(pcli->hwndContactList, SW_HIDE); - db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN); + db_set_b(NULL, "CList", "State", SETTING_STATE_HIDDEN); } else { CLUI_ShowWindowMod(pcli->hwndContactList, SW_MINIMIZE); - db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED); + db_set_b(NULL, "CList", "State", SETTING_STATE_MINIMIZED); } } - SetProcessWorkingSetSize(GetCurrentProcess(),-1,-1); + SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); } return 0; } int CListMod_HideWindow(HWND hwndContactList, int mode) { - KillTimer(pcli->hwndContactList,1/*TM_AUTOALPHA*/); + KillTimer(pcli->hwndContactList, 1/*TM_AUTOALPHA*/); if (!CLUI_HideBehindEdge()) return CLUI_SmoothAlphaTransition(pcli->hwndContactList, 0, 1); return 0; } diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index d83af199f4..3d259999f8 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -141,7 +141,6 @@ void CListSettings_CopyCacheItems(ClcCacheEntry *pDst, ClcCacheEntry *pSrc, DWOR pDst->m_bProtoNotExists = pSrc->m_bProtoNotExists; pDst->m_bIsSub = pSrc->m_bIsSub; - pDst->i = pSrc->i; pDst->ApparentMode = pSrc->ApparentMode; pDst->NotOnList = pSrc->NotOnList; pDst->IdleTS = pSrc->IdleTS; @@ -217,8 +216,8 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) } } - if (pdnce___GetStatus(pdnce) == 0) //very strange look status sort is broken let always reread status - pdnce___SetStatus(pdnce, GetStatusForContact(pdnce->hContact, pdnce->m_cache_cszProto)); + if (pdnce->m_cache_nStatus == 0) //very strange look status sort is broken let always reread status + pdnce->m_cache_nStatus = GetStatusForContact(pdnce->hContact, pdnce->m_cache_cszProto); if (pdnce->tszGroup == NULL) { DBVARIANT dbv = { 0 }; @@ -300,7 +299,7 @@ void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int Settin pdnce->bIsHidden = -1; pdnce->m_bIsSub = pdnce->m_bProtoNotExists = false; - pdnce___SetStatus(pdnce, 0); + pdnce->m_cache_nStatus = 0; pdnce->IdleTS = -1; pdnce->ApparentMode = -1; pdnce->NotOnList = -1; @@ -365,7 +364,7 @@ int GetContactInfosForSort(MCONTACT hContact, char **Proto, TCHAR **Name, int *S if (cacheEntry != NULL) { if (Proto != NULL) *Proto = cacheEntry->m_cache_cszProto; if (Name != NULL) *Name = cacheEntry->tszName; - if (Status != NULL) *Status = pdnce___GetStatus(cacheEntry); + if (Status != NULL) *Status = cacheEntry->m_cache_nStatus; } return (0); }; @@ -373,8 +372,7 @@ int GetContactInfosForSort(MCONTACT hContact, char **Proto, TCHAR **Name, int *S int GetContactCachedStatus(MCONTACT hContact) { - ClcCacheEntry *cacheEntry = NULL; - cacheEntry = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); return pdnce___GetStatus(cacheEntry); } @@ -430,7 +428,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) } if (pdnce->bIsHidden != 1) { - pdnce___SetStatus(pdnce, cws->value.wVal); //dont use direct set + pdnce->m_cache_nStatus = cws->value.wVal; if (cws->value.wVal == ID_STATUS_OFFLINE) if (g_CluiData.bRemoveAwayMessageForOffline) db_set_s(hContact, "CList", "StatusMsg", ""); diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index c998d4400c..3dc1408739 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -29,18 +29,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct { - int m_cache_nStatus,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}}; + int status, order; +} +static 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) { @@ -55,7 +58,7 @@ void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add) static int GetStatusModeOrdering(int statusMode) { for (int i=0; i < SIZEOF(statusModeOrder); i++) - if (statusModeOrder[i].m_cache_nStatus == statusMode) + if (statusModeOrder[i].status == statusMode) return statusModeOrder[i].order; return 1000; } -- cgit v1.2.3