From e3bc0d7e9099b2d91dcc997fab851ddb78b852ea Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Apr 2016 15:03:27 +0000 Subject: no need to change an extra icon if nothing is change git-svn-id: http://svn.miranda-ng.org/main/trunk@16794 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/BaseExtraIcon.cpp | 7 ++++++- src/mir_app/src/ExtraIcon.h | 1 + src/mir_app/src/extraicons.cpp | 14 +++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/BaseExtraIcon.cpp b/src/mir_app/src/BaseExtraIcon.cpp index 2ff3beaf3f..4503a85ed9 100644 --- a/src/mir_app/src/BaseExtraIcon.cpp +++ b/src/mir_app/src/BaseExtraIcon.cpp @@ -29,7 +29,8 @@ BaseExtraIcon::BaseExtraIcon(int id, const char *name, const TCHAR *description, m_OnClick(OnClick), m_onClickParam(param), m_tszDescription(mir_tstrdup(description)), - m_szDescIcon(mir_strdup(descIcon)) + m_szDescIcon(mir_strdup(descIcon)), + m_hOldImage(INVALID_HANDLE_VALUE) { } @@ -76,6 +77,10 @@ void BaseExtraIcon::onClick(MCONTACT hContact) int BaseExtraIcon::ClistSetExtraIcon(MCONTACT hContact, HANDLE hImage) { + if (hImage == m_hOldImage) + return 0; + + m_hOldImage = hImage; ExtraIcon *tmp = extraIconsByHandle[m_id - 1]; if (tmp != this) return tmp->ClistSetExtraIcon(hContact, hImage); diff --git a/src/mir_app/src/ExtraIcon.h b/src/mir_app/src/ExtraIcon.h index 3d00bf5a04..26cc63133c 100644 --- a/src/mir_app/src/ExtraIcon.h +++ b/src/mir_app/src/ExtraIcon.h @@ -93,6 +93,7 @@ protected: ptrA m_szDescIcon; MIRANDAHOOKPARAM m_OnClick; LPARAM m_onClickParam; + HANDLE m_hOldImage; }; ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index bdaa2d746f..6a127fde5b 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -35,8 +35,8 @@ int SortFunc(const ExtraIcon *p1, const ExtraIcon *p2) if (ret != 0) return ret; - int id1 = (p1->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*) p1)->getID() : 0; - int id2 = (p2->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*) p2)->getID() : 0; + int id1 = (p1->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*)p1)->getID() : 0; + int id2 = (p2->getType() != EXTRAICON_TYPE_GROUP) ? ((BaseExtraIcon*)p2)->getID() : 0; return id1 - id2; } @@ -80,7 +80,7 @@ int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage) if (cli.hwndContactTree == 0) return -1; - int icol = ExtraImage_ExtraIDToColumnNum( ConvertToClistSlot(slot)); + int icol = ExtraImage_ExtraIDToColumnNum(ConvertToClistSlot(slot)); if (icol == -1) return -1; @@ -88,7 +88,7 @@ int Clist_SetExtraIcon(MCONTACT hContact, int slot, HANDLE hImage) if (hItem == 0) return -1; - SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol,hImage)); + SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol, hImage)); return 0; } @@ -289,7 +289,7 @@ HANDLE ExtraIcon_Add(HICON hIcon) void fnReloadExtraIcons() { - SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(NULL,"CLUI","ExtraColumnSpace",18), 0); + SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(NULL, "CLUI", "ExtraColumnSpace", 18), 0); SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0); if (hExtraImageList) @@ -299,7 +299,7 @@ void fnReloadExtraIcons() SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hExtraImageList); SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0); - NotifyEventHooks(hEventExtraImageListRebuilding,0,0); + NotifyEventHooks(hEventExtraImageListRebuilding, 0, 0); bImageCreated = true; } @@ -379,7 +379,7 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int _hLang) } } -EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon, +EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const char *description, const char *descIcon, MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int _hLang) { -- cgit v1.2.3