From f3151f33e282214080abacf04521296acec5e9de Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 7 Dec 2015 16:15:24 +0000 Subject: fix to apply the unique identifiers to all menu roots git-svn-id: http://svn.miranda-ng.org/main/trunk@15826 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_genmenu.inc | 48 +++++++++--------------- include/m_genmenu.h | 3 +- plugins/Alarms/src/frame.cpp | 4 +- plugins/Alarms/src/options.cpp | 7 +++- plugins/CrashDumper/src/crshdmp.cpp | 1 + plugins/Db3x_mmap/src/ui.cpp | 9 +---- plugins/HistoryStats/src/main.cpp | 1 + plugins/MyDetails/src/frame.cpp | 4 +- plugins/NewsAggregator/Src/Menus.cpp | 1 + plugins/Non-IM Contact/src/main.cpp | 3 +- plugins/NotesAndReminders/src/main.cpp | 1 + plugins/Ping/src/menu.cpp | 1 + plugins/Ping/src/pingthread.cpp | 4 +- plugins/Popup/src/main.cpp | 4 +- plugins/Quotes/src/Forex.cpp | 5 ++- plugins/Sessions/Src/Main.cpp | 1 + plugins/StatusPlugins/StartupStatus/profiles.cpp | 4 +- plugins/Watrack/i_gui.inc | 14 ++++--- plugins/Watrack/proto/proto.pas | 14 ++++--- plugins/Watrack/stat/statlog.pas | 15 ++++---- plugins/Weather/src/weather_svcs.cpp | 1 + plugins/WebView/src/main.cpp | 4 +- plugins/WhenWasIt/src/WhenWasIt.cpp | 1 + plugins/YAPP/src/yapp.cpp | 1 + src/core/stdhelp/src/help.cpp | 1 + src/mir_app/src/menu_utils.cpp | 10 +++++ 26 files changed, 93 insertions(+), 69 deletions(-) diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index 14f51f8140..2c7546f916 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -208,16 +208,14 @@ type result hMenu } -function Menu_Build(parent:HMENU; menuObject:integer; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; - external AppDLL name 'Menu_Build'; +function Menu_Build(parent:HMENU; menuObject:integer; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; external AppDLL; { Passes custom lParam to the ExecMenuService for the specified menu item returns true if command is processed, false otherwise } -function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdcall; - external AppDLL name 'Menu_ProcessCommand'; +function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdcall; external AppDLL; { if menu not known call this @@ -226,23 +224,20 @@ function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdca returns true if command is processed, false otherwise } -function Menu_ProcessCommandById(iCommand:integer; lParam:LPARAM) : integer; stdcall; - external AppDLL name 'Menu_ProcessCommandById'; +function Menu_ProcessCommandById(iCommand:integer; lParam:LPARAM) : integer; stdcall; external AppDLL; { creates a submenu returns=MenuObjectHandle on success,-1 on failure } -function Menu_CreateRoot(menuObject:integer; const name:PWideChar; position:integer; icon:THANDLE; lang:integer) : THANDLE; stdcall; - external AppDLL name 'Menu_CreateRoot'; +function Menu_CreateRoot(menuObject:integer; const name:PWideChar; position:integer; icon:THANDLE; lang:integer) : THANDLE; stdcall; external AppDLL; { returns=MenuObjectHandle on success,-1 on failure } -function Menu_AddObject(const name, displayName, checkService, execService:PAnsiChar) : THANDLE; stdcall; - external AppDLL name 'Menu_AddObject'; +function Menu_AddObject(const name, displayName, checkService, execService:PAnsiChar) : THANDLE; stdcall; external AppDLL; { returns 0 on success,-1 on failure @@ -250,8 +245,7 @@ function Menu_AddObject(const name, displayName, checkService, execService:PAnsi call this service.MO_REMOVEMENUOBJECT NOT free it. } -function Menu_RemoveObject(hMenuObject:integer) : integer; stdcall; - external AppDLL name 'Menu_RemoveObject'; +function Menu_RemoveObject(hMenuObject:integer) : integer; stdcall; external AppDLL; { returns 0 on success,-1 on failure. @@ -259,36 +253,31 @@ function Menu_RemoveObject(hMenuObject:integer) : integer; stdcall; If MenuItemHandle is root all child will be removed too. } -function Menu_RemoveItem(hMenuItem:HGENMENU) : integer; stdcall; - external AppDLL name 'Menu_RemoveItem'; +function Menu_RemoveItem(hMenuItem:HGENMENU) : integer; stdcall; external AppDLL; { return MenuItemHandle on success,-1 on failure } -function Menu_AddItem(hMenuObject:integer; var tmi:TMO_MenuItem; pUserData:pointer) : HGENMENU; stdcall; - external AppDLL name 'Menu_AddItem'; +function Menu_AddItem(hMenuObject:integer; var tmi:TMO_MenuItem; pUserData:pointer) : HGENMENU; stdcall; external AppDLL; { Useful to get and free ownerdata before delete menu item. } -function Menu_GetItemData(hMenuItem:HGENMENU) : pointer; stdcall; - external AppDLL name 'Menu_GetItemData'; +function Menu_GetItemData(hMenuItem:HGENMENU) : pointer; stdcall; external AppDLL; { returns 0 on success,-1 on failure } -function Menu_GetItemInfo(hMenuItem:HGENMENU; var mi:TMO_MenuItem) : integer; stdcall; - external AppDLL name 'Menu_GetItemInfo'; +function Menu_GetItemInfo(hMenuItem:HGENMENU; var mi:TMO_MenuItem) : integer; stdcall; external AppDLL; { returns a menu handle on success or NULL on failure } -function Menu_GetDefaultItem(hMenuItem:HGENMENU) : HGENMENU; stdcall; - external AppDLL name 'Menu_GetDefaultItem'; +function Menu_GetDefaultItem(hMenuItem:HGENMENU) : HGENMENU; stdcall; external AppDLL; { wparam=MenuObjectHandle @@ -297,8 +286,7 @@ function Menu_GetDefaultItem(hMenuItem:HGENMENU) : HGENMENU; stdcall; this should be called in WM_KEYDOWN } -function Menu_ProcessHotKey(hMenuObject:integer; vKey:DWORD) : integer; stdcall; - external AppDLL name 'Menu_ProcessHotKey'; +function Menu_ProcessHotKey(hMenuObject:integer; vKey:DWORD) : integer; stdcall; external AppDLL; { sets an option for the whole menu object @@ -311,8 +299,7 @@ const MCO_OPT_ONADD_SERVICE = 3; // sets onAddService for menuobject. MCO_OPT_CHECK_SERVICE = 4; -function Menu_ConfigureObject(menu:THANDLE; option:integer; value:PAnsiChar) : integer; stdcall; - external AppDLL name 'Menu_ConfigureObject'; +function Menu_ConfigureObject(menu:THANDLE; option:integer; value:PAnsiChar) : integer; stdcall; external AppDLL; { wparam=0 @@ -321,11 +308,11 @@ function Menu_ConfigureObject(menu:THANDLE; option:integer; value:PAnsiChar) : i } const - OPT_USERDEFINEDITEMS = 1; // enables ability user to edit menuitems via options page. OPT_HOTKEY = 2; + MCI_OPT_EXECPARAM = 3; // INT_PTR or void*, associated with this item + MCI_OPT_UID = 4; -function Menu_ConfigureItem(menu:THANDLE; option:integer; value:int_ptr) : integer; stdcall; - external AppDLL name 'Menu_ConfigureItem'; +function Menu_ConfigureItem(menu:THANDLE; option:integer; value:PAnsiChar) : integer; stdcall; external AppDLL; { wparam=char* szProtoName @@ -333,7 +320,6 @@ function Menu_ConfigureItem(menu:THANDLE; option:integer; value:int_ptr) : integ returns HGENMENU of the root item or NULL } -function Menu_GetProtocolRoot(const proto:PAnsiChar) : integer; stdcall; - external AppDLL name 'Menu_GetProtocolRoot'; +function Menu_GetProtocolRoot(const proto:PAnsiChar) : integer; stdcall; external AppDLL; {$ENDIF} diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 02301febec..8dc27bfbfb 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -61,7 +61,7 @@ struct TMO_MenuItem #define UNSET_UID(M) { MUUID tmp = MIID_LAST; M.uid = tmp; } #else #define SET_UID(M,A,B,C,D1,D2,D3,D4,D5,D6,D7,D8) { M.uid = { A, B, C, {D1,D2,D3,D4,D5,D6,D7,D8}}; } -#define UNSET_UID(M) { M.uid = MIID_LAST; } + #define UNSET_UID(M) { M.uid = MIID_LAST; } #endif #ifdef __cplusplus @@ -250,6 +250,7 @@ __forceinline int Menu_ConfigureObject(int hMenuObject, int iSetting, LPCSTR psz #define MCI_OPT_UNIQUENAME 1 // a unique name to menuitem(used to store it in database when enabled OPT_USERDEFINEDITEMS) #define MCI_OPT_HOTKEY 2 // DWORD value = MAKELONG(VK_*, VK_SHIFT) #define MCI_OPT_EXECPARAM 3 // INT_PTR or void*, associated with this item +#define MCI_OPT_UID 4 // TMenuItem::uid as string like "2E407C55-5E89-4E83-9B79-15A803E7EE90" EXTERN_C MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value); diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 9282a8642c..0cf9561998 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -542,11 +542,13 @@ int CreateFrame() CreateServiceFunction(MODULE "/ShowHideReminders", ShowHideMenuFunc); CMenuItem mi; + mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Alarms"), 0); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8A3C1906-4809-4EE8-A32A-858003A2AAA7"); + SET_UID(mi, 0x27556ea9, 0xfa19, 0x4c2e, 0xb0, 0xc9, 0x48, 0x2, 0x5c, 0x17, 0xba, 0x5); mi.hIcolibItem = hIconMenuShowHide; mi.name.a = LPGEN("Show reminders"); mi.pszService = MODULE "/ShowHideReminders"; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Alarms"), 0); mi.position = 500010000; hMenuShowReminders = Menu_AddMainMenuItem(&mi); ///////////////////// diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index fcaedc750e..847f377ec5 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -575,13 +575,16 @@ void AddMenuItem() if (hMainMenuItem) return; CMenuItem mi; + if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { + mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Alarms"), mi.position); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "24F03563-01BE-4118-8297-E94375A783E7"); + } + SET_UID(mi, 0xd50b94e4, 0x8edd, 0x4083, 0x91, 0x93, 0x7c, 0x6a, 0xb8, 0x1, 0x41, 0xb9); mi.hIcolibItem = IcoLib_GetIconHandle("alarms_menu_set"); mi.name.a = "Set alarm"; mi.pszService = MODULE "/NewAlarm"; mi.position = 500010000; - if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Alarms"), mi.position); hMainMenuItem = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index c853194cb5..73aa9edb38 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -257,6 +257,7 @@ static int ModulesLoaded(WPARAM, LPARAM) CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Version Information"), 2000089999, GetIconHandle(IDI_VI)); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "9A7A9C76-7FD8-4C05-B402-6C46060C2D78"); SET_UID(mi, 0x52930e40, 0xb2ee, 0x4433, 0xad, 0x77, 0xf5, 0x42, 0xe, 0xf6, 0x57, 0xc1); mi.position = 2000089995; diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index 06babe9987..df37908037 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -313,17 +313,12 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM) CMenuItem mi; // main menu item - SET_UID(mi, 0x3a93aa5e, 0xe731, 0x445e, 0x8d, 0x3b, 0x6d, 0x2c, 0xdd, 0xde, 0xde, 0xe7); - mi.name.t = LPGENT("Database"); - mi.position = 500000000; - mi.flags = CMIF_TCHAR; - mi.hIcolibItem = iconList[0].hIcolib; - HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500000000, iconList[0].hIcolib); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "F7C5567C-D1EE-484B-B4F6-24677A5AAAEF"); SET_UID(mi, 0x50321866, 0xba1, 0x46dd, 0xb3, 0xa6, 0xc3, 0xcc, 0x55, 0xf2, 0x42, 0x9e); mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = db->GetMenuTitle(); - mi.root = hMenuRoot; mi.pszService = MS_DB_CHANGEPASSWORD; hSetPwdMenu = Menu_AddMainMenuItem(&mi); return 0; diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index 7c5c88fb9f..4f7a1a09d4 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -157,6 +157,7 @@ void AddMainMenu() CreateServiceFunction(con::SvcConfigure, MenuConfigure); HGENMENU hRoot = bInPopup ? Menu_CreateRoot(MO_MAIN, LPGENT("Statistics"), 1910000000) : NULL; + Menu_ConfigureItem(hRoot, MCI_OPT_UID, "7F116B24-9D84-4D04-B6AA-EED95051A184"); g_hMenuCreateStatistics = mu::clist::addMainMenuItem( LPGENT("Create statistics"), 0, 1910000000, IconLib::getIcon(IconLib::iiMenuCreateStatistics), con::SvcCreateStatistics, hRoot); diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 2dacea2550..fd169273bf 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -328,9 +328,11 @@ int CreateFrame() // Create menu item CMenuItem mi; + mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("My details"), 500010000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8C1C981C-4F28-4C4C-9121-544156210CE9"); + SET_UID(mi, 0x69a43f1d, 0x6ebd, 0x4e41, 0xa6, 0xbd, 0x18, 0xea, 0xc4, 0x3, 0x90, 0x35); mi.flags = CMIF_TCHAR; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("My details"), 500010000); mi.position = 1; mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_USERDETAILS); mi.name.t = LPGENT("Show my details"); diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index b0d5e2e2b5..6733becea1 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -26,6 +26,7 @@ void InitMenu() CMenuItem mi; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("News Aggregator"), 500099000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D9733E4F-1946-4390-8EB3-591E8687222E"); SET_UID(mi, 0x3ec91864, 0xefa7, 0x4994, 0xb7, 0x75, 0x6c, 0x96, 0xcb, 0x29, 0x2f, 0x93); mi.position = 10100001; diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index c4f2c281e9..87a0194420 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -144,10 +144,11 @@ extern "C" __declspec(dllexport) int Load() CreateServiceFunction("NIM_Contact/DoubleClick", doubleClick); CMenuItem mi; + mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("&Non-IM Contact"), 600090000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D7CE61C5-1178-41BA-B2ED-5A711BB21AE9"); SET_UID(mi, 0x73c11266, 0x153c, 0x4da4, 0x9b, 0x82, 0x5c, 0xce, 0xca, 0x86, 0xd, 0x41); mi.position = 600090000; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("&Non-IM Contact"), 600090000); mi.name.a = LPGEN("&Add Non-IM Contact"); mi.pszService = "AddLCcontact"; mi.hIcolibItem = icoList[0].hIcolib; diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index a2539f9eb5..0c54cd6626 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -196,6 +196,7 @@ int OnModulesLoaded(WPARAM wparam, LPARAM lparam) // register menus CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Notes && Reminders"), 1600000000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "A5E140BC-D697-4689-B75B-8ECFB6FE5931"); mi.flags = CMIF_TCHAR; mi.position = 1600000000; diff --git a/plugins/Ping/src/menu.cpp b/plugins/Ping/src/menu.cpp index 73d72c946e..4d886697dc 100644 --- a/plugins/Ping/src/menu.cpp +++ b/plugins/Ping/src/menu.cpp @@ -9,6 +9,7 @@ void InitMenus() CMenuItem mi; mi.flags = CMIF_TCHAR; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 500099900); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "FF273885-6AEC-4C8A-B8BC-9247D920F223"); SET_UID(mi, 0xc9a4d17a, 0xd5fa, 0x40d9, 0xbe, 0x7b, 0x9e, 0x2e, 0x5b, 0xbf, 0x8, 0x59); mi.position = 2000060000; diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index ac725f7557..1a09b4feb8 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -902,9 +902,11 @@ void InitList() CreateServiceFunction(PLUG "/ShowWindow", PingPlugShowWindow); CMenuItem mi; + mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 1000200001); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "7CFBF239-86B5-48B2-8D5B-39E09A7DB514"); + SET_UID(mi, 0x4adbd753, 0x27d6, 0x457a, 0xa6, 0x6, 0xdf, 0x4f, 0x2c, 0xd8, 0xb9, 0x3b); mi.flags = CMIF_TCHAR; - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 1000200001); mi.position = 3000320001; mi.name.t = LPGENT("Show/Hide &Ping Window"); mi.pszService = PLUG "/ShowWindow"; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index a30a274d94..705209a14b 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -180,11 +180,11 @@ void InitMenuItems(void) HANDLE hIcon = GetIconHandle(PopupOptions.ModuleIsEnabled ? IDI_POPUP : IDI_NOPOPUP); // Build main menu - hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT(MODULNAME_PLU), -1000000000, hIcon); + hMenuRoot = mi.root = Menu_CreateRoot(MO_MAIN, LPGENT(MODULNAME_PLU), -1000000000, hIcon); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "3F5B5AB5-46D8-469E-8951-50B287C59037"); // Add item to main menu SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f); - mi.root = (HGENMENU)hMenuRoot; mi.pszService = MENUCOMMAND_SVC; CreateServiceFunction(mi.pszService, svcEnableDisableMenuCommand); mi.name.t = PopupOptions.ModuleIsEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"); diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index b1e7de57aa..5bd76ee082 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -80,6 +80,7 @@ void InitMenu() CMenuItem mi; mi.flags = CMIF_TCHAR; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Quotes"), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "B474F556-22B6-42A1-A91E-22FE4F671388"); SET_UID(mi, 0x9de6716, 0x3591, 0x48c4, 0x9f, 0x64, 0x1b, 0xfd, 0xc6, 0xd1, 0x34, 0x97); mi.name.t = LPGENT("Enable/Disable Auto Update"); @@ -124,8 +125,10 @@ void InitMenu() HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu); - SET_UID(mi, 0xb9812194, 0x3235, 0x4e76, 0xa3, 0xa4, 0x73, 0x32, 0x96, 0x1c, 0x1c, 0xf4); mi.root = Menu_CreateRoot(MO_CONTACT, _T(QUOTES_PROTOCOL_NAME), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "C259BE01-642C-461E-997D-0E756B2A3AD6"); + + SET_UID(mi, 0xb9812194, 0x3235, 0x4e76, 0xa3, 0xa4, 0x73, 0x32, 0x96, 0x1c, 0x1c, 0xf4); mi.name.t = LPGENT("Refresh"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH); mi.pszService = "Quotes/RefreshContact"; diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index ed2284efd0..ab18633619 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -795,6 +795,7 @@ static int PluginInit(WPARAM, LPARAM) CMenuItem mi; mi.position = 1000000000; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Sessions Manager"), 1000000000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D77B9AB4-AF7E-43DB-A487-BD581704D635"); SET_UID(mi, 0xd35302fa, 0x8326, 0x4323, 0xa3, 0xe5, 0xb4, 0x41, 0xff, 0xfb, 0xaa, 0x2d); mi.name.a = LPGEN("Save session..."); diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index da6db98855..b3310eabe9 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -102,8 +102,10 @@ static int CreateMainMenuItems(WPARAM, LPARAM) if (!db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename)) continue; - if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1)) + if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1)) { mi.root = Menu_CreateRoot(MO_STATUS, LPGENT("Status profiles"), 2000100000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "1AB30D51-BABA-4B27-9288-1A12278BAD8D"); + } mi.name.t = profilename; mi.position = 2000100000 + mcount; diff --git a/plugins/Watrack/i_gui.inc b/plugins/Watrack/i_gui.inc index c5fb65b270..c00deaae3b 100644 --- a/plugins/Watrack/i_gui.inc +++ b/plugins/Watrack/i_gui.inc @@ -30,13 +30,15 @@ var mi:TMO_MenuItem; begin FillChar(mi, sizeof(mi), 0); + mi.root := Menu_CreateRoot(MO_MAIN, 'Watrack', 0, 0, 0); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, 'CAEA4B95-A873-429F-A083-BB2DF51E2E45'); + SET_UID(@mi, '85F2D289-04D2-4C7F-A223-A629CED253F0'); - mi.root :=Menu_CreateRoot(MO_MAIN, 'Watrack', 0, 0, 0); - mi.hIcon :=IcoLib_GetIcon(IcoBtnEnable,0); - mi.szName.a :='Disable WATrack'; - mi.pszService:=MS_WAT_PLUGINSTATUS; - mi.position :=MenuDisablePos; - hMenuDisable:=Menu_AddMainMenuItem(@mi); + mi.hIcon := IcoLib_GetIcon(IcoBtnEnable,0); + mi.szName.a := 'Disable WATrack'; + mi.pszService:= MS_WAT_PLUGINSTATUS; + mi.position := MenuDisablePos; + hMenuDisable := Menu_AddMainMenuItem(@mi); end; procedure ChangeMenuIcons(f1:cardinal); diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index 568302575f..bcb997a081 100644 --- a/plugins/Watrack/proto/proto.pas +++ b/plugins/Watrack/proto/proto.pas @@ -354,13 +354,15 @@ begin RegisterIcons; FillChar(mi, sizeof(mi), 0); + mi.root := Menu_CreateRoot(MO_CONTACT, 'Watrack', 0, 0, 0); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, 'CAEA4B95-A873-429F-A083-BB2DF51E2E45'); + SET_UID(@mi, '47D372B2-AA27-42B3-A3CB-85D3CE5F6A95'); - mi.root :=Menu_CreateRoot(MO_CONTACT, 'Watrack', 0, 0, 0); - mi.flags :=CMIF_NOTOFFLINE or CMIF_NOTOFFLIST; - mi.hIcon :=IcoLib_GetIcon(IcoBtnContext,0); - mi.szName.a :='Get user''s Music Info'; - mi.pszService :=MS_WAT_GETCONTACTINFO; - hContactMenuItem:=Menu_AddContactMenuItem(@mi); + mi.flags := CMIF_NOTOFFLINE or CMIF_NOTOFFLIST; + mi.hIcon := IcoLib_GetIcon(IcoBtnContext,0); + mi.szName.a := 'Get user''s Music Info'; + mi.pszService := MS_WAT_GETCONTACTINFO; + hContactMenuItem := Menu_AddContactMenuItem(@mi); SetProtocol; RegisterContacts; diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas index 7fee4c5ef9..7ae6f96cb7 100644 --- a/plugins/Watrack/stat/statlog.pas +++ b/plugins/Watrack/stat/statlog.pas @@ -583,13 +583,14 @@ begin FillChar(mi, sizeof(mi), 0); SET_UID(@mi, '40F4D15E-7D15-4E7B-A624-2F794586D960'); - mi.root :=Menu_CreateRoot(MO_MAIN, 'Watrack', MenuReportPos, 0, 0); - mi.hIcon :=IcoLib_GetIcon(IcoBtnReport,0); - mi.szName.a :='Create WATrack report'; - mi.pszService:=MS_WAT_MAKEREPORT; - mi.position :=MenuReportPos; - hMenuReport:=Menu_AddMainMenuItem(@mi); - plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus); + mi.root := Menu_CreateRoot(MO_MAIN, 'Watrack', MenuReportPos, 0, 0); + mi.hIcon := IcoLib_GetIcon(IcoBtnReport,0); + mi.szName.a := 'Create WATrack report'; + mi.pszService := MS_WAT_MAKEREPORT; + mi.position := MenuReportPos; + hMenuReport := Menu_AddMainMenuItem(@mi); + + plStatusHook := HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus); end; procedure DeInitProc(aSetDisable:boolean); diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index b9eee02242..5576693063 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -327,6 +327,7 @@ void AddMenuItems(void) // adding main menu items mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Weather"), 500099000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "82809D2F-2CF0-4E15-9350-D257A7748552"); SET_UID(mi, 0x5ad16188, 0xe0a0, 0x4c31, 0x85, 0xc3, 0xe4, 0x85, 0x79, 0x7e, 0x4b, 0x9c); CreateServiceFunction(MS_WEATHER_ENABLED, EnableDisableCmd); diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 14fb08497d..337c5ff94a 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -175,10 +175,12 @@ extern "C" int __declspec(dllexport) Load() //value is 0 if menu is enabled db_set_b(NULL, MODULENAME, MENU_IS_DISABLED_KEY, 0); + mi.root = Menu_CreateRoot(MO_MAIN, _T(MODULENAME), 20200001); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "403BE07B-7954-4F3E-B318-4301571776B8"); + /*DISABLE WEBVIEW*/ SET_UID(mi, 0xdedeb697, 0xfc10, 0x4622, 0x8b, 0x97, 0x74, 0x39, 0x32, 0x68, 0xa7, 0x7b); CreateServiceFunction("DisableWebview", AutoUpdateMCmd); - mi.root = Menu_CreateRoot(MO_MAIN, _T(MODULENAME), 20200001); mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)); if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)) mi.name.t = LPGENT("Auto update disabled"); diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index af068440cc..52a0b587b7 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -75,6 +75,7 @@ extern "C" int __declspec(dllexport) Load(void) CMenuItem mi; mi.position = 10000000; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Birthdays (When Was It)"), mi.position); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "95D842AE-FCCE-43C9-87E3-C28546B7E00E"); SET_UID(mi, 0x4efbd640, 0xabbd, 0x470e, 0x9a, 0xa, 0x64, 0x76, 0x1a, 0x74, 0xf3, 0x24); mi.pszService = MS_WWI_CHECK_BIRTHDAYS; diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index 8e670d941b..8dd71bb01b 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -169,6 +169,7 @@ void InitMenuItems(void) bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0)); + Menu_ConfigureItem(hMenuRoot, MCI_OPT_UID, "043A641A-2767-4C57-AA57-9233D6F9DC54"); CMenuItem mi; mi.flags = CMIF_TCHAR; diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index a1ab2d23f8..32249210a1 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -75,6 +75,7 @@ int LoadHelpModule(void) CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("&Help"), 2000090000); + Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8824ECA5-6942-46D7-9D07-1BA600E0D02E"); SET_UID(mi, 0xf3ebf1fa, 0x587c, 0x494d, 0xbd, 0x33, 0x7f, 0x88, 0xb3, 0x61, 0x1e, 0xd3); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index b3430d527f..884f6c7816 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -458,6 +458,8 @@ MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// +#pragma comment(lib, "Rpcrt4.lib") + MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value) { if (!bIsGenMenuInited) @@ -480,6 +482,10 @@ MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value) case MCI_OPT_EXECPARAM: pimi->execParam = value; return 0; + + case MCI_OPT_UID: + UuidFromStringA((RPC_CSTR)value, (UUID*)&pimi->mi.uid); + return 0; } return 1; @@ -733,6 +739,10 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs // if parent menu has no uid, copy our id instead if (!equalUUID(pmi->uid, miid_last) && equalUUID(pRoot->mi.uid, miid_last)) { + char szUid[100]; + bin2hex(&pmi->uid, sizeof(pmi->uid), szUid); + Netlib_Logf("[MENU]: fake UUID added to menu item %s", szUid); + pRoot->mi.uid = pmi->uid; pRoot->mi.uid.d[7]--; // and make it slightly different } -- cgit v1.2.3