From b3506557a58f53ed0fc3a96c4ec4a3b8098a542d Mon Sep 17 00:00:00 2001 From: George Hazan <george.hazan@gmail.com> Date: Mon, 22 Jun 2015 13:35:02 +0000 Subject: - CLISTMENUITEM::cbSize - atavism removed; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14325 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdaway/src/awaymsg.cpp | 4 +- src/core/stdemail/src/email.cpp | 2 +- src/core/stdfile/src/file.cpp | 4 +- src/core/stdhelp/src/help.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 2 +- src/core/stduihist/src/history.cpp | 2 +- src/core/stdurl/url.cpp | 2 +- src/core/stduserinfo/src/userinfo.cpp | 2 +- src/mir_app/src/chat_clist.cpp | 2 +- src/mir_app/src/chat_svc.cpp | 2 +- src/mir_app/src/clistmenus.cpp | 47 +++++++++--------- src/mir_app/src/clisttray.cpp | 2 +- src/mir_app/src/clui.cpp | 2 +- src/mir_app/src/findadd.cpp | 2 +- src/mir_app/src/genmenu.cpp | 92 +++++++++++++++++------------------ src/mir_app/src/genmenu.h | 50 ++++++++++--------- src/mir_app/src/genmenuopt.cpp | 4 +- src/mir_app/src/meta_menu.cpp | 6 +-- src/mir_app/src/movetogroup.cpp | 4 +- src/mir_app/src/options.cpp | 2 +- src/mir_app/src/proto_opts.cpp | 2 +- 21 files changed, 118 insertions(+), 119 deletions(-) (limited to 'src') diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index caaed0f169..2415198d4a 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -136,7 +136,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM) TCHAR str[128]; char *szProto = GetContactProto(hContact); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR; if (szProto != NULL) { @@ -173,7 +173,7 @@ int LoadAwayMsgModule(void) hWindowList = WindowList_Create(); CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = -2000005000; mi.flags = CMIF_NOTOFFLINE; mi.pszName = LPGEN("Re&ad status message"); diff --git a/src/core/stdemail/src/email.cpp b/src/core/stdemail/src/email.cpp index 270e818e1b..52b6e64e5d 100644 --- a/src/core/stdemail/src/email.cpp +++ b/src/core/stdemail/src/email.cpp @@ -66,7 +66,7 @@ static int EMailPreBuildMenu(WPARAM hContact, LPARAM) int LoadSendRecvEMailModule(void) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = -2000010000; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_SENDEMAIL); mi.pszName = LPGEN("&E-mail"); diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 6be3bf587b..1a7ad53931 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -336,7 +336,7 @@ static int SRFileProtoAck(WPARAM, LPARAM lParam) static int SRFileModulesLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = -2000020000; mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); mi.pszName = LPGEN("&File"); @@ -434,7 +434,7 @@ int LoadSendRecvFileModule(void) { CreateServiceFunction("FtMgr/Show", FtMgrShowCommand); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); mi.position = 1900000000; mi.pszName = LPGEN("File &transfers..."); diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index a6a09e1220..a8c70ad3aa 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -73,7 +73,7 @@ int LoadHelpModule(void) CreateServiceFunction("Help/WebsiteCommand", WebsiteCommand); CreateServiceFunction("Help/BugCommand", BugCommand); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); mi.pszPopupName = LPGEN("&Help"); mi.popupPosition = 2000090000; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index b11c854b13..330913a4a5 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -278,7 +278,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) RegisterSRMMFonts(); LoadMsgLogIcons(); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = -2000090000; mi.flags = CMIF_DEFAULT; mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_MESSAGE); diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 12add45b25..8ea9ae4aa2 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -401,7 +401,7 @@ static int PreShutdownHistoryModule(WPARAM, LPARAM) int LoadHistoryModule(void) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 1000090000; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_HISTORY); mi.pszName = LPGEN("View &history"); diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index bd467f3d49..ad3476c23a 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -119,7 +119,7 @@ static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM) static int SRUrlModulesLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = -2000040000; mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); mi.pszName = LPGEN("Web page address (&URL)"); diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 872312f824..ed003d3954 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -628,7 +628,7 @@ int LoadUserInfoModule(void) HookEvent(ME_DB_CONTACT_DELETED, UserInfoContactDelete); HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownUserInfo); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 1000050000; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS); mi.pszName = LPGEN("User &details"); diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 9a2c1991b8..c8abfa46a9 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -175,7 +175,7 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) if (db_get_b(hContact, szProto, "ChatRoom", 0)) { // still hide it for offline protos if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_NAME; if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) { if (ProtoServiceExists(szProto, PS_JOINCHAT)) { diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 8aee7e22cc..fb3b35ea17 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -560,7 +560,7 @@ static int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = -2000090001; mi.flags = CMIF_DEFAULT; mi.icolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN); diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index 069f55920c..f61a541219 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -78,14 +78,14 @@ static const int statusModePf2List[MAX_STATUS_COUNT] = static INT_PTR statusHotkeys[MAX_STATUS_COUNT]; -PMO_IntMenuItem* hStatusMainMenuHandles; +TMO_IntMenuItem **hStatusMainMenuHandles; int hStatusMainMenuHandlesCnt; typedef struct { int protoindex; int protostatus[MAX_STATUS_COUNT]; - PMO_IntMenuItem menuhandle[MAX_STATUS_COUNT]; + TMO_IntMenuItem *menuhandle[MAX_STATUS_COUNT]; } tStatusMenuHandles, *lpStatusMenuHandles; @@ -205,7 +205,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) mmep->szMenuName = tmi.name.t; tmi.ownerdata = mmep; - PMO_IntMenuItem pimi = MO_AddNewMenuItem(hMainMenuObject, &tmi); + TMO_IntMenuItem *pimi = MO_AddNewMenuItem(hMainMenuObject, &tmi); char* name; bool needFree = false; @@ -280,7 +280,7 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) tmi.ownerdata = cmep; //may be need to change how UniqueName is formed? - PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hContactMenuObject, &tmi); + TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hContactMenuObject, &tmi); char buf[256]; if (mi->pszService) mir_snprintf(buf, "%s/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", (mi->pszService) ? mi->pszService : ""); @@ -374,7 +374,7 @@ INT_PTR FreeOwnerDataContactMenu(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // STATUS MENU -BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat) +BOOL FindMenuHandleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itdat) { if (!itdat) return FALSE; @@ -392,7 +392,7 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itd if (inSub) return inSub; - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); if (pimi != NULL) { if (pimi == id) { itdat->OwnerMenu = hMenu; @@ -411,7 +411,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (!pcpp) return TRUE; - PMO_IntMenuItem timi = MO_GetIntMenuItem(pcpp->MenuItemHandle); + TMO_IntMenuItem *timi = MO_GetIntMenuItem(pcpp->MenuItemHandle); if (!timi) return TRUE; @@ -437,9 +437,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) timi->mi.flags &= ~CMIF_CHECKED; if (reset || check) { - PMO_IntMenuItem timiParent = MO_GetIntMenuItem(timi->mi.root); + TMO_IntMenuItem *timiParent = MO_GetIntMenuItem(timi->mi.root); if (timiParent) { - CLISTMENUITEM mi2 = { sizeof(mi2) }; + CLISTMENUITEM mi2 = { 0 }; mi2.flags = CMIM_NAME | CMIF_TCHAR; mi2.ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.name.t : LPGENT("Custom status")); @@ -546,11 +546,11 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) CallProtoServiceInt(NULL, smep->proto, PS_GETNAME, (WPARAM)_countof(szHumanName), (LPARAM)szHumanName); - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex); if (pimi == NULL) return 0; - PMO_IntMenuItem root = (PMO_IntMenuItem)pimi->mi.root; + TMO_IntMenuItem *root = (TMO_IntMenuItem*)pimi->mi.root; TCHAR buf[256], *ptszName; if (bIsLocked) { pimi->mi.flags |= CMIF_CHECKED; @@ -617,7 +617,7 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam) static INT_PTR ShowHideMenuItem(WPARAM wParam, LPARAM lParam) { - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam); if (pimi == NULL) return 1; @@ -628,7 +628,7 @@ static INT_PTR ShowHideMenuItem(WPARAM wParam, LPARAM lParam) else tmi.flags |= CMIF_HIDDEN; - return MO_ModifyMenuItem((PMO_IntMenuItem)wParam, &tmi); + return MO_ModifyMenuItem((TMO_IntMenuItem*)wParam, &tmi); } //wparam MenuItemHandle @@ -639,7 +639,7 @@ static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam) if (!cli.pfnConvertMenu(mi, &tmi)) return 0; - return MO_ModifyMenuItem((PMO_IntMenuItem)wParam, &tmi); + return MO_ModifyMenuItem((TMO_IntMenuItem*)wParam, &tmi); } INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) @@ -666,7 +666,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) return MO_ProcessCommandByMenuIdent(LOWORD(wParam), lParam); } -BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat) +BOOL FindMenuHanleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itdat) { if (!itdat) return FALSE; @@ -685,7 +685,7 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itda if (inSub) return inSub; - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); if (pimi != NULL) { if (pimi == id) { itdat->OwnerMenu = hMenu; @@ -827,7 +827,7 @@ void RebuildMenuOrder(void) hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService"); MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu"); - hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(_countof(statusModeList) * sizeof(PMO_IntMenuItem)); + hStatusMainMenuHandles = (TMO_IntMenuItem**)mir_calloc(_countof(statusModeList) * sizeof(TMO_IntMenuItem*)); hStatusMainMenuHandlesCnt = _countof(statusModeList); hStatusMenuHandles = (tStatusMenuHandles*)mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount()); @@ -866,7 +866,7 @@ void RebuildMenuOrder(void) smep->proto = mir_strdup(pa->szModuleName); tmi.ownerdata = smep; - PMO_IntMenuItem rootmenu = MO_AddNewMenuItem(hStatusMenuObject, &tmi); + TMO_IntMenuItem *rootmenu = MO_AddNewMenuItem(hStatusMenuObject, &tmi); memset(&tmi, 0, sizeof(tmi)); tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED; @@ -888,7 +888,7 @@ void RebuildMenuOrder(void) } else tmi.name.t = pa->tszAccountName; - PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi); + TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi); ((StatusMenuExecParam*)tmi.ownerdata)->protoindex = (int)menuHandle; MO_ModifyMenuItem(menuHandle, &tmi); @@ -1099,9 +1099,6 @@ int fnConvertMenu(CLISTMENUITEM *mi, TMO_MenuItem *pmi) if (mi == NULL || pmi == NULL) return FALSE; - if (mi->cbSize != sizeof(CLISTMENUITEM)) - return FALSE; - memset(pmi, 0, sizeof(TMO_MenuItem)); pmi->root = mi->hParentMenu; pmi->flags = mi->flags; @@ -1145,7 +1142,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) return 0; // for new style menus the pszPopupName contains the root menu handle - PMO_IntMenuItem pRoot = NULL; + TMO_IntMenuItem *pRoot = NULL; if (mi->flags & CMIF_ROOTHANDLE) pRoot = MO_GetIntMenuItem(mi->hParentMenu); @@ -1195,7 +1192,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) tmi.ownerdata = smep; } - PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi); + TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi); if (smep) smep->hMenuItem = menuHandle; @@ -1314,7 +1311,7 @@ void InitCustomMenus(void) // add exit command to menu - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 0x7fffffff; mi.pszService = "CloseAction"; mi.pszName = LPGEN("E&xit"); diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 556b4dc30d..68c98c2a11 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -723,7 +723,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) HMENU hMenu = GetSubMenu(hMainMenu, 0); TranslateMenu(hMenu); - MENUITEMINFO mi = { sizeof(mi) }; + MENUITEMINFO mi = { 0 }; mi.fMask = MIIM_SUBMENU | MIIM_TYPE; mi.fType = MFT_STRING; mi.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index fc8381b0e0..141ed13b8c 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -325,7 +325,7 @@ int LoadCLUIModule(void) db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact); mi.position = 2000070000; diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 5186f627c7..ea9efe510c 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -1028,7 +1028,7 @@ int LoadFindAddModule(void) HookEvent(ME_PROTO_ACCLISTCHANGED, OnSystemModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, FindAddPreShutdown); - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 500020000; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER); mi.pszName = LPGEN("&Find/add contacts..."); diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index ac481b7407..2c226f4aca 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -38,10 +38,10 @@ static void DumpMenuItem(TMO_IntMenuItem* pParent, int level = 0) memset(temp, '\t', level); temp[ level ] = 0; - for (PMO_IntMenuItem pimi = pParent; pimi != NULL; pimi = pimi->next) { + for (TMO_IntMenuItem *pimi = pParent; pimi != NULL; pimi = pimi->next) { Netlib_Logf(NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.name.t); - PMO_IntMenuItem submenu = pimi->submenu.first; + TMO_IntMenuItem *submenu = pimi->submenu.first; if (submenu) DumpMenuItem(submenu, level+1); } @@ -76,7 +76,7 @@ int GetMenuObjbyId(const int id) return -1; } -LPTSTR GetMenuItemText(PMO_IntMenuItem pimi) +LPTSTR GetMenuItemText(TMO_IntMenuItem *pimi) { if (pimi->mi.flags & CMIF_KEEPUNTRANSLATED) return pimi->mi.name.t; @@ -86,20 +86,20 @@ LPTSTR GetMenuItemText(PMO_IntMenuItem pimi) /////////////////////////////////////////////////////////////////////////////// -PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, void* param) +TMO_IntMenuItem *MO_RecursiveWalkMenu(TMO_IntMenuItem *parent, pfnWalkFunc func, void* param) { if (parent == NULL) return FALSE; - PMO_IntMenuItem pnext; - for (PMO_IntMenuItem pimi = parent; pimi != NULL; pimi = pnext) { - PMO_IntMenuItem submenu = pimi->submenu.first; + TMO_IntMenuItem *pnext; + for (TMO_IntMenuItem *pimi = parent; pimi != NULL; pimi = pnext) { + TMO_IntMenuItem *submenu = pimi->submenu.first; pnext = pimi->next; if (func(pimi, param)) // it can destroy the menu item return pimi; if (submenu) { - PMO_IntMenuItem res = MO_RecursiveWalkMenu(submenu, func, param); + TMO_IntMenuItem *res = MO_RecursiveWalkMenu(submenu, func, param); if (res) return res; } @@ -124,7 +124,7 @@ int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis) mis->itemWidth = 0; mis->itemHeight = 0; - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mis->itemData); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mis->itemData); if (pimi == NULL) return FALSE; @@ -150,7 +150,7 @@ int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis) mir_cslock lck(csMenuHook); - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)dis->itemData); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)dis->itemData); if (pimi == NULL || pimi->iconId == -1) return FALSE; @@ -224,7 +224,7 @@ INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey) if (objidx == -1) return FALSE; - for (PMO_IntMenuItem pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next) { + for (TMO_IntMenuItem *pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next) { if (pimi->mi.hotKey == 0) continue; if (HIWORD(pimi->mi.hotKey) != vKey) continue; if (!(LOWORD(pimi->mi.hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue; @@ -254,7 +254,7 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM) mir_cslock lck(csMenuHook); TIntMenuObject* pmo = g_menus[objidx]; - for (PMO_IntMenuItem p = pmo->m_items.first; p != NULL; p = p->next) + for (TMO_IntMenuItem *p = pmo->m_items.first; p != NULL; p = p->next) if (!mir_strcmp(p->UniqName, szProto)) return (INT_PTR)p; @@ -270,7 +270,7 @@ INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam) if (!bIsGenMenuInited || mi == NULL) return -1; - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam); mir_cslock lck(csMenuHook); if (pimi == NULL) return -1; @@ -279,7 +279,7 @@ INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam) return 0; } -static int FindDefaultItem(PMO_IntMenuItem pimi, void*) +static int FindDefaultItem(TMO_IntMenuItem *pimi, void*) { if (pimi->mi.flags & (CMIF_GRAYED | CMIF_HIDDEN)) return FALSE; @@ -292,7 +292,7 @@ INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM) if (!bIsGenMenuInited) return -1; - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam); mir_cslock lck(csMenuHook); return (pimi) ? (INT_PTR)MO_RecursiveWalkMenu(pimi, FindDefaultItem, NULL) : NULL; } @@ -301,7 +301,7 @@ INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM) // wparam MenuItemHandle // lparam PMO_MenuItem -int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, TMO_MenuItem *pmi) +int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi) { int oldflags; @@ -310,7 +310,7 @@ int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, TMO_MenuItem *pmi) mir_cslock lck(csMenuHook); - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)menuHandle); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)menuHandle); if (pimi == NULL) return -1; @@ -369,13 +369,13 @@ INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM) return -1; mir_cslock lck(csMenuHook); - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam); return (pimi) ? (INT_PTR)pimi->mi.ownerdata : -1; } -PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam) +TMO_IntMenuItem *MO_GetIntMenuItem(HGENMENU wParam) { - PMO_IntMenuItem result = (PMO_IntMenuItem)wParam; + TMO_IntMenuItem *result = (TMO_IntMenuItem*)wParam; if (result == NULL || wParam == (HGENMENU)0xffff1234 || wParam == HGENMENU_ROOT) return NULL; @@ -394,7 +394,7 @@ PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam) ///////////////////////////////////////////////////////////////////////////////////////// // LOWORD(wparam) menuident -static int FindMenuByCommand(PMO_IntMenuItem pimi, void* pCommand) +static int FindMenuByCommand(TMO_IntMenuItem *pimi, void* pCommand) { return (pimi->iCommand == (int)pCommand); } @@ -404,7 +404,7 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) if (!bIsGenMenuInited) return -1; - PMO_IntMenuItem pimi; + TMO_IntMenuItem *pimi; { mir_cslock lck(csMenuHook); int objidx = GetMenuObjbyId(menuID); @@ -422,7 +422,7 @@ INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) if (!bIsGenMenuInited) return -1; - PMO_IntMenuItem pimi = NULL; + TMO_IntMenuItem *pimi = NULL; { mir_cslock lck(csMenuHook); for (int i = 0; i < g_menus.getCount(); i++) @@ -433,12 +433,12 @@ INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) return (pimi) ? MO_ProcessCommand(pimi, lParam) : FALSE; } -int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam) +int MO_ProcessCommand(TMO_IntMenuItem *aHandle, LPARAM lParam) { if (!bIsGenMenuInited) return -1; - PMO_IntMenuItem pimi; + TMO_IntMenuItem *pimi; { mir_cslock lck(csMenuHook); if ((pimi = MO_GetIntMenuItem(aHandle)) == NULL) @@ -451,13 +451,13 @@ int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam) return 1; } -int MO_SetOptionsMenuItem(PMO_IntMenuItem aHandle, int setting, INT_PTR value) +int MO_SetOptionsMenuItem(TMO_IntMenuItem *aHandle, int setting, INT_PTR value) { if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); - PMO_IntMenuItem pimi = MO_GetIntMenuItem(aHandle); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem(aHandle); if (pimi == NULL) return -1; @@ -548,7 +548,7 @@ static int FindParent(TMO_IntMenuItem* pimi, void* p) INT_PTR MO_RemoveMenuItem(WPARAM wParam, LPARAM) { mir_cslock lck(csMenuHook); - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam); if (pimi == NULL) return -1; @@ -557,7 +557,7 @@ INT_PTR MO_RemoveMenuItem(WPARAM wParam, LPARAM) pimi->submenu.first = NULL; } - PMO_IntMenuItem prev = MO_RecursiveWalkMenu(pimi->owner->first, FindParent, pimi); + TMO_IntMenuItem *prev = MO_RecursiveWalkMenu(pimi->owner->first, FindParent, pimi); if (prev) prev->next = pimi->next; if (pimi->owner->first == pimi) @@ -583,7 +583,7 @@ struct KillMenuItemsParam LIST<TMO_IntMenuItem> arItems; }; -int KillMenuItems(PMO_IntMenuItem pimi, KillMenuItemsParam* param) +int KillMenuItems(TMO_IntMenuItem *pimi, KillMenuItemsParam* param) { if (pimi->hLangpack == param->hLangpack) param->arItems.insert(pimi); @@ -608,7 +608,7 @@ MIR_APP_DLL(void) KillModuleMenus(int hLangpack) /////////////////////////////////////////////////////////////////////////////// // we presume that this function is being called inside csMenuHook only -static int PackMenuItems(PMO_IntMenuItem pimi, void*) +static int PackMenuItems(TMO_IntMenuItem *pimi, void*) { pimi->iCommand = NextObjectMenuItemId++; return FALSE; @@ -631,7 +631,7 @@ static int GetNextObjectMenuItemId() // lparam = PMO_MenuItem // return MenuItemHandle -PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) +TMO_IntMenuItem *MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) { if (!bIsGenMenuInited || pmi == NULL) return NULL; @@ -676,7 +676,7 @@ PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) if (p->mi.root == HGENMENU_ROOT) p->mi.root = NULL; - PMO_IntMenuItem pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL; + TMO_IntMenuItem *pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL; if (pRoot) p->owner = &pRoot->submenu; else @@ -694,7 +694,7 @@ PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) // wparam = MenuObjectHandle // lparam = PMO_MenuItem -int FindRoot(PMO_IntMenuItem pimi, void* param) +int FindRoot(TMO_IntMenuItem *pimi, void* param) { if (pimi->mi.name.t != NULL) if (pimi->submenu.first && !mir_tstrcmp(pimi->mi.name.t, (TCHAR*)param)) @@ -703,7 +703,7 @@ int FindRoot(PMO_IntMenuItem pimi, void* param) return FALSE; } -PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) +TMO_IntMenuItem *MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) { if (!bIsGenMenuInited || pmi == NULL) return NULL; @@ -727,7 +727,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) else tszRoot = mir_a2t((char*)pmi->root); - PMO_IntMenuItem oldroot = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindRoot, tszRoot); + TMO_IntMenuItem *oldroot = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindRoot, tszRoot); mir_free(tszRoot); if (oldroot == NULL) { @@ -757,7 +757,7 @@ static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi) for (int i = GetMenuItemCount(hMenu) - 1; i >= 0; i--) { GetMenuItemInfo(hMenu, i, TRUE, &mii); if (mii.fType != MFT_SEPARATOR) { - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); if (pimi != NULL) if (pimi->mi.position <= mi->position) return i + 1; @@ -777,7 +777,7 @@ static DWORD GetMenuItemType(HMENU hMenu, int uItem) return mii.fType; } -static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, PMO_IntMenuItem& p) +static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, TMO_IntMenuItem* &p) { MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_DATA | MIIM_TYPE; @@ -796,7 +796,7 @@ static void InsertSeparator(HMENU hMenu, int uItem) static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii) { - PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), p; + TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), *p; if (pimi == NULL) return; @@ -866,7 +866,7 @@ INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) #define PUTPOSITIONSONMENU #endif -void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize) +void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSize) { if (pMenuItem->UniqName) mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->UniqName); @@ -876,7 +876,7 @@ void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->mi.name.t); } -HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *param) +HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *param) { if (param == NULL || pRootMenu == NULL) return NULL; @@ -890,7 +890,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para while (rootlevel == 0 && GetMenuItemCount(hMenu) > 0) DeleteMenu(hMenu, 0, MF_BYPOSITION); - for (PMO_IntMenuItem pmi = pRootMenu; pmi != NULL; pmi = pmi->next) { + for (TMO_IntMenuItem *pmi = pRootMenu; pmi != NULL; pmi = pmi->next) { TMO_MenuItem *mi = &pmi->mi; if (mi->flags & CMIF_HIDDEN) continue; @@ -1014,7 +1014,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para ///////////////////////////////////////////////////////////////////////////////////////// // iconlib in menu -static int MO_ReloadIcon(PMO_IntMenuItem pmi, void*) +static int MO_ReloadIcon(TMO_IntMenuItem *pmi, void*) { if (pmi->hIcolibItem) { HICON newIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false); @@ -1042,7 +1042,7 @@ int OnIconLibChanges(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// -static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*) +static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*) { TCHAR *uname = (pmi->UniqName) ? mir_a2t(pmi->UniqName) : mir_tstrdup(pmi->CustomName), *descr = GetMenuItemText(pmi); @@ -1111,7 +1111,7 @@ int TryProcessDoubleClick(MCONTACT hContact) if (iMenuID != -1) { NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0); - PMO_IntMenuItem pimi = (PMO_IntMenuItem)MO_GetDefaultMenuItem((WPARAM)g_menus[iMenuID]->m_items.first, 0); + TMO_IntMenuItem *pimi = (TMO_IntMenuItem*)MO_GetDefaultMenuItem((WPARAM)g_menus[iMenuID]->m_items.first, 0); if (pimi != NULL) { MO_ProcessCommand(pimi, hContact); return 0; @@ -1154,7 +1154,7 @@ static INT_PTR SRVMO_SetOptionsMenuItem(WPARAM, LPARAM lParam) if (lpop == NULL) return 0; - return MO_SetOptionsMenuItem((PMO_IntMenuItem)lpop->Handle, lpop->Setting, lpop->Value); + return MO_SetOptionsMenuItem((TMO_IntMenuItem*)lpop->Handle, lpop->Setting, lpop->Value); } int InitGenMenu() diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 1c129f2197..acd498384f 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -31,14 +31,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MENUITEM_SIGNATURE 0xDEADBEEF -typedef struct +struct TIntMenuObject; +struct TMO_IntMenuItem; + +struct TMO_LinkedList { - struct _tagIntMenuItem *first, // first element of submenu, or NULL - *last; // last element of submenu, or NULL -} - TMO_LinkedList; + TMO_IntMenuItem + *first, // first element of submenu, or NULL + *last; // last element of submenu, or NULL +}; -typedef struct _tagIntMenuItem +struct TMO_IntMenuItem { DWORD signature; int iCommand; @@ -52,12 +55,11 @@ typedef struct _tagIntMenuItem int originalPosition; int hLangpack; - struct _tagIntMenuItem *next; // next item in list - struct TIntMenuObject *parent; - TMO_LinkedList *owner; - TMO_LinkedList submenu; -} - TMO_IntMenuItem, *PMO_IntMenuItem; + TMO_IntMenuItem *next; // next item in list + TIntMenuObject *parent; + TMO_LinkedList *owner; + TMO_LinkedList submenu; +}; struct TIntMenuObject : public MZeroedObject { @@ -99,41 +101,41 @@ extern LIST<TIntMenuObject> g_menus; #define SEPARATORPOSITIONINTERVAL 100000 //internal usage -HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem, ListParam *param); -void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize); +HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem*, ListParam *param); +void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSize); -PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU); +TMO_IntMenuItem* MO_GetIntMenuItem(HGENMENU); -PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi); -PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi); +TMO_IntMenuItem* MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi); +TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi); int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis); int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis); -int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, TMO_MenuItem *pmiparam); -int MO_ProcessCommand(PMO_IntMenuItem pimi, LPARAM lParam); +int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmiparam); +int MO_ProcessCommand(TMO_IntMenuItem *pimi, LPARAM lParam); INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey); -int MO_SetOptionsMenuItem(PMO_IntMenuItem menuobjecthandle, int setting, INT_PTR value); +int MO_SetOptionsMenuItem(TMO_IntMenuItem *menuobjecthandle, int setting, INT_PTR value); int MO_SetOptionsMenuObject(HANDLE menuobjecthandle, int setting, INT_PTR value); INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam); int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam); // function returns TRUE if the walk should be immediately stopped -typedef int (*pfnWalkFunc)(PMO_IntMenuItem, void*); +typedef int (*pfnWalkFunc)(TMO_IntMenuItem*, void*); // returns the item, on which pfnWalkFunc returned TRUE -PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem, pfnWalkFunc, void*); +TMO_IntMenuItem *MO_RecursiveWalkMenu(TMO_IntMenuItem*, pfnWalkFunc, void*); //general stuff int InitGenMenu(); int UnitGenMenu(); -int FindRoot(PMO_IntMenuItem pimi, void* param); +int FindRoot(TMO_IntMenuItem *pimi, void* param); TMO_IntMenuItem * GetMenuItemByGlobalID(int globalMenuID); BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c -LPTSTR GetMenuItemText(PMO_IntMenuItem); +LPTSTR GetMenuItemText(TMO_IntMenuItem*); int GenMenuOptInit(WPARAM wParam, LPARAM); int GetMenuObjbyId(const int id); diff --git a/src/mir_app/src/genmenuopt.cpp b/src/mir_app/src/genmenuopt.cpp index db302e59da..2b306e5623 100644 --- a/src/mir_app/src/genmenuopt.cpp +++ b/src/mir_app/src/genmenuopt.cpp @@ -46,7 +46,7 @@ struct MenuItemOptData : public MZeroedObject bool bShow; int id; - PMO_IntMenuItem pimi; + TMO_IntMenuItem *pimi; }; static int SortMenuItems(const MenuItemOptData *p1, const MenuItemOptData *p2) @@ -160,7 +160,7 @@ class CGenMenuOptionsPage : public CDlgBase LIST<MenuItemOptData> arItems(10, SortMenuItems); - for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next) { + for (TMO_IntMenuItem *p = pimo->m_items.first; p != NULL; p = p->next) { if (p->mi.root != (HGENMENU)-1 && p->mi.root != NULL) continue; diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 1dce9747d4..1b07b97247 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -249,7 +249,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) if (cc == NULL) return 0; - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; Menu_ShowItem(hMenuRoot, false); if (cc->IsMeta()) { @@ -346,7 +346,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) INT_PTR Meta_OnOff(WPARAM, LPARAM) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.flags = CMIM_NAME | CMIM_ICON; bool bToggled = !db_mc_isEnabled(); @@ -371,7 +371,7 @@ INT_PTR Meta_OnOff(WPARAM, LPARAM) void InitMenus() { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; // main menu item mi.icolibItem = GetIconHandle(I_MENUOFF); diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index dabc638ad3..a8bd2771e4 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -67,7 +67,7 @@ static TCHAR* PrepareGroupName(TCHAR* str) static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, bool checked) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.hParentMenu = hRoot; mi.popupPosition = param; // param to pszService - only with CMIF_CHILDPOPUP !!!!!! mi.position = pos; @@ -88,7 +88,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare); if (!hMoveToGroupItem) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.position = 100000; mi.pszName = LPGEN("&Move to group"); mi.flags = CMIF_ROOTHANDLE; diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index b27baebe20..aee3be838e 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -1293,7 +1293,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) static int OptModulesLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS); mi.position = 1900000000; mi.pszName = LPGEN("&Options..."); diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 0c5ae404f3..d2b45a520a 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -1018,7 +1018,7 @@ static INT_PTR OptProtosShow(WPARAM, LPARAM) int OptProtosLoaded(WPARAM, LPARAM) { - CLISTMENUITEM mi = { sizeof(mi) }; + CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_ACCMGR); mi.position = 1900000000; mi.pszName = LPGEN("&Accounts..."); -- cgit v1.2.3