From 2a18cb546bac91077a193691368162d8f07992a1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 Apr 2016 18:00:05 +0000 Subject: we don't need that FindItem's implementation in nicer+ anymore, it's already in the core git-svn-id: http://svn.miranda-ng.org/main/trunk@16791 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/cluiframes.cpp | 11 ++- plugins/Clist_modern/src/init.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 22 ++--- plugins/Clist_modern/src/modern_clcmsgs.cpp | 2 +- plugins/Clist_modern/src/modern_clcutils.cpp | 2 +- plugins/Clist_modern/src/modern_clistevents.cpp | 6 +- plugins/Clist_modern/src/modern_clui.cpp | 4 +- plugins/Clist_modern/src/modern_commonprototypes.h | 7 +- plugins/Clist_modern/src/modern_statusbar.cpp | 6 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 +- plugins/Clist_nicer/src/clc.cpp | 26 ++--- plugins/Clist_nicer/src/clc.h | 4 - plugins/Clist_nicer/src/clcidents.cpp | 107 --------------------- plugins/Clist_nicer/src/clcmsgs.cpp | 8 +- plugins/Clist_nicer/src/clistmenus.cpp | 8 +- plugins/Clist_nicer/src/rowheight_funcs.cpp | 37 ++----- plugins/Clist_nicer/src/rowheight_funcs.h | 21 ++-- 17 files changed, 72 insertions(+), 203 deletions(-) delete mode 100644 plugins/Clist_nicer/src/clcidents.cpp diff --git a/plugins/Clist_modern/src/cluiframes.cpp b/plugins/Clist_modern/src/cluiframes.cpp index 1a2177a73a..7acf5e11b7 100644 --- a/plugins/Clist_modern/src/cluiframes.cpp +++ b/plugins/Clist_modern/src/cluiframes.cpp @@ -1711,9 +1711,9 @@ static int _us_DoRemoveFrame(WPARAM wParam, LPARAM) g_pfwFrames[pos].OwnerWindow = NULL; RemoveItemFromList(pos, &g_pfwFrames, &g_nFramesCount); - CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList, 0); - CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); return 0; }; @@ -2332,7 +2332,7 @@ int CLUIFramesOnClistResize(WPARAM wParam, LPARAM lParam) tick = GetTickCount() - tick; - if (pcli->hwndContactList != 0) CLUI__cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); + if (pcli->hwndContactList != 0) cliInvalidateRect(pcli->hwndContactList, NULL, TRUE); if (pcli->hwndContactList != 0) UpdateWindow(pcli->hwndContactList); if (lParam == 2) RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); @@ -2370,7 +2370,7 @@ int OnFrameTitleBarBackgroundChange(WPARAM, LPARAM) } } - CLUI__cliInvalidateRect(pcli->hwndContactList, 0, 0); + cliInvalidateRect(pcli->hwndContactList, 0, 0); RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_ERASE | RDW_INVALIDATE); return 0; @@ -2607,7 +2607,8 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam return 1; case WM_ENABLE: - if (hwnd != 0) CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + if (hwnd != 0) + cliInvalidateRect(hwnd, NULL, FALSE); return 0; case WM_ERASEBKGND: diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 0ddd291b3a..236275a2a0 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -153,7 +153,7 @@ static HRESULT SubclassClistInterface() pcli->pfnGetRowHeight = cliGetRowHeight; pcli->pfnGetRowTopY = cliGetRowTopY; pcli->pfnGetRowTotalHeight = cliGetRowTotalHeight; - pcli->pfnInvalidateRect = CLUI__cliInvalidateRect; + pcli->pfnInvalidateRect = cliInvalidateRect; pcli->pfnOnCreateClc = CLUI::cliOnCreateClc; pcli->pfnPaintClc = CLCPaint::cliPaintClc; pcli->pfnRebuildEntireList = cliRebuildEntireList; diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 34b0e84474..f1746e74a1 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -586,7 +586,7 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM if (dat->selection < 0) dat->selection = 0; if (dat->bCompactMode) SendMessage(hwnd, WM_SIZE, 0, 0); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); UpdateWindow(hwnd); SetCapture(hwnd); @@ -618,7 +618,7 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR { time_t cur_time = (time(NULL) / 60); if (cur_time != dat->last_tick_time) { - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); dat->last_tick_time = cur_time; } } @@ -773,7 +773,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP if (dat->bCompactMode) SendMessage(hwnd, WM_SIZE, 0, 0); else { - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd); } return TRUE; @@ -787,7 +787,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP else pcli->pfnSetContactCheckboxes(contact, bNewState); pcli->pfnRecalculateGroupCheckboxes(hwnd, dat); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); NMCLISTCONTROL nm; nm.hdr.code = CLN_CHECKCHANGED; @@ -814,7 +814,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP return FALSE; dat->selection = (hitFlags & CLCHT_NOWHERE) ? -1 : hit; - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); UpdateWindow(hwnd); if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA | CLCHT_ONITEMCHECK | CLCHT_NOWHERE))) { @@ -940,7 +940,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR POINT pt = UNPACK_POINT(lParam); HCURSOR hNewCursor = LoadCursor(NULL, IDC_NO); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); if (dat->dragAutoScrolling) { KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL); dat->dragAutoScrolling = 0; @@ -1263,7 +1263,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } } - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); dat->iDragItem = -1; dat->iInsertionMark = -1; return 0; @@ -1425,9 +1425,9 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam } else if (needRepaint) { if (contact && contact->pos_icon.bottom != 0 && contact->pos_icon.right != 0) - CLUI__cliInvalidateRect(hwnd, &(contact->pos_icon), FALSE); + cliInvalidateRect(hwnd, &contact->pos_icon, FALSE); else - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); //try only needed rectangle } @@ -1442,7 +1442,7 @@ static LRESULT clcOnIntmAvatarChanged(ClcData *dat, HWND hwnd, UINT, WPARAM hCon else if (hContact == 0) UpdateAllAvatars(dat); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); return 0; } @@ -1518,7 +1518,7 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR else contact->flags |= CONTACTF_NOTONLIST; - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 5e372e365d..2b889619b8 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -56,7 +56,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP RowHeights_GetMaxRowHeight(dat, hwnd); if (LOWORD(lParam)) - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); return 0; case CLM_SETHIDEEMPTYGROUPS: diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index c172e89ed1..2843dd748d 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -180,7 +180,7 @@ void cliScrollTo(HWND hwnd, ClcData *dat, int desty, int noSmooth) } } dat->yScroll = desty; - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE); } diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 9fc3867367..52752fdf3b 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -146,7 +146,7 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) } } - CLUI__cliInvalidateRect(g_CluiData.hwndEventFrame, NULL, FALSE); + cliInvalidateRect(g_CluiData.hwndEventFrame, NULL, FALSE); return p; } @@ -189,7 +189,7 @@ int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) if (hContact == g_CluiData.hUpdateContact || (INT_PTR)hDbEvent == 1) g_CluiData.hUpdateContact = 0; - CLUI__cliInvalidateRect(g_CluiData.hwndEventFrame, NULL, FALSE); + cliInvalidateRect(g_CluiData.hwndEventFrame, NULL, FALSE); return res; } @@ -291,7 +291,7 @@ static int EventArea_Draw(HWND hwnd, HDC hDC) if (GetParent(hwnd) == pcli->hwndContactList) return EventArea_DrawWorker(hwnd, hDC); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); return 0; } diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 74ff3c3c80..ab054410b0 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -174,7 +174,7 @@ int CLUI::OnEvent_FontReload(WPARAM wParam, LPARAM lParam) g_CluiData.dwKeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT); - CLUI__cliInvalidateRect(pcli->hwndContactList, 0, 0); + cliInvalidateRect(pcli->hwndContactList, 0, 0); return 0; } @@ -1486,7 +1486,7 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) return 0; } -BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase) +BOOL cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase) { if (CLUI_IsInMainWindow(hWnd) && g_CluiData.fLayered) { if (IsWindowVisible(hWnd)) diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index d6f5af45df..ff65753ae4 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -252,7 +252,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP CListEvent* cli_AddEvent(CLISTEVENT *cle); LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); int cliShowHide(WPARAM wParam, LPARAM lParam); -BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase); +BOOL cliInvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase); int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2); int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); @@ -261,9 +261,8 @@ void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact); void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat); void CLUI_cli_LoadCluiGlobalOpts(void); INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); -BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase); -int cliTrayIconInit(HWND hwnd); -int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount); +int cliTrayIconInit(HWND hwnd); +int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount); ClcContact* cliCreateClcContact(void); ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact); diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 95a4658dc2..6c272b4202 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -140,7 +140,7 @@ int ModernDrawStatusBar(HWND hwnd, HDC hDC) if (GetParent(hwnd) == pcli->hwndContactList) return ModernDrawStatusBarWorker(hwnd, hDC); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); return 0; } @@ -822,7 +822,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ApplyViewMode(filterName); } pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); SetCapture(NULL); return 0; } @@ -854,7 +854,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa GetClientRect(hwnd, &rc); if (PtInRect(&rc, pt) && msg == WM_LBUTTONDOWN && g_CluiData.bFilterEffective == CLVM_FILTER_PROTOS) { ApplyViewMode(""); - CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + cliInvalidateRect(hwnd, NULL, FALSE); SetCapture(NULL); return 0; } diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index a48543b1b1..29c2b1ac77 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -1365,7 +1365,7 @@ void ApplyViewMode(const char *Name, bool onlySelector) SetWindowText(hwndSelector, ptrT(mir_utf8decodeW((Name[0] == 13) ? Name + 1 : Name))); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); - CLUI__cliInvalidateRect(pcli->hwndStatus, NULL, FALSE); + cliInvalidateRect(pcli->hwndStatus, NULL, FALSE); } static int SkinSetViewMode(WPARAM wParam /*char * name*/, LPARAM lParam /*int index*/) diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 35237961cf..8bb428058e 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -275,7 +275,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L { WORD iExtraImage[EXTRA_ICON_COUNT]; BYTE flags = 0; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -284,7 +284,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L pcli->pfnDeleteItemFromTree(hwnd, wParam); if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(wParam, NULL, dat)) { pcli->pfnAddContactToTree(hwnd, dat, wParam, 1, 1); - if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -322,13 +322,13 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L !CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, &group, NULL)) { + if (!pcli->pfnFindItem(hwnd, dat, hContact, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (UINT_PTR)pcli->pfnContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); recalcScrollBar = 1; - FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL); + pcli->pfnFindItem(hwnd, dat, hContact, &contact, NULL, NULL); if (contact) { contact->iImage = (WORD)lParam; pcli->pfnNotifyNewContact(hwnd, hContact); @@ -395,14 +395,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_METACHANGEDEVENT: - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; if (lParam == 0) pcli->pfnInitAutoRebuild(hwnd); return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_NAMECHANGED: - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText)); @@ -413,7 +413,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_CODEPAGECHANGED: - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; contact->codePage = db_get_dw(wParam, "Tab_SRMsg", "ANSIcodepage", db_get_dw(wParam, "UserInfo", "ANSIcodepage", CP_ACP)); @@ -433,7 +433,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); } - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) return 0; contact->ace = cEntry; @@ -460,7 +460,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L TExtraCache *p; char *szProto = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) p = cfg::getCache(wParam, NULL); else { p = contact->pExtra; @@ -472,7 +472,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_STATUSCHANGED: - if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { WORD wStatus = db_get_w(wParam, contact->proto, "Status", ID_STATUS_OFFLINE); if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) { contact->wStatus = wStatus; @@ -485,7 +485,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L break; case INTM_PROTOCHANGED: - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; contact->proto = GetContactProto(wParam); @@ -520,7 +520,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L return DefWindowProc(hwnd, msg, wParam, lParam); case INTM_IDLECHANGED: - if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; char *szProto = (char*)cws->szModule; if (szProto == NULL) @@ -542,7 +542,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L MCONTACT hContact = wParam; TExtraCache *p; - if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) { + if (!pcli->pfnFindItem(hwnd, dat, hContact, &contact, NULL, NULL)) { p = cfg::getCache(hContact, szProto); if (!dat->bisEmbedded && szProto) { // may be a subcontact, forward the xstatus MCONTACT hMasterContact = db_mc_tryMeta(hContact); diff --git a/plugins/Clist_nicer/src/clc.h b/plugins/Clist_nicer/src/clc.h index 58d9c11594..2e3eea72f7 100644 --- a/plugins/Clist_nicer/src/clc.h +++ b/plugins/Clist_nicer/src/clc.h @@ -363,10 +363,6 @@ struct protoMenu HICON hIcon; }; -// 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 void RebuildEntireList(HWND hwnd, struct ClcData *dat); DWORD INTSORT_GetLastMsgTime(MCONTACT hContact); diff --git a/plugins/Clist_nicer/src/clcidents.cpp b/plugins/Clist_nicer/src/clcidents.cpp deleted file mode 100644 index 609c7c2a5d..0000000000 --- a/plugins/Clist_nicer/src/clcidents.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (ñ) 2012-16 Miranda NG project (http://miranda-ng.org), -Copyright (c) 2000-03 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -/* the CLC uses 3 different ways to identify elements in its list, this file -contains routines to convert between them. - -1) ClcContact/ClcGroup pair. Only ever used within the duration - of a single operation, but used at some point in nearly everything -2) index integer. The 0-based number of the item from the top. Only visible - items are counted (ie not closed groups). Used for saving selection and drag - highlight -3) hItem handle. Either the hContact or (hGroup|HCONTACT_ISGROUP). Used - exclusively externally - -1->2: GetRowsPriorTo() -1->3: ContactToHItem() -3->1: FindItem() -2->1: GetRowByIndex() -*/ - -int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible) -{ - int index = 0; - int nowVisible = 1; - ClcGroup *group = &dat->list; - - group->scanIndex = 0; - for (;;) { - if (group->scanIndex == group->cl.count) { - ClcGroup *tgroup; - group = group->parent; - if (group == NULL) - break; - nowVisible = 1; - for (tgroup = group; tgroup; tgroup = tgroup->parent) { - if (!(group->expanded)) { - nowVisible = 0; break; - } - } - group->scanIndex++; - continue; - } - if (nowVisible) - index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || - (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == (UINT_PTR)hItem) || - (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == ((UINT_PTR)hItem & ~HCONTACT_ISINFO))) { - if (isVisible) { - if (!nowVisible) - *isVisible = 0; - else { - int posy = RowHeight::getItemTopY(dat, index + 1); - if (posy < dat->yScroll) - *isVisible = 0; - else { - RECT clRect; - GetClientRect(hwnd, &clRect); - if (posy >= dat->yScroll + clRect.bottom) - *isVisible = 0; - else - *isVisible = 1; - } - } - } - if (contact) - *contact = group->cl.items[group->scanIndex]; - if (subgroup) - *subgroup = group; - return 1; - } - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { - group = group->cl.items[group->scanIndex]->group; - group->scanIndex = 0; - nowVisible &= (group->expanded); - continue; - } - group->scanIndex++; - } - - if (isVisible) *isVisible = FALSE; - if (contact) *contact = NULL; - if (subgroup) *subgroup = NULL; - return 0; -} diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 3c8e58591b..4769366144 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -33,7 +33,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM { ClcContact *contact; ClcGroup *group; - if (wParam == 0 || !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (wParam == 0 || !pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) return 0; if (lParam) @@ -46,7 +46,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_GETSTATUSMSG: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) @@ -65,7 +65,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -78,7 +78,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_QUERYPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index d48d2c9741..203f0faf2f 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -92,7 +92,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message")); if (cfg::clcdat) { - FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL); + pcli->pfnFindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); if (contact && contact->type != CLCIT_CONTACT) { DestroyWindow(hWnd); return FALSE; @@ -204,7 +204,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA DWORD dwFlags = db_get_dw(hContact, "CList", "CLN_Flags", 0), dwXMask = 0; LRESULT checked = 0; - FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL); + pcli->pfnFindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); if (iSel != CB_ERR) { dwFlags &= ~(ECF_FORCEAVATAR | ECF_HIDEAVATAR); @@ -291,7 +291,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_USER + 120: // set visibility status { ClcContact *contact = NULL; - if (FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { if (contact) { WORD wApparentMode = db_get_w(contact->hContact, contact->proto, "ApparentMode", 0); @@ -306,7 +306,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA { ClcContact *contact = NULL; - if (FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { if (contact) { WORD wApparentMode = 0; diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp index 79090e0b5c..0fbe7ebe01 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp @@ -129,41 +129,33 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd) // Calc and store row height for all items in the list void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) { - int indent, subindex, line_num; - ClcContact *Drawing; - ClcGroup *group; DWORD dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); // Draw lines - group = &dat->list; + ClcGroup *group = &dat->list; group->scanIndex = 0; - indent = 0; - //subindex=-1; - line_num = -1; + int line_num = -1; Clear(dat); while (true) { if (group->scanIndex == group->cl.count) { group = group->parent; - indent--; if (group == NULL) break; // Finished list group->scanIndex++; continue; } // Get item to draw - Drawing = group->cl.items[group->scanIndex]; + ClcContact *cc = group->cl.items[group->scanIndex]; line_num++; // Calc row height - getRowHeight(dat, Drawing, line_num, dwStyle); + getRowHeight(dat, cc, line_num, dwStyle); - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded & 0x0000ffff)) { - group = group->cl.items[group->scanIndex]->group; - indent++; + if (cc->type == CLCIT_GROUP && (cc->group->expanded & 0x0000ffff)) { + group = cc->group; group->scanIndex = 0; - subindex = -1; continue; } group->scanIndex++; @@ -173,42 +165,33 @@ void RowHeight::calcRowHeights(ClcData *dat, HWND hwnd) // Calc item top Y (using stored data) int RowHeight::getItemTopY(ClcData *dat, int item) { - int i; - int y = 0; - if (item >= dat->row_heights_size) return -1; - for (i = 0; i < item; i++) { + int y = 0; + for (int i = 0; i < item; i++) y += dat->row_heights[i]; - } return y; } - // Calc item bottom Y (using stored data) int RowHeight::getItemBottomY(ClcData *dat, int item) { - int i; - int y = 0; - if (item >= dat->row_heights_size) return -1; - for (i = 0; i <= item; i++) { + int y = 0; + for (int i = 0; i <= item; i++) y += dat->row_heights[i]; - } return y; } - // Calc total height of rows (using stored data) int RowHeight::getTotalHeight(ClcData *dat) { int y = 0; - for (int i = 0; i < dat->row_heights_size; i++) y += dat->row_heights[i]; diff --git a/plugins/Clist_nicer/src/rowheight_funcs.h b/plugins/Clist_nicer/src/rowheight_funcs.h index 60a0998e1c..aa49af8a10 100644 --- a/plugins/Clist_nicer/src/rowheight_funcs.h +++ b/plugins/Clist_nicer/src/rowheight_funcs.h @@ -16,7 +16,7 @@ public: static int getMaxRowHeight(ClcData *dat, const HWND hwnd); // Calc and store row height - static int getRowHeight(ClcData *dat, ClcContact* contact, int item, DWORD style) + static int getRowHeight(ClcData *dat, ClcContact *contact, int item, DWORD style) { if (!Alloc(dat, item + 1)) return -1; @@ -36,39 +36,36 @@ public: // 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)) { + (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; dat->row_heights[item] = height; - //contact->iRowHeight = item; - return height; } // Calc and store row height for all itens in the list - static void calcRowHeights (ClcData *dat, HWND hwnd); + static void calcRowHeights(ClcData *dat, HWND hwnd); // Calc item top Y (using stored data) - static int getItemTopY (ClcData *dat, int item); + static int getItemTopY(ClcData *dat, int item); // Calc item bottom Y (using stored data) - static int getItemBottomY (ClcData *dat, int item); + static int getItemBottomY(ClcData *dat, int item); // Calc total height of rows (using stored data) - static int getTotalHeight (ClcData *dat); + static int getTotalHeight(ClcData *dat); // Return the line that pos_y is at or -1 (using stored data). Y start at 0 - static int hitTest (ClcData *dat, int pos_y); + static int hitTest(ClcData *dat, int pos_y); // Returns the height of the chosen row - static int getHeight (ClcData *dat, int item); + static int getHeight(ClcData *dat, int item); }; #endif // __ROWHEIGHT_FUNCS_H__ -- cgit v1.2.3