diff options
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/clistmenus.cpp | 24 | ||||
-rw-r--r-- | src/mir_app/src/framesmenu.cpp | 3 | ||||
-rw-r--r-- | src/mir_app/src/genmenu.cpp | 13 | ||||
-rw-r--r-- | src/mir_app/src/genmenu.h | 1 |
4 files changed, 17 insertions, 24 deletions
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index f8f94e5175..fe6499c42f 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -187,9 +187,8 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi) //we need just one parametr.
mmep->szServiceName = mir_strdup(pmi->pszService);
mmep->szMenuName = pmi->name.t;
- pmi->ownerdata = mmep;
- TMO_IntMenuItem *pimi = Menu_AddItem(hMainMenuObject, pmi);
+ TMO_IntMenuItem *pimi = Menu_AddItem(hMainMenuObject, pmi, mmep);
if (pimi == NULL)
return NULL;
@@ -254,10 +253,9 @@ MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *pmi, const char *psz cmep->szServiceName = mir_strdup(pmi->pszService);
if (pszProto != NULL)
cmep->pszContactOwner = mir_strdup(pszProto);
- pmi->ownerdata = cmep;
// may be need to change how UniqueName is formed?
- TMO_IntMenuItem *pimi = Menu_AddItem(hContactMenuObject, pmi);
+ TMO_IntMenuItem *pimi = Menu_AddItem(hContactMenuObject, pmi, cmep);
if (pimi == NULL)
return NULL;
@@ -384,9 +382,8 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP smep->svc = mir_strdup(pmi->pszService);
smep->szProto = mir_strdup(pszProto);
}
- pmi->ownerdata = smep;
- TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, pmi);
+ TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, pmi, smep);
if (pimi == NULL)
return NULL;
@@ -842,9 +839,7 @@ void RebuildMenuOrder(void) // owner data
StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
smep->szProto = mir_strdup(pa->szModuleName);
- mi.ownerdata = smep;
-
- TMO_IntMenuItem *rootmenu = Menu_AddItem(hStatusMenuObject, &mi);
+ TMO_IntMenuItem *rootmenu = Menu_AddItem(hStatusMenuObject, &mi, smep);
memset(&mi, 0, sizeof(mi));
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
@@ -855,7 +850,6 @@ void RebuildMenuOrder(void) // owner data
smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
smep->szProto = mir_strdup(pa->szModuleName);
- mi.ownerdata = smep;
if (Proto_IsAccountLocked(pa))
mi.flags |= CMIF_CHECKED;
@@ -866,8 +860,8 @@ void RebuildMenuOrder(void) }
else mi.name.t = pa->tszAccountName;
- TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, &mi);
- ((StatusMenuExecParam*)mi.ownerdata)->protoindex = (int)pimi;
+ TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, &mi, smep);
+ smep->protoindex = (int)pimi;
Menu_ModifyItem(pimi, mi.name.t, mi.hIcon, mi.flags);
cli.menuProtos = (MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount + 1));
@@ -904,11 +898,10 @@ void RebuildMenuOrder(void) smep->status = statusModeList[j];
smep->protoindex = i;
smep->szProto = mir_strdup(pa->szModuleName);
- mi.ownerdata = smep;
hStatusMenuHandles[i].protoindex = i;
hStatusMenuHandles[i].protostatus[j] = statusModeList[j];
- hStatusMenuHandles[i].menuhandle[j] = Menu_AddItem(hStatusMenuObject, &mi);
+ hStatusMenuHandles[i].menuhandle[j] = Menu_AddItem(hStatusMenuObject, &mi, smep);
char buf[256];
mir_snprintf(buf, "ProtocolIcon_%s_%s", pa->szModuleName, mi.name.a);
@@ -943,14 +936,13 @@ void RebuildMenuOrder(void) // owner data
StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
smep->status = statusModeList[j];
- mi.ownerdata = smep;
{
TCHAR buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, _T("%s\t%s"), cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
mi.name.t = buf;
- hStatusMainMenuHandles[j] = Menu_AddItem(hStatusMenuObject, &mi);
+ hStatusMainMenuHandles[j] = Menu_AddItem(hStatusMenuObject, &mi, smep);
hStatusMainMenuHandles[j]->hotKey = hotKey;
}
diff --git a/src/mir_app/src/framesmenu.cpp b/src/mir_app/src/framesmenu.cpp index d5b3c81c17..98f7da0cdd 100644 --- a/src/mir_app/src/framesmenu.cpp +++ b/src/mir_app/src/framesmenu.cpp @@ -49,8 +49,7 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam) FrameMenuExecParam *fmep = new FrameMenuExecParam();
fmep->szServiceName = mir_strdup(pmi->pszService);
- pmi->ownerdata = fmep;
- return (INT_PTR)Menu_AddItem(hFrameMenuObject, pmi);
+ return (INT_PTR)Menu_AddItem(hFrameMenuObject, pmi, fmep);
}
// called with:
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index 1738d8b2bf..f4134d0218 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -379,7 +379,7 @@ MIR_APP_DLL(void*) Menu_GetItemData(HGENMENU hMenuItem) mir_cslock lck(csMenuHook);
TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
- return (pimi) ? pimi->mi.ownerdata : NULL;
+ return (pimi) ? pimi->pUserData : NULL;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -457,7 +457,7 @@ MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam) }
LPCSTR srvname = pimi->parent->ExecService;
- CallService(srvname, (WPARAM)pimi->mi.ownerdata, lParam);
+ CallService(srvname, (WPARAM)pimi->pUserData, lParam);
return true;
}
@@ -692,14 +692,14 @@ MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int pos mi.hLangpack = hLang;
mi.name.t = (TCHAR*)ptszName;
mi.position = position;
- return Menu_AddItem(hMenuObject, &mi);
+ return Menu_AddItem(hMenuObject, &mi, NULL);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Adds new menu item
// Returns a handle to the newly created item or NULL
-MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi)
+MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUserData)
{
if (!bIsGenMenuInited || pmi == NULL)
return NULL;
@@ -719,6 +719,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi) p->iconId = -1;
p->OverrideShow = TRUE;
p->originalPosition = pmi->position;
+ p->pUserData = pUserData;
if (pmi->flags & CMIF_UNICODE)
p->mi.name.t = mir_tstrdup(pmi->name.t);
@@ -885,7 +886,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, INT_PTR TCheckProcParam CheckParam;
CheckParam.wParam = wParam;
CheckParam.lParam = lParam;
- CheckParam.MenuItemOwnerData = mi->ownerdata;
+ CheckParam.MenuItemOwnerData = pmi->pUserData;
CheckParam.MenuItemHandle = pmi;
if (CallService(pmo->CheckService, (WPARAM)&CheckParam, 0) == FALSE)
continue;
@@ -1191,7 +1192,7 @@ TIntMenuObject::~TIntMenuObject() void TIntMenuObject::freeItem(TMO_IntMenuItem *p)
{
if (FreeService)
- CallService(FreeService, (WPARAM)p, (LPARAM)p->mi.ownerdata);
+ CallService(FreeService, (WPARAM)p, (LPARAM)p->pUserData);
p->signature = 0;
FreeAndNil((void**)&p->mi.name.t);
diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index a100379541..5c7dfb1c1e 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -55,6 +55,7 @@ struct TMO_IntMenuItem int originalPosition;
DWORD hotKey;
WPARAM execParam;
+ void* pUserData;
TMO_IntMenuItem *next; // next item in list
TIntMenuObject *parent;
|