From fd23c78f121f3f1d07d97d657c617b46b25c614f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Jun 2016 11:02:25 +0000 Subject: - finally clist_modern's own rebuild all function got wiped out; - massive removal of duplicate code; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@16894 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/init.cpp | 2 + plugins/Clist_modern/src/modern_aniavatars.cpp | 4 +- plugins/Clist_modern/src/modern_cachefuncs.cpp | 6 +- plugins/Clist_modern/src/modern_clc.cpp | 26 +--- plugins/Clist_modern/src/modern_clc.h | 8 +- plugins/Clist_modern/src/modern_clcidents.cpp | 2 +- plugins/Clist_modern/src/modern_clcitems.cpp | 155 +++++---------------- plugins/Clist_modern/src/modern_clcmsgs.cpp | 4 +- plugins/Clist_modern/src/modern_clcopts.cpp | 4 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 14 +- plugins/Clist_modern/src/modern_clcutils.cpp | 28 ++-- plugins/Clist_modern/src/modern_clui.cpp | 2 +- plugins/Clist_modern/src/modern_contact.cpp | 2 +- plugins/Clist_modern/src/modern_defsettings.h | 2 +- .../Clist_modern/src/modern_rowheight_funcs.cpp | 10 +- src/mir_app/src/clc.cpp | 8 +- 16 files changed, 90 insertions(+), 187 deletions(-) diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 268e6a508e..182a0129b2 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -175,7 +175,9 @@ static HRESULT SubclassClistInterface() pcli->pfnGetContactIcon = cli_GetContactIcon; pcli->pfnIconFromStatusMode = cli_IconFromStatusMode; pcli->pfnLoadCluiGlobalOpts = CLUI_cli_LoadCluiGlobalOpts; + pcli->pfnLoadClcOptions = cli_LoadCLCOptions; pcli->pfnSortCLC = cli_SortCLC; + pcli->pfnAddContactToGroup = cli_AddContactToGroup; pcli->pfnAddContactToTree = cli_AddContactToTree; pcli->pfnContactListWndProc = CLUI::cli_ContactListWndProc; pcli->pfnFreeContact = cli_FreeContact; diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 3a97deb84a..c6d731ae1f 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -810,7 +810,7 @@ int AniAva_AddAvatar(MCONTACT hContact, TCHAR * szFilename, int width, int heigt else pavi->dwAvatarUniqId = _AniAva_LoadAvatarFromImage(szFilename, width, heigth, &avii); if (hwnd) - SendMessage(hwnd, AAM_SETAVATAR, (WPARAM)&avii, (LPARAM)0); + SendMessage(hwnd, AAM_SETAVATAR, (WPARAM)&avii, 0); pavi->ObjectSize = avii.szSize; return MAKELONG(avii.szSize.cx, avii.szSize.cy); } @@ -925,7 +925,7 @@ int AniAva_SetAvatarPos(MCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha ANIAVATARIMAGEINFO avii = { 0 }; if (_AniAva_GetAvatarImageInfo(pai->dwAvatarUniqId, &avii)) - SendMessage(pai->hWindow, AAM_SETAVATAR, (WPARAM)&avii, (LPARAM)0); + SendMessage(pai->hWindow, AAM_SETAVATAR, (WPARAM)&avii, 0); } api->bAlpha = bAlpha; api->idxOverlay = overlayIdx; diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index de7d5078df..8e7965316d 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -63,7 +63,7 @@ void Cache_GetText(ClcData *dat, ClcContact *contact) { Cache_GetFirstLineText(dat, contact); - if (!dat->force_in_dialog) { + if (!dat->bForceInDialog) { if (dat->secondLine.show) Cache_GetNthLineText(dat, contact->pce, 2); if (dat->thirdLine.show) @@ -475,7 +475,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) ClcCacheEntry *pdnce = contact->pce; TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact, 0); - if (dat->first_line_append_nick && !dat->force_in_dialog) { + if (dat->first_line_append_nick && !dat->bForceInDialog) { DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_pszProto, "Nick", &dbv)) { TCHAR nick[_countof(contact->szText)]; @@ -492,7 +492,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) } else mir_tstrncpy(contact->szText, name, _countof(contact->szText)); - if (!dat->force_in_dialog) + if (!dat->bForceInDialog) contact->ssText.ReplaceSmileys(dat, pdnce, contact->szText, dat->first_line_draw_smileys); } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 078bcfbfc4..3f4efe4d81 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -291,22 +291,11 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA RowHeights_Initialize(dat); dat->bNeedsResort = true; - dat->MetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); - dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_MANUALUPDATE)) && db_mc_isEnabled(); - - dat->expandMeta = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); - dat->useMetaIcon = db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT); - dat->drawOverlayedStatus = db_get_b(NULL, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT); - g_CluiData.bSortByOrder[0] = db_get_b(NULL, "CList", "SortBy1", SETTING_SORTBY1_DEFAULT); - g_CluiData.bSortByOrder[1] = db_get_b(NULL, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT); - g_CluiData.bSortByOrder[2] = db_get_b(NULL, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT); - g_CluiData.fSortNoOfflineBottom = db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT); dat->menuOwnerID = -1; dat->menuOwnerType = CLCIT_INVALID; corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - LoadCLCOptions(hwnd, dat, TRUE); if (dat->contact_time_show || dat->secondLine.type == TEXT_CONTACT_TIME || dat->thirdLine.type == TEXT_CONTACT_TIME) CLUI_SafeSetTimer(hwnd, TIMERID_INVALIDATE, 5000, NULL); else @@ -343,7 +332,7 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA KillTimer(hwnd, TIMERID_INFOTIP); KillTimer(hwnd, TIMERID_RENAME); cliRecalcScrollBar(hwnd, dat); - if (g_CluiData.fDisableSkinEngine || dat->force_in_dialog) { + if (g_CluiData.fDisableSkinEngine || dat->bForceInDialog) { RECT rc = { 0 }; GetClientRect(hwnd, &rc); if (rc.right == 0) @@ -359,7 +348,7 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, NULL); HDC hdcMem = CreateCompatibleDC(hdc); HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); - HBRUSH hBrush = CreateSolidBrush((dat->bUseWindowsColours || dat->force_in_dialog) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour); + HBRUSH hBrush = CreateSolidBrush((dat->bUseWindowsColours || dat->bForceInDialog) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour); FillRect(hdcMem, &rc, hBrush); DeleteObject(hBrush); @@ -525,7 +514,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM dat->selection++; selMoved = 1; } - else if (changeGroupExpand == 2 && !contact->bSubExpanded && dat->expandMeta) { + else if (changeGroupExpand == 2 && !contact->bSubExpanded && dat->bMetaExpanding) { ClcContact *ht = NULL; KillTimer(hwnd, TIMERID_SUBEXPAND); contact->bSubExpanded = true; @@ -617,7 +606,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR KillTimer(hwnd, TIMERID_SUBEXPAND); { ClcContact *ht = NULL; - if (hitcontact && dat->expandMeta) { + if (hitcontact && dat->bMetaExpanding) { hitcontact->bSubExpanded = !hitcontact->bSubExpanded; db_set_b(hitcontact->hContact, "CList", "Expanded", hitcontact->bSubExpanded); if (hitcontact->bSubExpanded) @@ -734,7 +723,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP } if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->iSubAllocated && !contact->iSubNumber) - if (hitFlags & CLCHT_ONITEMICON && dat->expandMeta) { + if (hitFlags & CLCHT_ONITEMICON && dat->bMetaExpanding) { hitcontact = contact; HitPoint.x = (short)LOWORD(lParam); HitPoint.y = (short)HIWORD(lParam); @@ -1053,7 +1042,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, fMouseUpped = TRUE; - if (hitcontact != NULL && dat->expandMeta) { + if (hitcontact != NULL && dat->bMetaExpanding) { BYTE doubleClickExpand = db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT); CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, GetDoubleClickTime()*doubleClickExpand, NULL); } @@ -1522,7 +1511,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM if (FindItem(hwnd, dat, wParam, &contact, NULL, NULL, true)) { ClcCacheEntry *pdnce = contact->pce; if (pdnce && pdnce->m_pszProto) { - if (!dat->force_in_dialog) { + if (!dat->bForceInDialog) { Cache_GetNthLineText(dat, pdnce, 2); Cache_GetNthLineText(dat, pdnce, 3); } @@ -1546,7 +1535,6 @@ static LRESULT clcOnIntmReloadOptions(ClcData *dat, HWND hwnd, UINT msg, WPARAM { corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); pcli->pfnLoadClcOptions(hwnd, dat, FALSE); - LoadCLCOptions(hwnd, dat, FALSE); pcli->pfnSaveStateAndRebuildList(hwnd, dat); pcli->pfnSortCLC(hwnd, dat, 1); if (IsWindowVisible(hwnd)) diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h index ab94c5def0..03e05d44b6 100644 --- a/plugins/Clist_modern/src/modern_clc.h +++ b/plugins/Clist_modern/src/modern_clc.h @@ -240,11 +240,9 @@ struct ClcData : public ClcDataBase { BYTE HiLightMode; BYTE doubleClickExpand; - int MetaIgnoreEmptyExtra; - BYTE expandMeta; BYTE IsMetaContactsEnabled; time_t last_tick_time; - BOOL force_in_dialog; + bool bForceInDialog, bPlaceOfflineToRoot, bMetaIgnoreEmptyExtra, bMetaExpanding; int subIndent; int rightMargin; HBITMAP hMenuBackground; @@ -315,7 +313,6 @@ struct ClcData : public ClcDataBase BYTE menuOwnerType; int menuOwnerID; DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond - BYTE useMetaIcon; BYTE drawOverlayedStatus; int nInsertionLevel; @@ -348,6 +345,7 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD hItem, ClcContact **contact, ClcGro int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); // clcitems.c +ClcContact* cli_AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact); void cliRebuildEntireList(HWND hwnd, ClcData *dat); void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort); @@ -362,7 +360,7 @@ void cliBeginRenameSelection(HWND hwnd, ClcData *dat); int cliHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags); void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth); int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt); -void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst); +void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst); COLORREF cliGetColor(char *module, char *color, COLORREF defColor); diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 8cb539e218..f1d7a96ce8 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -183,7 +183,7 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup if (cc->type == CLCIT_CONTACT) if (cc->iSubAllocated) - if (cc->bSubExpanded && dat->expandMeta) { + if (cc->bSubExpanded && dat->bMetaExpanding) { for (i = 0; i < cc->iSubAllocated; i++) { index++; if (testindex == index) { diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 777181b598..9340e05877 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -43,41 +43,40 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) int bHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); for (int j = 0; j < subcount; j++) { MCONTACT hsub = db_mc_getSub(cont->hContact, j); - ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hsub); - WORD wStatus = cacheEntry->getStatus(); + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hsub); + WORD wStatus = pdnce->getStatus(); - if (!showOfflineHereGroup && bHideOffline && !cacheEntry->m_bNoHiddenOffline && wStatus == ID_STATUS_OFFLINE) + if (!showOfflineHereGroup && bHideOffline && !pdnce->m_bNoHiddenOffline && wStatus == ID_STATUS_OFFLINE) continue; ClcContact& p = cont->subcontacts[i]; - p.hContact = cacheEntry->hContact; - p.pce = cacheEntry; + p.hContact = pdnce->hContact; + p.pce = pdnce; p.avatar_pos = AVATAR_POS_DONT_HAVE; Cache_GetAvatar(dat, &p); - p.iImage = corecli.pfnGetContactIcon(cacheEntry->hContact); + p.iImage = corecli.pfnGetContactIcon(pdnce->hContact); memset(p.iExtraImage, 0xFF, sizeof(p.iExtraImage)); - p.proto = cacheEntry->m_pszProto; + p.proto = pdnce->m_pszProto; p.type = CLCIT_CONTACT; - p.flags = 0;//CONTACTF_ONLINE; + p.flags = 0; p.iSubNumber = i + 1; p.lastPaintCounter = 0; p.subcontacts = cont; p.bImageIsSpecial = false; - //p.status = cacheEntry->status; Cache_GetTimezone(dat, (&p)->hContact); Cache_GetText(dat, &p); - char *szProto = cacheEntry->m_pszProto; + char *szProto = pdnce->m_pszProto; if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, wStatus)) p.flags |= CONTACTF_ONLINE; - int apparentMode = szProto != NULL ? cacheEntry->ApparentMode : 0; + int apparentMode = szProto != NULL ? pdnce->ApparentMode : 0; if (apparentMode == ID_STATUS_OFFLINE) p.flags |= CONTACTF_INVISTO; else if (apparentMode == ID_STATUS_ONLINE) p.flags |= CONTACTF_VISTO; else if (apparentMode) p.flags |= CONTACTF_VISTO | CONTACTF_INVISTO; - if (cacheEntry->NotOnList) p.flags |= CONTACTF_NOTONLIST; - int idleMode = szProto != NULL ? cacheEntry->IdleTS : 0; + if (pdnce->NotOnList) p.flags |= CONTACTF_NOTONLIST; + int idleMode = szProto != NULL ? pdnce->IdleTS : 0; if (idleMode) p.flags |= CONTACTF_IDLE; i++; } @@ -109,16 +108,15 @@ void cli_FreeContact(ClcContact *p) corecli.pfnFreeContact(p); } -static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, MCONTACT hContact) +static void _LoadDataToContact(ClcContact *cont, ClcCacheEntry *pdnce, ClcGroup *group, ClcData *dat, MCONTACT hContact) { if (!cont) return; - ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); - char *szProto = cacheEntry->m_pszProto; + char *szProto = pdnce->m_pszProto; cont->type = CLCIT_CONTACT; - cont->pce = cacheEntry; + cont->pce = pdnce; cont->iSubAllocated = 0; cont->iSubNumber = 0; cont->subcontacts = NULL; @@ -128,10 +126,10 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, cont->hContact = hContact; cont->proto = szProto; - if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, cacheEntry->m_iStatus)) + if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, pdnce->m_iStatus)) cont->flags |= CONTACTF_ONLINE; - WORD apparentMode = szProto != NULL ? cacheEntry->ApparentMode : 0; + WORD apparentMode = szProto != NULL ? pdnce->ApparentMode : 0; if (apparentMode) switch (apparentMode) { case ID_STATUS_OFFLINE: @@ -144,17 +142,16 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, cont->flags |= CONTACTF_VISTO | CONTACTF_INVISTO; } - if (cacheEntry->NotOnList) + if (pdnce->NotOnList) cont->flags |= CONTACTF_NOTONLIST; - DWORD idleMode = szProto != NULL ? cacheEntry->IdleTS : 0; + DWORD idleMode = szProto != NULL ? pdnce->IdleTS : 0; if (idleMode) cont->flags |= CONTACTF_IDLE; // Add subcontacts - if (szProto) - if (dat->IsMetaContactsEnabled && !mir_strcmp(cont->proto, META_PROTO)) - AddSubcontacts(dat, cont, CLCItems_IsShowOfflineGroup(group)); + if (dat->IsMetaContactsEnabled && !mir_strcmp(szProto, META_PROTO)) + AddSubcontacts(dat, cont, CLCItems_IsShowOfflineGroup(group)); cont->lastPaintCounter = 0; cont->avatar_pos = AVATAR_POS_DONT_HAVE; @@ -165,29 +162,24 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, cont->bContactRate = db_get_b(hContact, "CList", "Rate", 0); } -static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact) +ClcContact* cli_AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact) { - if (group == NULL || dat == NULL) - return NULL; - - dat->bNeedsResort = true; - int i; - for (i = group->cl.getCount() - 1; i >= 0; i--) - if (group->cl[i]->type != CLCIT_INFO || !(group->cl[i]->flags & CLCIIF_BELOWCONTACTS)) - break; + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + if (pdnce->m_iStatus == ID_STATUS_OFFLINE && dat->bPlaceOfflineToRoot) + group = &dat->list; - ClcContact *cc = pcli->pfnAddItemToGroup(group, i + 1); - _LoadDataToContact(cc, group, dat, hContact); + ClcContact *cc = corecli.pfnAddContactToGroup(dat, group, hContact); + _LoadDataToContact(cc, pdnce, group, dat, hContact); return cc; } void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline) { - ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); - if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_bIsSub) + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + if (dat->IsMetaContactsEnabled && pdnce && pdnce->m_bIsSub) return; //contact should not be added - if (!dat->IsMetaContactsEnabled && cacheEntry && !mir_strcmp(cacheEntry->m_pszProto, META_PROTO)) + if (!dat->IsMetaContactsEnabled && pdnce && !mir_strcmp(pdnce->m_pszProto, META_PROTO)) return; corecli.pfnAddContactToTree(hwnd, dat, hContact, updateTotalCount, checkHideOffline); @@ -195,7 +187,7 @@ void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int update ClcGroup *group; ClcContact *cont; if (FindItem(hwnd, dat, hContact, &cont, &group, NULL, false)) - _LoadDataToContact(cont, group, dat, hContact); + _LoadDataToContact(cont, pdnce, group, dat, hContact); } bool CLCItems_IsShowOfflineGroup(ClcGroup *group) @@ -238,10 +230,6 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected) void cliRebuildEntireList(HWND hwnd, ClcData *dat) { - DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - ClcGroup *group = NULL; - - BOOL PlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT); KillTimer(hwnd, TIMERID_REBUILDAFTER); pcli->bAutoRebuild = false; @@ -249,84 +237,13 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) RowHeights_Clear(dat); RowHeights_GetMaxRowHeight(dat, hwnd); - dat->list.expanded = 1; - dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", SETTING_HIDEOFFLINEATROOT_DEFAULT) && style & CLS_USEGROUPS; - dat->list.cl.destroy(); - dat->bNeedsResort = true; - MCONTACT hSelected = SaveSelection(dat); dat->selection = -1; + dat->bNeedsResort = true; dat->HiLightMode = db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT); + dat->bPlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) != 0; - for (int i = 1;; i++) { - DWORD groupFlags; - TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags); - if (szGroupName == NULL) - break; - pcli->pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0); - } - - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - ClcContact *cont = NULL; - ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); - - int nHiddenStatus = CLVM_GetContactHiddenStatus(hContact, NULL, dat); - if ((style & CLS_SHOWHIDDEN && nHiddenStatus != -1) || !nHiddenStatus) { - if (mir_tstrlen(cacheEntry->tszGroup) == 0) - group = &dat->list; - else - group = pcli->pfnAddGroup(hwnd, dat, cacheEntry->tszGroup, (DWORD)-1, 0, 0); - - if (group != NULL) { - if (cacheEntry->m_iStatus == ID_STATUS_OFFLINE && PlaceOfflineToRoot) - group = &dat->list; - - group->totalMembers++; - - if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { - if (cacheEntry->m_pszProto == NULL) { - if (!pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE) || cacheEntry->m_bNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) - cont = AddContactToGroup(dat, group, hContact); - } - else if (!pcli->pfnIsHiddenMode(dat, cacheEntry->m_iStatus) || cacheEntry->m_bNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) - cont = AddContactToGroup(dat, group, hContact); - } - else cont = AddContactToGroup(dat, group, hContact); - } - } - if (cont) { - cont->iSubAllocated = 0; - if (cont->proto && dat->IsMetaContactsEnabled && mir_strcmp(cont->proto, META_PROTO) == 0) - AddSubcontacts(dat, cont, CLCItems_IsShowOfflineGroup(group)); - } - } - - if (style & CLS_HIDEEMPTYGROUPS) { - group = &dat->list; - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.getCount()) { - if ((group = group->parent) == NULL) - break; - group->scanIndex++; - continue; - } - - ClcContact *cc = group->cl[group->scanIndex]; - if (cc->type == CLCIT_GROUP) { - if (cc->group->cl.getCount() == 0) - group = pcli->pfnRemoveItemFromGroup(hwnd, group, cc, 0); - else { - group = cc->group; - group->scanIndex = 0; - } - continue; - } - group->scanIndex++; - } - } - - pcli->pfnSortCLC(hwnd, dat, 0); + corecli.pfnRebuildEntireList(hwnd, dat); RestoreSelection(dat, hSelected); } @@ -473,7 +390,7 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat) if (dat != NULL && dat->IsMetaContactsEnabled && db_mc_isSub(hContact)) return -1; //subcontact - if (pdnce && pdnce->m_bIsUnknown && dat != NULL && !dat->force_in_dialog) + if (pdnce && pdnce->m_bIsUnknown && dat != NULL && !dat->bForceInDialog) return 1; //'Unknown Contact' if (dat != NULL && dat->bFilterSearch && pdnce && pdnce->tszName) { @@ -483,7 +400,7 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat) searchResult = _tcsstr(lowered_name, lowered_search) ? 0 : 1; } - if (pdnce && g_CluiData.bFilterEffective && dat != NULL && !dat->force_in_dialog) { + if (pdnce && g_CluiData.bFilterEffective && dat != NULL && !dat->bForceInDialog) { if (szProto == NULL) szProto = GetContactProto(hContact); // check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set). diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 22a130250d..649d39736f 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -40,7 +40,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP return 0; case CLM_AUTOREBUILD: - if (dat->force_in_dialog) { + if (dat->bForceInDialog) { pcli->pfnSaveStateAndRebuildList(hwnd, dat); pcli->bAutoRebuild = false; } @@ -76,7 +76,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP if (wParam > FONTID_MODERN_MAX) break; dat->fontModernInfo[wParam].colour = lParam; - dat->force_in_dialog = TRUE; + dat->bForceInDialog = true; // Issue 40: option knows nothing about moderns colors // others who know have to set colors from lowest to highest switch (wParam) { diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index bce1166c21..e65ee314c5 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -325,7 +325,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA CheckDlgButton(hwndDlg, IDC_META, db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_METADBLCLK, db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR + CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, db_get_b(NULL, "CLC", "bMetaIgnoreEmptyExtra", SETTING_METAAVOIDDBLCLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_METAEXPAND, db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, db_get_b(NULL, "ModernData", "InternalAwayMsgDiscovery", SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, db_get_b(NULL, "ModernData", "RemoveAwayMessageForOffline", SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR @@ -354,7 +354,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA db_set_b(NULL, "CLC", "Meta", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_META)); db_set_b(NULL, "CLC", "MetaDoubleClick", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METADBLCLK)); db_set_b(NULL, "CLC", "MetaHideExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA)); - db_set_b(NULL, "CLC", "MetaIgnoreEmptyExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA_IGN)); + db_set_b(NULL, "CLC", "bMetaIgnoreEmptyExtra", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METASUBEXTRA_IGN)); db_set_b(NULL, "CLC", "MetaExpanding", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_METAEXPAND)); db_set_b(NULL, "ModernData", "InternalAwayMsgDiscovery", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISCOVER_AWAYMSG)); db_set_b(NULL, "ModernData", "RemoveAwayMessageForOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG)); diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index fed66f75cb..8f31531595 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1317,7 +1317,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R COLORREF colourFg = dat->selBkColour; int mode = BlendedInActiveState ? BlendValue : ILD_NORMAL; if (Drawing->iExtraImage[iImage] == EMPTY_EXTRA_ICON) { - if (!dat->MetaIgnoreEmptyExtra) { + if (!dat->bMetaIgnoreEmptyExtra) { SetRect(&rc, p_rect.left + x, p_rect.top, p_rect.left + x + ICON_HEIGHT, p_rect.bottom); x += dat->extraColumnSpacing; if (dat->text_rtl != 0) _RTLRect(&rc, free_row_rc.right); @@ -1506,7 +1506,7 @@ int CLCPaint::_DetermineDrawMode(HWND hWnd, ClcData *dat) { int paintMode = DM_LAYERED; // by default - if (dat->force_in_dialog) + if (dat->bForceInDialog) paintMode = DM_CONTROL; else if (g_CluiData.fDisableSkinEngine) paintMode = DM_CLASSIC; @@ -1778,7 +1778,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, } _PaintRowItems(pc.hdcMem, dat, Drawing, row_rc, free_row_rc, left_pos, right_pos, selected, hottrack, rcPaint); if (mpRequest) { - if (!dat->force_in_dialog) { + if (!dat->bForceInDialog) { mir_free(mpRequest->pl_Params[1].szValue); mpRequest->pl_Params[1].szValue = mir_strndup("Ovl", 3); mpRequest->pl_Params[1].dwValueHash = mod_CalcHash("Ovl"); @@ -1800,7 +1800,7 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT *rcPaint, // increment by subcontacts ClcContact *cc = group->cl[group->scanIndex]; - if (cc != NULL && cc->subcontacts != NULL && cc->type != CLCIT_GROUP && cc->bSubExpanded && dat->expandMeta) { + if (cc != NULL && cc->subcontacts != NULL && cc->type != CLCIT_GROUP && cc->bSubExpanded && dat->bMetaExpanding) { if (subindex < cc->iSubAllocated - 1) subindex++; else @@ -2144,7 +2144,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT int count = 0; for (iImage = dat->extraColumnsCount - 1; iImage >= 0; iImage--) { - if (Drawing->iExtraImage[iImage] != EMPTY_EXTRA_ICON || !dat->MetaIgnoreEmptyExtra) { + if (Drawing->iExtraImage[iImage] != EMPTY_EXTRA_ICON || !dat->bMetaIgnoreEmptyExtra) { RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, dat->extraColumnSpacing, dat->extraColumnSpacing, ICON_HEIGHT, 0); if (rc.left < rc.right) { // Store position @@ -2644,7 +2644,7 @@ void CLCPaint::_DrawContactText(HDC hdcMem, ClcData *dat, ClcContact *Drawing, i { ChangeToFont(hdcMem, dat, GetBasicFontID(Drawing), NULL); if (selected) - SetTextColor(hdcMem, dat->force_in_dialog ? GetSysColor(COLOR_HIGHLIGHTTEXT) : dat->selTextColour); + SetTextColor(hdcMem, dat->bForceInDialog ? GetSysColor(COLOR_HIGHLIGHTTEXT) : dat->selTextColour); else if (hottrack || (dat->bFilterSearch && dat->szQuickSearch[0] != '\0' && Drawing->type != CLCIT_GROUP)) _SetHotTrackColour(hdcMem, dat); @@ -2798,7 +2798,7 @@ void CLCPaint::_DrawContactItems(HDC hdcMem, ClcData *dat, ClcContact *Drawing, (dat->text_rtl ? DT_RTLREADING : 0) | (dat->text_align_right ? DT_RIGHT : 0) | (gl_TrimText ? DT_END_ELLIPSIS : 0) | - ((dat->force_in_dialog || dat->bkChanged) ? DT_FORCENATIVERENDER : 0); + ((dat->bForceInDialog || dat->bkChanged) ? DT_FORCENATIVERENDER : 0); RECT text_rc = *row_rc; diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index b5d01c3a08..34050275bf 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -151,13 +151,12 @@ void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth) dat->yScroll = oldy + (desty - oldy)*(int)(nowTick - startTick) / dat->scrollTime; if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL && */FALSE) ScrollWindowEx(hwnd, 0, previousy - dat->yScroll, NULL, NULL, NULL, NULL, SW_INVALIDATE); - else { - CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)hwnd, (LPARAM)0); - //InvalidateRectZ(hwnd,NULL,FALSE); - } + else + CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)hwnd, 0); + previousy = dat->yScroll; SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); - CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)hwnd, (LPARAM)0); + CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)hwnd, 0); UpdateWindow(hwnd); } } @@ -430,14 +429,13 @@ void LoadCLCFonts(HWND hwnd, ClcData *dat) HFONT holdfont = (HFONT)GetCurrentObject(hdc, OBJ_FONT); for (int i = 0; i <= FONTID_MODERN_MAX; i++) { - if (!dat->fontModernInfo[i].changed && dat->fontModernInfo[i].hFont) { + if (!dat->fontModernInfo[i].changed && dat->fontModernInfo[i].hFont) DeleteObject(dat->fontModernInfo[i].hFont); - } - LOGFONT lf; // Issue 40: Do not reload font colors for embedded clists // Parent window is responsible to re-set fonts colors if needed - GetFontSetting(i, &lf, dat->force_in_dialog ? NULL : &dat->fontModernInfo[i].colour, &dat->fontModernInfo[i].effect, &dat->fontModernInfo[i].effectColour1, &dat->fontModernInfo[i].effectColour2); + LOGFONT lf; + GetFontSetting(i, &lf, dat->bForceInDialog ? NULL : &dat->fontModernInfo[i].colour, &dat->fontModernInfo[i].effect, &dat->fontModernInfo[i].effectColour1, &dat->fontModernInfo[i].effectColour2); dat->fontModernInfo[i].hFont = CreateFontIndirect(&lf); dat->fontModernInfo[i].changed = 0; @@ -450,7 +448,7 @@ void LoadCLCFonts(HWND hwnd, ClcData *dat) ReleaseDC(hwnd, hdc); } -void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) +void cli_LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) { g_CluiData.fDisableSkinEngine = db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT); @@ -596,7 +594,7 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) else memset(&dat->thirdLine, 0, sizeof(dat->thirdLine)); dat->rightMargin = db_get_b(NULL, "CLC", "RightMargin", CLCDEFAULT_RIGHTMARGIN); - dat->force_in_dialog = (pcli->hwndContactTree) ? (hwnd != pcli->hwndContactTree) : 0; + dat->bForceInDialog = (pcli->hwndContactTree) ? (hwnd != pcli->hwndContactTree) : 0; dat->subIndent = db_get_b(NULL, "CLC", "SubIndent", CLCDEFAULT_GROUPINDENT); if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } @@ -620,13 +618,13 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE)&CLS_MANUALUPDATE)) && db_get_b(NULL, META_PROTO, "Enabled", 1); if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree) - dat->MetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); + dat->bMetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "bMetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT) != 0; else - dat->MetaIgnoreEmptyExtra = FALSE; + dat->bMetaIgnoreEmptyExtra = false; - dat->expandMeta = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); - dat->useMetaIcon = db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT); + dat->bMetaExpanding = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT) != 0; + dat->bPlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT) != 0; dat->drawOverlayedStatus = db_get_b(NULL, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT); dat->dbbMetaHideExtra = db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 2f1d258d2c..7b51d0edeb 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -773,7 +773,7 @@ static UINT_PTR SetTimerSync(WPARAM wParam, LPARAM) UINT_PTR CLUI_SafeSetTimer(HWND hwnd, int ID, int Timeout, TIMERPROC proc) { struct _tagTimerAsync param = { hwnd, ID, Timeout, proc }; - return Sync(SetTimerSync, (WPARAM)¶m, (LPARAM)0); + return Sync(SetTimerSync, (WPARAM)¶m, 0); } int CLUI_UpdateTimer() diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 71753c5aee..816294ea61 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -107,7 +107,7 @@ int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2) } // one is offline: offline goes below online - if (g_CluiData.fSortNoOfflineBottom == 0) { + if (!g_CluiData.fSortNoOfflineBottom) { int statusa = c1->getStatus(); int statusb = c2->getStatus(); if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) diff --git a/plugins/Clist_modern/src/modern_defsettings.h b/plugins/Clist_modern/src/modern_defsettings.h index 60ab0ce282..38d367ecf3 100644 --- a/plugins/Clist_modern/src/modern_defsettings.h +++ b/plugins/Clist_modern/src/modern_defsettings.h @@ -122,7 +122,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 //"ModernData","RemoveAwayMessageForOffline" #define SETTING_FILTERSEARCH_DEFAULT 0 //"ModernData","FilterSearch" #define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 //"CLC","MetaDoubleClick" -#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 //"CLC","MetaIgnoreEmptyExtra" +#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 //"CLC","bMetaIgnoreEmptyExtra" #define SETTING_METAHIDEEXTRA_DEFAULT 0 //"CLC","MetaHideExtra" #define SETTING_METAEXPANDING_DEFAULT 1 //"CLC","MetaExpanding" #define SETTING_USEMETAICON_DEFAULT 1 //"CLC","Meta" diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index b239ea046e..b3b7f48f2f 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -200,11 +200,11 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) case TC_EXTRA: // Draw extra icons if (contact->type == CLCIT_CONTACT && (!contact->iSubNumber || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) { - BOOL hasExtra = FALSE; + bool hasExtra = false; int width = 0; for (int k = 0; k < dat->extraColumnsCount; k++) - if (contact->iExtraImage[k] != EMPTY_EXTRA_ICON || !dat->MetaIgnoreEmptyExtra) { - hasExtra = TRUE; + if (contact->iExtraImage[k] != EMPTY_EXTRA_ICON || !dat->bMetaIgnoreEmptyExtra) { + hasExtra = true; if (item != -1) break; width += (width > 0) ? dat->extraColumnSpacing : (dat->extraColumnSpacing - 2); } @@ -228,7 +228,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item) (!contact->iSubNumber || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) { int eNum = pCell->type - TC_EXTRA1; if (eNum < dat->extraColumnsCount) - if (contact->iExtraImage[eNum] != EMPTY_EXTRA_ICON || !dat->MetaIgnoreEmptyExtra) { + if (contact->iExtraImage[eNum] != EMPTY_EXTRA_ICON || !dat->bMetaIgnoreEmptyExtra) { pCell->h = ICON_HEIGHT; pCell->w = ICON_HEIGHT; } @@ -445,7 +445,7 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd) // increment by subcontacts if (group->cl[group->scanIndex]->subcontacts != NULL && group->cl[group->scanIndex]->type != CLCIT_GROUP) { - if (group->cl[group->scanIndex]->bSubExpanded && dat->expandMeta) { + if (group->cl[group->scanIndex]->bSubExpanded && dat->bMetaExpanding) { if (subindex < group->cl[group->scanIndex]->iSubAllocated - 1) subindex++; else diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 26bfc36841..c1ef17f036 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -255,10 +255,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam dat = new ClcData(); SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); } - { - for (int i = 0; i <= FONTID_MAX; i++) - dat->fontInfo[i].changed = 1; - } + + for (int i = 0; i <= FONTID_MAX; i++) + dat->fontInfo[i].changed = 1; + dat->selection = -1; dat->iconXSpace = 20; dat->checkboxSize = 13; -- cgit v1.2.3