From ab4abbb7a60f941acab8f0566c6b619f68f1b489 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 27 Jun 2015 11:09:19 +0000 Subject: - CLISTMENUITEM::pszContactOwner removed, because it's supported only by contact's menu; - Menu_AddContactMenuItem now receives parameter szProto; - Menu_Add* helpers are converted into real functions; git-svn-id: http://svn.miranda-ng.org/main/trunk@14409 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_clist.inc | 72 ++++++++++++++------------------------------ include/delphi/m_helpers.inc | 12 +++----- include/m_clist.h | 47 +++++++---------------------- 3 files changed, 37 insertions(+), 94 deletions(-) (limited to 'include') diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index 04af0877d9..0183450f3d 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -46,6 +46,19 @@ const } MS_CLIST_GETSTATUSMODEDESCRIPTION:PAnsiChar = 'CList/GetStatusModeDescription'; +const + CMIF_GRAYED = 1; + CMIF_CHECKED = 2; + CMIF_HIDDEN = 4; // only works on contact menus + CMIF_NOTOFFLINE = 8; // item won't appear for contacts that are offline + CMIF_NOTONLINE = 16; // " online + CMIF_NOTONLIST = 32; // item won't appear on standard contacts + CMIF_NOTOFFLIST = 64; // item won't appear on contacts that have the 'NotOnList' setting + CMIF_UNICODE = 512; // will return TCHAR* instead of AnsiChar* + CMIF_KEEPUNTRANSLATED = 1024; // don't translate a menu item + + CMIF_DEFAULT = 4096; // this menu item is the default one + type // WARNING: do not use Translate(TS) for p(t)szName or p(t)szPopupName as they // are translated by the core, which may lead to double translation. @@ -53,67 +66,26 @@ type PCLISTMENUITEM = ^TCLISTMENUITEM; TCLISTMENUITEM = record szName : TChar; // [TRANSLATED-BY-CORE] text of the menu item - flags : dword; + flags : dword; // combination of CMIF_* 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 - CMIF_GRAYED = 1; - CMIF_CHECKED = 2; - CMIF_HIDDEN = 4; // only works on contact menus - CMIF_NOTOFFLINE = 8; // item won't appear for contacts that are offline - CMIF_NOTONLINE = 16; // " online - CMIF_NOTONLIST = 32; // item won't appear on standard contacts - CMIF_NOTOFFLIST = 64; // item won't appear on contacts that have the 'NotOnList' setting - CMIF_ROOTHANDLE = 384; // means that hParentMenu member is set (since 0.8#26) - CMIF_UNICODE = 512; // will return TCHAR* instead of AnsiChar* - CMIF_KEEPUNTRANSLATED = 1024; // don't translate a menu item - - CMIF_DEFAULT = 4096; // this menu item is the default one +function _AddMainMenuItem(mi:PCLISTMENUITEM; hlang:integer) : HGENMENU; stdcall; + external AppDll name 'Menu_AddMainMenuItem'; -// for compatibility. since 0.8.0 they both mean nothing - CMIF_ROOTPOPUP = 128; // root item for new popup (save return id for childs) - CMIF_CHILDPOPUP = 256; // child for rootpopup menu +function _AddContactMenuItem(mi:PCLISTMENUITEM; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall; + external AppDll name 'Menu_AddContactMenuItem'; - { - wParam : 0 - lParam : Pointer to a initalised TCLISTMENUITEM structure - Affect : Add a new menu item to the main menu, see notes - Returns: A handle to the new MENU item or NULL(0) on failure - Notes : The given TCLISTMENUITEM.pszService in is called when the item - get clicked with : - - - wParam = 0, lParam = hwndContactList - } - MS_CLIST_ADDMAINMENUITEM:PAnsiChar = 'CList/AddMainMenuItem'; +function _AddProtoMenuItem(mi:PCLISTMENUITEM; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall; + external AppDll name 'Menu_AddProtoMenuItem'; - { - wParam : 0 - lParam : Pointer to a initalised TCLISTMENUITEM structure - Affect : Add a new item to the user contact menus, see notes - Notes : exactly the same as MS_CLIST_ADDMAINMENUITEM except when an item - is selected, the service gets called with wParam=hContact, - pszContactOwner is obeyed. - - - Popup menus are not supported, pszPopupName and popupPosition - are ignored. If CTRL is held down when right clicking the menu - position numbers will be displayed in brackets after the menu item - text, this only works in debug builds! - } - MS_CLIST_ADDCONTACTMENUITEM:PAnsiChar = 'CList/AddContactMenuItem'; - MS_CLIST_ADDSTATUSMENUITEM :PAnsiChar = 'CList/AddStatusMenuItem'; - MS_CLIST_ADDPROTOMENUITEM :PAnsiChar = 'CList/AddProtoMenuItem'; +function _AddStatusMenuItem(mi:PCLISTMENUITEM; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall; + external AppDll name 'Menu_AddStatusMenuItem'; { Affect : Modify an existing menu item, see notes diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 1cf14f32b0..72a0b66103 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -392,26 +392,22 @@ end; function Menu_AddMainMenuItem(mi:PCLISTMENUITEM):HGENMENU; begin - mi^.hLangpack:=hLangpack; - result:=CallService(MS_CLIST_ADDMAINMENUITEM, 0,LPARAM(mi)); + result:=_AddMainMenuItem(mi, hLangpack); end; function Menu_AddContactMenuItem(mi:PCLISTMENUITEM):HGENMENU; begin - mi^.hLangpack:=hLangpack; - result:=CallService(MS_CLIST_ADDCONTACTMENUITEM, 0,LPARAM(mi)); + result:=_AddContactMenuItem(mi, nil, hLangpack); end; function Menu_AddStatusMenuItem(mi:PCLISTMENUITEM):HGENMENU; begin - mi^.hLangpack:=hLangpack; - result:=CallService(MS_CLIST_ADDSTATUSMENUITEM, 0,LPARAM(mi)); + result:=_AddStatusMenuItem(mi, nil, hLangpack); end; function Menu_AddProtoMenuItem(mi:PCLISTMENUITEM):HGENMENU; begin - mi^.hLangpack:=hLangpack; - result:=CallService(MS_CLIST_ADDPROTOMENUITEM, 0,LPARAM(mi)); + result:=_AddProtoMenuItem(mi, nil, hLangpack); end; function Menu_AddTrayMenuItem(mi:PCLISTMENUITEM):HGENMENU; diff --git a/include/m_clist.h b/include/m_clist.h index 7314f9f303..a8f9477de8 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -77,7 +77,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //the service that is called when the item is clicked is called with //wParam = 0, lParam = hwndContactList //dividers are inserted every 100000 positions -//pszContactOwner is ignored for this service. //there is a #define PUTPOSITIONSINMENU in clistmenus.c which, when set, will //cause the position numbers to be placed in brackets after the menu items @@ -87,25 +86,13 @@ 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 - }; - 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 - }; - 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) + MAllStrings name; // [TRANSLATED-BY-CORE] text of the menu item + DWORD flags; // set of CMIF_* flags + int position; // approx position on the menu. lower numbers go nearer the top + HANDLE icolibItem; // set CMIF_ICONFROMICOLIB to pass this value + char* pszService; // name of service to call when the item gets selected + HGENMENU hParentMenu; // HGENMENU_ROOT or NULL means the root menu + int hLangpack; // plugin's hLangpack (added automatically) }; #define CMIF_GRAYED 1 @@ -126,10 +113,7 @@ struct CLISTMENUITEM #define CMIF_KEEPUNTRANSLATED 1024 // don't translate a menu item #define CMIF_DEFAULT 4096 // this menu item is the default one -__forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddMainMenuItem", 0, (LPARAM)mi); -} +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(CLISTMENUITEM *mi, int = hLangpack); //add a new item to the user contact menus //identical to clist/addmainmenuitem except when item is selected the service @@ -140,20 +124,11 @@ __forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi) //displayed in brackets after the menu item text. This only works in debug //builds. -__forceinline HGENMENU Menu_AddContactMenuItem(CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddContactMenuItem", 0, (LPARAM)mi); -} +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(CLISTMENUITEM *mi, const char *pszProto = NULL, int = hLangpack); -__forceinline HGENMENU Menu_AddStatusMenuItem(CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddStatusMenuItem", 0, (LPARAM)mi); -} +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(CLISTMENUITEM *mi, const char *pszProto = NULL, int = hLangpack); -__forceinline HGENMENU Menu_AddProtoMenuItem(CLISTMENUITEM *mi) -{ mi->hLangpack = hLangpack; - return (HGENMENU)CallService("CList/AddProtoMenuItem", 0, (LPARAM)mi); -} +EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddProtoMenuItem(CLISTMENUITEM *mi, const char *pszProto = NULL, int = hLangpack); //the context menu for a contact is about to be built v0.1.0.1+ //wParam = (MCONTACT)hContact -- cgit v1.2.3