diff options
author | George Hazan <george.hazan@gmail.com> | 2016-04-19 12:43:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-04-19 12:43:33 +0000 |
commit | 01ff549a2303122360f819c3344ff8a374839d82 (patch) | |
tree | 2241ad5b66087551f54a726894055d2e08a8763c /src | |
parent | 2201b08878bbf3f72c6e48ef82e4b80374f58c29 (diff) |
further junk cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16717 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clc.cpp | 31 | ||||
-rw-r--r-- | src/mir_app/src/clc.h | 4 | ||||
-rw-r--r-- | src/mir_app/src/clcitems.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/clcmsgs.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/clistevents.cpp | 9 | ||||
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 13 | ||||
-rw-r--r-- | src/mir_app/src/clistsettings.cpp | 19 | ||||
-rw-r--r-- | src/mir_app/src/contact.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/meta_menu.cpp | 4 |
9 files changed, 34 insertions, 62 deletions
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 246f7e6b45..556e2ca308 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -32,10 +32,9 @@ void UninitCustomMenus(void); void MTG_OnmodulesLoad(void);
static bool bModuleInitialized = false;
-static MWindowList hClcWindowList;
static HANDLE hShowInfoTipEvent;
HANDLE hHideInfoTipEvent;
-static LIST<void> arEvents(10);
+MWindowList hClcWindowList;
int g_IconWidth, g_IconHeight;
@@ -165,12 +164,6 @@ static int ClcContactDeleted(WPARAM wParam, LPARAM lParam) return 0;
}
-static int ClcContactIconChanged(WPARAM wParam, LPARAM lParam)
-{
- WindowList_BroadcastAsync(hClcWindowList, INTM_ICONCHANGED, wParam, lParam);
- return 0;
-}
-
static int ClcIconsChanged(WPARAM, LPARAM)
{
WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0);
@@ -191,7 +184,6 @@ static INT_PTR GetInfoTipHoverTime(WPARAM, LPARAM) static void SortClcByTimer(HWND hwnd)
{
- KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC);
SetTimer(hwnd, TIMERID_DELAYEDRESORTCLC, 200, NULL);
}
@@ -210,14 +202,13 @@ int LoadCLCModule(void) InitFileDropping();
- arEvents.insert(HookEvent(ME_SYSTEM_MODULESLOADED, ClcModulesLoaded));
- arEvents.insert(HookEvent(ME_PROTO_ACCLISTCHANGED, ClcAccountsChanged));
- arEvents.insert(HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged));
- arEvents.insert(HookEvent(ME_DB_CONTACT_ADDED, ClcContactAdded));
- arEvents.insert(HookEvent(ME_DB_CONTACT_DELETED, ClcContactDeleted));
- arEvents.insert(HookEvent(ME_CLIST_CONTACTICONCHANGED, ClcContactIconChanged));
- arEvents.insert(HookEvent(ME_SKIN_ICONSCHANGED, ClcIconsChanged));
- arEvents.insert(HookEvent(ME_PROTO_ACK, ClcProtoAck));
+ HookEvent(ME_SYSTEM_MODULESLOADED, ClcModulesLoaded);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, ClcAccountsChanged);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ClcSettingChanged);
+ HookEvent(ME_DB_CONTACT_ADDED, ClcContactAdded);
+ HookEvent(ME_DB_CONTACT_DELETED, ClcContactDeleted);
+ HookEvent(ME_SKIN_ICONSCHANGED, ClcIconsChanged);
+ HookEvent(ME_PROTO_ACK, ClcProtoAck);
InitCustomMenus();
return 0;
@@ -228,9 +219,6 @@ void UnloadClcModule() if (!bModuleInitialized)
return;
- for (int i = 0; i < arEvents.getCount(); i++)
- UnhookEvent(arEvents[i]);
-
mir_free(cli.clcProto);
WindowList_Destroy(hClcWindowList); hClcWindowList = NULL;
@@ -461,7 +449,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam // this means an offline msg is flashing, so the contact should be shown
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
int shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b(wParam, "CList", "Hidden", 0))
- && (!cli.pfnIsHiddenMode(dat, status) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam);
+ && (!cli.pfnIsHiddenMode(dat, status) || cli.pfnGetContactIcon(wParam) != lParam);
contact = NULL;
group = NULL;
@@ -841,6 +829,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam KillTimer(hwnd, TIMERID_REBUILDAFTER);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ cli.bAutoRebuild = false;
break;
case TIMERID_DELAYEDRESORTCLC:
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index bebef650b7..3d41d0931b 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -36,6 +36,8 @@ struct ClcCacheEntry : public ClcCacheEntryBase /* clc.c */
extern int g_IconWidth, g_IconHeight;
+extern MWindowList hClcWindowList;
+extern HIMAGELIST hCListImages;
void fnClcOptionsChanged(void);
void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam);
@@ -183,7 +185,7 @@ void fnCluiProtocolStatusChanged(int, const char*); void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon);
/* contact.c */
-void fnChangeContactIcon(MCONTACT hContact, int iIcon, int add);
+void fnChangeContactIcon(MCONTACT hContact, int iIcon);
void fnLoadContactTree(void);
int fnSetHideOffline(WPARAM wParam, LPARAM lParam);
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index 9f249e3d30..15b9f41bfc 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "clc.h" -//routines for managing adding/removal of items in the list, including sorting +// routines for managing adding/removal of items in the list, including sorting int fnAddItemToGroup(ClcGroup *group, int iAboveItem) { @@ -188,7 +188,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) i = cli.pfnAddItemToGroup(group, index + 1); char *szProto = GetContactProto(hContact); group->cl.items[i]->type = CLCIT_CONTACT; - group->cl.items[i]->iImage = CallService(MS_CLIST_GETCONTACTICON, hContact, 0); + group->cl.items[i]->iImage = cli.pfnGetContactIcon(hContact); group->cl.items[i]->hContact = hContact; group->cl.items[i]->proto = szProto; if (szProto != NULL && !cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE))) diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 80d3e47f19..04cadc8fb1 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -75,9 +75,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR }
case CLM_AUTOREBUILD:
- KillTimer(hwnd, TIMERID_REBUILDAFTER);
- cli.pfnSaveStateAndRebuildList(hwnd, dat);
- cli.bAutoRebuild = false;
+ SetTimer(hwnd, TIMERID_REBUILDAFTER, 50, 0);
break;
case CLM_DELETEITEM:
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index 65985d8ed1..bf38e584ec 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -33,8 +33,6 @@ struct CListImlIcon static struct CListImlIcon *imlIcon;
static int imlIconCount;
-extern HIMAGELIST hCListImages;
-
static UINT_PTR flashTimerId;
static int iconsOn;
static int disableTrayFlash;
@@ -116,7 +114,7 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD) if (g_cliEvents[j].hContact == g_cliEvents[i].hContact)
break;
if (j >= i)
- cli.pfnChangeContactIcon(g_cliEvents[i].hContact, iconsOn || disableIconFlash ? g_cliEvents[i].imlIconIndex : 0, 0);
+ cli.pfnChangeContactIcon(g_cliEvents[i].hContact, iconsOn || disableIconFlash ? g_cliEvents[i].imlIconIndex : 0);
// decrease eflashes in any case - no need to collect all events
if (g_cliEvents[i].flags & CLEF_ONLYAFEW)
@@ -169,7 +167,7 @@ CListEvent* fnAddEvent(CLISTEVENT *cle) flashTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "IconFlashTime", 550), IconFlashTimer);
cli.pfnTrayIconUpdateWithImageList(p->imlIconIndex, p->ptszTooltip, szProto);
}
- cli.pfnChangeContactIcon(cle->hContact, p->imlIconIndex, 1);
+ cli.pfnChangeContactIcon(cle->hContact, p->imlIconIndex);
return p;
}
@@ -191,8 +189,7 @@ int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent) // Update contact's icon
char *szProto = GetContactProto(hContact);
- cli.pfnChangeContactIcon(g_cliEvents[i].hContact,
- CallService(MS_CLIST_GETCONTACTICON, (WPARAM)g_cliEvents[i].hContact, 1), 0);
+ cli.pfnChangeContactIcon(g_cliEvents[i].hContact, cli.pfnGetContactIcon(g_cliEvents[i].hContact));
// Free any memory allocated to the event
g_cliEvents.remove(i);
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index ce2516b70c..6ccdeb7e14 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -165,11 +165,6 @@ int fnGetContactIcon(MCONTACT hContact) szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
}
-static INT_PTR GetContactIcon(WPARAM wParam, LPARAM)
-{
- return cli.pfnGetContactIcon(wParam);
-}
-
static void AddProtoIconIndex(PROTOACCOUNT *pa)
{
ProtoIconIndex *pii = new ProtoIconIndex;
@@ -394,6 +389,13 @@ int fnShowHide(WPARAM, LPARAM) return 0;
}
+void fnChangeContactIcon(MCONTACT hContact, int iIcon) +{ + WindowList_BroadcastAsync(hClcWindowList, INTM_ICONCHANGED, hContact, iIcon);
+ + NotifyEventHooks(hContactIconChangedEvent, hContact, iIcon); +} +
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
@@ -437,7 +439,6 @@ int LoadContactListModule2(void) CreateServiceFunction(MS_CLIST_DOCKINGPROCESSMESSAGE, Docking_ProcessWindowMessageStub);
CreateServiceFunction(MS_CLIST_DOCKINGISDOCKED, Docking_IsDocked);
CreateServiceFunction(MS_CLIST_HOTKEYSPROCESSMESSAGE, HotkeysProcessMessageStub);
- CreateServiceFunction(MS_CLIST_GETCONTACTICON, GetContactIcon);
InitCListEvents();
InitGroupServices();
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 51fbb266d0..390e4d5f38 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -145,7 +145,7 @@ INT_PTR InvalidateDisplayName(WPARAM wParam, LPARAM) int ContactAdded(WPARAM wParam, LPARAM)
{
- cli.pfnChangeContactIcon(wParam, cli.pfnIconFromStatusMode(GetContactProto(wParam), ID_STATUS_OFFLINE, NULL), 1);
+ cli.pfnChangeContactIcon(wParam, cli.pfnIconFromStatusMode(GetContactProto(wParam), ID_STATUS_OFFLINE, NULL));
return 0;
}
@@ -190,23 +190,14 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) cli.pfnCheckCacheItem(pdnce);
}
else if (!strcmp(cws->szSetting, "Status")) {
- if (!db_get_b(hContact, "CList", "Hidden", 0)) {
- if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
- // User's state is changing, and we are hideOffline-ing
- if (cws->value.wVal == ID_STATUS_OFFLINE) {
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 0);
- return 0;
- }
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 1);
- }
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 0);
- }
+ if (!db_get_b(hContact, "CList", "Hidden", 0))
+ cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact));
}
}
else if (!strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "Hidden")) {
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0)
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1);
+ cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
}
else if (!strcmp(cws->szSetting, "MyHandle")) {
ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact);
@@ -225,7 +216,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) else
szProto = cws->value.pszVal;
cli.pfnChangeContactIcon(hContact,
- cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 0);
+ cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact));
}
}
return 0;
diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp index 76466126db..d86c8b8127 100644 --- a/src/mir_app/src/contact.cpp +++ b/src/mir_app/src/contact.cpp @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "clc.h" -extern HANDLE hContactIconChangedEvent; extern HANDLE hGroupChangeEvent; static int GetContactStatus(MCONTACT hContact) @@ -36,11 +35,6 @@ static int GetContactStatus(MCONTACT hContact) return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } -void fnChangeContactIcon(MCONTACT hContact, int iIcon, int) -{ - NotifyEventHooks(hContactIconChangedEvent, hContact, iIcon); -} - void fnLoadContactTree(void) { CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0); @@ -54,7 +48,7 @@ void fnLoadContactTree(void) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0)) - cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact), 1); + cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact)); } CallService(MS_CLUI_LISTENDREBUILD, 0, 0); } diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 3c7228a30b..7c6cf58832 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "stdafx.h"
+#include "clc.h"
#include <m_nudge.h>
#include "metacontacts.h"
@@ -281,8 +282,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) }
else ptszName = cli.pfnGetContactDisplayName(hContact, 0);
- int iconIndex = CallService(MS_CLIST_GETCONTACTICON, hContact, 0);
- HICON hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
+ HICON hIcon = ImageList_GetIcon(hCListImages, cli.pfnGetContactIcon(hContact), 0);
Menu_ModifyItem(hMenuContact[i], ptszName, hIcon, 0);
DestroyIcon(hIcon);
|