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 --- include/delphi/m_clist.inc | 1 - include/delphi/m_genmenu.inc | 50 +++++++++----------------- include/m_clist.h | 1 - include/m_genmenu.h | 84 +++++++++++++++++++------------------------- 4 files changed, 53 insertions(+), 83 deletions(-) (limited to 'include') 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 -- cgit v1.2.3