From be616d81bdaf8fd4ae61b0a145fb81bbdf467994 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jun 2015 22:03:02 +0000 Subject: YEEHAW! CLISTMENUITEM::pszPopupName also died git-svn-id: http://svn.miranda-ng.org/main/trunk@14404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_clist.inc | 30 ++--- include/delphi/m_genmenu.inc | 23 +++- include/m_clist.h | 36 +++--- include/m_genmenu.h | 24 ++-- plugins/Actman/ua/i_uaplaces.inc | 2 +- plugins/Alarms/src/frame.cpp | 2 +- plugins/Alarms/src/options.cpp | 6 +- plugins/BasicHistory/src/BasicHistory.cpp | 3 +- plugins/CSList/src/cslist.cpp | 2 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 2 +- plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp | 29 ++--- plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp | 5 +- plugins/Clist_modern/src/modern_clistmenus.cpp | 10 +- plugins/Clist_modern/src/modern_clisttray.cpp | 2 +- plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp | 43 +++---- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 4 +- plugins/Clist_nicer/src/clistmenus.cpp | 1 - plugins/CrashDumper/src/crshdmp.cpp | 27 ++-- plugins/Db3x_mmap/src/ui.cpp | 2 +- plugins/DbEditorPP/src/main.cpp | 2 +- plugins/Db_autobackups/src/main.cpp | 2 +- plugins/FTPFileYM/src/ftpfile.cpp | 10 +- plugins/HistoryStats/src/main.cpp | 21 +-- plugins/HistoryStats/src/mu_common.cpp | 4 +- plugins/HistoryStats/src/mu_common.h | 2 +- plugins/ListeningTo/src/listeningto.cpp | 6 +- plugins/MenuItemEx/src/main.cpp | 5 +- plugins/MirOTR/src/mirotrmenu.cpp | 2 +- plugins/MyDetails/src/frame.cpp | 4 +- plugins/MyDetails/src/mydetails.cpp | 4 +- plugins/NewAwaySysMod/src/AwaySys.cpp | 5 +- plugins/NewEventNotify/src/menuitem.cpp | 2 +- plugins/NewXstatusNotify/src/main.cpp | 3 +- plugins/NewsAggregator/Src/Menus.cpp | 5 +- plugins/Non-IM Contact/src/main.cpp | 4 +- plugins/NotesAndReminders/src/main.cpp | 6 +- plugins/PasteIt/src/PasteIt.cpp | 6 +- plugins/Ping/src/menu.cpp | 4 +- plugins/Ping/src/pingthread.cpp | 4 +- plugins/Popup/src/main.cpp | 3 +- plugins/ProfileManager/src/pmanagerEx.cpp | 7 +- plugins/Quotes/src/Forex.cpp | 36 +----- plugins/SecureIM/src/main.cpp | 10 +- plugins/SendScreenshotPlus/src/Main.cpp | 6 +- plugins/Sessions/Src/Main.cpp | 48 +++---- plugins/SimpleStatusMsg/src/main.cpp | 4 +- plugins/SmileyAdd/src/main.cpp | 2 - plugins/SmileyAdd/src/services.cpp | 2 +- plugins/StartupSilence/src/main.cpp | 2 +- plugins/StatusPlugins/StartupStatus/profiles.cpp | 4 +- plugins/TabSRMM/src/typingnotify.cpp | 2 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 57 ++++----- plugins/Watrack/i_gui.inc | 2 +- plugins/Watrack/lastfm/lastfm.pas | 4 +- plugins/Watrack/myshows/myshows.pas | 2 +- plugins/Watrack/popup/popups.pas | 2 +- plugins/Watrack/proto/proto.pas | 2 +- plugins/Watrack/stat/statlog.pas | 4 +- plugins/Weather/src/weather_svcs.cpp | 7 +- plugins/WebView/src/main.cpp | 3 +- plugins/WhenWasIt/src/WhenWasIt.cpp | 73 +++++------ plugins/WhoUsesMyFiles/src/wumfplug.cpp | 6 +- plugins/YAMN/src/main.cpp | 1 - plugins/YAPP/src/services.cpp | 1 - plugins/YAPP/src/yapp.cpp | 15 +-- plugins/mRadio/i_tray.inc | 6 +- protocols/AimOscar/src/theme.cpp | 5 +- protocols/FacebookRM/src/theme.cpp | 21 +-- protocols/GTalkExt/src/menu.cpp | 1 - protocols/Gadu-Gadu/src/gg.cpp | 5 +- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/import.cpp | 2 +- protocols/Gadu-Gadu/src/links.cpp | 2 +- protocols/Gadu-Gadu/src/sessions.cpp | 2 +- protocols/IRCG/src/services.cpp | 5 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 10 +- protocols/JabberG/src/jabber_menu.cpp | 24 ++-- protocols/JabberG/src/jabber_privacy.cpp | 6 +- protocols/JabberG/src/jabber_xstatus.cpp | 2 +- protocols/MRA/src/Mra_menus.cpp | 10 +- protocols/MSN/src/msn_menu.cpp | 5 +- protocols/SkypeWeb/src/skype_menus.cpp | 5 +- protocols/Steam/src/steam_menus.cpp | 6 +- protocols/Steam/src/steam_proto.h | 2 +- protocols/Tlen/src/tlen.cpp | 11 +- protocols/Tox/src/tox_menus.cpp | 13 +- protocols/Twitter/src/proto.cpp | 2 +- protocols/VKontakte/src/vk_proto.cpp | 2 - protocols/WhatsApp/src/theme.cpp | 5 +- protocols/Xfire/src/Xfire_game.cpp | 3 +- protocols/Xfire/src/Xfire_gamelist.cpp | 3 +- protocols/Xfire/src/main.cpp | 3 +- protocols/Yahoo/src/services.cpp | 10 +- src/core/stdhelp/src/help.cpp | 3 +- src/mir_app/src/clistmenus.cpp | 73 +++-------- src/mir_app/src/framesmenu.cpp | 4 +- src/mir_app/src/genmenu.cpp | 141 ++++++++------------- src/mir_app/src/genmenu.h | 4 - src/mir_app/src/meta_menu.cpp | 4 +- src/mir_app/src/miranda.h | 2 +- src/mir_app/src/movetogroup.cpp | 3 +- 101 files changed, 419 insertions(+), 647 deletions(-) diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index d8e9147711..7fe96dd4ff 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -52,22 +52,20 @@ type // Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl". PCLISTMENUITEM = ^TCLISTMENUITEM; TCLISTMENUITEM = record - szName : TChar; // [TRANSLATED-BY-CORE] text of the menu item - flags : dword; - position : int; // approx position on the menu, lower numbers go nearer the top - hIcon : THANDLE; // icon to put by the item, if this was *not* loaded from - // a resource, you can delete it straight after the call - //icolibItem:THANDLE; if CMIF_ICONFROMICOLIB used - pszService : PAnsiChar; // name of the service to call when the service is clicked - szPopupName : TChar; // [TRANSLATED-BY-CORE] name of the popup menu that this item is on, if this - // is NULL the iteem is on the root of the menu - // or hParentMenu:HGENMENU - valid if CMIF_ROOTHANDLE is set. NULL or (HGENMENU)-1 means the root menu - pszContactOwner: PAnsiChar; // contact menus only, the protocol module that owns - // the contacts to which this to which this menu item - // applies, NULL(0) if it applies to all contacts. - // if it applies to multiple but not all protocols - // add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU - hLangpack : int; // plugin's hLangpack (added automatically) + szName : TChar; // [TRANSLATED-BY-CORE] text of the menu item + flags : dword; + position : int; // approx position on the menu, lower numbers go nearer the top + hIcon : THANDLE; // icon to put by the item, if this was *not* loaded from + // a resource, you can delete it straight after the call + pszService : PAnsiChar; // name of the service to call when the service is clicked + hParentMenu : THANDLE; // parent menu hamdle + + pszContactOwner: PAnsiChar; // contact menus only, the protocol module that owns + // the contacts to which this to which this menu item + // applies, NULL(0) if it applies to all contacts. + // if it applies to multiple but not all protocols + // add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU + hLangpack : int; // plugin's hLangpack (added automatically) end; const diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index 400abdf6ec..b152cb8106 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -86,6 +86,13 @@ plugin may add different menu items with some service. (pszPopupName=(AnsiChar *)hMenuItem - for make child of popup) } +// predefined menu object codes +const + MO_MAIN = -1; + MO_CONTACT = -2; + MO_PROTO = -3; + MO_STATUS = -4; + // Group MENU type PGroupMenuParam = ^TGroupMenuParam; @@ -194,7 +201,7 @@ type result hMenu } -function Menu_Build(parent:HMENU; menuObject:THANDLE; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; +function Menu_Build(parent:HMENU; menuObject:integer; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall; external AppDLL name 'Menu_Build'; { @@ -215,6 +222,14 @@ function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdca function Menu_ProcessCommandById(iCommand:integer; lParam:LPARAM) : integer; stdcall; external AppDLL name 'Menu_ProcessCommandById'; +{ + 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'; + { returns=MenuObjectHandle on success,-1 on failure } @@ -228,7 +243,7 @@ function Menu_AddObject(const name, displayName, checkService, execService:PAnsi call this service.MO_REMOVEMENUOBJECT NOT free it. } -function Menu_RemoveObject(hMenuObject:THANDLE) : integer; stdcall; +function Menu_RemoveObject(hMenuObject:integer) : integer; stdcall; external AppDLL name 'Menu_RemoveObject'; { @@ -244,7 +259,7 @@ function Menu_RemoveItem(hMenuItem:HGENMENU) : integer; stdcall; return MenuItemHandle on success,-1 on failure } -function Menu_AddItem(hMenuObject:THANDLE; var tmi:TMO_MenuItem) : integer; stdcall; +function Menu_AddItem(hMenuObject:integer; var tmi:TMO_MenuItem) : integer; stdcall; external AppDLL name 'Menu_AddItem'; { @@ -275,7 +290,7 @@ function Menu_GetDefaultItem(hMenuItem:HGENMENU) : HGENMENU; stdcall; this should be called in WM_KEYDOWN } -function Menu_ProcessHotKey(hMenuObject:THANDLE; vKey:DWORD) : integer; stdcall; +function Menu_ProcessHotKey(hMenuObject:integer; vKey:DWORD) : integer; stdcall; external AppDLL name 'Menu_ProcessHotKey'; { diff --git a/include/m_clist.h b/include/m_clist.h index 4bc8d25709..7314f9f303 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -88,28 +88,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CLISTMENUITEM { union { - char* pszName; //[TRANSLATED-BY-CORE] text of the menu item - TCHAR* ptszName; //Unicode text of the menu item + char* pszName; // [TRANSLATED-BY-CORE] text of the menu item + TCHAR* ptszName; // Unicode text of the menu item }; - DWORD flags; //set of CMIF_* flags - int position; //approx position on the menu. lower numbers go nearer the top + DWORD flags; // set of CMIF_* flags + int position; // approx position on the menu. lower numbers go nearer the top union { - HICON hIcon; //icon to put by the item. If this was not loaded from - //a resource, you can delete it straight after the call - HANDLE icolibItem; //set CMIF_ICONFROMICOLIB to pass this value + HICON hIcon; // icon to put by the item. If this was not loaded from + // a resource, you can delete it straight after the call + HANDLE icolibItem; // set CMIF_ICONFROMICOLIB to pass this value }; - char* pszService; //name of service to call when the item gets selected - union { - char* pszPopupName; //[TRANSLATED-BY-CORE] name of the popup menu that this item is on. If this - TCHAR* ptszPopupName; //is NULL the item is on the root of the menu - HGENMENU hParentMenu; // valid if CMIF_ROOTHANDLE is set. NULL or (HGENMENU)-1 means the root menu - }; - - char *pszContactOwner; //contact menus only. The protocol module that owns - //the contacts to which this menu item applies. NULL if it - //applies to all contacts. If it applies to multiple but not all - //protocols, add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU - int hLangpack; //plugin's hLangpack (added automatically) + char* pszService; // name of service to call when the item gets selected + HGENMENU hParentMenu; // HGENMENU_ROOT or NULL means the root menu + + char *pszContactOwner; // contact menus only. The protocol module that owns + // the contacts to which this menu item applies. NULL if it + // applies to all contacts. If it applies to multiple but not all + // protocols, add multiple menu items or use ME_CLIST_PREBUILDCONTACTMENU + int hLangpack; // plugin's hLangpack (added automatically) }; #define CMIF_GRAYED 1 @@ -119,7 +115,6 @@ struct CLISTMENUITEM #define CMIF_NOTONLINE 16 // " online #define CMIF_NOTONLIST 32 //item won't appear on standard contacts #define CMIF_NOTOFFLIST 64 //item won't appear on contacts that have the 'NotOnList' setting -#define CMIF_ROOTHANDLE 384 //means that hParentMenu member is set #define CMIF_UNICODE 512 //will return TCHAR* instead of char* #if defined(_UNICODE) @@ -129,7 +124,6 @@ struct CLISTMENUITEM #endif #define CMIF_KEEPUNTRANSLATED 1024 // don't translate a menu item -//#define CMIF_ICONFROMICOLIB 2048 // use icolibName instead of hIcon, unused #define CMIF_DEFAULT 4096 // this menu item is the default one __forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi) diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 3aa06a6544..a1fd164538 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -13,6 +13,12 @@ #define HGENMENU_ROOT ((HGENMENU)INVALID_HANDLE_VALUE) +// predefined menu objects +#define MO_MAIN (-1) +#define MO_CONTACT (-2) +#define MO_PROTO (-3) +#define MO_STATUS (-4) + #define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 struct TMO_MenuItem @@ -52,7 +58,7 @@ struct ProcessCommandParam // Builds a menu from menu object's description // Returns hMenu on success or NULL on failure -EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, HANDLE hMenuObject, WPARAM wParam = 0, LPARAM lParam = 0); +EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, int hMenuObject, WPARAM wParam = 0, LPARAM lParam = 0); ///////////////////////////////////////////////////////////////////////////////////////// // Passes custom lParam to the ExecMenuService for the specified menu item @@ -72,13 +78,13 @@ EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam); // Adds a menu item to genmenu // Returns HGENMENU on success, or NULL on failure -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pItem); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pItem); ///////////////////////////////////////////////////////////////////////////////////////// // Adds new submenu // Returns HGENMENU on success, or NULL on failure -EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(HGENMENU hRoot, LPCTSTR ptszName, int position, HANDLE hIcoLib = NULL, int hLang = hLangpack); +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib = NULL, int hLang = hLangpack); ///////////////////////////////////////////////////////////////////////////////////////// // process a WM_DRAWITEM message for user context menus v0.1.1.0+ @@ -131,7 +137,7 @@ EXTERN_C MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszN // returns TRUE if a key was, FALSE otherwise // this should be called in WM_KEYDOWN -EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(HANDLE hMenuObject, int key); +EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key); ///////////////////////////////////////////////////////////////////////////////////////// // Removes a menu item from genmenu @@ -163,7 +169,7 @@ EXTERN_C MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet); // // returns = MenuObjectHandle on success, NULL on failure -EXTERN_C MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService); +EXTERN_C MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService); ///////////////////////////////////////////////////////////////////////////////////////// // Removes the whole menu object with all submenus @@ -171,7 +177,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, // Note: you must free all ownerdata structures, before you // call this function. Menu_RemoveObject DOES NOT free it. -EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject); +EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(int hMenuObject); ///////////////////////////////////////////////////////////////////////////////////////// // tunes the whold menu object @@ -191,10 +197,10 @@ EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject); // Set menu check service #define MCO_OPT_CHECK_SERVICE 4 -EXTERN_C MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE hMenu, int iSetting, INT_PTR value); +EXTERN_C MIR_APP_DLL(int) Menu_ConfigureObject(int hMenuObject, int iSetting, INT_PTR value); -__forceinline int Menu_ConfigureObject(HANDLE hMenu, int iSetting, LPCSTR pszValue) -{ return Menu_ConfigureObject(hMenu, iSetting, INT_PTR(pszValue)); +__forceinline int Menu_ConfigureObject(int hMenuObject, int iSetting, LPCSTR pszValue) +{ return Menu_ConfigureObject(hMenuObject, iSetting, INT_PTR(pszValue)); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Actman/ua/i_uaplaces.inc b/plugins/Actman/ua/i_uaplaces.inc index 9b7dac8cf1..bd724bf406 100644 --- a/plugins/Actman/ua/i_uaplaces.inc +++ b/plugins/Actman/ua/i_uaplaces.inc @@ -455,7 +455,7 @@ begin if UAMenuItem.hMenuRoot<>0 then begin clmi.flags:=clmi.flags or CMIF_ROOTHANDLE; - clmi.szPopupName.w:=pWideChar(UAMenuItem.hMenuRoot); + clmi.hParentMenu:=UAMenuItem.hMenuRoot; end; clmi.pszService:=ActionItem.szNameID; diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 0f62257afa..5586cf4c0e 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -545,7 +545,7 @@ int CreateFrame() mi.hIcon = hIconMenuShowHide; mi.pszName = LPGEN("Show reminders"); mi.pszService = MODULE "/ShowHideReminders"; - mi.pszPopupName = LPGEN("Alarms"); + mi.hParentMenu = 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 1f7ac9418c..15df78706c 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -698,11 +698,7 @@ void AddMenuItem() mi.pszService = MODULE "/NewAlarm"; mi.position = 500010000; if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) - mi.pszPopupName = "Alarms"; - - GroupMenuParam gmp = {0}; - Menu_AddGroupMenuItem(&gmp, &mi); - + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Alarms"), mi.position); hMainMenuItem = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 9c35ce146f..f95b352062 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -122,7 +122,6 @@ void InitTaskMenuItems() if (hTaskMainMenu == NULL) { CLISTMENUITEM mi = { 0 }; mi.position = 500060005; - mi.flags = CMIF_ROOTHANDLE; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_HISTORY); mi.pszName = LPGEN("Execute history task"); hTaskMainMenu = Menu_AddMainMenuItem(&mi); @@ -139,7 +138,7 @@ void InitTaskMenuItems() int pos = (int)taskMenus.size(); for (; taskIt != Options::instance->taskOptions.end(); ++taskIt) { CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.pszService = MS_HISTORY_EXECUTE_TASK; mi.hParentMenu = hTaskMainMenu; mi.ptszName = (TCHAR*)taskIt->taskName.c_str(); diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 2c0fe38f0a..a51e18c032 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -239,7 +239,7 @@ void addProtoStatusMenuItem(char *protoName) CreateServiceFunctionParam(buf, showList, (LPARAM)protoName); CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = forms[0].hIcoLibItem; mi.ptszName = _T(MODULENAME); mi.position = 2000040000; diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index f9483e7bd1..d04add9b62 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -328,6 +328,7 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu); CLISTMENUITEM mi = { 0 }; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); mi.flags = CMIF_TCHAR; if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) mi.ptszName = LPGENT("Disable c&lient change notification"); @@ -335,7 +336,6 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) mi.ptszName = LPGENT("Enable c&lient change notification"); mi.pszService = MS_CCN_TOGGLEPOPUPS; - mi.ptszPopupName = LPGENT("Popups"); g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index 6128f93967..4174008b90 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -68,7 +68,7 @@ static int _iNextFrameId = 100; static HFONT _hTitleBarFont = NULL; // menus -static FrameMenuHandles cont = { HGENMENU_ROOT }; +static FrameMenuHandles cont = { NULL }; // others static int _nContactListHeight = 0; @@ -760,7 +760,7 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.hParentMenu = root; mi.position = popuppos++; mi.pszName = LPGEN("&Visible"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_SHFRAME; Menu_ConfigureItem(fmh.MIVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -784,13 +784,13 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp // floating mi.position = popuppos++; mi.pszName = LPGEN("&Floating mode"); - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.pszService = "Set_Floating"; Menu_ConfigureItem(fmh.MIFloating = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); mi.position = popuppos++; mi.pszName = LPGEN("&Border"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_SETUNBORDER; Menu_ConfigureItem(fmh.MIBorder = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -799,12 +799,10 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp // alignment root mi.position = popuppos++; mi.pszName = LPGEN("&Align"); - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.pszService = ""; fmh.MIAlignRoot = pfnAdd(&mi); - mi.flags = CMIF_ROOTHANDLE; - // align top mi.hParentMenu = fmh.MIAlignRoot; mi.position = popuppos++; @@ -831,7 +829,6 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.hParentMenu = root; mi.position = popuppos++; mi.pszName = LPGEN("&Position"); - mi.flags = CMIF_ROOTHANDLE; mi.pszService = ""; mi.pszContactOwner = (char*)0; fmh.MIPosRoot = pfnAdd(&mi); @@ -839,7 +836,6 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp mi.hParentMenu = fmh.MIPosRoot; mi.position = popuppos++; mi.pszName = LPGEN("&Up"); - mi.flags = CMIF_ROOTHANDLE; mi.pszService = CLUIFRAMESMOVEUP; mi.pszContactOwner = (char*)1; Menu_ConfigureItem(fmh.MIPosUp = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -1512,14 +1508,13 @@ static int CLUIFramesLoadMainMenu() if (_fCluiFramesModuleNotStarted) return -1; - if (cont.MainMenuItem != HGENMENU_ROOT) { + if (cont.MainMenuItem != NULL) { Menu_RemoveItem(cont.MainMenuItem); - cont.MainMenuItem = HGENMENU_ROOT; + cont.MainMenuItem = NULL; } // create root menu CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); mi.position = 3000090000; mi.pszName = LPGEN("Frames"); @@ -1529,7 +1524,7 @@ static int CLUIFramesLoadMainMenu() int separator = 3000200000; for (int i = 0; i < g_nFramesCount; i++) { mi.hIcon = g_pfwFrames[i].TitleBar.hicon; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.position = separator; mi.hParentMenu = cont.MainMenuItem; mi.ptszName = g_pfwFrames[i].TitleBar.tbname ? g_pfwFrames[i].TitleBar.tbname : g_pfwFrames[i].name; @@ -1545,7 +1540,7 @@ static int CLUIFramesLoadMainMenu() // create "show all frames" menu mi.hIcon = NULL; - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.position = separator++; mi.hParentMenu = cont.MainMenuItem; mi.pszName = LPGEN("Show all frames"); @@ -3387,7 +3382,7 @@ int CLUIFrameOnModulesLoad(WPARAM, LPARAM) { /* HOOK */ CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, HGENMENU_ROOT, 000010000, Menu_AddContextFrameMenuItem); + CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, Menu_AddContextFrameMenuItem); return 0; } @@ -3478,9 +3473,9 @@ int LoadCLUIFramesModule(void) static INT_PTR UnloadMainMenu() { CLUIFrameOnModulesUnload(0, 0); - if (cont.MainMenuItem != HGENMENU_ROOT) { + if (cont.MainMenuItem != NULL) { Menu_RemoveItem(cont.MainMenuItem); - cont.MainMenuItem = HGENMENU_ROOT; + cont.MainMenuItem = NULL; } return (INT_PTR)cont.MainMenuItem; diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp index b901fa7678..7bb10f52f3 100644 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../hdr/modern_clc.h" //////////////////////////////Group MENU///////////////////////// -HANDLE hGroupMenuObject; +int hGroupMenuObject; HGENMENU hGroupMainMenuItemProxy; HGENMENU hHideShowMainMenuItem; @@ -305,7 +305,8 @@ void InitGroupMenus(void) //////////////////////////////END Group MENU///////////////////////// //////////////////////////////SubGroup MENU///////////////////////// -HANDLE hSubGroupMenuObject; + +int hSubGroupMenuObject; HANDLE hSubGroupMainMenuItemProxy; HANDLE hSubGroupStatusMenuItemProxy; diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index fb18a985cd..aa68906097 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -101,9 +101,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) CLISTMENUITEM mi = { 0 }; mi.icolibItem = iconList[bContactRate].hIcolib; - mi.hParentMenu = HGENMENU_ROOT; - mi.position = 0; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; if (!bContactRate) mi.ptszName = FAVMENUROOTNAME; else { @@ -121,7 +119,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) bModifyMenu = TRUE; } - Menu_ConfigureObject(hFavoriteContactMenu, MCI_OPT_UNIQUENAME, "ModernClistMenu_ContactRate"); + Menu_ConfigureItem(hFavoriteContactMenu, MCI_OPT_UNIQUENAME, "ModernClistMenu_ContactRate"); mi.hParentMenu = hFavoriteContactMenu; if (!hFavoriteContactMenuItems) { @@ -131,7 +129,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) int i; for (i = 0; i < _countof(rates); i++) { - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | ((bContactRate == i) ? CMIF_CHECKED : 0); + mi.flags = CMIF_TCHAR | ((bContactRate == i) ? CMIF_CHECKED : 0); if (bModifyMenu && hFavoriteContactMenuItems[i]) Menu_ModifyItem(hFavoriteContactMenuItems[i], NULL, iconList[i].hIcolib, mi.flags); else { @@ -144,7 +142,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) } mi.hIcon = NULL; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | (db_get_b(hContact, "CList", "noOffline", 0) ? CMIF_CHECKED : 0); + mi.flags = CMIF_TCHAR | (db_get_b(hContact, "CList", "noOffline", 0) ? CMIF_CHECKED : 0); if (bModifyMenu && hShowIfOflineItem) Menu_ModifyItem(hShowIfOflineItem, NULL, INVALID_HANDLE_VALUE, mi.flags); else { diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 93ad8f1b2a..ac20d89b61 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int g_mutex_bOnTrayRightClick = 0; BOOL g_bMultiConnectionMode = FALSE; static HMENU hMainMenu, hStatusMenu; -static HANDLE hTrayMenuObject; +static int hTrayMenuObject; BOOL IS_WM_MOUSE_DOWN_IN_TRAY; BOOL g_trayTooltipActive = FALSE; POINT tray_hover_pos = { 0 }; diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index c1dbc69c9c..951979c69f 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -89,7 +89,7 @@ static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT; static boolean resizing = FALSE; // menus -static FrameMenuHandles cont = { HGENMENU_ROOT }; +static FrameMenuHandles cont; // others static int ContactListHeight; @@ -577,7 +577,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.hParentMenu = root; mi.position = popuppos++; mi.pszName = LPGEN("&FrameTitle"); - mi.flags = CMIF_ROOTHANDLE | CMIF_GRAYED; + mi.flags = CMIF_GRAYED; fmh.MITitle = pfnAdd(&mi); popuppos += 100000; @@ -585,13 +585,13 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.hIcon = NULL; mi.position = popuppos++; mi.pszName = LPGEN("&Visible"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_SHFRAME; Menu_ConfigureItem(fmh.MIVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); mi.position = popuppos++; mi.pszName = LPGEN("&Show title bar"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_SHFRAMETITLEBAR; Menu_ConfigureItem(fmh.MITBVisible = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -599,20 +599,20 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.position = popuppos++; mi.pszName = LPGEN("&Locked"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_ULFRAME; Menu_ConfigureItem(fmh.MILock = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); mi.position = popuppos++; mi.pszName = LPGEN("&Collapsed"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_UCOLLFRAME; Menu_ConfigureItem(fmh.MIColl = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); // floating mi.position = popuppos++; mi.pszName = LPGEN("&Floating mode"); - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.pszService = "Set_Floating"; fmh.MIFloating = pfnAdd(&mi); @@ -620,7 +620,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.position = popuppos++; mi.pszName = LPGEN("&Border"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_SETUNBORDER; Menu_ConfigureItem(fmh.MIBorder = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -628,7 +628,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.position = popuppos++; mi.pszName = LPGEN("&Skinned frame"); - mi.flags = CMIF_ROOTHANDLE | CMIF_CHECKED; + mi.flags = CMIF_CHECKED; mi.pszService = MS_CLIST_FRAMES_SETSKINNED; Menu_ConfigureItem(fmh.MISkinned = pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -638,11 +638,10 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.hParentMenu = root; mi.position = popuppos++; mi.pszName = LPGEN("&Align"); - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.pszService = ""; fmh.MIAlignRoot = pfnAdd(&mi); - mi.flags = CMIF_ROOTHANDLE; // align top mi.hParentMenu = fmh.MIAlignRoot; mi.position = popuppos++; @@ -669,7 +668,6 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.hParentMenu = root; mi.position = popuppos++; mi.pszName = LPGEN("&Position"); - mi.flags = CMIF_ROOTHANDLE; mi.pszService = ""; mi.pszContactOwner = (char*)0; HGENMENU menuid = pfnAdd(&mi); @@ -677,14 +675,12 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE mi.hParentMenu = menuid; mi.position = popuppos++; mi.pszName = LPGEN("&Up"); - mi.flags = CMIF_ROOTHANDLE; mi.pszService = CLUIFRAMESMOVEUP; mi.pszContactOwner = (char*)1; Menu_ConfigureItem(pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); mi.position = popuppos++; mi.pszName = LPGEN("&Down"); - mi.flags = CMIF_ROOTHANDLE; mi.pszService = CLUIFRAMESMOVEDOWN; mi.pszContactOwner = (char*)-1; Menu_ConfigureItem(pfnAdd(&mi), MCI_OPT_EXECPARAM, frameid); @@ -1333,17 +1329,15 @@ static int CLUIFramesLoadMainMenu() if (FramesSysNotStarted) return -1; - if (cont.MainMenuItem != HGENMENU_ROOT) { + if (cont.MainMenuItem != NULL) { Menu_RemoveItem(cont.MainMenuItem); - cont.MainMenuItem = HGENMENU_ROOT; + cont.MainMenuItem = NULL; } // create root menu CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_FRAME); - mi.flags = CMIF_ROOTHANDLE; mi.position = 3000090000; - mi.hParentMenu = HGENMENU_ROOT; mi.pszName = LPGEN("Frames"); mi.pszService = 0; cont.MainMenuItem = Menu_AddMainMenuItem(&mi); @@ -1352,7 +1346,7 @@ static int CLUIFramesLoadMainMenu() int separator = (int)3000200000; for (int i = 0; i < nFramescount; i++) { mi.hIcon = Frames[i].TitleBar.hicon; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.position = separator; mi.hParentMenu = cont.MainMenuItem; mi.ptszName = Frames[i].TitleBar.tbname ? Frames[i].TitleBar.tbname : Frames[i].name; @@ -1367,8 +1361,8 @@ static int CLUIFramesLoadMainMenu() separator += 100000; // create "show all frames" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_MIRANDA)); - mi.flags = CMIF_ROOTHANDLE; + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); + mi.flags = 0; mi.position = separator++; mi.hParentMenu = cont.MainMenuItem; mi.pszName = LPGEN("Show all frames"); @@ -1376,17 +1370,14 @@ static int CLUIFramesLoadMainMenu() Menu_AddMainMenuItem(&mi); // create "show all titlebars" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); + mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_HELP); mi.position = separator++; - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Show all title bars"); mi.pszService = MS_CLIST_FRAMES_SHOWALLFRAMESTB; Menu_AddMainMenuItem(&mi); // create "hide all titlebars" menu - mi.hIcon = NULL;//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_HELP)); mi.position = separator++; - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Hide all title bars"); mi.pszService = MS_CLIST_FRAMES_HIDEALLFRAMESTB; Menu_AddMainMenuItem(&mi); @@ -2949,7 +2940,7 @@ static int CLUIFrameOnModulesLoad(WPARAM, LPARAM) hThreadMFUpdate = mir_forkthread(MF_UpdateThread, NULL); SetThreadPriority(hThreadMFUpdate, THREAD_PRIORITY_IDLE); CLUIFramesLoadMainMenu(); - CLUIFramesCreateMenuForFrame(-1, HGENMENU_ROOT, 000010000, Menu_AddContextFrameMenuItem); + CLUIFramesCreateMenuForFrame(-1, NULL, 000010000, Menu_AddContextFrameMenuItem); return 0; } diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 86bff0d6a2..077d832549 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include //////////////////////////////Group MENU///////////////////////// -HANDLE hGroupMenuObject; +int hGroupMenuObject; HANDLE hPreBuildGroupMenuEvent; HGENMENU hGroupMainMenuItemProxy; @@ -314,7 +314,7 @@ void InitGroupMenus(void) //////////////////////////////END Group MENU///////////////////////// //////////////////////////////SubGroup MENU///////////////////////// -HANDLE hSubGroupMenuObject; +int hSubGroupMenuObject; HANDLE hSubGroupMainMenuItemProxy; HANDLE hSubGroupStatusMenuItemProxy; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index d0b08d00d2..fd7b062dd3 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -383,7 +383,6 @@ int InitCustomMenus(void) CLISTMENUITEM mi = { 0 }; mi.position = 200000; - mi.hParentMenu = HGENMENU_ROOT; mi.pszService = "CList/SetContactIgnore"; mi.icolibItem = iconItem[1].hIcolib; mi.pszName = LPGEN("&Contact list settings..."); diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index cbbc44a885..57a0ef06ee 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -256,63 +256,54 @@ static int ModulesLoaded(WPARAM, LPARAM) } CLISTMENUITEM mi = { 0 }; - // mi.popupPosition = 2000089999; !!!!!!!!!!!!!!!!!!!!!!! - mi.position = 2000089999; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; - mi.icolibItem = GetIconHandle(IDI_VI); - mi.ptszName = LPGENT("Version Information"); - mi.hParentMenu = HGENMENU_ROOT; - HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi); - - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; - mi.hParentMenu = hMenuRoot; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Version Information"), 2000089999, GetIconHandle(IDI_VI)); mi.position = 2000089995; - mi.ptszName = LPGENT("Copy to clipboard"); + mi.pszName = LPGEN("Copy to clipboard"); mi.icolibItem = GetIconHandle(IDI_VITOCLIP); mi.pszService = MS_CRASHDUMPER_STORETOCLIP; Menu_AddMainMenuItem(&mi); mi.position = 2000089996; - mi.ptszName = LPGENT("Store to file"); + mi.pszName = LPGEN("Store to file"); mi.icolibItem = GetIconHandle(IDI_VITOFILE); mi.pszService = MS_CRASHDUMPER_STORETOFILE; Menu_AddMainMenuItem(&mi); mi.position = 2000089997; - mi.ptszName = LPGENT("Show"); + mi.pszName = LPGEN("Show"); mi.icolibItem = GetIconHandle(IDI_VISHOW); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_AddMainMenuItem(&mi); mi.position = 2000089998; - mi.ptszName = LPGENT("Show with DLLs"); + mi.pszName = LPGEN("Show with DLLs"); mi.icolibItem = GetIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); mi.position = 2000089999; - mi.ptszName = LPGENT("Upload"); + mi.pszName = LPGEN("Upload"); mi.icolibItem = GetIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_UPLOAD; Menu_AddMainMenuItem(&mi); mi.position = 2000089999; - mi.ptszName = LPGENT("Copy link to clipboard"); + mi.pszName = LPGEN("Copy link to clipboard"); mi.icolibItem = GetIconHandle(IDI_LINKTOCLIP);//need icon mi.pszService = MS_CRASHDUMPER_URLTOCLIP; Menu_AddMainMenuItem(&mi); if (catchcrashes && !needrestart) { mi.position = 2000099990; - mi.ptszName = LPGENT("Open crash report directory"); + mi.pszName = LPGEN("Open crash report directory"); mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); mi.pszService = MS_CRASHDUMPER_URL; Menu_AddMainMenuItem(&mi); } mi.position = 2000099991; - mi.ptszName = LPGENT("Open online Version Info"); + mi.pszName = LPGEN("Open online Version Info"); mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); mi.pszService = MS_CRASHDUMPER_URL; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index c995a5c3f3..0fbbe2e031 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -314,7 +314,7 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM) CLISTMENUITEM mi = { 0 }; mi.ptszName = LPGENT("Database"); mi.position = 500000000; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = iconList[0].hIcolib; HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi); diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index d34cc61906..840a49442c 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -114,9 +114,9 @@ int ModulesLoaded(WPARAM, LPARAM) // Register menu item CLISTMENUITEM mi = { 0 }; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 1900000001); mi.position = 1900000001; mi.icolibItem = GetIcoLibHandle(ICO_DBE_BUTT); - mi.pszPopupName = "Database"; mi.pszName = modFullname; mi.pszService = "DBEditorpp/MenuCommand"; Menu_AddMainMenuItem(&mi); diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 7e1d9d76d4..99b4abe08b 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -100,7 +100,7 @@ int ModulesLoad(WPARAM, LPARAM) CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs); CLISTMENUITEM mi = { 0 }; - mi.pszPopupName = LPGEN("Database"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000); mi.pszName = LPGEN("Backup profile"); mi.pszService = MS_AB_BACKUP; diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index f0f4efad27..bf5950cdae 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -92,7 +92,7 @@ void InitMenuItems() TCHAR stzName[256]; CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = iconList[ServerList::FTP_COUNT].hIcolib; mi.position = 3000090001; mi.ptszName = LPGENT("FTP File"); @@ -105,7 +105,7 @@ void InitMenuItems() mi.ptszName = stzName; CLISTMENUITEM mi2 = { 0 }; - mi2.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi2.flags = CMIF_TCHAR; mi2.pszService = MS_FTPFILE_CONTACTMENU; for (int i = 0; i < ServerList::FTP_COUNT; i++) @@ -116,16 +116,12 @@ void InitMenuItems() mi.flags = CMIF_TCHAR; mi.hParentMenu = 0; if (opt.bUseSubmenu) - { - mi.flags |= CMIF_ROOTHANDLE; mi.hParentMenu = hMenu; - } mi.icolibItem = iconList[i].hIcolib; hSubMenu[i] = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(hSubMenu[i], MCI_OPT_EXECPARAM, i + 1000); - mi.flags |= CMIF_ROOTHANDLE; mi.hParentMenu = hMainMenu; hMainSubMenu[i] = Menu_AddMainMenuItem(&mi); @@ -161,7 +157,7 @@ void InitMenuItems() } memset(&mi, 0, sizeof(mi)); - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = iconList[ServerList::FTP_COUNT].hIcolib; mi.position = 3000090001; mi.ptszName = LPGENT("FTP File manager"); diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index 28536605e8..b468dd96bf 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -155,29 +155,18 @@ void AddMainMenu() CreateServiceFunction(con::SvcShowStatistics, MenuShowStatistics); CreateServiceFunction(con::SvcConfigure, MenuConfigure); + HGENMENU hRoot = bInPopup ? Menu_CreateRoot(MO_MAIN, LPGENT("Statistics"), 1910000000) : NULL; + g_hMenuCreateStatistics = mu::clist::addMainMenuItem( - LPGENT("Create statistics"), // MEMO: implicit translation - 0, - 1910000000, - IconLib::getIcon(IconLib::iiMenuCreateStatistics), - con::SvcCreateStatistics, - bInPopup ? LPGENT("Statistics") : NULL); + LPGENT("Create statistics"), 0, 1910000000, IconLib::getIcon(IconLib::iiMenuCreateStatistics), con::SvcCreateStatistics, hRoot); g_hMenuShowStatistics = mu::clist::addMainMenuItem( LPGENT("Show statistics"), // MEMO: implicit translation - 0, - 1910000001, - IconLib::getIcon(IconLib::iiMenuShowStatistics), - con::SvcShowStatistics, - bInPopup ? LPGENT("Statistics") : NULL); + 0, 1910000001, IconLib::getIcon(IconLib::iiMenuShowStatistics), con::SvcShowStatistics, hRoot); g_hMenuConfigure = mu::clist::addMainMenuItem( bInPopup ? LPGENT("Configure...") : LPGENT("Configure statistics..."), // MEMO: implicit translation - 0, - 1910000002, - IconLib::getIcon(IconLib::iiMenuConfigure), - con::SvcConfigure, - bInPopup ? LPGENT("Statistics") : NULL); + 0, 1910000002, IconLib::getIcon(IconLib::iiMenuConfigure), con::SvcConfigure, hRoot); } /* diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index 0446013c4d..7c344b2738 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -12,7 +12,7 @@ namespace mu namespace clist { - HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName /* = NULL */) + HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, HGENMENU hRoot) { // TODO: support for unicode-core with unicode-aware CList CLISTMENUITEM mi = { 0 }; @@ -21,7 +21,7 @@ namespace mu mi.position = position; mi.hIcon = hIcon; mi.pszService = const_cast(pszService); - mi.ptszPopupName = (TCHAR*)pszPopupName; + mi.hParentMenu = hRoot; return Menu_AddMainMenuItem(&mi); } diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index e05b36c078..9e1bf12eae 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -13,7 +13,7 @@ namespace mu namespace clist { - HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL); + HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, HGENMENU hRoot = 0); HGENMENU addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const char* pszContactOwner = NULL); const TCHAR* getContactDisplayName(MCONTACT hContact); const TCHAR* getStatusModeDescription(int nStatusMode); diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 116786208f..c37f1de785 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -198,7 +198,7 @@ void RebuildMenu() mi.position = 500080000 + i; mi.pszService = MS_LISTENINGTO_MAINMENU; mi.ptszName = text; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR + mi.flags = CMIF_TCHAR | (ListeningToEnabled(info->proto, TRUE) ? CMIF_CHECKED : 0) | (opts.enable_sending ? 0 : CMIF_GRAYED); @@ -296,7 +296,7 @@ int ModulesLoaded(WPARAM, LPARAM) CLISTMENUITEM mi = { 0 }; mi.position = 500080000; mi.ptszName = LPGENT("Listening to"); - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = iconList[0].hIcolib; hMainMenuGroup = Menu_AddMainMenuItem(&mi); @@ -308,7 +308,7 @@ int ModulesLoaded(WPARAM, LPARAM) // Add all protos mi.ptszName = LPGENT("Send to all protocols"); - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR + mi.flags = CMIF_TCHAR | (ListeningToEnabled(NULL, true) ? CMIF_CHECKED : 0) | (opts.enable_sending ? 0 : CMIF_GRAYED); proto_items.resize(1); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 8937e6f198..55a3e2782c 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -740,7 +740,7 @@ static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD fl mi.position = pos; mi.ptszName = name; mi.hIcon = icon; - mi.flags = CMIF_UNICODE | CMIF_ROOTHANDLE | flag; + mi.flags = CMIF_UNICODE | flag; mi.pszService = service; HGENMENU res = Menu_AddContactMenuItem(&mi); @@ -979,10 +979,8 @@ static int PluginInit(WPARAM, LPARAM) hmenuHide = Menu_AddContactMenuItem(&mi); mi.position++; - mi.hParentMenu = HGENMENU_ROOT; mi.ptszName = LPGENT("Ignore"); mi.pszService = 0; - mi.flags |= CMIF_ROOTHANDLE; mi.hIcon = IcoLib_GetIcon("miex_ignore"); hmenuIgnore = Menu_AddContactMenuItem(&mi); @@ -997,7 +995,6 @@ static int PluginInit(WPARAM, LPARAM) ood.pszPage = "Ignore"; AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), IcoLib_GetIcon("miex_ignore"), 0, "Opt/OpenOptions", pos, (int)&ood); - mi.pszPopupName = 0; mi.position++; mi.ptszName = LPGENT("Copy to Account"); mi.pszService = MS_PROTO; diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 377afc4547..b4459382f4 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -static HANDLE hMirOTRMenuObject; +static int hMirOTRMenuObject; static HGENMENU hStatusInfoItem, hHTMLConvMenuItem; HWND hDummyPaintWin; diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index f4f98dd258..3345092557 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -329,8 +329,8 @@ int CreateFrame() CLISTMENUITEM mi = { 0 }; mi.flags = CMIF_TCHAR; - mi.ptszPopupName = LPGENT("My details"); - mi.position = 1; // 500010000 + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("My details"), 500010000); + mi.position = 1; mi.hIcon = Skin_LoadIcon(SKINICON_OTHER_USERDETAILS); mi.ptszName = LPGENT("Show my details"); mi.pszService = MODULE_NAME"/ShowHideMyDetails"; diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 9fb9ce467c..974b57a644 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -89,12 +89,12 @@ static int MainInit(WPARAM, LPARAM) // Add options to menu CLISTMENUITEM mi = { 0 }; mi.position = 500050000; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS); mi.ptszName = LPGENT("My details"); HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi); - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.hParentMenu = hMenuRoot; mi.icolibItem = NULL; diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 5a404dce92..72c63abb58 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -636,14 +636,13 @@ int MirandaLoaded(WPARAM, LPARAM) g_hContactMenuItem = Menu_AddContactMenuItem(&mi); memset(&mi, 0, sizeof(mi)); - mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; + mi.flags = CMIF_TCHAR; mi.hIcon = NULL; - mi.hParentMenu = HGENMENU_ROOT; mi.position = 1000020000; mi.ptszName = LPGENT("Autoreply"); g_hToggleSOEContactMenuItem = Menu_AddContactMenuItem(&mi); - mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; + mi.flags = CMIF_TCHAR; mi.hParentMenu = g_hToggleSOEContactMenuItem; mi.position = 1000020000; diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 0aa91b51f7..34e2fa4b4b 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -51,9 +51,9 @@ int MenuitemInit(BOOL bStatus) CreateServiceFunction(MS_NEN_MENUNOTIFY, MenuitemNotifyCmd); CLISTMENUITEM mi = { 0 }; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); mi.position = 1; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); - mi.pszPopupName = LPGEN("Popups"); mi.pszService = MS_NEN_MENUNOTIFY; mi.flags = 0; hMenuitemNotify = Menu_AddMainMenuItem(&mi); diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index fafec319e8..6553001288 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1075,7 +1075,8 @@ void InitMainMenuItem() { CLISTMENUITEM mi = { 0 }; mi.flags = CMIF_TCHAR; - mi.ptszPopupName = ServiceExists(MS_POPUP_ADDPOPUPT) ? _T("Popups") : NULL; + if (ServiceExists(MS_POPUP_ADDPOPUPT)) + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); mi.pszService = MS_STATUSCHANGE_MENUCOMMAND; hEnableDisableMenu = Menu_AddMainMenuItem(&mi); diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index b92ec6f3e5..1748792c4e 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -26,10 +26,7 @@ void InitMenu() CLISTMENUITEM mi = { 0 }; mi.pszContactOwner = MODULE; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; - - // adding main menu items - mi.ptszPopupName = LPGENT("News Aggregator"); - // mi.popupPosition = 500099000; !!!!!!!!!!!!!!!!!!!!!!! + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("News Aggregator"), 500099000); mi.position = 10100001; if (db_get_b(NULL, MODULE, "AutoUpdate", 1)) diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 35793bfe8d..4cdc4b3504 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -143,8 +143,7 @@ extern "C" __declspec(dllexport) int Load() CLISTMENUITEM mi = { 0 }; mi.position = 600090000; - mi.pszPopupName = LPGEN("&Non-IM Contact"); - // mi.popupPosition = 600090000; !!!!!!!!!!!!!!!!!!!! + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("&Non-IM Contact"), 600090000); mi.pszName = LPGEN("&Add Non-IM Contact"); mi.pszService = "AddLCcontact"; mi.icolibItem = icoList[0].hIcolib; @@ -168,7 +167,6 @@ extern "C" __declspec(dllexport) int Load() } mi.position = 600090000; - mi.pszPopupName = LPGEN("&Non-IM Contact"); mi.pszName = LPGEN("&String Maker"); mi.pszService = "TestStringReplaceLine"; Menu_AddMainMenuItem(&mi); diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 8906f1d651..b3654f4e39 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -181,10 +181,10 @@ int OnModulesLoaded(WPARAM wparam, LPARAM lparam) RegisterKeyBindings(); g_AddContListMI = (BOOL)db_get_dw(0,MODULENAME,"AddContactMenuItems",1); + // register menus CLISTMENUITEM mi = { 0 }; - mi.pszContactOwner = NULL; - mi.ptszPopupName = LPGENT("Notes && Reminders"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Notes && Reminders"), 1600000000); mi.flags = CMIF_TCHAR; mi.position = 1600000000; @@ -244,13 +244,11 @@ int OnModulesLoaded(WPARAM wparam, LPARAM lparam) Menu_AddMainMenuItem(&mi); // register misc - hkOptInit = HookEvent(ME_OPT_INITIALISE, OnOptInitialise); hkTopToolbarInit = HookEvent("TopToolBar/ModuleLoaded", OnTopToolBarInit); UnhookEvent(hkModulesLoaded); // init vars and load all data - InitSettings(); CreateMsgWindow(); LoadNotes(TRUE); diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 21e4945c32..bd251a3ec4 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -292,7 +292,7 @@ INT_PTR ContactMenuService(WPARAM hContact, LPARAM lParam) void InitMenuItems() { CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = icon.hIcolib; mi.position = 3000090005; mi.ptszName = LPGENT("Paste It"); @@ -300,7 +300,7 @@ void InitMenuItems() hContactMenu = Menu_AddContactMenuItem(&mi); memset(&mi, 0, sizeof(mi)); - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.pszService = MS_PASTEIT_CONTACTMENU; mi.hParentMenu = hContactMenu; mi.ptszName = LPGENT("Paste from clipboard"); @@ -318,7 +318,7 @@ void InitMenuItems() mi2.hParentMenu = hDefWebMenu; for (int i = 0; i < PasteToWeb::pages; ++i) { - mi2.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi2.flags = CMIF_TCHAR; if (Options::instance->defWeb == i) mi2.flags |= CMIF_CHECKED; mi2.ptszName = pasteToWebs[i]->GetName(); diff --git a/plugins/Ping/src/menu.cpp b/plugins/Ping/src/menu.cpp index 564d2ee8bf..263edf9656 100644 --- a/plugins/Ping/src/menu.cpp +++ b/plugins/Ping/src/menu.cpp @@ -8,8 +8,8 @@ void InitMenus() // main menu CLISTMENUITEM mi = { 0 }; mi.flags = CMIF_TCHAR; - // mi.popupPosition = 500099900; !!!!!!!!!!!!!!!!!!!! - mi.ptszPopupName = LPGENT("Ping"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 500099900); + mi.position = 2000060000; mi.hIcon = hIconResponding; mi.ptszName = LPGENT("Enable all pings"); diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index e5c6061d6b..a8ec7c89e1 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -993,10 +993,8 @@ void InitList() CLISTMENUITEM mi = { 0 }; mi.flags = CMIF_TCHAR; - // mi.popupPosition = 1000200001; !!!!!!!!!!!!! - mi.ptszPopupName = LPGENT("Ping"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Ping"), 1000200001); mi.position = 3000320001; - mi.hIcon = 0;//LoadIcon( hInst, 0); mi.ptszName = LPGENT("Show/Hide &Ping Window"); mi.pszService = PLUG "/ShowWindow"; Menu_AddMainMenuItem(&mi); diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index ab37a4f16b..ba6a9d21fc 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -181,8 +181,7 @@ void InitMenuItems(void) { CLISTMENUITEM mi = { 0 }; // support new genmenu style - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; - mi.hParentMenu = HGENMENU_ROOT; + mi.flags = CMIF_TCHAR; // Build main menu mi.position = -1000000000 /*1000001*/; diff --git a/plugins/ProfileManager/src/pmanagerEx.cpp b/plugins/ProfileManager/src/pmanagerEx.cpp index 05a94201c4..6679d13b15 100644 --- a/plugins/ProfileManager/src/pmanagerEx.cpp +++ b/plugins/ProfileManager/src/pmanagerEx.cpp @@ -95,19 +95,16 @@ static IconItem iconList[] = static int OnModulesLoaded(WPARAM, LPARAM) { CLISTMENUITEM mi = { 0 }; - mi.position = -500200000; - mi.pszPopupName = LPGEN("Database"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), -500200000); for (int i = 0; i < _countof(iconList); i++) { mi.pszName = iconList[i].szDescr; mi.pszService = iconList[i].szName; mi.icolibItem = iconList[i].hIcolib; if (i == 3) - mi.pszPopupName = NULL; + mi.hParentMenu = NULL; Menu_AddMainMenuItem(&mi); } - - Menu_AddTrayMenuItem(&mi); return 0; } diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 837220368f..9dcc4a8618 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -84,32 +84,25 @@ namespace void InitMenu() { CLISTMENUITEM mi = { 0 }; - mi.ptszName = LPGENT("Quotes"); - mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; - mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); - HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi); + mi.flags = CMIF_TCHAR; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Quotes"), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); mi.ptszName = LPGENT("Enable/Disable Auto Update"); - mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; mi.position = 10100001; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = g_pszAutoUpdateCmd; - mi.hParentMenu = hMenuRoot; g_hEnableDisableMenu = Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_EnableDisable); UpdateMenu(g_bAutoUpdate); mi.ptszName = LPGENT("Refresh All Quotes\\Rates"); - mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; mi.position = 20100001; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = "Quotes/RefreshAll"; - mi.hParentMenu = hMenuRoot; Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_RefreshAll); mi.ptszName = LPGENT("Currency Converter..."); - //mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTHANDLE; mi.position = 20100002; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); mi.pszService = g_pszCurrencyConverter; @@ -117,7 +110,6 @@ namespace CreateServiceFunction(mi.pszService, QuotesMenu_CurrencyConverter); mi.ptszName = LPGENT("Export All Quotes"); - //mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTHANDLE; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_EXPORT); mi.pszService = "Quotes/ExportAll"; mi.position = 20100003; @@ -125,7 +117,6 @@ namespace CreateServiceFunction(mi.pszService, QuotesMenu_ExportAll); mi.ptszName = LPGENT("Import All Quotes"); - //mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB|CMIF_ROOTHANDLE; mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_IMPORT); mi.pszService = "Quotes/ImportAll"; mi.position = 20100004; @@ -136,27 +127,10 @@ namespace HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu); - memset(&mi, 0, sizeof(mi)); - mi.pszContactOwner = QUOTES_PROTOCOL_NAME; - hMenuRoot = NULL; if (bSubGroups) - { - mi.pszPopupName = (char *)-1; - mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); - mi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE; - tstring sProtocolName = quotes_a2t(QUOTES_PROTOCOL_NAME); - mi.ptszName = const_cast(sProtocolName.c_str());//A2T(QUOTES_PROTOCOL_NAME); - mi.position = 0; - - hMenuRoot = Menu_AddContactMenuItem(&mi); - } - - mi.flags = CMIF_TCHAR; - if (bSubGroups) - { - mi.flags |= CMIF_ROOTHANDLE; - mi.pszPopupName = (char*)hMenuRoot; - } + mi.hParentMenu = Menu_CreateRoot(MO_CONTACT, _T(QUOTES_PROTOCOL_NAME), 20100004, Quotes_GetIconHandle(IDI_ICON_MAIN)); + else + mi.hParentMenu = NULL; mi.ptszName = LPGENT("Refresh"); mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 7fb923a5bb..670b86fc79 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -48,13 +48,13 @@ static HGENMENU AddMenuItem(LPCSTR name, int pos, HICON hicon, LPCSTR service, i return Menu_AddContactMenuItem(&mi); } -static HGENMENU AddSubItem(HANDLE rootid, LPCSTR name, int pos, int poppos, LPCSTR service, WPARAM wParam = 0) +static HGENMENU AddSubItem(HGENMENU hRoot, LPCSTR name, int pos, int poppos, LPCSTR service, WPARAM wParam = 0) { CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_HIDDEN; + mi.flags = CMIF_HIDDEN; mi.position = pos; mi.pszName = (char*)name; - mi.pszPopupName = (char*)rootid; + mi.hParentMenu = hRoot; mi.pszService = (char*)service; HGENMENU res = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(res, MCI_OPT_EXECPARAM, poppos); @@ -235,7 +235,7 @@ static int onModulesLoaded(WPARAM, LPARAM) g_hMenu[1] = AddMenuItem(sim302, 110001, g_hICO[ICO_CM_DIS], MODULENAME"/SIM_DIS", CMIF_NOTOFFLINE); if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) { - g_hMenu[2] = AddMenuItem(sim312[0], 110002, NULL, NULL, CMIF_ROOTHANDLE); + g_hMenu[2] = AddMenuItem(sim312[0], 110002, NULL, NULL); g_hMenu[3] = AddSubItem(g_hMenu[2], sim232[0], 110003, 110002, MODULENAME"/SIM_ST_DIS"); g_hMenu[4] = AddSubItem(g_hMenu[2], sim232[1], 110004, 110002, MODULENAME"/SIM_ST_ENA"); g_hMenu[5] = AddSubItem(g_hMenu[2], sim232[2], 110005, 110002, MODULENAME"/SIM_ST_TRY"); @@ -258,7 +258,7 @@ static int onModulesLoaded(WPARAM, LPARAM) } if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) { - g_hMenu[10] = AddMenuItem(sim311[0], 110010, NULL, NULL, CMIF_ROOTHANDLE); + g_hMenu[10] = AddMenuItem(sim311[0], 110010, NULL, NULL); g_hMenu[11] = AddSubItem(g_hMenu[10], sim231[0], 110011, 110010, MODULENAME"/MODE_NAT"); g_hMenu[12] = AddSubItem(g_hMenu[10], sim231[1], 110012, 110010, MODULENAME"/MODE_PGP"); g_hMenu[13] = AddSubItem(g_hMenu[10], sim231[2], 110013, 110010, MODULENAME"/MODE_GPG"); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index e08fb1b63b..39709c0b3f 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -272,9 +272,9 @@ DLL_EXPORT int Load(void) srv_reg(Send2ImageShack); /// menu items CLISTMENUITEM mi = { 0 }; - mi.flags=CMIF_ROOTHANDLE|CMIF_TCHAR/*|CMIF_ICONFROMICOLIB*/; - mi.hParentMenu=HGENMENU_ROOT; - mi.icolibItem=GetIconHandle(ICO_MAINXS); + mi.flags = CMIF_TCHAR; + mi.hParentMenu = HGENMENU_ROOT; + mi.icolibItem = GetIconHandle(ICO_MAINXS); #define _Menu_AddMainMenuItemEx(name,srv,pos) do{mi.ptszName=name;mi.pszService=srv;mi.position=pos;Menu_AddMainMenuItem(&mi);}while(0) #define _Menu_AddContactMenuItemEx(name,srv,pos) do{mi.ptszName=name;mi.pszService=srv;mi.position=pos;Menu_AddContactMenuItem(&mi);}while(0) _Menu_AddMainMenuItemEx(LPGENT("Take a screenshot"),MS_SENDSS_OPENDIALOG,1000001); diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 153ab20540..525e276465 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -793,30 +793,30 @@ static int PluginInit(WPARAM, LPARAM) Hotkey_Register(&hkd); // Main menu - CLISTMENUITEM cl = { 0 }; - cl.position = 1000000000; - - cl.pszName = LPGEN("Save session..."); - cl.pszPopupName = LPGEN("Sessions Manager"); - cl.icolibItem = iconList[4].hIcolib; - cl.pszService = MS_SESSIONS_SAVEUSERSESSION; - hmSaveCurrentSession = Menu_AddMainMenuItem(&cl); - - cl.pszName = LPGEN("Load session..."); - cl.pszService = MS_SESSIONS_OPENMANAGER; - cl.icolibItem = iconList[3].hIcolib; - Menu_AddMainMenuItem(&cl); - - cl.pszName = LPGEN("Close session"); - cl.pszService = MS_SESSIONS_CLOSESESSION; - cl.icolibItem = 0; - Menu_AddMainMenuItem(&cl); - - cl.pszName = LPGEN("Load last session"); - cl.pszService = MS_SESSIONS_RESTORELASTSESSION; - cl.icolibItem = iconList[5].hIcolib; - cl.position = 10100000; - Menu_AddMainMenuItem(&cl); + CLISTMENUITEM mi = { 0 }; + mi.position = 1000000000; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Sessions Manager"), 1000000000); + + mi.pszName = LPGEN("Save session..."); + mi.icolibItem = iconList[4].hIcolib; + mi.pszService = MS_SESSIONS_SAVEUSERSESSION; + hmSaveCurrentSession = Menu_AddMainMenuItem(&mi); + + mi.pszName = LPGEN("Load session..."); + mi.pszService = MS_SESSIONS_OPENMANAGER; + mi.icolibItem = iconList[3].hIcolib; + Menu_AddMainMenuItem(&mi); + + mi.pszName = LPGEN("Close session"); + mi.pszService = MS_SESSIONS_CLOSESESSION; + mi.icolibItem = 0; + Menu_AddMainMenuItem(&mi); + + mi.pszName = LPGEN("Load last session"); + mi.pszService = MS_SESSIONS_RESTORELASTSESSION; + mi.icolibItem = iconList[5].hIcolib; + mi.position = 10100000; + Menu_AddMainMenuItem(&mi); return 0; } diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 2eb4e4f36b..9bf3cb4eb0 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1490,9 +1490,9 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) if (Proto_IsAccountLocked(pa[i])) { mir_sntprintf(szBuffer, TranslateT("%s (locked)"), pa[i]->tszAccountName); - mi.ptszPopupName = szBuffer; + mi.hParentMenu = Menu_CreateRoot(MO_STATUS, szBuffer, mi.position); } - else mi.ptszPopupName = pa[i]->tszAccountName; + else mi.hParentMenu = Menu_CreateRoot(MO_STATUS, pa[i]->tszAccountName, mi.position); hProtoStatusMenuItem[i] = Menu_AddStatusMenuItem(&mi); } diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 51c13ae50d..1cc9974b79 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -51,10 +51,8 @@ static IconItem icon = { LPGEN("Button smiley"), "SmileyAdd_ButtonSmiley", IDI_S static int ModulesLoaded(WPARAM, LPARAM) { CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE; mi.position = 2000070050; mi.icolibItem = icon.hIcolib; - mi.hParentMenu = HGENMENU_ROOT; mi.pszName = LPGEN("Assign smiley category"); hContactMenuItem = Menu_AddContactMenuItem(&mi); diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 44de589741..2cc5413753 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -294,7 +294,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) CLISTMENUITEM mi = { 0 }; mi.hParentMenu = hContactMenuItem; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.pszService = MS_SMILEYADD_CUSTOMCATMENU; bool nonecheck = true; diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 3595e1884d..2d4aaaa8d6 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -292,7 +292,7 @@ static INT_PTR InitMenu() CLISTMENUITEM mi = { 0 }; mi.position = 100000000; mi.icolibItem = GetIconHandle(MENU_NAME); - mi.pszPopupName = MENU_NAME; + mi.pszName = MENU_NAME; mi.pszService = SS_SERVICE_NAME; hSSMenuToggleOnOff = Menu_AddMainMenuItem(&mi); UpdateMenu(); diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 697793b8da..957836adcd 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -102,8 +102,8 @@ 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)) - mi.ptszPopupName = LPGENT("Status profiles"); + if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1)) + mi.hParentMenu = Menu_CreateRoot(MO_STATUS, LPGENT("Status profiles"), 2000100000); mi.ptszName = profilename; mi.position = 2000100000 + mcount; diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index c34ed8328f..c1637a6f0f 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -546,7 +546,7 @@ int TN_ModuleInit() mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED)); } mi.pszService = "TypingNotify/EnableDisableMenuCommand"; - mi.pszPopupName = LPGEN("Popups"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); hDisableMenu = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index aebdd2bdd1..e3891a5f65 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -67,8 +67,8 @@ void RebuildContact() { BYTE item = 0; - HGENMENU mhRoot = HGENMENU_ROOT; - HGENMENU mhExIm = HGENMENU_ROOT; + HGENMENU mhRoot = NULL; + HGENMENU mhExIm = NULL; static HGENMENU hMenuItem[4] = {NULL, NULL, NULL, NULL }; SvcEMailRebuildMenu(); @@ -86,13 +86,11 @@ void RebuildContact() // support new genmenu style CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE; - mi.hParentMenu = HGENMENU_ROOT; switch (flag) { case 3: //cascade off - mhRoot = mhExIm = HGENMENU_ROOT; + mhRoot = mhExIm = NULL; hMenuItem[0] = NULL; break; case 5: @@ -111,7 +109,7 @@ void RebuildContact() mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddContactMenuItem(&mi); hMenuItem[0] = mhExIm; - mhRoot = HGENMENU_ROOT; + mhRoot = NULL; break; default: //disable Menu @@ -133,14 +131,14 @@ void RebuildContact() // Export mi.pszService = MS_USERINFO_VCARD_EXPORT; - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export user details"); + mi.pszName = mhExIm != NULL ? LPGEN("&Export") : LPGEN("&Export user details"); mi.position = 1000050200; mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); hMenuItem[2] = Menu_AddContactMenuItem(&mi); // Import mi.pszService = MS_USERINFO_VCARD_IMPORT; - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import user details"); + mi.pszName = mhExIm != NULL ? LPGEN("&Import") : LPGEN("&Import user details"); mi.position = 1000050300; mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); hMenuItem[3] = Menu_AddContactMenuItem(&mi); @@ -159,8 +157,8 @@ void RebuildMain() { BYTE item = 0; - HGENMENU mhRoot = HGENMENU_ROOT; - HGENMENU mhExIm = HGENMENU_ROOT; + HGENMENU mhRoot = NULL; + HGENMENU mhExIm = NULL; static HGENMENU hMenuItem[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; // load options @@ -175,14 +173,12 @@ void RebuildMain() // support new genmenu style CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE; - mi.hParentMenu = HGENMENU_ROOT; switch (flag) { case 3: //cascade off - mhRoot = mhExIm = HGENMENU_ROOT; + mhRoot = mhExIm = NULL; hMenuItem[item++] = NULL; break; case 5: @@ -201,7 +197,7 @@ void RebuildMain() mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddMainMenuItem(&mi); hMenuItem[item++] = mhExIm; - mhRoot = HGENMENU_ROOT; + mhRoot = NULL; break; default: //disable Menue @@ -294,8 +290,8 @@ void RebuildGroup() BYTE item = 0; GroupMenuParam gmp = { 0 }; - HGENMENU mhRoot = HGENMENU_ROOT; - HGENMENU mhExIm = HGENMENU_ROOT; + HGENMENU mhRoot = NULL; + HGENMENU mhExIm = NULL; static HGENMENU hMenuItem[3] = {NULL, NULL, NULL }; // load options @@ -316,15 +312,11 @@ void RebuildGroup() mi.pszService = text; char* tDest = text + mir_strlen(text); - // support new genmenu style - mi.flags = CMIF_ROOTHANDLE; - mi.hParentMenu = HGENMENU_ROOT; - switch (flag) { case 3: //cascade off - mhRoot = mhExIm = HGENMENU_ROOT; + mhRoot = mhExIm = NULL; hMenuItem[item++] = NULL; break; case 5: @@ -343,7 +335,7 @@ void RebuildGroup() mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddGroupMenuItem(0, &mi); hMenuItem[item++] = mhExIm; - mhRoot = HGENMENU_ROOT; + mhRoot = NULL; break; default: //disable Menue @@ -388,8 +380,8 @@ void RebuildSubGroup() BYTE item = 0; GroupMenuParam gmp = { 0 }; - HGENMENU mhRoot = HGENMENU_ROOT; - HGENMENU mhExIm = HGENMENU_ROOT; + HGENMENU mhRoot = NULL; + HGENMENU mhExIm = NULL; static HGENMENU hMenuItem[3] = {NULL, NULL, NULL }; // load options @@ -410,15 +402,11 @@ void RebuildSubGroup() mi.pszService = text; char* tDest = text + mir_strlen(text); - // support new genmenu style - mi.flags = CMIF_ROOTHANDLE; - mi.hParentMenu = HGENMENU_ROOT; - switch (flag) { case 3: //cascade off - mhRoot = mhExIm = HGENMENU_ROOT; + mhRoot = mhExIm = NULL; hMenuItem[item++] = NULL; break; case 5: @@ -437,7 +425,7 @@ void RebuildSubGroup() mi.pszName = LPGEN("Export/import group"); mhExIm = Menu_AddSubGroupMenuItem(0, &mi); hMenuItem[item++] = mhExIm; - mhRoot = HGENMENU_ROOT; + mhRoot = NULL; break; default: //disable Menue @@ -450,7 +438,7 @@ void RebuildSubGroup() // Export mir_strcpy(tDest, "/ExportGroup"); //mi.pszService if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export group"); + mi.pszName = mhExIm != NULL ? LPGEN("&Export") : LPGEN("&Export group"); mi.position = 1050200; mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); gmp.lParam=0; @@ -460,7 +448,7 @@ void RebuildSubGroup() // Import mir_strcpy(tDest, "/ImportGroup"); //mi.pszService if (!ServiceExists(mi.pszService)) CreateServiceFunction(mi.pszService, svcExIm_Group_Service); - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import group"); + mi.pszName = mhExIm != NULL ? LPGEN("&Import") : LPGEN("&Import group"); mi.position = 1050300; mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); gmp.lParam=0; @@ -494,8 +482,8 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) int mProtoCount = pcli->menuProtoCount; - HGENMENU mhRoot = HGENMENU_ROOT; - HGENMENU mhExIm = HGENMENU_ROOT; + HGENMENU mhRoot = NULL; + HGENMENU mhExIm = NULL; // on call by hook or first start if (!lParam || !hMenuItemAccount) { @@ -538,7 +526,6 @@ INT_PTR RebuildAccount(WPARAM wParam, LPARAM lParam) char* tDest = text + mir_strlen( text ); // support new genmenu style - mi.flags = CMIF_ROOTHANDLE; mi.hParentMenu = mhRoot; switch (flag) { diff --git a/plugins/Watrack/i_gui.inc b/plugins/Watrack/i_gui.inc index 81e4c35beb..fa10a41062 100644 --- a/plugins/Watrack/i_gui.inc +++ b/plugins/Watrack/i_gui.inc @@ -34,7 +34,7 @@ var mi:TCListMenuItem; begin FillChar(mi, sizeof(mi), 0); - mi.szPopupName.a:=PluginShort; + mi.hParentMenu:=Menu_CreateRoot(MO_MAIN, 'Watrack', 0, 0, 0); mi.hIcon :=IcoLib_GetIcon(IcoBtnEnable,0); mi.szName.a :='Disable WATrack'; diff --git a/plugins/Watrack/lastfm/lastfm.pas b/plugins/Watrack/lastfm/lastfm.pas index ae56647617..8cb51a855c 100644 --- a/plugins/Watrack/lastfm/lastfm.pas +++ b/plugins/Watrack/lastfm/lastfm.pas @@ -181,12 +181,12 @@ begin DestroyIcon(sid.hDefaultIcon); FillChar(mi, sizeof(mi), 0); - mi.szPopupName.a:=PluginShort; + mi.hParentMenu:=Menu_CreateRoot(MO_MAIN, 'Watrack', 500050000, 0, 0); mi.hIcon :=IcoLib_GetIcon(IcoLastFM,0); mi.szName.a :='Disable scrobbling'; mi.pszService:=MS_WAT_LASTFM; - mi.position :=500050000; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + mi.position :=500050000; hMenuLast:=Menu_AddMainMenuItem(@mi); end; diff --git a/plugins/Watrack/myshows/myshows.pas b/plugins/Watrack/myshows/myshows.pas index e6c5c6cb21..054d9a6010 100644 --- a/plugins/Watrack/myshows/myshows.pas +++ b/plugins/Watrack/myshows/myshows.pas @@ -212,7 +212,7 @@ begin DestroyIcon(sid.hDefaultIcon); FillChar(mi, sizeof(mi), 0); - mi.szPopupName.a:=PluginShort; + mi.hParentMenu:=Menu_CreateRoot(MO_MAIN, 'Watrack', 500050000, 0, 0); mi.hIcon :=IcoLib_GetIcon(IcoMyShows,0); mi.szName.a :='Disable scrobbling'; diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas index cd548e9e88..a75264cf7c 100644 --- a/plugins/Watrack/popup/popups.pas +++ b/plugins/Watrack/popup/popups.pas @@ -473,7 +473,7 @@ begin HookEvent(ME_SKIN2_ICONSCHANGED,@IconChanged); FillChar(mi,SizeOf(mi),0); - mi.szPopupName.a:=PluginShort; + mi.hParentMenu:=Menu_CreateRoot(MO_MAIN, 'Watrack', MenuInfoPos, 0, 0); mi.hIcon :=IcoLib_GetIcon(IcoBtnInfo,0); mi.szName.a :='Music Info'; mi.pszService:=MS_WAT_SHOWMUSICINFO; diff --git a/plugins/Watrack/proto/proto.pas b/plugins/Watrack/proto/proto.pas index 2d4e488d41..25408aeba0 100644 --- a/plugins/Watrack/proto/proto.pas +++ b/plugins/Watrack/proto/proto.pas @@ -354,7 +354,7 @@ begin RegisterIcons; FillChar(mi, sizeof(mi), 0); - mi.szPopupName.a:=PluginShort; + mi.hParentMenu:=Menu_CreateRoot(MO_MAIN, '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'; diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas index ea6b5baf54..fe5418017f 100644 --- a/plugins/Watrack/stat/statlog.pas +++ b/plugins/Watrack/stat/statlog.pas @@ -582,11 +582,11 @@ begin DestroyIcon(sid.hDefaultIcon); FillChar(mi, sizeof(mi), 0); - mi.szPopupName.a:=PluginShort; + mi.hParentMenu:=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; // !!!!!!!!!!!!!!!!!!!!! + mi.position :=MenuReportPos; hMenuReport:=Menu_AddMainMenuItem(@mi); plStatusHook:=HookEvent(ME_WAT_NEWSTATUS,@NewPlStatus); end; diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index b4ea9a0f6c..fbd0d965ae 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -322,8 +322,7 @@ void AddMenuItems(void) Menu_AddContactMenuItem(&mi); // adding main menu items - mi.pszPopupName = LPGEN("Weather"); - // mi.popupPosition = 500099000; !!!!!!!!!!!!!!!!!!!!! + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Weather"), 500099000); CreateServiceFunction(MS_WEATHER_ENABLED, EnableDisableCmd); mi.pszName = LPGEN("Enable/Disable Weather Update"); @@ -348,12 +347,12 @@ void AddMenuItems(void) Menu_AddMainMenuItem(&mi); // only run if popup service exists - if ( ServiceExists(MS_POPUP_ADDPOPUPT)) { + if (ServiceExists(MS_POPUP_ADDPOPUPT)) { CreateServiceFunction(WEATHERPROTONAME "/PopupMenu", MenuitemNotifyCmd); mi.pszName = LPGEN("Weather Notification"); mi.icolibItem = GetIconHandle("popup"); mi.position = 0; - mi.pszPopupName = LPGEN("Popups"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); mi.pszService = WEATHERPROTONAME "/PopupMenu"; hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); UpdatePopupMenu(opt.UsePopup); diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 1becb0a577..a0cb6460e7 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -178,8 +178,7 @@ extern "C" int __declspec(dllexport) Load() /*DISABLE WEBVIEW*/ CreateServiceFunction("DisableWebview", AutoUpdateMCmd); - mi.position = 20200001; - mi.ptszPopupName = _T(MODULENAME); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, _T(MODULENAME), 20200001); mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)); if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)) mi.ptszName = LPGENT("Auto update disabled"); diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index e4d8d73a5b..b47593aaeb 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -72,42 +72,43 @@ extern "C" int __declspec(dllexport) Load(void) hAddBirthdayWndsList = WindowList_Create(); - CLISTMENUITEM cl = { 0 }; - cl.position = 10000000; - cl.pszPopupName = LPGEN("Birthdays (When Was It)"); - - cl.pszService = MS_WWI_CHECK_BIRTHDAYS; - cl.icolibItem = hCheckMenu; - cl.pszName = LPGEN("Check for birthdays"); - Menu_AddMainMenuItem(&cl); - - cl.pszService = MS_WWI_LIST_SHOW; - cl.pszName = LPGEN("Birthday list"); - cl.icolibItem = hListMenu; - Menu_AddMainMenuItem(&cl); - - cl.pszService = MS_WWI_REFRESH_USERDETAILS; - cl.position = 10100000; - cl.pszName = LPGEN("Refresh user details"); - cl.icolibItem = hRefreshUserDetails; - Menu_AddMainMenuItem(&cl); - - cl.pszService = MS_WWI_IMPORT_BIRTHDAYS; - cl.position = 10200000; - cl.pszName = LPGEN("Import birthdays"); - cl.icolibItem = hImportBirthdays; - Menu_AddMainMenuItem(&cl); - - cl.pszService = MS_WWI_EXPORT_BIRTHDAYS; - cl.pszName = LPGEN("Export birthdays"); - cl.icolibItem = hExportBirthdays; - Menu_AddMainMenuItem(&cl); - - cl.pszService = MS_WWI_ADD_BIRTHDAY; - cl.position = 10000000; - cl.icolibItem = hAddBirthdayContact; - cl.pszName = LPGEN("Add/change user &birthday"); - Menu_AddContactMenuItem(&cl); + CLISTMENUITEM mi = { 0 }; + mi.position = 10000000; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Birthdays (When Was It)"), mi.position); + + mi.pszService = MS_WWI_CHECK_BIRTHDAYS; + mi.icolibItem = hCheckMenu; + mi.pszName = LPGEN("Check for birthdays"); + Menu_AddMainMenuItem(&mi); + + mi.pszService = MS_WWI_LIST_SHOW; + mi.pszName = LPGEN("Birthday list"); + mi.icolibItem = hListMenu; + Menu_AddMainMenuItem(&mi); + + mi.pszService = MS_WWI_REFRESH_USERDETAILS; + mi.position = 10100000; + mi.pszName = LPGEN("Refresh user details"); + mi.icolibItem = hRefreshUserDetails; + Menu_AddMainMenuItem(&mi); + + mi.pszService = MS_WWI_IMPORT_BIRTHDAYS; + mi.position = 10200000; + mi.pszName = LPGEN("Import birthdays"); + mi.icolibItem = hImportBirthdays; + Menu_AddMainMenuItem(&mi); + + mi.pszService = MS_WWI_EXPORT_BIRTHDAYS; + mi.pszName = LPGEN("Export birthdays"); + mi.icolibItem = hExportBirthdays; + Menu_AddMainMenuItem(&mi); + + mi.hParentMenu = 0; + mi.pszService = MS_WWI_ADD_BIRTHDAY; + mi.position = 10000000; + mi.icolibItem = hAddBirthdayContact; + mi.pszName = LPGEN("Add/change user &birthday"); + Menu_AddContactMenuItem(&mi); // Register hotkeys HOTKEYDESC hotkey = { sizeof(hotkey) }; diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 3fa6e3d6dc..fe9ce91b60 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -493,6 +493,7 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_WUMF_CONNECTIONSSHOW, WumfShowConnections); CLISTMENUITEM mi = { 0 }; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 1999990000); if (WumfOptions.PopupsEnabled == FALSE) { mi.pszName = LPGEN("Enable WUMF popups"); mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP)); @@ -501,10 +502,9 @@ extern "C" __declspec(dllexport) int Load(void) mi.pszName = LPGEN("Disable WUMF popups"); mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP)); } + mi.pszService = MS_WUMF_SWITCHPOPUP; - // mi.popupPosition = 1999990000; !!!!!!!!!!!!!!!!!!!!!!!!! - mi.pszPopupName = LPGEN("Popups"); - hMenuItem = Menu_AddMainMenuItem(&mi); + hMenuItem = Menu_AddMainMenuItem(&mi); mi.pszName = LPGEN("WUMF: Show connections"); mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_DRIVE)); diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index e4520895a1..ecb739d653 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -145,7 +145,6 @@ int SystemModulesLoaded(WPARAM, LPARAM) mi.position = 0xb0000000; mi.icolibItem = g_GetIconHandle(0); mi.pszName = LPGEN("Check &mail (All Account)"); - mi.pszPopupName = NULL;//YAMN_DBMODULE; mi.pszService = MS_YAMN_FORCECHECK; hMenuItemMain = Menu_AddMainMenuItem(&mi); diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index c314328c05..e80b50203a 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -194,7 +194,6 @@ static INT_PTR GetOpaque(WPARAM wParam, LPARAM lParam) void UpdateMenu() { bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; - if (isEnabled) { Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON)); Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_ON)); diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index 323712e943..c937996dcf 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -168,18 +168,11 @@ void InitMenuItems(void) { bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE|CMIF_TCHAR; - mi.hParentMenu = HGENMENU_ROOT; - - // Build main menu - mi.position = 500010000; - mi.ptszName = LPGENT("Popups"); - mi.hIcon = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); - hMenuRoot = Menu_AddMainMenuItem(&mi); + hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0)); - // Add item to main menu - mi.hParentMenu = (HGENMENU)hMenuRoot; + CLISTMENUITEM mi = { 0 }; + mi.flags = CMIF_TCHAR; + mi.hParentMenu = hMenuRoot; mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0); mi.pszService= MS_POPUP_SHOWHISTORY; diff --git a/plugins/mRadio/i_tray.inc b/plugins/mRadio/i_tray.inc index 4a32675903..0406bf311f 100644 --- a/plugins/mRadio/i_tray.inc +++ b/plugins/mRadio/i_tray.inc @@ -2,7 +2,7 @@ var doTray:bool; var - trayradioparent:THANDLE; + trayradioparent:HGENMENU; trayprotoh:THANDLE; trayparent:THANDLE; traymute :THANDLE; @@ -91,7 +91,7 @@ begin // build menu from sorted list FillChar(mi,SizeOf(mi),0); mi.Flags :=CMIF_KEEPUNTRANSLATED or CMIF_UNICODE or CMIF_ROOTHANDLE; - mi.szPopupName:=TChar(trayparent); + mi.hParentMenu:=trayparent; pc:=StrCopyE(@buf,'mRadio/Choose'); for i:=0 to trayStations.realCount-1 do begin @@ -146,7 +146,7 @@ begin trayradioparent:=Menu_AddMainMenuItem(@mi); FillChar(mi, sizeof(mi), 0); - mi.szPopupName:=TChar(trayradioparent); + mi.hParentMenu:=trayradioparent; if PluginStatus=ID_STATUS_ONLINE then begin diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 3626175e4b..fe5555e638 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -216,10 +216,9 @@ void CAimProto::InitMainMenus(void) HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = GetIconHandle("aim"); mi.ptszName = m_tszUserName; - mi.hParentMenu = HGENMENU_ROOT; mi.position = 500090000; hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi); } @@ -232,7 +231,7 @@ void CAimProto::InitMainMenus(void) mi.pszService = service_name; mi.hParentMenu = hRoot; - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/ManageAccount"); CreateProtoService("/ManageAccount", &CAimProto::ManageAccount); diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index bb5ab200d6..589d2e125e 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -219,8 +219,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) if (hRoot == NULL) { CLISTMENUITEM miRoot = { 0 }; miRoot.position = 500085000; - miRoot.hParentMenu = HGENMENU_ROOT; - miRoot.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | (this->isOnline() ? 0 : CMIF_GRAYED); + miRoot.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | (this->isOnline() ? 0 : CMIF_GRAYED); miRoot.icolibItem = GetIconHandle("facebook"); miRoot.ptszName = m_tszUserName; hRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&miRoot); @@ -232,7 +231,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) } } - mi.flags = CMIF_ROOTHANDLE | (this->isOnline() ? 0 : CMIF_GRAYED); + mi.flags = (this->isOnline() ? 0 : CMIF_GRAYED); mi.position = 201001; mi.hParentMenu = hRoot; @@ -244,7 +243,6 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) //CreateProtoService("/VisitProfile",&FacebookProto::VisitProfile); mir_strcpy(tDest, "/VisitProfile"); - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Visit profile"); mi.icolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); // TODO RM: remember and properly free in destructor? @@ -257,38 +255,25 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) Menu_AddProtoMenuItem(&mi); // Services... - mi.pszName = LPGEN("Services..."); - mir_strcpy(tDest, "/Services"); - mi.flags = CMIF_ROOTHANDLE | (this->isOnline() ? 0 : CMIF_GRAYED); - mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_HELP); - m_hMenuServicesRoot = Menu_AddProtoMenuItem(&mi); + mi.hParentMenu = m_hMenuServicesRoot = Menu_CreateRoot(MO_PROTO, LPGENT("Services..."), mi.position, Skin_GetIconHandle(SKINICON_OTHER_HELP)); CreateProtoService("/RefreshBuddyList", &FacebookProto::RefreshBuddyList); mir_strcpy(tDest, "/RefreshBuddyList"); - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Refresh Buddy List"); - mi.pszPopupName = LPGEN("Services"); mi.icolibItem = GetIconHandle("friendship"); - mi.hParentMenu = m_hMenuServicesRoot; Menu_AddProtoMenuItem(&mi); CreateProtoService("/CheckFriendRequests", &FacebookProto::CheckFriendRequests); mir_strcpy(tDest, "/CheckFriendRequests"); - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Check Friends Requests"); mi.icolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST); - mi.hParentMenu = m_hMenuServicesRoot; Menu_AddProtoMenuItem(&mi); CreateProtoService("/CheckNewsfeeds", &FacebookProto::CheckNewsfeeds); mir_strcpy(tDest, "/CheckNewsfeeds"); - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Check Newsfeeds"); - mi.pszPopupName = LPGEN("Services"); mi.icolibItem = GetIconHandle("newsfeed"); - mi.hParentMenu = m_hMenuServicesRoot; Menu_AddProtoMenuItem(&mi); - return 0; } diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index d6de671201..d39dc2b166 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -45,7 +45,6 @@ int InitMenus(WPARAM wParam, LPARAM lParam) CreateServiceFunctionParam(szServiceName, OpenMailboxMenuHandler, (LPARAM)szModuleName); CLISTMENUITEM cmi = { 0 }; - cmi.flags = CMIF_ROOTHANDLE; cmi.hParentMenu = HGENMENU(wParam); cmi.hIcon = g_hPopupIcon; cmi.position = 200101; diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index b6b75db861..7a7a6dd8d6 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -269,14 +269,13 @@ void GGPROTO::menus_init() if (hRoot == NULL) { mi.ptszName = m_tszUserName; mi.position = 500090000; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = iconList[0].hIcolib; hGCRoot = hCLRoot = hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi); } else { mi.hParentMenu = hRoot; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.ptszName = LPGENT("Conference"); mi.position = 200001; diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 9019e9278b..76f99f114f 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -60,7 +60,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) char service[64]; CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.hParentMenu = hRoot; // Conferencing diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index b82554d567..b9c925d1d4 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -520,7 +520,7 @@ void GGPROTO::import_init(HGENMENU hRoot) CreateProtoService(GGS_IMPORT_SERVER, &GGPROTO::import_server); CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.hParentMenu = hRoot; mi.position = 2000500001; mi.icolibItem = iconList[1].hIcolib; diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 15a1da12a8..f8f04874d1 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -27,7 +27,7 @@ #define GGS_PARSELINK "GG/ParseLink" #define GGS_MENUCHOOSE "GG/MenuChoose" -static HANDLE hInstanceMenu; +static int hInstanceMenu; static INT_PTR gg_menuchoose(WPARAM wParam, LPARAM lParam) { diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 2e7339e74d..1b19989681 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -421,7 +421,7 @@ void GGPROTO::sessions_menus_init(HGENMENU hRoot) CreateProtoService(GGS_CONCUR_SESS, &GGPROTO::sessions_view); CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.hParentMenu = hRoot; mi.position = (hMenuRoot) ? 2050000001 : 200003; mi.icolibItem = iconList[16].hIcolib; diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 52d92259e1..ef3635738c 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -34,8 +34,7 @@ void CIrcProto::InitMainMenus(void) // Root popupmenuitem mi.ptszName = m_tszUserName; mi.position = -1999901010; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = GetIconHandle(IDI_MAIN); hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi); } @@ -46,7 +45,7 @@ void CIrcProto::InitMainMenus(void) } } - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.pszName = LPGEN("&Quick connect"); mi.icolibItem = GetIconHandle(IDI_QUICK); mir_strcpy(d, IRC_QUICKCONNECT); diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 21c1a1374c..28cd0a0d7d 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -838,7 +838,6 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) { size_t len = mir_strlen(m_szModuleName); char srvFce[MAX_PATH + 64]; - char szItem[MAX_PATH + 64]; int bXStatusMenuBuilt = 0; BYTE bXStatus = getContactXStatus(NULL); @@ -853,12 +852,13 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) if (m_bHideXStatusUI || m_bHideXStatusMenu) return; - mir_snprintf(szItem, _countof(szItem), Translate("%s Custom Status"), m_szModuleName); - CLISTMENUITEM mi = { 0 }; - mi.pszPopupName = szItem; - // mi.popupPosition = 500084000; !!!!!!!!!!!!!!!! mi.position = 2000040000; + { + TCHAR szItem[MAX_PATH + 64]; + mir_sntprintf(szItem, _countof(szItem), TranslateT("%s Custom Status"), m_tszUserName); + mi.hParentMenu = Menu_CreateRoot(MO_STATUS, szItem, 500084000); + } for (int i = 0; i <= XSTATUS_COUNT; i++) { mir_snprintf(srvFce, _countof(srvFce), "%s/menuXStatus%d", m_szModuleName, i); diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 53414f2e6c..7ef067e026 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -34,7 +34,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MENUITEM_RESOURCES 10 static MWindowList hDialogsList = NULL; -static HANDLE hChooserMenu, hStatusMenuInit; +static HANDLE hStatusMenuInit; + +static int hChooserMenu; static int iChooserMenuPos = 30000; static HGENMENU g_hMenuRequestAuth; @@ -282,11 +284,10 @@ void g_MenuInit(void) mi.pszService = "Jabber/DirectPresenceDummySvc"; mi.pszName = LPGEN("Send Presence"); mi.position = -1999901011; - mi.hParentMenu = HGENMENU_ROOT; mi.icolibItem = g_GetIconHandle(IDI_NOTES); g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi); - mi.flags |= CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags |= CMIF_TCHAR; for (int i = 0; i < _countof(PresenceModeArray); i++) { char buf[] = "Jabber/DirectPresenceX"; buf[_countof(buf) - 2] = '0' + i; @@ -299,13 +300,12 @@ void g_MenuInit(void) CreateServiceFunctionParam(mi.pszService, JabberMenuHandleDirectPresence, PresenceModeArray[i].mode); } - mi.flags &= ~(CMIF_ROOTHANDLE | CMIF_TCHAR); + mi.flags &= ~(CMIF_TCHAR); // Resource selector mi.pszService = "Jabber/ResourceSelectorDummySvc"; mi.pszName = LPGEN("Jabber Resource"); mi.position = -1999901011; - mi.hParentMenu = HGENMENU_ROOT; mi.icolibItem = g_GetIconHandle(IDI_JABBER); g_hMenuResourcesRoot = Menu_AddContactMenuItem(&mi); @@ -314,7 +314,6 @@ void g_MenuInit(void) mi.position = -1999901000; mi.hParentMenu = g_hMenuResourcesRoot; mi.icolibItem = g_GetIconHandle(IDI_JABBER); - mi.flags |= CMIF_ROOTHANDLE; g_hMenuResourcesActive = Menu_AddContactMenuItem(&mi); CreateServiceFunctionParam(mi.pszService, JabberMenuHandleResource, MENUITEM_LASTSEEN); @@ -422,9 +421,6 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) char* tDest = text + nModuleNameLength; CLISTMENUITEM mi = { 0 }; - mi.flags = CMIF_ROOTHANDLE; - mi.position = 0; - mi.icolibItem = NULL; mi.pszService = text; mi.pszContactOwner = m_szModuleName; @@ -597,8 +593,7 @@ void CJabberProto::MenuInit() if (hJabberRoot == NULL) { mi.ptszName = m_tszUserName; mi.position = -1999901006; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = m_hProtoIcon; hJabberRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi); } @@ -611,7 +606,7 @@ void CJabberProto::MenuInit() // "Bookmarks..." CreateProtoService("/Bookmarks", &CJabberProto::OnMenuHandleBookmarks); mir_strcpy(tDest, "/Bookmarks"); - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.hParentMenu = hJabberRoot; mi.pszName = LPGEN("Bookmarks"); mi.position = 200001; @@ -628,7 +623,6 @@ void CJabberProto::MenuInit() // "Service Discovery..." CreateProtoService("/ServiceDiscovery", &CJabberProto::OnMenuHandleServiceDiscovery); mir_strcpy(tDest, "/ServiceDiscovery"); - mi.flags = CMIF_ROOTHANDLE; mi.pszName = LPGEN("Service Discovery"); mi.position = 2000050001; mi.icolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY); @@ -708,7 +702,7 @@ void CJabberProto::MenuInit() mi.pszContactOwner = m_szModuleName; mi.hParentMenu = hJabberRoot; mi.pszName = LPGEN("Resource priority"); - mi.flags = CMIF_ROOTHANDLE | CMIF_HIDDEN; + mi.flags = CMIF_HIDDEN; m_hMenuPriorityRoot = Menu_AddProtoMenuItem(&mi); TCHAR szName[128]; @@ -716,7 +710,7 @@ void CJabberProto::MenuInit() mi.pszService = srvFce; mi.ptszName = szName; mi.position = 2000040000; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.hParentMenu = m_hMenuPriorityRoot; mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/0", m_szModuleName); diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 9bfeb7e63e..c0094d836e 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -2094,7 +2094,7 @@ void CJabberProto::BuildPrivacyMenu() mi.position = 200005; mi.pszContactOwner = m_szModuleName; mi.icolibItem = GetIconHandle(IDI_AGENTS); - mi.flags = CMIF_ROOTHANDLE | CMIF_HIDDEN; + mi.flags = CMIF_HIDDEN; mi.pszName = LPGEN("Privacy Lists"); mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName); m_hPrivacyMenuRoot = Menu_AddProtoMenuItem(&mi); @@ -2104,7 +2104,7 @@ void CJabberProto::BuildPrivacyMenu() mir_snprintf(srvFce, _countof(srvFce), "%s/PrivacyLists", m_szModuleName); mi.pszService = srvFce; mi.position = 3000040000; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.icolibItem = GetIconHandle(IDI_PRIVACY_LISTS); mi.ptszName = LPGENT("List Editor..."); mi.hParentMenu = m_hPrivacyMenuRoot; @@ -2125,7 +2125,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) CLISTMENUITEM mi = { 0 }; mi.position = 2000040000; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.hParentMenu = m_hPrivacyMenuRoot; mi.pszService = srvFce; diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 4c4b472218..85c9464cf6 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -469,7 +469,7 @@ void CPepGuiService::RebuildMenu() mi.hParentMenu = hJabberRoot; mi.pszService = szService; mi.position = 200010; - mi.flags = CMIF_TCHAR | CMIF_HIDDEN | CMIF_ROOTHANDLE; + mi.flags = CMIF_TCHAR | CMIF_HIDDEN; mi.icolibItem = m_hIcolibItem; mi.ptszName = m_szText ? m_szText : _T(""); m_hMenuItem = Menu_AddProtoMenuItem(&mi); diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index fe73fa2ca1..a8ad1ff78d 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -286,8 +286,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) CLISTMENUITEM mi = { 0 }; mi.position = 2000060000; - // mi.popupPosition = 500085000; - mi.ptszPopupName = szItem; + mi.hParentMenu = Menu_CreateRoot(MO_STATUS, szItem, 500085000); mi.flags = CMIF_UNICODE; mi.pszService = szServiceFunction; mi.pszContactOwner = m_szModuleName; @@ -338,27 +337,24 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI hRootMenu = Menu_GetProtocolRoot(m_szModuleName); if (hRootMenu == NULL) { mi.ptszName = m_tszUserName; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.hIcon = g_hMainIcon; hRootMenu = Menu_AddProtoMenuItem(&mi); } mi.position = 20003; mi.hParentMenu = hRootMenu; - mi.flags = CMIF_ROOTHANDLE; } else { fnAddFunc = Menu_AddContactMenuItem; mi.position = lPosition; - mi.flags = CMIF_ROOTHANDLE; } + mi.flags = 0; mi.pszName = LPGEN("Services..."); mi.hIcon = g_hMainIcon; hRootMenu = fnAddFunc(&mi); - mi.flags = CMIF_ROOTHANDLE; mi.hParentMenu = hRootMenu; mi.pszService = szServiceFunction; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 89c0bdabe0..2a43ea284b 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -277,8 +277,7 @@ void CMsnProto::MsnInitMainMenu(void) HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.position = 500085000; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = GetIconHandle(IDI_MSN); mi.ptszName = m_tszUserName; hRoot = mainMenuRoot = Menu_AddProtoMenuItem(&mi); @@ -288,7 +287,7 @@ void CMsnProto::MsnInitMainMenu(void) mainMenuRoot = NULL; } - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.hParentMenu = hRoot; mi.pszService = servicefunction; diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 8d24cb25f7..0d072a76b3 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -120,8 +120,7 @@ int CSkypeProto::OnInitStatusMenu() { mi.ptszName = m_tszUserName; mi.position = -1999901006; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = Skin_GetIconHandle("main"); hStatusMunuRoot = /*m_hMenuRoot = */Menu_AddProtoMenuItem(&mi); } @@ -133,7 +132,7 @@ int CSkypeProto::OnInitStatusMenu() m_hMenuRoot = NULL; }*/ mi.hParentMenu = hStatusMunuRoot; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mir_strcpy(tDest, "/CreateNewChat"); diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 6b76a93220..1032d56037 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -HANDLE CSteamProto::hChooserMenu; +int CSteamProto::hChooserMenu; HGENMENU CSteamProto::contactMenuItems[CMI_MAX]; template @@ -108,7 +108,7 @@ void CSteamProto::OnInitStatusMenu() mi.ptszName = m_tszUserName; mi.position = -1999901006; mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; //mi.icolibItem = NULL; hSteamRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi); } @@ -118,7 +118,7 @@ void CSteamProto::OnInitStatusMenu() } mi.hParentMenu = hSteamRoot; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; // Show block list mir_strcpy(tDest, "/BlockList"); diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index eed74c5c42..ef83b7dc14 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -160,7 +160,7 @@ protected: // menus HGENMENU m_hMenuRoot; - static HANDLE hChooserMenu; + static int hChooserMenu; static HGENMENU contactMenuItems[CMI_MAX]; int __cdecl AuthRequestCommand(WPARAM, LPARAM); diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index c8cda6ec35..d7334edd89 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -266,16 +266,7 @@ void TlenProtocol::initMenuItems() CLISTMENUITEM mi = { 0 }; mi.pszContactOwner = m_szModuleName; - - mi.ptszName = m_tszUserName; - mi.position = -1999901009; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; - mi.icolibItem = GetIconHandle(IDI_TLEN); - hMenuRoot = Menu_AddMainMenuItem(&mi); - - mi.flags = CMIF_ROOTHANDLE; - mi.hParentMenu = (HGENMENU)hMenuRoot; + mi.hParentMenu = hMenuRoot = Menu_CreateRoot(MO_MAIN, m_tszUserName, -1999901009, GetIconHandle(IDI_TLEN)); mi.pszService = text; hMenuChats = NULL; diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 34f00da9ec..6aab96385e 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -88,20 +88,13 @@ int CToxProto::OnInitStatusMenu() { mi.ptszName = m_tszUserName; mi.position = -1999901006; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = Skin_GetIconHandle("main"); - hStatusMunuRoot = /*m_hMenuRoot = */Menu_AddProtoMenuItem(&mi); + hStatusMunuRoot = Menu_AddProtoMenuItem(&mi); } - /*else - { - if (m_hMenuRoot) - Menu_RemoveItem(m_hMenuRoot, 0); - m_hMenuRoot = NULL; - }*/ mi.hParentMenu = hStatusMunuRoot; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; // Create copy tox id command mir_strcpy(tDest, "/CopyToxID"); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 5870a8f12f..2dbbf5f1f7 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -264,7 +264,7 @@ int TwitterProto::OnBuildStatusMenu(WPARAM, LPARAM) mi.pszService = text; mi.hParentMenu = hRoot; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.position = 1001; Menu_AddStatusMenuItem(&mi); diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 5b626653f8..dfd5bfcea4 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -195,7 +195,6 @@ void CVkProto::InitMenus() char szService[100]; // Proto menu - mi.flags = CMIF_ROOTHANDLE; mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName); mir_snprintf(szService, "%s%s", m_szModuleName, PS_CREATECHAT); @@ -305,7 +304,6 @@ void CVkProto::InitMenus() mi.pszService = szService; g_hContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi); - mi.flags |= CMIF_ROOTHANDLE; mi.hParentMenu = g_hContactMenuItems[CMI_GETSERVERHISTORY]; mir_snprintf(szService, "%s%s", m_szModuleName, PS_GETSERVERHISTORYLAST1DAY); diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 68c1602f27..d802870dad 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -57,8 +57,7 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam) HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.position = 500085000; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | (isOnline() ? 0 : CMIF_GRAYED); + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | (isOnline() ? 0 : CMIF_GRAYED); mi.icolibItem = GetIconHandle("whatsApp"); mi.ptszName = m_tszUserName; hRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi); @@ -70,7 +69,7 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam) } } - mi.flags = CMIF_ROOTHANDLE | (isOnline() ? 0 : CMIF_GRAYED); + mi.flags = (isOnline() ? 0 : CMIF_GRAYED); mi.position = 201001; CreateProtoService("/CreateGroup", &WhatsAppProto::OnCreateGroup); diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 8f7f7b6d7f..8abedcb60c 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -437,8 +437,7 @@ void Xfire_game::createMenuitem(unsigned int pos, int dbid) dbid = pos; CLISTMENUITEM mi = { 0 }; - // mi.popupPosition = 500084000; !!!!!!!!!!!!!!!!!!!!!!!! - mi.pszPopupName = Translate("Start game"); + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENW("Start game"), 500084000); mi.pszContactOwner = protocolname; mir_snprintf(temp, _countof(temp), servicefunction, this->id); diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp index 624e79a184..344289044a 100644 --- a/protocols/Xfire/src/Xfire_gamelist.cpp +++ b/protocols/Xfire/src/Xfire_gamelist.cpp @@ -242,11 +242,10 @@ void Xfire_gamelist::clearGamelist() { void Xfire_gamelist::createDummyMenuItem() { CLISTMENUITEM mi = { 0 }; + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENW("Start game"), 500084000); mi.position = 500090001; mi.pszName = Translate("Please wait..."); mi.hIcon = LoadIcon(hinstance, MAKEINTRESOURCE(ID_OP)); - // mi.popupPosition = 500084000; !!!!!!!!!!!!!!!!!!!!!!! - mi.pszPopupName = Translate("Start game"); mi.pszContactOwner = protocolname; dummymenuitem = Menu_AddMainMenuItem(&mi); } diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index ab71efc9ee..ab06f85b5c 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -1114,7 +1114,7 @@ extern "C" __declspec(dllexport) int Load(void) // erweiterte Kontextmenüpunkte CLISTMENUITEM mi = { 0 }; - mi.ptszPopupName = _T(protocolname); + mi.hParentMenu = Menu_CreateRoot(MO_CONTACT, _T(protocolname), 500090000); mi.flags = CMIF_TCHAR; char servicefunction[100]; @@ -1188,6 +1188,7 @@ extern "C" __declspec(dllexport) int Load(void) blockfriend = Menu_AddContactMenuItem(&mi); // my fire profile + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, _T(protocolname), 500090000); mir_strcpy(servicefunction, protocolname); mir_strcat(servicefunction, "GotoProfile2"); CreateServiceFunction(servicefunction, GotoProfile2); diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 644de2d398..a66b451843 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -368,19 +368,19 @@ void CYahooProto::MenuMainInit(void) HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.position = 500015000; - mi.hParentMenu = HGENMENU_ROOT; - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = GetIconHandle(IDI_YAHOO); mi.ptszName = m_tszUserName; hRoot = mainMenuRoot = Menu_AddProtoMenuItem(&mi); } else { - if (mainMenuRoot) + if (mainMenuRoot) { Menu_RemoveItem(mainMenuRoot); - mainMenuRoot = NULL; + mainMenuRoot = NULL; + } } - mi.flags = CMIF_ROOTHANDLE; + mi.flags = 0; mi.hParentMenu = hRoot; // Show custom status menu diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index d71ff4c9b1..95fbab090f 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -75,8 +75,7 @@ int LoadHelpModule(void) CLISTMENUITEM mi = { 0 }; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); - mi.pszPopupName = LPGEN("&Help"); - // mi.popupPosition = 2000090000; !!!!!!!!!!!!!!!!!!!! + mi.hParentMenu = Menu_CreateRoot(MO_MAIN, LPGENT("&Help"), 2000090000); mi.position = 2000090000; mi.pszName = LPGEN("&About..."); mi.pszService = "Help/AboutCommand"; diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index 5103f02de3..a3343b8506 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -44,10 +44,8 @@ typedef struct { } CListIntMenuItem, *lpCListIntMenuItem; -//new menu sys -HANDLE hMainMenuObject = 0; -HANDLE hContactMenuObject = 0; -HANDLE hStatusMenuObject = 0; +// new menu sys +int hMainMenuObject = 0, hContactMenuObject = 0, hStatusMenuObject = 0; int UnloadMoveToGroup(void); int statustopos(int status); @@ -255,20 +253,14 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) if (!cli.pfnConvertMenu(mi, &tmi)) return 0; - if (!(mi->flags & CMIF_ROOTHANDLE)) { - //old system - tmi.flags |= CMIF_ROOTHANDLE; - tmi.root = NULL; - } - - //owner data + // owner data ContactMenuExecParam *cmep = (ContactMenuExecParam*)mir_calloc(sizeof(ContactMenuExecParam)); cmep->szServiceName = mir_strdup(mi->pszService); if (mi->pszContactOwner != NULL) cmep->pszContactOwner = mir_strdup(mi->pszContactOwner); tmi.ownerdata = cmep; - //may be need to change how UniqueName is formed? + // may be need to change how UniqueName is formed? TMO_IntMenuItem *pimi = Menu_AddItem(hContactMenuObject, &tmi); cmep->pimi = pimi; @@ -798,7 +790,7 @@ void RebuildMenuOrder(void) //adding root TMO_MenuItem tmi = { 0 }; - tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED; + tmi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; tmi.position = pos++; tmi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); @@ -816,7 +808,7 @@ void RebuildMenuOrder(void) TMO_IntMenuItem *rootmenu = Menu_AddItem(hStatusMenuObject, &tmi); memset(&tmi, 0, sizeof(tmi)); - tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED; + tmi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; tmi.root = rootmenu; tmi.position = pos++; tmi.hIcon = ic; @@ -859,7 +851,7 @@ void RebuildMenuOrder(void) // adding memset(&tmi, 0, sizeof(tmi)); - tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + tmi.flags = CMIF_TCHAR; if (statusModeList[j] == ID_STATUS_OFFLINE) tmi.flags |= CMIF_CHECKED; tmi.root = rootmenu; @@ -902,7 +894,7 @@ void RebuildMenuOrder(void) continue; TMO_MenuItem tmi = { sizeof(tmi) }; - tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + tmi.flags = CMIF_TCHAR; if (statusModeList[j] == ID_STATUS_OFFLINE) tmi.flags |= CMIF_CHECKED; @@ -982,12 +974,12 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) // reset all current possible checked statuses for (int pos2 = 0; pos2 < hStatusMainMenuHandlesCnt; pos2++) if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt) - Menu_ModifyItem(hStatusMainMenuHandles[pos2], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE); + Menu_ModifyItem(hStatusMainMenuHandles[pos2], NULL, INVALID_HANDLE_VALUE, 0); cli.currentStatusMenuItem = overallStatus; pos = statustopos(cli.currentStatusMenuItem); if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) - Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE | CMIF_CHECKED); + Menu_SetChecked(hStatusMainMenuHandles[pos], true); } else { int pos = statustopos(cli.currentStatusMenuItem); @@ -995,7 +987,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) pos = 0; if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) - Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE); + Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, 0); cli.currentStatusMenuItem = 0; } @@ -1007,13 +999,13 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) if (pos == -1) pos = 0; for (pos = 0; pos < _countof(statusModeList); pos++) - Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE); + Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, 0); } if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + _countof(statusModeList)) { int pos = statustopos((int)ack->lParam); if (pos >= 0 && pos < _countof(statusModeList)) - Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE | CMIF_CHECKED); + Menu_SetChecked(hStatusMenuHandles[i].menuhandle[pos], true); } break; } @@ -1063,47 +1055,14 @@ HGENMENU fnGetProtocolMenu(const char* proto) ///////////////////////////////////////////////////////////////////////////////////////// -static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) +static INT_PTR AddStatusMenuItem(WPARAM, LPARAM lParam) { - CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; - TMO_MenuItem tmi; + CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam; if (!cli.pfnConvertMenu(mi, &tmi)) return 0; - // for new style menus the pszPopupName contains the root menu handle - TMO_IntMenuItem *pRoot = NULL; - if (mi->flags & CMIF_ROOTHANDLE) - pRoot = MO_GetIntMenuItem(mi->hParentMenu); - - // for old style menus the pszPopupName really means the popup name - else { - MenuProto *mp = FindProtocolMenu(mi->pszContactOwner); - if (mp && mi->pszPopupName) { - if (mp->pMenu) { - TCHAR *ptszName = (mi->flags & CMIF_UNICODE) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName); - pRoot = MO_RecursiveWalkMenu(mp->pMenu->submenu.first, FindRoot, ptszName); - mir_free(ptszName); - } - if (pRoot == NULL) { - TMO_MenuItem tmi = { 0 }; - tmi.flags = (mi->flags & CMIF_UNICODE) | CMIF_ROOTHANDLE; - tmi.position = 1001; - tmi.root = mp->pMenu; - tmi.hIcon = NULL; - tmi.name.a = mi->pszPopupName; - pRoot = Menu_AddItem(hStatusMenuObject, &tmi); - } - - tmi.flags |= CMIF_ROOTHANDLE; - tmi.root = pRoot; - } - } - - if (wParam) { - int *res = (int*)wParam; - *res = (int)pRoot; - } + TMO_IntMenuItem *pRoot = MO_GetIntMenuItem(mi->hParentMenu); // owner data StatusMenuExecParam *smep = NULL; diff --git a/src/mir_app/src/framesmenu.cpp b/src/mir_app/src/framesmenu.cpp index 34061566ae..20c89ce1e1 100644 --- a/src/mir_app/src/framesmenu.cpp +++ b/src/mir_app/src/framesmenu.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -static HANDLE hFrameMenuObject; +static int hFrameMenuObject; static HANDLE hPreBuildFrameMenuEvent; // contactmenu exec param(ownerdata) @@ -52,7 +52,7 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam) if (!cli.pfnConvertMenu(mi, &tmi)) return NULL; - tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL; + tmi.root = mi->hParentMenu; FrameMenuExecParam *fmep = new FrameMenuExecParam(); fmep->szServiceName = mir_strdup(mi->pszService); diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index ae4b414d15..f4b2529f7a 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -67,8 +67,19 @@ void FreeAndNil(void **p) } } -int GetMenuObjbyId(const int id) +int GetMenuObjbyId(int id) { + switch (id) { + case MO_MAIN: id = hMainMenuObject; break; + case MO_CONTACT: id = hContactMenuObject; break; + case MO_STATUS: id = hStatusMenuObject; break; + case MO_PROTO: + if (db_get_b(NULL, "CList", "MoveProtoMenus", true)) + id = hStatusMenuObject; + else + id = hMainMenuObject; + } + for (int i = 0; i < g_menus.getCount(); i++) if (g_menus[i]->id == id) return i; @@ -192,13 +203,13 @@ int MO_RemoveAllObjects() ///////////////////////////////////////////////////////////////////////////////////////// -EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(HANDLE hMenuObject, int key) +EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessHotKey(int hMenuObject, int key) { if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); - int objidx = GetMenuObjbyId((int)hMenuObject); + int objidx = GetMenuObjbyId(hMenuObject); if (objidx == -1) return FALSE; @@ -290,9 +301,9 @@ static void Menu_SetItemFlags(HGENMENU hMenuItem, bool bSet, int mask) else flags &= ~mask; + // we allow to set only first 3 bits mir_cslock lck(csMenuHook); - int oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE); - pimi->mi.flags = flags | oldflags; + pimi->mi.flags = flags | (pimi->mi.flags & 0xFFFFFFF8); } MIR_APP_DLL(void) Menu_EnableItem(HGENMENU hMenuItem, bool bEnable) @@ -327,8 +338,9 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HAND replaceStrT(pimi->mi.name.t, ptszName); if (iFlags != -1) { - int oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE); - pimi->mi.flags = iFlags | oldflags; + // we allow to set only first 3 bits + int oldflags = (pimi->mi.flags & 0xFFFFFFF8); + pimi->mi.flags = (iFlags & 0x07) | oldflags; } if (hIcon != INVALID_HANDLE_VALUE && !bIconsDisabled) { @@ -480,14 +492,14 @@ MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value) ///////////////////////////////////////////////////////////////////////////////////////// -MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE handle, int setting, INT_PTR value) +MIR_APP_DLL(int) Menu_ConfigureObject(int hMenuObject, int setting, INT_PTR value) { if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); - int pimoidx = GetMenuObjbyId((int)handle); + int pimoidx = GetMenuObjbyId(hMenuObject); int res = pimoidx != -1; if (res) { TIntMenuObject* pmo = g_menus[pimoidx]; @@ -519,7 +531,7 @@ MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE handle, int setting, INT_PTR value) ///////////////////////////////////////////////////////////////////////////////////////// -MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService) +MIR_APP_DLL(int) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService) { if (!bIsGenMenuInited || szName == NULL) return NULL; @@ -534,18 +546,18 @@ MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR s p->ExecService = mir_strdup(szExecService); p->m_hMenuIcons = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 15, 100); g_menus.insert(p); - return (HANDLE)p->id; + return p->id; } ///////////////////////////////////////////////////////////////////////////////////////// -MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject) +MIR_APP_DLL(int) Menu_RemoveObject(int hMenuObject) { - if (!bIsGenMenuInited || hMenuObject == NULL) + if (!bIsGenMenuInited || hMenuObject == 0) return -1; mir_cslock lck(csMenuHook); - int objidx = GetMenuObjbyId((int)hMenuObject); + int objidx = GetMenuObjbyId(hMenuObject); if (objidx == -1) return -1; @@ -654,36 +666,46 @@ static int GetNextObjectMenuItemId() // Adds new submenu // Returns a handle to the newly created root item or NULL -MIR_APP_DLL(HGENMENU) Menu_CreateRoot(HGENMENU hRoot, LPCTSTR ptszName, int position, HANDLE hIcoLib, int hLang) +static 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)) + return TRUE; + + return FALSE; +} + +MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib, int hLang) { - if (hRoot == NULL) + mir_cslock lck(csMenuHook); + int objidx = GetMenuObjbyId(hMenuObject); + if (objidx == -1) return NULL; + TMO_IntMenuItem *oldroot = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindRoot, (void*)ptszName); + if (oldroot != NULL) + return oldroot; + TMO_MenuItem tmi = { 0 }; - tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; + tmi.flags = CMIF_TCHAR; tmi.hIcolibItem = hIcoLib; - tmi.root = hRoot; tmi.hLangpack = hLang; tmi.name.t = (TCHAR*)ptszName; tmi.position = position; - return Menu_AddItem(hRoot->owner, &tmi); + return Menu_AddItem(hMenuObject, &tmi); } ///////////////////////////////////////////////////////////////////////////////////////// // Adds new menu item // Returns a handle to the newly created item or NULL -MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pmi) +MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi) { if (!bIsGenMenuInited || pmi == NULL) return NULL; - // old mode - if (!(pmi->flags & CMIF_ROOTHANDLE)) - return MO_AddOldNewMenuItem(hMenuObject, pmi); - mir_cslock lck(csMenuHook); - int objidx = GetMenuObjbyId((int)hMenuObject); + int objidx = GetMenuObjbyId(hMenuObject); if (objidx == -1) return NULL; @@ -719,10 +741,13 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pmi) p->mi.root = NULL; TMO_IntMenuItem *pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL; - if (pRoot) + if (pRoot) { p->owner = &pRoot->submenu; - else - p->owner = &pmo->m_items; + + if (pRoot->iconId == -1) + pRoot->iconId = p->iconId; + } + else p->owner = &pmo->m_items; if (!p->owner->first) p->owner->first = p; @@ -736,62 +761,6 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pmi) // wparam = MenuObjectHandle // lparam = PMO_MenuItem -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)) - return TRUE; - - return FALSE; -} - -TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi) -{ - if (!bIsGenMenuInited || pmi == NULL) - return NULL; - - int objidx = GetMenuObjbyId((int)menuobjecthandle); - if (objidx == -1) - return NULL; - - if (pmi->flags & CMIF_ROOTHANDLE) - return NULL; - - //is item with popup or not - if (pmi->root == 0) { - // yes, this without popup - pmi->root = NULL; //first level - } - else { // no, search for needed root and create it if need - TCHAR* tszRoot; - if (pmi->flags & CMIF_UNICODE) - tszRoot = mir_tstrdup((TCHAR*)pmi->root); - else - tszRoot = mir_a2t((char*)pmi->root); - - TMO_IntMenuItem *oldroot = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindRoot, tszRoot); - mir_free(tszRoot); - - if (oldroot == NULL) { - // not found, creating root - TMO_MenuItem tmi = *pmi; - tmi.flags |= CMIF_ROOTHANDLE; - tmi.ownerdata = 0; - tmi.root = NULL; - // copy pszPopupName - tmi.name.t = (TCHAR*)pmi->root; - if ((oldroot = Menu_AddItem(menuobjecthandle, &tmi)) != NULL) - Menu_ConfigureItem(oldroot, MCI_OPT_UNIQUENAME, (const char*)pmi->root); - } - pmi->root = oldroot; - - // popup will be created in next commands - } - pmi->flags |= CMIF_ROOTHANDLE; - // add popup(root allready exists) - return Menu_AddItem(menuobjecthandle, pmi); -} - static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi) { MENUITEMINFO mii = { 0 }; @@ -1037,14 +1006,14 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, INT_PTR // lparam ListParam* // result hMenu -EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, HANDLE hMenuObject, WPARAM wParam, LPARAM lParam) +EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, int hMenuObject, WPARAM wParam, LPARAM lParam) { if (!bIsGenMenuInited) return NULL; mir_cslock lck(csMenuHook); - int pimoidx = GetMenuObjbyId(int(hMenuObject)); + int pimoidx = GetMenuObjbyId(hMenuObject); if (pimoidx == -1) return 0; diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 93909aab18..6c6be6aeae 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -107,8 +107,6 @@ void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSiz TMO_IntMenuItem* MO_GetIntMenuItem(HGENMENU); -TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi); - int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis); int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis); @@ -124,8 +122,6 @@ TMO_IntMenuItem *MO_RecursiveWalkMenu(TMO_IntMenuItem*, pfnWalkFunc, void*); int InitGenMenu(); int UnitGenMenu(); -int FindRoot(TMO_IntMenuItem *pimi, void* param); - TMO_IntMenuItem * GetMenuItemByGlobalID(int globalMenuID); BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index d4bb4734ae..28f321a63b 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -397,12 +397,12 @@ void InitMenus() hMenuDelete = Menu_AddContactMenuItem(&mi); mi.position = -99000; - mi.flags = CMIF_HIDDEN | CMIF_ROOTHANDLE; + mi.flags = CMIF_HIDDEN; mi.icolibItem = 0; mi.pszName = LPGEN("Subcontacts"); hMenuRoot = Menu_AddContactMenuItem(&mi); - mi.flags = CMIF_HIDDEN | CMIF_ROOTHANDLE; + mi.flags = CMIF_HIDDEN; mi.hParentMenu = hMenuRoot; for (int i = 0; i < MAX_CONTACTS; i++) { mi.position--; diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index 7d1edbee87..aba85570c5 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -122,7 +122,7 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon /**** clistmenus.cpp ********************************************************************/ -extern HANDLE hMainMenuObject, hContactMenuObject, hStatusMenuObject; +extern int hMainMenuObject, hContactMenuObject, hStatusMenuObject; extern HANDLE hPreBuildMainMenuEvent, hPreBuildContactMenuEvent; extern HANDLE hShutdownEvent, hPreShutdownEvent; diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index 311c72a629..7deca5d376 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -71,7 +71,7 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo mi.hParentMenu = hRoot; mi.position = pos; mi.ptszName = PrepareGroupName(name); - mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; if (checked) mi.flags |= CMIF_CHECKED; mi.pszService = MTG_MOVE; @@ -91,7 +91,6 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) CLISTMENUITEM mi = { 0 }; mi.position = 100000; mi.pszName = LPGEN("&Move to group"); - mi.flags = CMIF_ROOTHANDLE; mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP); hMoveToGroupItem = Menu_AddContactMenuItem(&mi); -- cgit v1.2.3