diff options
author | George Hazan <george.hazan@gmail.com> | 2016-01-28 13:05:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-01-28 13:05:28 +0000 |
commit | a040f3a8dbcc17d8a3a50a9594b3226dce28788c (patch) | |
tree | 8c033c939982d3f58e3d81fb721a94b5840a5250 /plugins | |
parent | 3ffb500915c8b5a9e02d2b0136c20e9519d4f983 (diff) |
- local structure declarations moved to the global header;
- structure definition optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16178 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Clist_modern/src/modern_clistevents.cpp | 39 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 4 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clistevents.cpp | 44 |
3 files changed, 33 insertions, 54 deletions
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 0b365ea153..6ea11cdc73 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -48,15 +48,6 @@ void EventArea_ConfigureEventArea(); HWND g_hwndEventArea = 0;
-struct CListEvent {
- int imlIconIndex;
- int flashesDone;
- CLISTEVENT cle;
-
- int menuId;
- int imlIconOverlayIndex;
-};
-
static CListEvent *event;
static int eventCount;
static int disableTrayFlash;
@@ -86,7 +77,7 @@ static CLISTEVENT* MyGetEvent(int iSelection) for (int i = 0; i < pcli->events.count; i++) {
CListEvent *p = pcli->events.items[i];
if (p->menuId == iSelection)
- return &p->cle;
+ return p;
}
return NULL;
}
@@ -104,31 +95,31 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) if (p == NULL)
return NULL;
- if (p->cle.hContact != 0 && p->cle.hDbEvent != 1 && !(p->cle.flags & CLEF_ONLYAFEW)) {
+ if (p->hContact != 0 && p->hDbEvent != 1 && !(p->flags & CLEF_ONLYAFEW)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID;
- if (p->cle.pszService &&
- (!strncmp("SRMsg/ReadMessage", p->cle.pszService, _countof("SRMsg/ReadMessage")) ||
- !strncmp("GChat/DblClickEvent", p->cle.pszService, _countof("GChat/DblClickEvent"))))
+ if (p->pszService &&
+ (!strncmp("SRMsg/ReadMessage", p->pszService, _countof("SRMsg/ReadMessage")) ||
+ !strncmp("GChat/DblClickEvent", p->pszService, _countof("GChat/DblClickEvent"))))
{
// dup check only for msg events
for (int j = 0; j < GetMenuItemCount(g_CluiData.hMenuNotify); j++) {
if (GetMenuItemInfo(g_CluiData.hMenuNotify, j, TRUE, &mii) != 0) {
NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
- if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->cle.hContact && nmi->iIcon == p->imlIconIndex)
+ if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex)
return p;
}
}
}
- char *szProto = GetContactProto(p->cle.hContact);
- TCHAR *szName = pcli->pfnGetContactDisplayName(p->cle.hContact, 0);
+ char *szProto = GetContactProto(p->hContact);
+ TCHAR *szName = pcli->pfnGetContactDisplayName(p->hContact, 0);
if (szProto && szName) {
NotifyMenuItemExData *nmi = (struct NotifyMenuItemExData *) malloc(sizeof(struct NotifyMenuItemExData));
if (nmi) {
TCHAR szBuffer[128];
- TCHAR* szStatus = pcli->pfnGetStatusModeDescription(db_get_w(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ TCHAR* szStatus = pcli->pfnGetStatusModeDescription(db_get_w(p->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
TCHAR szwProto[64];
MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
szwProto[63] = 0;
@@ -136,10 +127,10 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) szBuffer[127] = 0;
AppendMenu(g_CluiData.hMenuNotify, MF_BYCOMMAND | MF_STRING, g_CluiData.wNextMenuID, szBuffer);
mii.hbmpItem = HBMMENU_CALLBACK;
- nmi->hContact = p->cle.hContact;
+ nmi->hContact = p->hContact;
nmi->iIcon = p->imlIconIndex;
- nmi->hIcon = p->cle.hIcon;
- nmi->hDbEvent = p->cle.hDbEvent;
+ nmi->hIcon = p->hIcon;
+ nmi->hDbEvent = p->hDbEvent;
mii.dwItemData = (ULONG_PTR)nmi;
mii.wID = g_CluiData.wNextMenuID;
SetMenuItemInfo(g_CluiData.hMenuNotify, g_CluiData.wNextMenuID, FALSE, &mii);
@@ -151,9 +142,9 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) }
}
}
- else if (p->cle.hContact != 0 && (p->cle.flags & CLEF_ONLYAFEW)) {
+ else if (p->hContact != 0 && (p->flags & CLEF_ONLYAFEW)) {
g_CluiData.iIconNotify = p->imlIconIndex;
- g_CluiData.hUpdateContact = p->cle.hContact;
+ g_CluiData.hUpdateContact = p->hContact;
}
if (pcli->events.count > 0) {
@@ -174,7 +165,7 @@ int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) // Find the event that should be removed
int i;
for (i = 0; i < pcli->events.count; i++)
- if ((pcli->events.items[i]->cle.hContact == hContact) && (pcli->events.items[i]->cle.hDbEvent == hDbEvent))
+ if ((pcli->events.items[i]->hContact == hContact) && (pcli->events.items[i]->hDbEvent == hDbEvent))
break;
// Event was not found
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index 00e87952a3..4e7833944c 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -270,8 +270,8 @@ TCHAR* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact); void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add);
void cli_SetContactCheckboxes(ClcContact*, int);
LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
-struct CListEvent* cliCreateEvent(void);
-struct CListEvent* cli_AddEvent(CLISTEVENT *cle);
+CListEvent* cliCreateEvent(void);
+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);
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index cb424b8579..5e87211e03 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -34,16 +34,6 @@ extern HPEN g_hPenCLUIFrames; HWND g_hwndEventArea = 0;
-struct CListEvent
-{
- int imlIconIndex;
- int flashesDone;
- CLISTEVENT cle;
-
- int menuId;
- int imlIconOverlayIndex;
-};
-
struct CListImlIcon
{
int index;
@@ -86,12 +76,10 @@ void HideShowNotifyFrame() static CLISTEVENT* MyGetEvent(int iSelection)
{
- int i;
-
- for (i = 0; i < pcli->events.count; i++) {
+ for (int i = 0; i < pcli->events.count; i++) {
CListEvent* p = pcli->events.items[i];
if (p->menuId == iSelection)
- return &p->cle;
+ return p;
}
return NULL;
}
@@ -260,28 +248,28 @@ CListEvent* AddEvent(CLISTEVENT *cle) if (p == NULL)
return NULL;
- if (p->cle.hContact != 0 && p->cle.hDbEvent != 1 && !(p->cle.flags & CLEF_ONLYAFEW)) {
+ if (p->hContact != 0 && p->hDbEvent != 1 && !(p->flags & CLEF_ONLYAFEW)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_BITMAP | MIIM_ID;
- if (p->cle.pszService && !strncmp("SRMsg/ReadMessage", p->cle.pszService, 17)) {
+ if (p->pszService && !strncmp("SRMsg/ReadMessage", p->pszService, 17)) {
// dup check only for msg events
for (int j = 0; j < GetMenuItemCount(cfg::dat.hMenuNotify); j++) {
if (GetMenuItemInfo(cfg::dat.hMenuNotify, j, TRUE, &mii) != 0) {
NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)mii.dwItemData;
- if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->cle.hContact && nmi->iIcon == p->imlIconIndex)
+ if (nmi != 0 && (HANDLE)nmi->hContact == (HANDLE)p->hContact && nmi->iIcon == p->imlIconIndex)
return p;
}
}
}
- char *szProto = GetContactProto(p->cle.hContact);
- TCHAR *szName = pcli->pfnGetContactDisplayName(p->cle.hContact, 0);
+ char *szProto = GetContactProto(p->hContact);
+ TCHAR *szName = pcli->pfnGetContactDisplayName(p->hContact, 0);
if (szProto && szName) {
NotifyMenuItemExData *nmi = (NotifyMenuItemExData*)malloc(sizeof(NotifyMenuItemExData));
if (nmi) {
TCHAR szBuffer[128];
- TCHAR* szStatus = pcli->pfnGetStatusModeDescription(cfg::getWord(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ TCHAR* szStatus = pcli->pfnGetStatusModeDescription(cfg::getWord(p->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
TCHAR szwProto[64];
MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
@@ -291,10 +279,10 @@ CListEvent* AddEvent(CLISTEVENT *cle) szBuffer[127] = 0;
AppendMenu(cfg::dat.hMenuNotify, MF_BYCOMMAND | MF_STRING, cfg::dat.wNextMenuID, szBuffer);
mii.hbmpItem = HBMMENU_CALLBACK;
- nmi->hContact = p->cle.hContact;
+ nmi->hContact = p->hContact;
nmi->iIcon = p->imlIconIndex;
- nmi->hIcon = p->cle.hIcon;
- nmi->hDbEvent = p->cle.hDbEvent;
+ nmi->hIcon = p->hIcon;
+ nmi->hDbEvent = p->hDbEvent;
mii.dwItemData = (ULONG_PTR)nmi;
mii.wID = cfg::dat.wNextMenuID;
SetMenuItemInfo(cfg::dat.hMenuNotify, cfg::dat.wNextMenuID, FALSE, &mii);
@@ -306,16 +294,16 @@ CListEvent* AddEvent(CLISTEVENT *cle) }
}
}
- else if (p->cle.hContact != 0 && (p->cle.flags & CLEF_ONLYAFEW)) {
+ else if (p->hContact != 0 && (p->flags & CLEF_ONLYAFEW)) {
cfg::dat.hIconNotify = p->imlIconIndex;
- cfg::dat.hUpdateContact = p->cle.hContact;
+ cfg::dat.hUpdateContact = p->hContact;
}
if (cfg::dat.dwFlags & CLUI_STICKYEVENTS) {
- HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree, CLM_FINDCONTACT, (WPARAM)p->cle.hContact, 0);
+ HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree, CLM_FINDCONTACT, (WPARAM)p->hContact, 0);
if (hItem) {
SendMessage(pcli->hwndContactTree, CLM_SETSTICKY, (WPARAM)hItem, 1);
- pcli->pfnClcBroadcast(INTM_PROTOCHANGED, (WPARAM)p->cle.hContact, 0);
+ pcli->pfnClcBroadcast(INTM_PROTOCHANGED, (WPARAM)p->hContact, 0);
}
}
@@ -340,7 +328,7 @@ int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) // Find the event that should be removed
int i;
for (i = 0; i < pcli->events.count; i++)
- if ((pcli->events.items[i]->cle.hContact == hContact) && (pcli->events.items[i]->cle.hDbEvent == hDbEvent))
+ if ((pcli->events.items[i]->hContact == hContact) && (pcli->events.items[i]->hDbEvent == hDbEvent))
break;
// Event was not found
|