From 7d3d5e16b4e5378a751576095771c2a75b7276fb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 23 Jun 2015 12:43:36 +0000 Subject: - Menu_ConfigureItem replaced MO_SETOPTIONSMENUITEM; - Menu_ConfigureObject replaced MO_SETOPTIONSMENUOBJECT; - TIntMenuObject::hotkey replaced TMenuObject::hotkey git-svn-id: http://svn.miranda-ng.org/main/trunk@14349 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_app.lib | Bin 56810 -> 57544 bytes bin10/lib/mir_app64.lib | Bin 55510 -> 56178 bytes bin12/lib/mir_app.lib | Bin 56810 -> 57544 bytes bin12/lib/mir_app64.lib | Bin 55510 -> 56178 bytes include/delphi/m_clist.inc | 1 - include/delphi/m_genmenu.inc | 50 +++++------- include/m_clist.h | 1 - include/m_genmenu.h | 84 +++++++++------------ plugins/CSList/src/cslist.cpp | 2 +- plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp | 2 +- plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp | 36 ++++----- plugins/Clist_modern/src/modern_clistmenus.cpp | 6 +- plugins/Clist_modern/src/modern_clisttray.cpp | 15 ++-- plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp | 2 +- plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp | 34 ++++----- plugins/FloatingContacts/src/thumbs.cpp | 8 +- plugins/HistoryStats/src/mu_common.cpp | 6 +- plugins/HistoryStats/src/mu_common.h | 4 +- plugins/MirOTR/src/mirotrmenu.cpp | 6 +- plugins/UserInfoEx/src/mir_menuitems.cpp | 56 +++++++------- protocols/AimOscar/src/theme.cpp | 2 +- protocols/FacebookRM/src/theme.cpp | 2 +- protocols/Gadu-Gadu/src/gg.cpp | 2 +- protocols/IRCG/src/services.cpp | 2 +- protocols/JabberG/src/jabber_menu.cpp | 2 +- protocols/JabberG/src/jabber_privacy.cpp | 2 +- protocols/JabberG/src/jabber_xstatus.cpp | 2 +- protocols/MRA/src/Mra_menus.cpp | 2 +- protocols/MSN/src/msn_menu.cpp | 2 +- protocols/SkypeWeb/src/skype_menus.cpp | 2 +- protocols/Steam/src/steam_menus.cpp | 2 +- protocols/Tox/src/tox_menus.cpp | 2 +- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/WhatsApp/src/theme.cpp | 2 +- protocols/Yahoo/src/services.cpp | 2 +- src/mir_app/src/clistmenus.cpp | 34 ++++----- src/mir_app/src/genmenu.cpp | 66 ++++++---------- src/mir_app/src/genmenu.h | 3 +- src/mir_app/src/mir_app.def | 3 + src/mir_app/src/mir_app64.def | 3 + 40 files changed, 190 insertions(+), 262 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index 9de335094d..e51c9ce2b0 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index e1e0681969..7a07daad19 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index 9de335094d..e51c9ce2b0 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index e1e0681969..7a07daad19 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index cf5df8da4b..c92f468a82 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -64,7 +64,6 @@ type // or hParentMenu:HGENMENU - valid if CMIF_ROOTHANDLE is set. NULL or (HGENMENU)-1 means the root menu popupPosition : int; // position of the popup menu on the root menu, ignored // if pszPopupName is NULL(0) or if the popup menu already exists - hotKey : dword; // keyboard accelerator, same as lParam of WM_HOTKEY, 0 for none 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. diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc index a8d54d8edb..e17a9a2a56 100644 --- a/include/delphi/m_genmenu.inc +++ b/include/delphi/m_genmenu.inc @@ -200,7 +200,6 @@ type szName :TCHAR; flags :integer; hIcon :HICON; // or hIcolibItem:THANDLE; - hotKey :dword; ownerdata:^pointer; hLangpack:int; end; @@ -370,54 +369,39 @@ const MO_MEASUREMENUITEM:PAnsiChar = 'MO/MeasureMenuItem'; { - set uniq name to menuitem(used to store it in database when enabled OPT_USERDEFINEDITEMS) -} - OPT_MENUITEMSETUNIQNAME = 1; -{ - Set FreeService for menuobject. When freeing menuitem it will be called with - wParam=MenuItemHandle - lParam=mi.ownerdata -} - OPT_MENUOBJECT_SET_FREE_SERVICE = 2; - -{ - Set onAddService for menuobject. + sets an option for the whole menu object + returns TRUE if it processed the command, FALSE otherwise } - OPT_MENUOBJECT_SET_ONADD_SERVICE = 3; +const + OPT_MENUITEMSETUNIQNAME = 1; // sets uniq name to menuitem(used to store it in database when enabled OPT_USERDEFINEDITEMS) + OPT_MENUOBJECT_SET_FREE_SERVICE = 2; // sets FreeService for menuobject. + OPT_MENUOBJECT_SET_ONADD_SERVICE = 3; // sets onAddService for menuobject. OPT_MENUOBJECT_SET_CHECK_SERVICE = 4; -//enable ability user to edit menuitems via options page. - OPT_USERDEFINEDITEMS = 1; - -type - POptParam = ^TOptParam; - TOptParam = record - Handle :THANDLE; - Setting:int; - Value :int_ptr; - end; +function Menu_ConfigureObject(menu:THANDLE; option:integer; value:PAnsiChar) : integer; stdcall; + external AppDLL name 'Menu_ConfigureObject'; -const { wparam=0 lparam=*lpOptParam returns TRUE if it processed the command, FALSE otherwise } - MO_SETOPTIONSMENUOBJECT:PAnsiChar = 'MO/SetOptionsMenuObject'; -{ - wparam=0 - lparam=*lpOptParam - returns TRUE if it processed the command, FALSE otherwise -} - MO_SETOPTIONSMENUITEM:PAnsiChar = 'MO/SetOptionsMenuItem'; +const + OPT_USERDEFINEDITEMS = 1; // enables ability user to edit menuitems via options page. + OPT_HOTKEY = 2; + +function Menu_ConfigureItem(menu:THANDLE; option:integer; value:int_ptr) : integer; stdcall; + external AppDLL name 'Menu_ConfigureItem'; { wparam=char* szProtoName lparam=0 returns HGENMENU of the root item or NULL } - MO_GETPROTOROOTMENU:PAnsiChar = 'MO/GetProtoRootMenu'; + +function Menu_GetProtocolRoot(const proto:PAnsiChar) : integer; stdcall; + external AppDLL name 'Menu_GetProtocolRoot'; {$ENDIF} diff --git a/include/m_clist.h b/include/m_clist.h index 049d37a7f1..82c11dd553 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -110,7 +110,6 @@ struct CLISTMENUITEM int popupPosition; //position of the popup menu on the root menu. Ignored //if pszPopupName is NULL or the popup menu already //existed - DWORD hotKey; //keyboard accelerator, same as lParam of WM_HOTKEY, 0 for none 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 diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 2b29a4bb51..78ea963bbd 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -193,7 +193,6 @@ struct TMO_MenuItem HICON hIcon; HANDLE hIcolibItem; }; - DWORD hotKey; void *ownerdata; int hLangpack; }; @@ -282,23 +281,6 @@ typedef struct //this should be called in WM_KEYDOWN #define MO_PROCESSHOTKEYS "MO/ProcessHotKeys" -//set uniq name to menuitem(used to store it in database when enabled OPT_USERDEFINEDITEMS) -#define OPT_MENUITEMSETUNIQNAME 1 - -//Set FreeService for menuobject. When freeing menuitem it will be called with -//wParam=MenuItemHandle -//lParam=mi.ownerdata -#define OPT_MENUOBJECT_SET_FREE_SERVICE 2 - -//Set onAddService for menuobject. -#define OPT_MENUOBJECT_SET_ONADD_SERVICE 3 - -//Set menu check service -#define OPT_MENUOBJECT_SET_CHECK_SERVICE 4 - -//enable ability user to edit menuitems via options page. -#define OPT_USERDEFINEDITEMS 1 - // szName = unique menu object identifier // szDisplayName = menu display name (auto-translated by core) // szCheckService = this service called when module build menu(MO_BUILDMENU). @@ -328,45 +310,51 @@ __forceinline HANDLE MO_CreateMenuObject(LPCSTR szName, LPCSTR szDisplayName, LP //call this service.MO_REMOVEMENUOBJECT NOT free it. #define MO_REMOVEMENUOBJECT "MO/RemoveMenuObject" -// wparam=0 -// lparam=*lpOptParam +///////////////////////////////////////////////////////////////////////////////////////// +// tunes the whold menu object // returns TRUE if it processed the command, FALSE otherwise -#define MO_SRV_SETOPTIONSMENUOBJECT "MO/SetOptionsMenuObject" -typedef struct tagOptParam -{ - HANDLE Handle; - int Setting; - INT_PTR Value; -} - OptParam,*lpOptParam; +// enable ability user to edit menuitems via options page. +#define MCO_OPT_USERDEFINEDITEMS 1 -__forceinline void MO_SetMenuObjectParam(HANDLE hMenu, int iSetting, int iValue) -{ - OptParam param = { hMenu, iSetting, iValue }; - CallService(MO_SRV_SETOPTIONSMENUOBJECT, 0, (LPARAM)¶m); -} -__forceinline void MO_SetMenuObjectParam(HANDLE hMenu, int iSetting, LPCSTR pszValue) -{ - OptParam param = { hMenu, iSetting, (INT_PTR)pszValue }; - CallService(MO_SRV_SETOPTIONSMENUOBJECT, 0, (LPARAM)¶m); +// Set FreeService for menuobject. When freeing menuitem it will be called with +// wParam=MenuItemHandle +// lParam=mi.ownerdata +#define MCO_OPT_FREE_SERVICE 2 + +// Set onAddService for menuobject. +#define MCO_OPT_ONADD_SERVICE 3 + +// 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); + +__forceinline int Menu_ConfigureObject(HANDLE hMenu, int iSetting, LPCSTR pszValue) +{ return Menu_ConfigureObject(hMenu, iSetting, INT_PTR(pszValue)); } -//wparam=0 -//lparam=*lpOptParam -//returns TRUE if it processed the command, FALSE otherwise -#define MO_SETOPTIONSMENUITEM "MO/SetOptionsMenuItem" +///////////////////////////////////////////////////////////////////////////////////////// +// tunes a menu item +// returns TRUE if it processed the command, FALSE otherwise -//wparam=char* szProtoName -//lparam=0 -//returns HGENMENU of the root item or NULL -#define MO_GETPROTOROOTMENU "MO/GetProtoRootMenu" +#define MCI_OPT_UNIQUENAME 1 // a unique name to menuitem(used to store it in database when enabled OPT_USERDEFINEDITEMS) +#define MCI_OPT_HOTKEY 2 // DWORD value = MAKELONG(VK_*, VK_SHIFT) -__forceinline HGENMENU MO_GetProtoRootMenu( const char* szProtoName ) -{ - return ( HGENMENU )CallService( MO_GETPROTOROOTMENU, ( WPARAM )szProtoName, 0 ); +EXTERN_C MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value); + +__forceinline int Menu_ConfigureItem(HGENMENU hMenu, int iSetting, LPCSTR pszValue) +{ return Menu_ConfigureItem(hMenu, iSetting, INT_PTR(pszValue)); } +///////////////////////////////////////////////////////////////////////////////////////// +// returns HGENMENU of the root item or NULL + +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(const char *szProtoName); + +///////////////////////////////////////////////////////////////////////////////////////// +// kills all menu items & submenus that belong to the hLangpack given + EXTERN_C MIR_APP_DLL(void) KillModuleMenus(int hLangpack); #endif diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 2714c2fdb7..68119b7f9b 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -229,7 +229,7 @@ void addProtoStatusMenuItem(char *protoName) if (pdescr == NULL) return; - HGENMENU hRoot = MO_GetProtoRootMenu(pdescr->szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(pdescr->szModuleName); if (hRoot == NULL) return; diff --git a/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp index 4f11a5d83d..a8d4a70d58 100644 --- a/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp @@ -111,6 +111,6 @@ int InitFramesMenus(void) // frame menu object hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService"); - MO_SetMenuObjectParam(hFrameMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "FrameMenuFreeService"); + Menu_ConfigureObject(hFrameMenuObject, MCO_OPT_FREE_SERVICE, "FrameMenuFreeService"); return 0; } diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp index fd4d0f60db..57cf2ac25f 100644 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp @@ -84,15 +84,12 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam) } tmi.ownerdata = mmep; + HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi); + char buf[1024]; mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); - return (INT_PTR)op.Handle; + Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf); + return (INT_PTR)hNewItem; } int GroupMenuCheckService(WPARAM, LPARAM) @@ -229,9 +226,9 @@ void GroupMenus_Init(void) // Group menu hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService"); - MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu"); - MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService"); + Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu"); + Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService"); //add exit command to menu GroupMenuParam gmp; @@ -395,15 +392,12 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam) } tmi.ownerdata = mmep; + HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi); + char buf[1024]; mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); - return (INT_PTR)op.Handle; + Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf); + return (INT_PTR)hNewItem; } INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM) @@ -477,10 +471,10 @@ void InitSubGroupMenus(void) // SubGroup menu hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService"); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService"); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService"); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService"); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService"); // add exit command to menu GroupMenuParam gmp; diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index 809bb75508..0962902ba1 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -121,11 +121,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) bModifyMenu = TRUE; } - OptParam op; - op.Handle = hFavoriteContactMenu; - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)"ModernClistMenu_ContactRate"; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); + Menu_ConfigureObject(hFavoriteContactMenu, MCI_OPT_UNIQUENAME, "ModernClistMenu_ContactRate"); mi.hParentMenu = hFavoriteContactMenu; if (!hFavoriteContactMenuItems) { diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 47c96ad7f7..7854a6abfa 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -181,12 +181,9 @@ static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam) tmi.ownerdata = mir_strdup(mi->pszService); - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)mi->pszService; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); - return (INT_PTR)op.Handle; + HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi); + Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, mi->pszService); + return (INT_PTR)hNewItem; } INT_PTR TrayMenuonAddService(WPARAM wParam, LPARAM lParam) @@ -315,9 +312,9 @@ void InitTrayMenus(void) // Tray menu hTrayMenuObject = MO_CreateMenuObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService"); - MO_SetMenuObjectParam(hTrayMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetMenuObjectParam(hTrayMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu"); - MO_SetMenuObjectParam(hTrayMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService"); + Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu"); + Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService"); // add exit command to menu CLISTMENUITEM mi = { 0 }; diff --git a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp index c23a472b98..858c65dcf7 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp @@ -112,6 +112,6 @@ int InitFramesMenus(void) // frame menu object hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService"); - MO_SetMenuObjectParam(hFrameMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "FrameMenuFreeService"); + Menu_ConfigureObject(hFrameMenuObject, MCO_OPT_FREE_SERVICE, "FrameMenuFreeService"); return 0; } diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 279f6c1206..cbce3fa8a4 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -92,15 +92,12 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam) } tmi.ownerdata = mmep; + HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi); + char buf[1024]; mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); - return (INT_PTR)op.Handle; + Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf); + return (INT_PTR)hNewItem; } INT_PTR GroupMenuCheckService(WPARAM, LPARAM) @@ -244,9 +241,9 @@ void InitGroupMenus(void) //Group menu hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService"); - MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu"); - MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService"); + Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu"); + Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService"); // add exit command to menu GroupMenuParam gmp; @@ -405,15 +402,12 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam) } tmi.ownerdata = mmep; + HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi); + char buf[1024]; mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName); - - OptParam op; - op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi); - op.Setting = OPT_MENUITEMSETUNIQNAME; - op.Value = (INT_PTR)buf; - CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op); - return (INT_PTR)op.Handle; + Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf); + return (INT_PTR)hNewItem; } INT_PTR SubGroupMenuCheckService(WPARAM, LPARAM) @@ -494,9 +488,9 @@ void InitSubGroupMenus(void) // SubGroup menu hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService"); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"); - MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService"); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu"); + Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService"); { //add exit command to menu diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index a060262332..7101b78803 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -683,14 +683,14 @@ void ThumbInfo::OnTimer(BYTE idTimer) } } if (bEnableTip && fcOpt.bShowTip && idTimer == TIMERID_HOVER_T) { - POINT pt; - CLCINFOTIP ti = { 0 }; - ti.cbSize = sizeof(ti); - KillTimer(hwnd, TIMERID_HOVER_T); fTipTimerActive = FALSE; + + POINT pt; GetCursorPos(&pt); if (abs(pt.x - ptTipSt.x) < 5 && abs(pt.y - ptTipSt.y) < 5) { + CLCINFOTIP ti = { 0 }; + ti.cbSize = sizeof(ti); ti.ptCursor = pt; fTipActive = TRUE; diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index b2f7b9aa5a..0edf3fa601 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 */, int popupPosition /* = 0 */, DWORD hotKey /* = 0 */) + HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName /* = NULL */, int popupPosition /* = 0 */) { // TODO: support for unicode-core with unicode-aware CList CLISTMENUITEM mi = { 0 }; @@ -23,11 +23,10 @@ namespace mu mi.pszService = const_cast(pszService); mi.ptszPopupName = (TCHAR*)pszPopupName; mi.popupPosition = popupPosition; - mi.hotKey = hotKey; return Menu_AddMainMenuItem(&mi); } - HGENMENU addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey /* = 0 */, const char* pszContactOwner /* = NULL */) + HGENMENU addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const char* pszContactOwner /* = NULL */) { // TODO: support for unicode-core with unicode-aware CList CLISTMENUITEM mi = { 0 }; @@ -36,7 +35,6 @@ namespace mu mi.position = position; mi.hIcon = hIcon; mi.pszService = const_cast(pszService); - mi.hotKey = hotKey; mi.pszContactOwner = const_cast(pszContactOwner); return Menu_AddContactMenuItem(&mi); } diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index ec7e1d5447..080b0fb931 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -13,8 +13,8 @@ namespace mu namespace clist { - HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0); - HGENMENU addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey = 0, const char* pszContactOwner = NULL); + HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL, int popupPosition = 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/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index d65acdc67b..87807a5ee2 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -31,7 +31,6 @@ static INT_PTR AddMirOTRMenuItem(WPARAM, LPARAM lParam) tmi.flags = mi->flags; tmi.hIcon = mi->hIcon; tmi.hIcolibItem = mi->icolibItem; - tmi.hotKey = mi->hotKey; tmi.position = mi->position; tmi.name.t = mi->ptszName; tmi.root = mi->root; @@ -197,9 +196,8 @@ void InitMirOTRMenu(void) CreateServiceFunction(MS_MIROTR_REMOVEMIROTRMENUITEM, RemoveMirOTRMenuItem); hMirOTRMenuObject = MO_CreateMenuObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService"); - MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_USERDEFINEDITEMS, FALSE); - MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "MIROTRMENUS/FreeOwnerDataMirOTRMenu"); - MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "MIROTRMENUS/OnAddMenuItemMirOTRMenu"); + Menu_ConfigureObject(hMirOTRMenuObject, MCO_OPT_FREE_SERVICE, "MIROTRMENUS/FreeOwnerDataMirOTRMenu"); + Menu_ConfigureObject(hMirOTRMenuObject, MCO_OPT_ONADD_SERVICE, "MIROTRMENUS/OnAddMenuItemMirOTRMenu"); // menu items MIROTRMENUITEM mi = { 0 }; diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index c1b188ea00..50a5e46a8a 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -93,7 +93,7 @@ void RebuildContact() case 3: //cascade off mhRoot = mhExIm = HGENMENU_ROOT; - hMenuItem[item++] = NULL; + hMenuItem[0] = NULL; break; case 5: //cascade all @@ -102,7 +102,7 @@ void RebuildContact() mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN); mi.pszName = MODULELONGNAME; mhRoot = Menu_AddContactMenuItem(&mi); - hMenuItem[item++] = mhRoot; + hMenuItem[0] = mhRoot; mhExIm = mhRoot; break; case 9: @@ -112,7 +112,7 @@ void RebuildContact() mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXIMPORT); mi.pszName = LPGEN("Export/import contact"); mhExIm = Menu_AddContactMenuItem(&mi); - hMenuItem[item++] = mhExIm; + hMenuItem[0] = mhExIm; mhRoot = HGENMENU_ROOT; break; default: @@ -122,35 +122,31 @@ void RebuildContact() mi.popupPosition = NULL; // ContactDetailsPS's menuitem - { - mi.hParentMenu = mhRoot; - mi.pszService = MS_USERINFO_SHOWDIALOG; - mi.pszName = LPGEN("User &details"); - mi.position = 1000050000; - mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN); - mi.hotKey = MAKELPARAM(VK_F3, MOD_ALT); - hMenuItem[item++] = Menu_AddContactMenuItem(&mi); - mi.hotKey = NULL; - } - - // VCard's Ex/Import menuitems - { - mi.hParentMenu = mhExIm; + mi.hParentMenu = mhRoot; + mi.pszService = MS_USERINFO_SHOWDIALOG; + mi.pszName = LPGEN("User &details"); + mi.position = 1000050000; + mi.hIcon = IcoLib_GetIcon(ICO_COMMON_MAIN); + hMenuItem[1] = Menu_AddContactMenuItem(&mi); - // Export - mi.pszService = MS_USERINFO_VCARD_EXPORT; - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Export") : LPGEN("&Export user details"); - mi.position = 1000050200; - mi.hIcon = IcoLib_GetIcon(ICO_BTN_EXPORT); - hMenuItem[item++] = Menu_AddContactMenuItem(&mi); + Menu_ConfigureItem(hMenuItem[1], MCI_OPT_HOTKEY, MAKELPARAM(VK_F3, MOD_ALT)); - // Import - mi.pszService = MS_USERINFO_VCARD_IMPORT; - mi.pszName = mhExIm != HGENMENU_ROOT ? LPGEN("&Import") : LPGEN("&Import user details"); - mi.position = 1000050300; - mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); - hMenuItem[item++] = Menu_AddContactMenuItem(&mi); - } + // VCard's Ex/Import menuitems + mi.hParentMenu = mhExIm; + + // Export + mi.pszService = MS_USERINFO_VCARD_EXPORT; + mi.pszName = mhExIm != HGENMENU_ROOT ? 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.position = 1000050300; + mi.hIcon = IcoLib_GetIcon(ICO_BTN_IMPORT); + hMenuItem[3] = Menu_AddContactMenuItem(&mi); } /** diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index fbfaa67627..f23004803d 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -214,7 +214,7 @@ void CAimProto::InitMainMenus(void) CLISTMENUITEM mi = { 0 }; - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.icolibItem = GetIconHandle("aim"); diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 7d7c05cdcf..7b7392e49d 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -215,7 +215,7 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) CLISTMENUITEM mi = { 0 }; mi.pszService = text; - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { CLISTMENUITEM miRoot = { 0 }; miRoot.popupPosition = 500085000; diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index ffeb1ecc65..1cfffa77ee 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -265,7 +265,7 @@ void GGPROTO::menus_init() { CLISTMENUITEM mi = { 0 }; - HGENMENU hGCRoot, hCLRoot, hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hGCRoot, hCLRoot, hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.ptszName = m_tszUserName; mi.position = 500090000; diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index fc4a4ff834..37e3d70cc0 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -29,7 +29,7 @@ void CIrcProto::InitMainMenus(void) CLISTMENUITEM mi = { 0 }; mi.pszService = temp; - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { // Root popupmenuitem mi.ptszName = m_tszUserName; diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 32bccd1ad0..58e54e1297 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -593,7 +593,7 @@ void CJabberProto::MenuInit() CLISTMENUITEM mi = { 0 }; mi.pszService = text; - HGENMENU hJabberRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hJabberRoot = Menu_GetProtocolRoot(m_szModuleName); if (hJabberRoot == NULL) { mi.ptszName = m_tszUserName; mi.position = -1999901006; diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 7ade002960..1e3382f92d 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -2096,7 +2096,7 @@ void CJabberProto::BuildPrivacyMenu() mi.icolibItem = GetIconHandle(IDI_AGENTS); mi.flags = CMIF_ROOTPOPUP | CMIF_CHILDPOPUP | CMIF_HIDDEN; mi.pszName = LPGEN("Privacy Lists"); - mi.hParentMenu = MO_GetProtoRootMenu(m_szModuleName); + mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName); m_hPrivacyMenuRoot = Menu_AddProtoMenuItem(&mi); CreateProtoService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists); diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index bd78e108c4..4c4b472218 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -458,7 +458,7 @@ void CPepGuiService::InitGui() void CPepGuiService::RebuildMenu() { - HGENMENU hJabberRoot = MO_GetProtoRootMenu(m_proto->m_szModuleName); + HGENMENU hJabberRoot = Menu_GetProtocolRoot(m_proto->m_szModuleName); if (hJabberRoot == NULL) return; diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index c8f74bae05..740ab95550 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -335,7 +335,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI if (bIsMain) { fnAddFunc = Menu_AddProtoMenuItem; - hRootMenu = MO_GetProtoRootMenu(m_szModuleName); + hRootMenu = Menu_GetProtocolRoot(m_szModuleName); if (hRootMenu == NULL) { mi.ptszName = m_tszUserName; mi.hParentMenu = HGENMENU_ROOT; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index b6897742fc..67f742da1c 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -274,7 +274,7 @@ void CMsnProto::MsnInitMainMenu(void) CLISTMENUITEM mi = { 0 }; - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.popupPosition = 500085000; mi.hParentMenu = HGENMENU_ROOT; diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index 8f5cc22832..82b805699e 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -115,7 +115,7 @@ int CSkypeProto::OnInitStatusMenu() CLISTMENUITEM mi = { 0 }; mi.pszService = text; - HGENMENU hStatusMunuRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hStatusMunuRoot = Menu_GetProtocolRoot(m_szModuleName); if (!hStatusMunuRoot) { mi.ptszName = m_tszUserName; diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index e67c73b3ed..eeaec5377a 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -103,7 +103,7 @@ void CSteamProto::OnInitStatusMenu() CLISTMENUITEM mi = { 0 }; mi.pszService = text; - HGENMENU hSteamRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hSteamRoot = Menu_GetProtocolRoot(m_szModuleName); if (!hSteamRoot) { mi.ptszName = m_tszUserName; diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 62781c3046..6753214e3b 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -83,7 +83,7 @@ int CToxProto::OnInitStatusMenu() CLISTMENUITEM mi = { 0 }; mi.pszService = text; - HGENMENU hStatusMunuRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hStatusMunuRoot = Menu_GetProtocolRoot(m_szModuleName); if (!hStatusMunuRoot) { mi.ptszName = m_tszUserName; diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index edde181f3c..8652c96d2c 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -196,7 +196,7 @@ void CVkProto::InitMenus() // Proto menu mi.flags = CMIF_CHILDPOPUP; - mi.hParentMenu = MO_GetProtoRootMenu(m_szModuleName); + mi.hParentMenu = Menu_GetProtocolRoot(m_szModuleName); mir_snprintf(szService, "%s%s", m_szModuleName, PS_CREATECHAT); mi.pszService = szService; diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index ac5f6ff3ff..6851cc571f 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -54,7 +54,7 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { 0 }; mi.pszService = text; - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.popupPosition = 500085000; mi.hParentMenu = HGENMENU_ROOT; diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 8f283495a1..d935f50d16 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -372,7 +372,7 @@ void CYahooProto::MenuMainInit(void) CLISTMENUITEM mi = { 0 }; mi.pszService = servicefunction; - HGENMENU hRoot = MO_GetProtoRootMenu(m_szModuleName); + HGENMENU hRoot = Menu_GetProtocolRoot(m_szModuleName); if (hRoot == NULL) { mi.position = 500015000; mi.hParentMenu = HGENMENU_ROOT; diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index 2e8c4cfda3..47e2fa473e 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -218,7 +218,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) } else name = mi->pszName; - MO_SetOptionsMenuItem(pimi, OPT_MENUITEMSETUNIQNAME, (INT_PTR)name); + Menu_ConfigureItem(pimi, MCI_OPT_UNIQUENAME, name); if (needFree) mir_free(name); return (INT_PTR)pimi; @@ -291,7 +291,7 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) mir_snprintf(buf, "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", mi->ptszName); } else buf[0] = '\0'; - if (buf[0]) MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf); + if (buf[0]) Menu_ConfigureItem(menuHandle, MCI_OPT_UNIQUENAME, buf); return (INT_PTR)menuHandle; } @@ -809,7 +809,7 @@ void RebuildMenuOrder(void) } hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService"); - MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu"); + Menu_ConfigureObject(hStatusMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu"); hStatusMainMenuHandles = (TMO_IntMenuItem**)mir_calloc(_countof(statusModeList) * sizeof(TMO_IntMenuItem*)); hStatusMainMenuHandlesCnt = _countof(statusModeList); @@ -885,7 +885,7 @@ void RebuildMenuOrder(void) char buf[256]; mir_snprintf(buf, "RootProtocolIcon_%s", pa->szModuleName); - MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf); + Menu_ConfigureItem(menuHandle, MCI_OPT_UNIQUENAME, buf); DestroyIcon(ic); pos += 500000; @@ -918,7 +918,7 @@ void RebuildMenuOrder(void) char buf[256]; mir_snprintf(buf, "ProtocolIcon_%s_%s", pa->szModuleName, tmi.name.a); - MO_SetOptionsMenuItem(hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf); + Menu_ConfigureItem(hStatusMenuHandles[i].menuhandle[j], MCI_OPT_UNIQUENAME, buf); IcoLib_ReleaseIcon(tmi.hIcon); } @@ -945,9 +945,8 @@ void RebuildMenuOrder(void) tmi.hIcon = Skin_LoadIcon(skinIconStatusList[j]); tmi.position = pos++; - tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0' + j); - //owner data + // owner data StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam)); smep->status = statusModeList[j]; tmi.ownerdata = smep; @@ -955,16 +954,16 @@ void RebuildMenuOrder(void) TCHAR buf[256], hotkeyName[100]; WORD hotKey = GetHotkeyValue(statusHotkeys[j]); HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey)); - mir_sntprintf(buf, _T("%s\t%s"), - cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName); + mir_sntprintf(buf, _T("%s\t%s"), cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName); tmi.name.t = buf; - tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); hStatusMainMenuHandles[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi); + + hStatusMainMenuHandles[j]->hotKey = hotKey; } char buf[256]; mir_snprintf(buf, "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.name.a); - MO_SetOptionsMenuItem(hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf); + Menu_ConfigureItem(hStatusMainMenuHandles[j], MCI_OPT_UNIQUENAME, buf); IcoLib_ReleaseIcon(tmi.hIcon); break; @@ -985,7 +984,7 @@ static int sttRebuildHotkeys(WPARAM, LPARAM) mir_sntprintf(buf, _T("%s\t%s"), cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName); Menu_ModifyItem(hStatusMainMenuHandles[j], buf); - hStatusMainMenuHandles[j]->mi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); + hStatusMainMenuHandles[j]->hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); } return 0; @@ -1072,7 +1071,6 @@ int fnConvertMenu(CLISTMENUITEM *mi, TMO_MenuItem *pmi) pmi->root = mi->hParentMenu; pmi->flags = mi->flags; pmi->hIcon = mi->hIcon; - pmi->hotKey = mi->hotKey; pmi->name.a = mi->pszName; pmi->position = mi->position; pmi->hLangpack = mi->hLangpack; @@ -1170,7 +1168,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) mir_snprintf(buf, "%s/%s", (p) ? p : "", mi->pszService ? mi->pszService : ""); mir_free(p); - MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf); + Menu_ConfigureItem(menuHandle, MCI_OPT_UNIQUENAME, buf); return (INT_PTR)menuHandle; } @@ -1249,13 +1247,13 @@ void InitCustomMenus(void) // main menu hMainMenuObject = MO_CreateMenuObject("MainMenu", LPGEN("Main menu"), 0, "MainMenuExecService"); - MO_SetOptionsMenuObject(hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetOptionsMenuObject(hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu"); + Menu_ConfigureObject(hMainMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hMainMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu"); // contact menu hContactMenuObject = MO_CreateMenuObject("ContactMenu", LPGEN("Contact menu"), "ContactMenuCheckService", "ContactMenuExecService"); - MO_SetOptionsMenuObject(hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE); - MO_SetOptionsMenuObject(hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu"); + Menu_ConfigureObject(hContactMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE); + Menu_ConfigureObject(hContactMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu"); // initialize hotkeys CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus); diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index 8efe8d2481..b060decb5c 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -225,11 +225,11 @@ INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey) return FALSE; for (TMO_IntMenuItem *pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next) { - if (pimi->mi.hotKey == 0) continue; - if (HIWORD(pimi->mi.hotKey) != vKey) continue; - if (!(LOWORD(pimi->mi.hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue; - if (!(LOWORD(pimi->mi.hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue; - if (!(LOWORD(pimi->mi.hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue; + if (pimi->hotKey == 0) continue; + if (HIWORD(pimi->hotKey) != vKey) continue; + if (!(LOWORD(pimi->hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue; + if (!(LOWORD(pimi->hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue; + if (!(LOWORD(pimi->hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue; MO_ProcessCommand(pimi, 0); return TRUE; @@ -238,14 +238,13 @@ INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey) return FALSE; } -INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM) +MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(const char *szProto) { - char *szProto = (char*)wParam; if (szProto == NULL) return 0; if (db_get_b(NULL, "CList", "MoveProtoMenus", TRUE)) - return (INT_PTR)cli.pfnGetProtocolMenu(szProto); + return cli.pfnGetProtocolMenu(szProto); int objidx = GetMenuObjbyId((int)hMainMenuObject); if (objidx == -1) @@ -256,7 +255,7 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM) TIntMenuObject* pmo = g_menus[objidx]; for (TMO_IntMenuItem *p = pmo->m_items.first; p != NULL; p = p->next) if (!mir_strcmp(p->UniqName, szProto)) - return (INT_PTR)p; + return p; return NULL; } @@ -440,25 +439,30 @@ int MO_ProcessCommand(TMO_IntMenuItem *aHandle, LPARAM lParam) return 1; } -int MO_SetOptionsMenuItem(TMO_IntMenuItem *aHandle, int setting, INT_PTR value) +MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value) { if (!bIsGenMenuInited) return -1; mir_cslock lck(csMenuHook); - TMO_IntMenuItem *pimi = MO_GetIntMenuItem(aHandle); + TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hItem); if (pimi == NULL) return -1; - if (setting == OPT_MENUITEMSETUNIQNAME) { - mir_free(pimi->UniqName); - pimi->UniqName = mir_strdup((char*)value); + switch (iOption) { + case MCI_OPT_UNIQUENAME: + replaceStr(pimi->UniqName, (char*)value); + return 0; + + case MCI_OPT_HOTKEY: + pimi->hotKey = (DWORD)value; + return 0; } return 1; } -int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value) +MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE handle, int setting, INT_PTR value) { if (!bIsGenMenuInited) return -1; @@ -471,22 +475,22 @@ int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value) TIntMenuObject* pmo = g_menus[pimoidx]; switch (setting) { - case OPT_MENUOBJECT_SET_ONADD_SERVICE: + case MCO_OPT_ONADD_SERVICE: FreeAndNil((void**)&pmo->onAddService); pmo->onAddService = mir_strdup((char*)value); break; - case OPT_MENUOBJECT_SET_FREE_SERVICE: + case MCO_OPT_FREE_SERVICE: FreeAndNil((void**)&pmo->FreeService); pmo->FreeService = mir_strdup((char*)value); break; - case OPT_MENUOBJECT_SET_CHECK_SERVICE: + case MCO_OPT_CHECK_SERVICE: FreeAndNil((void**)&pmo->CheckService); pmo->CheckService = mir_strdup((char*)value); break; - case OPT_USERDEFINEDITEMS: + case MCO_OPT_USERDEFINEDITEMS: pmo->m_bUseUserDefinedItems = (BOOL)value; break; } @@ -728,7 +732,7 @@ TMO_IntMenuItem *MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi // copy pszPopupName tmi.name.t = (TCHAR*)pmi->root; if ((oldroot = MO_AddNewMenuItem(menuobjecthandle, &tmi)) != NULL) - MO_SetOptionsMenuItem(oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root); + Menu_ConfigureItem(oldroot, MCI_OPT_UNIQUENAME, (const char*)pmi->root); } pmi->root = oldroot; @@ -1128,24 +1132,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) return 0; } -static INT_PTR SRVMO_SetOptionsMenuObject(WPARAM, LPARAM lParam) -{ - lpOptParam lpop = (lpOptParam)lParam; - if (lpop == NULL) - return 0; - - return MO_SetOptionsMenuObject(lpop->Handle, lpop->Setting, lpop->Value); -} - -static INT_PTR SRVMO_SetOptionsMenuItem(WPARAM, LPARAM lParam) -{ - lpOptParam lpop = (lpOptParam)lParam; - if (lpop == NULL) - return 0; - - return MO_SetOptionsMenuItem((TMO_IntMenuItem*)lpop->Handle, lpop->Setting, lpop->Value); -} - int InitGenMenu() { CreateServiceFunction(MO_BUILDMENU, MO_BuildMenu); @@ -1160,10 +1146,6 @@ int InitGenMenu() CreateServiceFunction(MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent); CreateServiceFunction(MO_PROCESSHOTKEYS, (MIRANDASERVICE)MO_ProcessHotKeys); CreateServiceFunction(MO_REMOVEMENUOBJECT, MO_RemoveMenuObject); - CreateServiceFunction(MO_GETPROTOROOTMENU, MO_GetProtoRootMenu); - - CreateServiceFunction(MO_SRV_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject); - CreateServiceFunction(MO_SETOPTIONSMENUITEM, SRVMO_SetOptionsMenuItem); bIconsDisabled = db_get_b(NULL, "CList", "DisableMenuIcons", 0) != 0; diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 12dabdacc7..0c5f3cd0d2 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -53,6 +53,7 @@ struct TMO_IntMenuItem HANDLE hIcolibItem; // handle of iconlib item HBITMAP hBmp; int originalPosition; + DWORD hotKey; int hLangpack; TMO_IntMenuItem *next; // next item in list @@ -113,8 +114,6 @@ int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis); int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis); int MO_ProcessCommand(TMO_IntMenuItem *pimi, LPARAM lParam); INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey); -int MO_SetOptionsMenuItem(TMO_IntMenuItem *menuobjecthandle, int setting, INT_PTR value); -int MO_SetOptionsMenuObject(HANDLE menuobjecthandle, int setting, INT_PTR value); INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam); int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 8764180eff..e8e029f9e7 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -202,3 +202,6 @@ Utils_ReplaceVars @199 Utils_ReplaceVarsW @200 Menu_ShowItem @201 Menu_ModifyItem @202 +Menu_ConfigureItem @203 +Menu_GetProtocolRoot @204 +Menu_ConfigureObject @205 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 87aee3de21..e1114580b8 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -202,3 +202,6 @@ Utils_ReplaceVars @199 Utils_ReplaceVarsW @200 Menu_ShowItem @201 Menu_ModifyItem @202 +Menu_ConfigureItem @203 +Menu_GetProtocolRoot @204 +Menu_ConfigureObject @205 -- cgit v1.2.3