From 211967c3ae7d510f2e63aac7fe912d040ad1ebc3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 30 Oct 2015 16:41:09 +0000 Subject: old unused code that belongs to StdClist moved from the core to plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@15652 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 8 +- plugins/Clist_modern/src/modern_clcitems.cpp | 1 + plugins/Clist_modern/src/modern_clcmsgs.cpp | 168 +++++++++++----------- plugins/Clist_modern/src/modern_clistsettings.cpp | 33 ++--- 5 files changed, 101 insertions(+), 111 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 12d6a29765..e48ab15e95 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -515,7 +515,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(contact->hContact); TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact, 0); - if (dat->first_line_append_nick && (!dat->force_in_dialog)) { + if (dat->first_line_append_nick && !dat->force_in_dialog) { DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { TCHAR nick[_countof(contact->szText)]; diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 260b131276..e5c067e482 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1500,9 +1500,8 @@ static LRESULT clcOnIntmNameChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP Cache_GetText(dat, contact, 1); cliRecalcScrollBar(hwnd, dat); } - dat->needsResort = 1; - pcli->pfnSortContacts(); + dat->needsResort = 1; return ret; } @@ -1584,10 +1583,9 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM if (db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOOFLINETOROOT_DEFAULT)) pcli->pfnInitAutoRebuild(hwnd); - else { - pcli->pfnSortContacts(); + else PostMessage(hwnd, INTM_INVALIDATE, 0, 0); - } + return ret; } diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index e57e8d6a89..0d488cf780 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -333,6 +333,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) BOOL PlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT); KillTimer(hwnd, TIMERID_REBUILDAFTER); + pcli->bAutoRebuild = false; ClearRowByIndexCache(); ImageArray_Clear(&dat->avatar_cache); diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index e8cf1a0e75..07ace535a6 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -41,12 +41,11 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP return 0; case CLM_AUTOREBUILD: - if (dat->force_in_dialog) + if (dat->force_in_dialog) { pcli->pfnSaveStateAndRebuildList(hwnd, dat); - else - clcSetDelayTimer(TIMERID_REBUILDAFTER, hwnd); - - pcli->bAutoRebuild = false; + pcli->bAutoRebuild = false; + } + else clcSetDelayTimer(TIMERID_REBUILDAFTER, hwnd); return 0; case CLM_SETFONT: @@ -62,17 +61,17 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP return 0; case CLM_SETHIDEEMPTYGROUPS: - { - BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); - if (wParam) - SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS); - else - SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~CLS_HIDEEMPTYGROUPS); - BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); - if (newval != old) - pcli->pfnInitAutoRebuild(hwnd); - } - return 0; + { + BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); + if (wParam) + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS); + else + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~CLS_HIDEEMPTYGROUPS); + BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); + if (newval != old) + pcli->pfnInitAutoRebuild(hwnd); + } + return 0; case CLM_SETTEXTCOLOR: if (wParam > FONTID_MODERN_MAX) break; @@ -105,76 +104,76 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP return 0; case CLM_GETNEXTITEM: - { - int i = 0; - if (wParam != CLGN_ROOT) { - if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL)) - return NULL; - i = List_IndexOf((SortedList*)&group->cl, contact); - if (i < 0) return 0; - } - switch (wParam) { - case CLGN_ROOT: - if (dat->list.cl.count) - return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]); - else - return NULL; - case CLGN_CHILD: - if (contact->type != CLCIT_GROUP) - return NULL; - group = contact->group; - if (group->cl.count == 0) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]); - case CLGN_PARENT: - return group->groupId | HCONTACT_ISGROUP; - case CLGN_NEXT: - do { - if (++i >= group->cl.count) + { + int i = 0; + if (wParam != CLGN_ROOT) { + if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL)) return NULL; - } while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_PREVIOUS: - do { - if (--i < 0) + i = List_IndexOf((SortedList*)&group->cl, contact); + if (i < 0) return 0; + } + switch (wParam) { + case CLGN_ROOT: + if (dat->list.cl.count) + return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]); + else + return NULL; + case CLGN_CHILD: + if (contact->type != CLCIT_GROUP) + return NULL; + group = contact->group; + if (group->cl.count == 0) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]); + case CLGN_PARENT: + return group->groupId | HCONTACT_ISGROUP; + case CLGN_NEXT: + do { + if (++i >= group->cl.count) + return NULL; + } while (group->cl.items[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_PREVIOUS: + do { + if (--i < 0) + return NULL; + } while (group->cl.items[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_NEXTCONTACT: + for (i++; i < group->cl.count; i++) + if (group->cl.items[i]->type == CLCIT_CONTACT) + break; + if (i >= group->cl.count) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_PREVIOUSCONTACT: + if (i >= group->cl.count) + return NULL; + for (i--; i >= 0; i--) + if (group->cl.items[i]->type == CLCIT_CONTACT) + break; + if (i < 0) return NULL; - } while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_NEXTCONTACT: - for (i++; i < group->cl.count; i++) - if (group->cl.items[i]->type == CLCIT_CONTACT) - break; - if (i >= group->cl.count) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_PREVIOUSCONTACT: - if (i >= group->cl.count) - return NULL; - for (i--; i >= 0; i--) - if (group->cl.items[i]->type == CLCIT_CONTACT) - break; - if (i < 0) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_NEXTGROUP: - for (i++; i < group->cl.count; i++) - if (group->cl.items[i]->type == CLCIT_GROUP) - break; - if (i >= group->cl.count) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_PREVIOUSGROUP: - if (i >= group->cl.count) - return NULL; - for (i--; i >= 0; i--) - if (group->cl.items[i]->type == CLCIT_GROUP) - break; - if (i < 0) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_NEXTGROUP: + for (i++; i < group->cl.count; i++) + if (group->cl.items[i]->type == CLCIT_GROUP) + break; + if (i >= group->cl.count) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_PREVIOUSGROUP: + if (i >= group->cl.count) + return NULL; + for (i--; i >= 0; i--) + if (group->cl.items[i]->type == CLCIT_GROUP) + break; + if (i < 0) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + } } - } - return NULL; + return NULL; case CLM_SELECTITEM: ClcGroup *tgroup; @@ -198,8 +197,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); if (k) { - for (int i = 0; i < mainindex; i++) - { + for (int i = 0; i < mainindex; i++) { ClcContact *tempCont = group->cl.items[i]; if (tempCont->type == CLCIT_CONTACT && tempCont->SubAllocated && tempCont->SubExpanded) index += tempCont->SubAllocated; diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index dc047d848e..d17427c5ec 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -313,7 +313,7 @@ char *GetContactCachedProtocol(MCONTACT hContact) int GetStatusForContact(MCONTACT hContact, char *szProto) { - return (szProto) ? (int)(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)) : ID_STATUS_OFFLINE; + return (szProto) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE; } void ClcCacheEntry::freeName() @@ -366,10 +366,9 @@ int GetContactCachedStatus(MCONTACT hContact) int ContactAdded(WPARAM hContact, LPARAM) { - if (!MirandaExiting()) { + if (!MirandaExiting()) cli_ChangeContactIcon(hContact, pcli->pfnIconFromStatusMode((char*)GetContactCachedProtocol(hContact), ID_STATUS_OFFLINE, hContact), 1); ///by FYR - pcli->pfnSortContacts(); - } + return 0; } @@ -414,25 +413,19 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0; } - if (pdnce->bIsHidden != 1) { - pdnce->m_cache_nStatus = cws->value.wVal; - if (cws->value.wVal == ID_STATUS_OFFLINE) - if (g_CluiData.bRemoveAwayMessageForOffline) - db_set_s(hContact, "CList", "StatusMsg", ""); + if (pdnce->bIsHidden) + return 0; - if ((db_get_w(NULL, "CList", "SecondLineType", 0) == TEXT_STATUS_MESSAGE || db_get_w(NULL, "CList", "ThirdLineType", 0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_cache_cszProto) - amRequestAwayMsg(hContact); + pdnce->m_cache_nStatus = cws->value.wVal; + if (cws->value.wVal == ID_STATUS_OFFLINE) + if (g_CluiData.bRemoveAwayMessageForOffline) + db_set_s(hContact, "CList", "StatusMsg", ""); - pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); - cli_ChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 0); //by FYR - pcli->pfnSortContacts(); - } - else { - if (!(!strcmp(cws->szSetting, "LogonTS") || !strcmp(cws->szSetting, "TickTS") || !strcmp(cws->szSetting, "InfoTS"))) - pcli->pfnSortContacts(); + if ((db_get_w(NULL, "CList", "SecondLineType", 0) == TEXT_STATUS_MESSAGE || db_get_w(NULL, "CList", "ThirdLineType", 0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_cache_cszProto) + amRequestAwayMsg(hContact); - return 0; - } + pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); + cli_ChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 0); //by FYR } } -- cgit v1.2.3