From 08fa43d58030952c48bcb2a7179e18579662c301 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 26 Jul 2014 14:37:37 +0000 Subject: same parameter for clist_nicer git-svn-id: http://svn.miranda-ng.org/main/trunk@9947 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/Include/clc.h | 2 +- plugins/Clist_nicer/src/Include/commonheaders.h | 2 + plugins/Clist_nicer/src/clc.cpp | 258 ++++++++++++------------ plugins/Clist_nicer/src/clcitems.cpp | 11 +- plugins/Clist_nicer/src/clcmsgs.cpp | 4 +- plugins/Clist_nicer/src/clcutils.cpp | 10 +- plugins/Clist_nicer/src/clistevents.cpp | 6 +- plugins/Clist_nicer/src/clistmod.cpp | 4 +- plugins/Clist_nicer/src/clisttray.cpp | 6 +- plugins/Clist_nicer/src/clui.cpp | 4 +- plugins/Clist_nicer/src/init.cpp | 65 +++--- 11 files changed, 168 insertions(+), 204 deletions(-) diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index e189de5904..4c78d3ab42 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -387,7 +387,7 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut); #define DROPTARGET_ONCONTACT 4 #define DROPTARGET_INSERTION 5 int GetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt); -void LoadClcOptions(HWND hwnd, struct ClcData *dat); +void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst); void RecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat); void SetGroupChildCheckboxes(ClcGroup *group, int checked); BYTE GetCachedStatusMsg(TExtraCache* p, char *szProto); diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h index cdddfa0fab..eaa1d0505d 100644 --- a/plugins/Clist_nicer/src/Include/commonheaders.h +++ b/plugins/Clist_nicer/src/Include/commonheaders.h @@ -77,6 +77,8 @@ extern LONG g_cxsmIcon, g_cysmIcon; extern LIST arStatusItems; extern ImageItem *g_glyphItem; +extern CLIST_INTERFACE coreCli; + typedef int (__cdecl *pfnDrawAvatar)(HDC hdcOrig, HDC hdcMem, RECT *rc, ClcContact *contact, int y, struct ClcData *dat, int selected, WORD cstatus, int rowHeight); BOOL __forceinline GetItemByStatus(int status, StatusItems_t *retitem); diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index e9c7520c6a..1449b0446f 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -230,8 +230,6 @@ int LoadCLCModule(void) ///////////////////////////////////////////////////////////////////////////////////////// // clist_nicer+ control window procedure -extern LRESULT(CALLBACK *saveContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ClcContact *contact; @@ -289,102 +287,102 @@ LBL_Def: return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar); case INTM_GROUPCHANGED: - { - WORD iExtraImage[EXTRA_ICON_COUNT]; - BYTE flags = 0; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - memset(iExtraImage, 0xFF, sizeof(iExtraImage)); - else { - memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); - flags = contact->flags; - } - 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)) { - memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); - if (flags & CONTACTF_CHECKED) - contact->flags |= CONTACTF_CHECKED; + { + WORD iExtraImage[EXTRA_ICON_COUNT]; + BYTE flags = 0; + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + memset(iExtraImage, 0xFF, sizeof(iExtraImage)); + else { + memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); + flags = contact->flags; } + 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)) { + memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); + if (flags & CONTACTF_CHECKED) + contact->flags |= CONTACTF_CHECKED; + } - NMCLISTCONTROL nm; - nm.hdr.code = CLN_CONTACTMOVED; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = (HANDLE)wParam; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); + NMCLISTCONTROL nm; + nm.hdr.code = CLN_CONTACTMOVED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = (HANDLE)wParam; + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); + } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, 1); } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, 1); - } goto LBL_Def; case INTM_ICONCHANGED: - { - int recalcScrollBar = 0; - MCONTACT hContact = wParam; - WORD status = ID_STATUS_OFFLINE; - int contactRemoved = 0; - MCONTACT hSelItem = NULL; - ClcContact *selcontact = NULL; - - char *szProto = GetContactProto(hContact); - if (szProto == NULL) - status = ID_STATUS_OFFLINE; - else - status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); - - int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || - !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 (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); - pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); - recalcScrollBar = 1; - FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL); - if (contact) { - contact->iImage = (WORD)lParam; - pcli->pfnNotifyNewContact(hwnd, hContact); + { + int recalcScrollBar = 0; + MCONTACT hContact = wParam; + WORD status = ID_STATUS_OFFLINE; + int contactRemoved = 0; + MCONTACT hSelItem = NULL; + ClcContact *selcontact = NULL; + + char *szProto = GetContactProto(hContact); + if (szProto == NULL) + status = ID_STATUS_OFFLINE; + else + status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); + + int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || + !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 (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); + pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); + recalcScrollBar = 1; + FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL); + if (contact) { + contact->iImage = (WORD)lParam; + pcli->pfnNotifyNewContact(hwnd, hContact); + } } } - } - else { - //item in list already - DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - if (contact->iImage == (WORD)lParam) - break; - if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); - pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); - contactRemoved = TRUE; - recalcScrollBar = 1; - } else { - contact->iImage = (WORD)lParam; - if (!pcli->pfnIsHiddenMode(dat, status)) - contact->flags |= CONTACTF_ONLINE; + //item in list already + DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); + if (contact->iImage == (WORD)lParam) + break; + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); + pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); + contactRemoved = TRUE; + recalcScrollBar = 1; + } + else { + contact->iImage = (WORD)lParam; + if (!pcli->pfnIsHiddenMode(dat, status)) + contact->flags |= CONTACTF_ONLINE; + else + contact->flags &= ~CONTACTF_ONLINE; + } + } + if (hSelItem) { + ClcGroup *selgroup; + if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)& selgroup->cl, selcontact)); else - contact->flags &= ~CONTACTF_ONLINE; + dat->selection = -1; } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); + if (recalcScrollBar) + pcli->pfnRecalcScrollBar(hwnd, dat); } - if (hSelItem) { - ClcGroup *selgroup; - if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)& selgroup->cl, selcontact)); - else - dat->selection = -1; - } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); - if (recalcScrollBar) - pcli->pfnRecalcScrollBar(hwnd, dat); - } goto LBL_Def; case INTM_METACHANGED: @@ -438,53 +436,53 @@ LBL_Def: goto LBL_Def; case INTM_AVATARCHANGED: - { - avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; contact = NULL; + { + avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; + + if (wParam == 0) { + //RemoveFromImgCache(0, cEntry); + cfg::dat.bForceRefetchOnPaint = TRUE; + RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + cfg::dat.bForceRefetchOnPaint = FALSE; + goto LBL_Def; + } - if (wParam == 0) { - //RemoveFromImgCache(0, cEntry); - cfg::dat.bForceRefetchOnPaint = TRUE; - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - cfg::dat.bForceRefetchOnPaint = FALSE; - goto LBL_Def; - } + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + return 0; + contact->ace = cEntry; + if (cEntry == NULL) + contact->cFlags &= ~ECF_AVATAR; + else { + DWORD dwFlags; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - return 0; - contact->ace = cEntry; - if (cEntry == NULL) - contact->cFlags &= ~ECF_AVATAR; - else { - DWORD dwFlags; - - if (contact->pExtra) - dwFlags = contact->pExtra->dwDFlags; - else - dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); - if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) - contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); - else - contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); + if (contact->pExtra) + dwFlags = contact->pExtra->dwDFlags; + else + dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); + if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) + contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); + else + contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); + } + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); } - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); - } goto LBL_Def; case INTM_STATUSMSGCHANGED: - { - TExtraCache *p; - char *szProto = NULL; + { + TExtraCache *p; + char *szProto = NULL; - if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - p = cfg::getCache(wParam, NULL); - else { - p = contact->pExtra; - szProto = contact->proto; + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + p = cfg::getCache(wParam, NULL); + else { + p = contact->pExtra; + szProto = contact->proto; + } + GetCachedStatusMsg(p, szProto); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); } - GetCachedStatusMsg(p, szProto); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); - } goto LBL_Def; case INTM_STATUSCHANGED: @@ -526,13 +524,12 @@ LBL_Def: if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; - if (contact == 0 || group == 0) - break; - { + if (contact && group) { int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact)); pcli->pfnInvalidateItem(hwnd, dat, iItem); + goto LBL_Def; } - goto LBL_Def; + break; case INTM_FORCESORT: dat->needsResort = TRUE; @@ -684,7 +681,8 @@ LBL_Def: pt.x = dat->iconXSpace + 15; pt.y = RowHeight::getItemTopY(dat, dat->selection) - dat->yScroll + (int)(dat->row_heights[dat->selection] * .7); hitFlags = dat->selection == -1 ? CLCHT_NOWHERE : CLCHT_ONITEMLABEL; - } else { + } + else { ScreenToClient(hwnd, &pt); dat->selection = HitTest(hwnd, dat, pt.x, pt.y, &contact, NULL, &hitFlags); } @@ -735,5 +733,5 @@ LBL_Def: break; } - return saveContactListControlWndProc(hwnd, msg, wParam, lParam); + return coreCli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index e0a21a84b7..8442edb661 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -24,11 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -extern int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, MCONTACT hContact); -extern int ( *saveAddInfoItemToGroup )(ClcGroup *group, int flags, const TCHAR *pszText); -extern ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount); -extern ClcGroup* ( *saveAddGroup )(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); - static void TZ_LoadTimeZone(MCONTACT hContact, struct TExtraCache *c, const char *szProto); //routines for managing adding/removal of items in the list, including sorting @@ -45,7 +40,7 @@ ClcContact* CreateClcContact( void ) int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) { - int i = saveAddInfoItemToGroup(group, flags, pszText); + int i = coreCli.pfnAddInfoItemToGroup(group, flags, pszText); ClcContact* p = group->cl.items[i]; p->codePage = 0; //p->clientId = -1; @@ -59,7 +54,7 @@ int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers) { - ClcGroup *p = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers); + ClcGroup *p = coreCli.pfnAddGroup(hwnd, dat, szName, flags, groupId, calcTotalMembers); if ( p && p->parent ) RTL_DetectGroupName( p->parent->cl.items[ p->parent->cl.count-1] ); @@ -94,7 +89,7 @@ void LoadAvatarForContact(ClcContact *p) int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) { - int i = saveAddContactToGroup(dat, group, hContact); + int i = coreCli.pfnAddContactToGroup(dat, group, hContact); ClcContact* p = group->cl.items[i]; p->wStatus = cfg::getWord(hContact, p->proto, "Status", ID_STATUS_OFFLINE); diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index 5eace41b51..99b7bd2358 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //processing of all the CLM_ messages incoming -extern LRESULT ( *saveProcessExternalMessages )(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); - LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -104,5 +102,5 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM return dat->isMultiSelect; } - return saveProcessExternalMessages(hwnd, dat, msg, wParam, lParam); + return coreCli.pfnProcessExternalMessages(hwnd, dat, msg, wParam, lParam); } diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index f947d94c52..65cb2954a6 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -542,13 +542,11 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) SetFocus(dat->hwndRenameEdit); } -extern void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat); - -void LoadClcOptions(HWND hwnd, struct ClcData *dat) +void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) { dat->bkChanged = 0; - saveLoadClcOptions(hwnd, dat); + coreCli.pfnLoadClcOptions(hwnd, dat, bFirst); dat->min_row_heigh = (int)cfg::getByte("CLC","RowHeight",CLCDEFAULT_ROWHEIGHT); dat->group_row_height = (int)cfg::getByte("CLC","GRowHeight",CLCDEFAULT_ROWHEIGHT); @@ -587,9 +585,9 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) SystemParametersInfoA(SPI_GETDESKWALLPAPER, MAX_PATH, wpbuf, 0); // we have a wallpaper string - if (wpbuf[0] != 0) { + if (wpbuf[0] != 0) dat->hBmpBackground = reinterpret_cast(LoadImageA(NULL, wpbuf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); - } + cfg::dat.bmpBackground = dat->hBmpBackground; if (cfg::dat.bmpBackground) { HDC hdcThis = GetDC(pcli->hwndContactList); diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index 68527e01e0..a06278dd20 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static HWND hwndEventFrame = 0; HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight); -extern CListEvent* ( *saveAddEvent )(CLISTEVENT *cle); -extern int ( *saveRemoveEvent )(MCONTACT hContact, HANDLE hDbEvent); extern FRAMEWND *wndFrameEventArea; extern HPEN g_hPenCLUIFrames; @@ -255,7 +253,7 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa CListEvent* AddEvent(CLISTEVENT *cle) { - CListEvent *p = saveAddEvent(cle); + CListEvent *p = coreCli.pfnAddEvent(cle); if (p == NULL) return NULL; @@ -355,7 +353,7 @@ int RemoveEvent(MCONTACT hContact, HANDLE hDbEvent) DeleteMenu(cfg::dat.hMenuNotify, pcli->events.items[i]->menuId, MF_BYCOMMAND); } } } - saveRemoveEvent(hContact, hDbEvent); + coreCli.pfnRemoveEvent(hContact, hDbEvent); if (pcli->events.count == 0) { cfg::dat.bEventAreaEnabled = FALSE; diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index bcdd29a34c..1ee7074df1 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -44,8 +44,6 @@ static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) return(g_maxStatus == ID_STATUS_OFFLINE ? pcli->currentDesiredStatusMode : g_maxStatus); } -extern int ( *saveIconFromStatusMode )( const char *szProto, int status, MCONTACT hContact ); - int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON *phIcon) { if (phIcon != NULL) @@ -73,7 +71,7 @@ int IconFromStatusMode(const char *szProto, int status, MCONTACT hContact, HICON } } - return saveIconFromStatusMode(szFinalProto, finalStatus, hContact); + return coreCli.pfnIconFromStatusMode(szFinalProto, finalStatus, hContact); } static int MenuItem_LockAvatar(WPARAM wParam, LPARAM lParam) diff --git a/plugins/Clist_nicer/src/clisttray.cpp b/plugins/Clist_nicer/src/clisttray.cpp index 3f5c45cb79..00a3de8eaa 100644 --- a/plugins/Clist_nicer/src/clisttray.cpp +++ b/plugins/Clist_nicer/src/clisttray.cpp @@ -101,11 +101,9 @@ int TrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCou ///////////////////////////////////////////////////////////////////////////////////////// -extern INT_PTR (*saveTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); - INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) { - MSG *msg = (MSG *)wParam; + MSG *msg = (MSG*)wParam; if (msg->message == TIM_CALLBACK && msg->lParam == WM_MOUSEMOVE ) { if (cfg::dat.bNoTrayTips) { *((LRESULT *)lParam) = 0; @@ -113,5 +111,5 @@ INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) } } - return saveTrayIconProcessMessage(wParam, lParam); + return coreCli.pfnTrayIconProcessMessage(wParam, lParam); } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 20c8e4a103..19da78521a 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -727,8 +727,6 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) return 0; } -extern LRESULT(CALLBACK *saveContactListWndProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); - static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, MCONTACT hContact) { if (item->dwFlags & BUTTON_PASSHCONTACTW || item->dwFlags & BUTTON_PASSHCONTACTL || item->dwFlags & BUTTON_ISCONTACTDBACTION) { @@ -1847,7 +1845,7 @@ buttons_done: break; } - return saveContactListWndProc(hwnd, msg, wParam, lParam); + return coreCli.pfnContactListWndProc(hwnd, msg, wParam, lParam); } #ifndef CS_DROPSHADOW diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index de0efb2551..18fda921a4 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -26,7 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../cluiframes/cluiframes.h" HINSTANCE g_hInst = 0; -CLIST_INTERFACE *pcli = NULL; +CLIST_INTERFACE *pcli, coreCli; + int hLangpack; #define DEFAULT_TB_VISIBILITY (1 | 2 | 4 | 8 | 16 | 32 | 64 | 8192) @@ -53,40 +54,18 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY); int ShowHide(WPARAM wParam, LPARAM lParam); int ClcShutdown(WPARAM wParam, LPARAM lParam); -void (*saveLoadClcOptions)(HWND hwnd, struct ClcData *dat); -void LoadClcOptions(HWND hwnd, struct ClcData *dat); - -int (*saveAddContactToGroup)(struct ClcData *dat, ClcGroup *group, MCONTACT hContact); -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact); - -CListEvent *(*saveAddEvent)(CLISTEVENT *cle); CListEvent *AddEvent(CLISTEVENT *cle); - -int (*saveAddInfoItemToGroup)(ClcGroup *group, int flags, const TCHAR *pszText); -int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); - -ClcGroup *(*saveAddGroup)(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); -LRESULT (CALLBACK *saveContactListWndProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); - -LRESULT (CALLBACK *saveContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - -int (*saveIconFromStatusMode)(const char *szProto, int status, MCONTACT hContact); - -LRESULT (*saveProcessExternalMessages)(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); +int AddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact); +int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); - -int (*saveRemoveEvent)(MCONTACT hContact, HANDLE hDbEvent); -int RemoveEvent(MCONTACT hContact, HANDLE hDbEvent); - -INT_PTR (*saveTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); +int RemoveEvent(MCONTACT hContact, HANDLE hDbEvent); INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); +void RecalcScrollBar(HWND hwnd, struct ClcData *dat); -void (*saveRecalcScrollBar)(HWND hwnd, struct ClcData *dat); -void RecalcScrollBar(HWND hwnd, struct ClcData *dat); +LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); PLUGININFOEX pluginInfo = { @@ -194,9 +173,11 @@ static int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hConta extern "C" int __declspec(dllexport) CListInitialise() { mir_getLP( &pluginInfo ); - mir_getCLI(); mir_getTMI(&tmi); + mir_getCLI(); + coreCli = *pcli; + API::onInit(); RegisterCLUIFrameClasses(); @@ -286,20 +267,20 @@ extern "C" int __declspec(dllexport) CListInitialise() pcli->pfnSetHideOffline = SetHideOffline; pcli->pfnShowHide = ShowHide; - saveAddContactToGroup = pcli->pfnAddContactToGroup; pcli->pfnAddContactToGroup = AddContactToGroup; + pcli->pfnAddContactToGroup = AddContactToGroup; - saveAddEvent = pcli->pfnAddEvent; pcli->pfnAddEvent = AddEvent; - saveRemoveEvent = pcli->pfnRemoveEvent; pcli->pfnRemoveEvent = RemoveEvent; + pcli->pfnAddEvent = AddEvent; + pcli->pfnRemoveEvent = RemoveEvent; - saveAddGroup = pcli->pfnAddGroup; pcli->pfnAddGroup = AddGroup; - saveAddInfoItemToGroup = pcli->pfnAddInfoItemToGroup; pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; - saveContactListControlWndProc = pcli->pfnContactListControlWndProc; pcli->pfnContactListControlWndProc = ContactListControlWndProc; - saveContactListWndProc = pcli->pfnContactListWndProc; pcli->pfnContactListWndProc = ContactListWndProc; - saveIconFromStatusMode = pcli->pfnIconFromStatusMode; pcli->pfnIconFromStatusMode = fnIconFromStatusMode; - saveLoadClcOptions = pcli->pfnLoadClcOptions; pcli->pfnLoadClcOptions = LoadClcOptions; - saveProcessExternalMessages = pcli->pfnProcessExternalMessages; pcli->pfnProcessExternalMessages = ProcessExternalMessages; - saveRecalcScrollBar = pcli->pfnRecalcScrollBar; pcli->pfnRecalcScrollBar = RecalcScrollBar; - saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage; + pcli->pfnAddGroup = AddGroup; + pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; + pcli->pfnContactListControlWndProc = ContactListControlWndProc; + pcli->pfnContactListWndProc = ContactListWndProc; + pcli->pfnIconFromStatusMode = fnIconFromStatusMode; + pcli->pfnLoadClcOptions = LoadClcOptions; + pcli->pfnProcessExternalMessages = ProcessExternalMessages; + pcli->pfnRecalcScrollBar = RecalcScrollBar; + pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage; int rc = LoadContactListModule(); if (rc == 0) -- cgit v1.2.3