diff options
57 files changed, 524 insertions, 538 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex 6d4e7008fb..17885d1af3 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex 93c804c28f..c5f5a9394e 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex 6d4e7008fb..17885d1af3 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex 93c804c28f..c5f5a9394e 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index 0183450f3d..251b5d68f6 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -87,6 +87,9 @@ function _AddProtoMenuItem(mi:PCLISTMENUITEM; pszProto:PAnsiChar; hlang:integer) function _AddStatusMenuItem(mi:PCLISTMENUITEM; pszProto:PAnsiChar; hlang:integer) : HGENMENU; stdcall;
external AppDll name 'Menu_AddStatusMenuItem';
+function Menu_BuildContactMenu(hContact:TMCONTACT) : HMENU; stdcall;
+ external AppDll name 'Menu_BuildContactMenu';
+
{
Affect : Modify an existing menu item, see notes
Returns: 0 on success, [non zero] on failure
@@ -262,16 +265,6 @@ const MS_CLIST_MENUDRAWITEM:PAnsiChar = 'CList/MenuDrawItem';
{
- wParam : TMCONTACT
- lParam : 0
- Affect : Built the context menu for a specific contact
- Returns: A HMENU handle identifying the menu, this should be DestroyMenu()ed
- when done.
- Version: v0.1.1.0+
- }
- MS_CLIST_MENUBUILDCONTACT:PAnsiChar = 'CList/MenuBuildContact';
-
- {
wParam : 0
lParam : 0
Affect : Get the image list handle with all the useful icons in it
@@ -303,22 +296,6 @@ const //******************************* CLUI only *********************************
- {
- wParam : 0
- lParam : 0
- Affect : Get the handle to Miranda's main menu
- Version: v0.1.1.0+
- }
- MS_CLIST_MENUGETMAIN:PAnsiChar = 'CList/MenuGetMain';
-
- {
- wParam : 0
- lParam : 0
- Affect : Get a handle to Miranda's status menu
- Version: v0.1.1.0+
- }
- MS_CLIST_MENUGETSTATUS:PAnsiChar = 'CList/MenuGetStatus';
-
CLISTMENUIDMIN = $4000; // reserved range for clist menu ids
CLISTMENUIDMAX = $7FFF;
{
diff --git a/include/m_clist.h b/include/m_clist.h index a8f9477de8..38cce1e062 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -39,28 +39,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_genmenu.h>
#endif
-//sent when the user asks to change their status
-//wParam = new status, from statusmodes.h
-//lParam = protocol name, NULL if for all protocols (added in v0.3.1alpha)
-//also sent due to a ms_clist_setstatusmode call
+/////////////////////////////////////////////////////////////////////////////////////////
+// sent when the user asks to change their status
+// wParam = new status, from statusmodes.h
+// lParam = protocol name, NULL if for all protocols
+// also sent due to a ms_clist_setstatusmode call
#define ME_CLIST_STATUSMODECHANGE "CList/StatusModeChange"
-//force a change of status mode
-//wParam = new status, from statusmodes.h
+/////////////////////////////////////////////////////////////////////////////////////////
+// force a change of status mode
+// wParam = new status, from statusmodes.h
#define MS_CLIST_SETSTATUSMODE "CList/SetStatusMode"
-//get the current status mode
-//wParam = lParam = 0
-//returns the current status
-//This is the status *as set by the user*, not any protocol-specific status
-//All protocol modules will attempt to conform to this setting at all times
+/////////////////////////////////////////////////////////////////////////////////////////
+// get the current status mode
+// wParam = lParam = 0
+// returns the current status
+// This is the status *as set by the user*, not any protocol-specific status
+// All protocol modules will attempt to conform to this setting at all times
#define MS_CLIST_GETSTATUSMODE "CList/GetStatusMode"
-//gets a textual description of the given status mode (v0.1.0.1+)
-//wParam = status mode, from statusmodes.h
-//lParam = flags, below
-//returns a static buffer of the description of the given status mode
-//returns NULL if the status mode was unknown
+/////////////////////////////////////////////////////////////////////////////////////////
+// gets a textual description of the given status mode
+// wParam = status mode, from statusmodes.h
+// lParam = flags, below
+// returns a static buffer of the description of the given status mode
+// returns NULL if the status mode was unknown
+
#define GSMDF_UNICODE 2 //will return TCHAR* instead of char*
#if defined(_UNICODE)
#define GSMDF_TCHAR GSMDF_UNICODE //will return TCHAR* instead of char*
@@ -70,20 +75,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define GSMDF_UNTRANSLATED 4
#define MS_CLIST_GETSTATUSMODEDESCRIPTION "CList/GetStatusModeDescription"
-//add a new item to the main menu
-//wParam = 0
-//lParam = (LPARAM)(CLISTMENUITEM*)&mi
-//returns a handle to the new item, or NULL on failure
-//the service that is called when the item is clicked is called with
-//wParam = 0, lParam = hwndContactList
-//dividers are inserted every 100000 positions
-//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
-
-// 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.
-// Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl".
-
struct CLISTMENUITEM
{
MAllStrings name; // [TRANSLATED-BY-CORE] text of the menu item
@@ -113,73 +104,175 @@ struct CLISTMENUITEM #define CMIF_KEEPUNTRANSLATED 1024 // don't translate a menu item
#define CMIF_DEFAULT 4096 // this menu item is the default one
+/////////////////////////////////////////////////////////////////////////////////////////
+// MAIN MENU
+
+// adds a new element into main menu
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
-//gets called with wParam = (MCONTACT)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.
+// gets a handle to the main Miranda menu
+// returns a HMENU. This need not to be freed since it's owned by clist
+EXTERN_C MIR_APP_DLL(HMENU) Menu_GetMainMenu(void);
+// rebuilds the main menu
+// returns a HMENU identifying the menu.
+EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildMainMenu(void);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// the main menu is about to be built
+// wParam = lParam = 0
+#define ME_CLIST_PREBUILDMAINMENU "CList/PreBuildMainMenu"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// CONTACT MENU
+
+// adds a new element into contact menu
EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(CLISTMENUITEM *mi, const char *pszProto = NULL, int = hLangpack);
+// builds the context menu for a specific contact
+// returns a HMENU identifying the menu. This should be DestroyMenu()ed when
+// finished with.
+EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact);
+
+// the context menu for a contact is about to be built
+// modules should use this to change menu items that are specific to the
+// contact that has them
+#define ME_CLIST_PREBUILDCONTACTMENU "CList/PreBuildContactMenu"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// STATUS MENU
+
+// get a handle to the Miranda status menu
+// returns a HMENU. This need not be freed since it's owned by clist
+EXTERN_C MIR_APP_DLL(HMENU) Menu_GetStatusMenu(void);
+
+// adds an item to a status menu
EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(CLISTMENUITEM *mi, const char *pszProto = NULL, int = hLangpack);
+// the status menu is about to be built
+// wParam = lParam = 0
+#define ME_CLIST_PREBUILDSTATUSMENU "CList/PreBuildStatusMenu"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// PROTOCOL MENU
+
+// adds an item to status or main menu, according to the option
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
-//lParam = 0
-//modules should use this to change menu items that are specific to the
-//contact that has them
-#define ME_CLIST_PREBUILDCONTACTMENU "CList/PreBuildContactMenu"
-
-//sets the service to call when a contact is double-clicked
-//wParam = 0
-//lParam = (LPARAM)(CLISTDOUBLECLICKACTION*)&dca
-//contactType is one or more of the constants below
-//pszService is called with wParam = hContact, lParam = 0
-//pszService will only be called if there is no outstanding event on the
-//selected contact
-//returns 0 on success, nonzero on failure
-//in case of conflicts, the first module to have registered will get the
-//double click, no others will. This service will return success even for
-//duplicates.
-/*
- Note: During development of 0.3.0.0 (2003/02/15) this service was completely dropped
- by default it always returns 1 to mark failure, see ME_CLIST_DOUBLECLICKED for
- a better implementation as a hook.
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// GROUP MENU
+
+typedef struct
+{
+ int wParam;
+ int lParam;
+}
+GroupMenuParam, *lpGroupMenuParam;
+
+// builds the Group menu
+// wParam=lParam=0
+// returns a HMENU identifying the menu.
+#define MS_CLIST_MENUBUILDGROUP "CList/MenuBuildGroup"
+
+// add a new item to the Group menus
+// wParam=lpGroupMenuParam, params to call when exec menuitem
+// lParam=(LPARAM)(CLISTMENUITEM*)&mi
+
+__forceinline HGENMENU Menu_AddGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi)
+{
+ mi->hLangpack = hLangpack;
+ return (HGENMENU)CallService("CList/AddGroupMenuItem", (WPARAM)gmp, (LPARAM)mi);
+}
+
+// the Group menu is about to be built
+// wParam=lParam=0
+#define ME_CLIST_PREBUILDGROUPMENU "CList/PreBuildGroupMenu"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// SUBGROUP MENU
+
+// builds the SubGroup menu
+// wParam=lParam=0
+// returns a HMENU identifying the menu.
+#define MS_CLIST_MENUBUILDSUBGROUP "CList/MenuBuildSubGroup"
+
+// add a new item to the SubGroup menus
+// wParam=lpGroupMenuParam, params to call when exec menuitem
+// lParam=(LPARAM)(CLISTMENUITEM*)&mi
+
+__forceinline HGENMENU Menu_AddSubGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi)
+{
+ mi->hLangpack = hLangpack;
+ return (HGENMENU)CallService("CList/AddSubGroupMenuItem", (WPARAM)gmp, (LPARAM)mi);
+}
+
+// the SubGroup menu is about to be built
+// wParam=lParam=0
+#define ME_CLIST_PREBUILDSUBGROUPMENU "CList/PreBuildSubGroupMenu"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// TRAY MENU
+
+// builds the tray menu
+// wParam=lParam=0
+// returns a HMENU identifying the menu.
+#define MS_CLIST_MENUBUILDTRAY "CList/MenuBuildTray"
+
+// add a new item to the tray menus
+// wParam=0
+// lParam=(LPARAM)(CLISTMENUITEM*)&mi
+
+__forceinline HGENMENU Menu_AddTrayMenuItem(CLISTMENUITEM *mi)
+{
+ mi->hLangpack = hLangpack;
+ return (HGENMENU)CallService("CList/AddTrayMenuItem", 0, (LPARAM)mi);
+}
+
+// the tray menu is about to be built
+// wParam=lParam=0
+#define ME_CLIST_PREBUILDTRAYMENU "CList/PreBuildTrayMenu"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// sets the service to call when a contact is double-clicked
+// contactType is one or more of the constants below
+// pszService is called with wParam = hContact, lParam = 0
+// pszService will only be called if there is no outstanding event on the
+// selected contact
+// returns 0 on success, nonzero on failure
+// in case of conflicts, the first module to have registered will get the
+// double click, no others will. This service will return success even for
+// duplicates.
+
typedef struct {
int cbSize;
char *pszContactOwner; //name of protocol owning contact, or NULL for all
DWORD flags; //any of the CMIF_NOT... flags above
char *pszService; //service to call on double click
} CLISTDOUBLECLICKACTION;
-#define MS_CLIST_SETDOUBLECLICKACTION "CList/SetDoubleClickAction"
-/*
-wParam = (WPARAM)hContact
-lParam = 0
+#define MS_CLIST_SETDOUBLECLICKACTION "CList/SetDoubleClickAction"
-Event is fired when there is a double click on a CList contact,
-it is upto the caller to check for the protocol & status
-of the MCONTACT, it's not done for you anymore since it didn't make
-sense to store all this information in memory, etc.
+/////////////////////////////////////////////////////////////////////////////////////////
+// wParam = (WPARAM)hContact
+// lParam = 0
+//
+// Event is fired when there is a double click on a CList contact,
+// it is upto the caller to check for the protocol & status
+// of the MCONTACT, it's not done for you anymore since it didn't make
+// sense to store all this information in memory, etc.
-*/
#define ME_CLIST_DOUBLECLICKED "CList/DoubleClicked"
-//gets the string that the contact list will use to represent a contact
-//wParam = (MCONTACT)hContact
-//lParam = flags
-//returns a pointer to the name, will always succeed, even if it needs to
-//return "(Unknown Contact)"
-//this pointer is to a statically allocated buffer which will be overwritten
-//on every call to this service. Callers should make sure that they copy the
-//information before they call this service again.
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// gets the string that the contact list will use to represent a contact
+// wParam = (MCONTACT)hContact
+// lParam = flags
+// returns a pointer to the name, will always succeed, even if it needs to
+// return "(Unknown Contact)"
+// this pointer is to a statically allocated buffer which will be overwritten
+// on every call to this service. Callers should make sure that they copy the
+// information before they call this service again.
+
#define GCDNF_NOMYHANDLE 1 //will never return the user's custom name
#define GCDNF_UNICODE 2 //will return TCHAR* instead of char*
#define GCDNF_NOCACHE 4 //will not use the cache
@@ -190,29 +283,33 @@ sense to store all this information in memory, etc. #define GCDNF_TCHAR 0 //will return char*, as usual
#endif
-//even if it's the one that should be displayed. v0.1.2.0+
-//v0.3.0.0+ if using GCDNF_NOMYHANDLE you must free your string
+/////////////////////////////////////////////////////////////////////////////////////////
+// even if it's the one that should be displayed.
+// v0.3.0.0+ if using GCDNF_NOMYHANDLE you must free your string
#define MS_CLIST_GETCONTACTDISPLAYNAME "CList/GetContactDisplayName"
+/////////////////////////////////////////////////////////////////////////////////////////
// Invalidates the display name cache
-//wParam = (MCONTACT)hContact
-//lParam = not used
+// wParam = (MCONTACT)hContact
+// lParam = not used
#define MS_CLIST_INVALIDATEDISPLAYNAME "CList/InvalidateDiplayName"
-//adds an event to the contact list's queue
-//wParam = 0
-//lParam = (LPARAM)(CLISTEVENT*)cle
-//The contact list will flash hIcon next to the contact hContact (use NULL for
-//a system message). szServiceName will be called when the user double clicks
-//the icon, at which point the event will be removed from the contact list's
-//queue automatically
-//pszService is called with wParam = (WPARAM)(HWND)hwndContactList,
-//lParam = (LPARAM)(CLISTEVENT*)cle. Its return value is ignored. cle is
-//invalidated when your service returns, so take copies of any important
-//information in it.
-//hDbEvent should be unique since it and hContact are the identifiers used by
-//clist/removeevent if, for example, your module implements a 'read next' that
-//bypasses the double-click.
+/////////////////////////////////////////////////////////////////////////////////////////
+// adds an event to the contact list's queue
+// wParam = 0
+// lParam = (LPARAM)(CLISTEVENT*)cle
+// The contact list will flash hIcon next to the contact hContact (use NULL for
+// a system message). szServiceName will be called when the user double clicks
+// the icon, at which point the event will be removed from the contact list's
+// queue automatically
+// pszService is called with wParam = (WPARAM)(HWND)hwndContactList,
+// lParam = (LPARAM)(CLISTEVENT*)cle. Its return value is ignored. cle is
+// invalidated when your service returns, so take copies of any important
+// information in it.
+// hDbEvent should be unique since it and hContact are the identifiers used by
+// clist/removeevent if, for example, your module implements a 'read next' that
+// bypasses the double-click.
+
typedef struct {
int cbSize; //size in bytes of this structure
MCONTACT hContact; //handle to the contact to put the icon by
@@ -247,152 +344,52 @@ typedef struct { #define MS_CLIST_ADDEVENT "CList/AddEvent"
-//removes an event from the contact list's queue
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(HANDLE)hDbEvent
-//returns 0 if the event was successfully removed, or nonzero if the event
-//was not found
+/////////////////////////////////////////////////////////////////////////////////////////
+// removes an event from the contact list's queue
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HANDLE)hDbEvent
+// returns 0 if the event was successfully removed, or nonzero if the event
+// was not found
#define MS_CLIST_REMOVEEVENT "Clist/RemoveEvent"
-//gets the details of an event in the queue v0.1.2.1+
-//wParam = (MCONTACT)hContact
-//lParam = iEvent
-//returns a CLISTEVENT* on success, NULL on failure
-//Returns the iEvent-th event from the queue for hContact, so iEvent = 0 will
-//get the event that will be got when the user clicks on that contact.
-//Use hContact = INVALID_HANDLE_VALUE to search over all contacts, so iEvent = 0
-//will get the event that will be got if the user clicks the systray icon.
+/////////////////////////////////////////////////////////////////////////////////////////
+// gets the details of an event in the queue
+// wParam = (MCONTACT)hContact
+// lParam = iEvent
+// returns a CLISTEVENT* on success, NULL on failure
+// Returns the iEvent-th event from the queue for hContact, so iEvent = 0 will
+// get the event that will be got when the user clicks on that contact.
+// Use hContact = INVALID_HANDLE_VALUE to search over all contacts, so iEvent = 0
+// will get the event that will be got if the user clicks the systray icon.
#define MS_CLIST_GETEVENT "CList/GetEvent"
-//builds the context menu for a specific contact v0.1.1.0+
-//wParam = (MCONTACT)hContact
-//lParam = 0
-//returns a HMENU identifying the menu. This should be DestroyMenu()ed when
-//finished with.
-#define MS_CLIST_MENUBUILDCONTACT "CList/MenuBuildContact"
-
-//gets the image list with all the useful icons in it v0.1.1.0+
-//wParam = lParam = 0
-//returns a HIMAGELIST
-//the members of this image list are opaque, and you should trust what you
-//are given
+/////////////////////////////////////////////////////////////////////////////////////////
+// gets the image list with all the useful icons in it
+// wParam = lParam = 0
+// returns a HIMAGELIST
+// the members of this image list are opaque, and you should trust what you are given
#define MS_CLIST_GETICONSIMAGELIST "CList/GetIconsImageList"
#define IMAGE_GROUPOPEN 11
#define IMAGE_GROUPSHUT 12
-//get the icon that should be associated with a contact v0.1.2.0+
-//wParam = (MCONTACT)hContact
-//lParam = 0
-//returns an index into the contact list imagelist. See clist/geticonsimagelist
-//If the contact is flashing an icon, this function will not return that
-//flashing icon. Use me_clist_contacticonchanged to get info about that.
+/////////////////////////////////////////////////////////////////////////////////////////
+// get the icon that should be associated with a contact
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// returns an index into the contact list imagelist. See clist/geticonsimagelist
+// If the contact is flashing an icon, this function will not return that
+// flashing icon. Use me_clist_contacticonchanged to get info about that.
#define MS_CLIST_GETCONTACTICON "CList/GetContactIcon"
-//The icon of a contact in the contact list has changed v0.1.2.0+
-//wParam = (MCONTACT)hContact
-//lParam = iconId
-//iconId is an offset into the clist's imagelist. See clist/geticonsimagelist
+/////////////////////////////////////////////////////////////////////////////////////////
+// The icon of a contact in the contact list has changed
+// wParam = (MCONTACT)hContact
+// lParam = iconId
+// iconId is an offset into the clist's imagelist. See clist/geticonsimagelist
#define ME_CLIST_CONTACTICONCHANGED "CList/ContactIconChanged"
-/******************************* CLUI only *********************************/
-
-// Stuff below here is ideally for the use of a CList UI module only.
-
-//get a handle to the main Miranda menu v0.1.1.0+
-//wParam = lParam = 0
-//returns a HMENU. This need not be freed since it's owned by clist
-#define MS_CLIST_MENUGETMAIN "CList/MenuGetMain"
-
-//get a handle to the Miranda status menu v0.1.1.0+
-//wParam = lParam = 0
-//returns a HMENU. This need not be freed since it's owned by clist
-#define MS_CLIST_MENUGETSTATUS "CList/MenuGetStatus"
-
-// Group MENU
-typedef struct
-{
- int wParam;
- int lParam;
-}
-GroupMenuParam, *lpGroupMenuParam;
-
-//builds the SubGroup menu
-//wParam=lParam=0
-//returns a HMENU identifying the menu.
-#define MS_CLIST_MENUBUILDSUBGROUP "CList/MenuBuildSubGroup"
-
-//add a new item to the SubGroup menus
-//wParam=lpGroupMenuParam, params to call when exec menuitem
-//lParam=(LPARAM)(CLISTMENUITEM*)&mi
-
-__forceinline HGENMENU Menu_AddSubGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi)
-{
- mi->hLangpack = hLangpack;
- return (HGENMENU)CallService("CList/AddSubGroupMenuItem", (WPARAM)gmp, (LPARAM)mi);
-}
-
-//the SubGroup menu is about to be built
-//wParam=lParam=0
-#define ME_CLIST_PREBUILDSUBGROUPMENU "CList/PreBuildSubGroupMenu"
-
-// Group MENU
-
-//builds the Group menu
-//wParam=lParam=0
-//returns a HMENU identifying the menu.
-#define MS_CLIST_MENUBUILDGROUP "CList/MenuBuildGroup"
-
-//add a new item to the Group menus
-//wParam=lpGroupMenuParam, params to call when exec menuitem
-//lParam=(LPARAM)(CLISTMENUITEM*)&mi
-
-__forceinline HGENMENU Menu_AddGroupMenuItem(lpGroupMenuParam gmp, CLISTMENUITEM *mi)
-{
- mi->hLangpack = hLangpack;
- return (HGENMENU)CallService("CList/AddGroupMenuItem", (WPARAM)gmp, (LPARAM)mi);
-}
-
-//the Group menu is about to be built
-//wParam=lParam=0
-#define ME_CLIST_PREBUILDGROUPMENU "CList/PreBuildGroupMenu"
-
-// TRAY MENU
-
-//builds the tray menu
-//wParam=lParam=0
-//returns a HMENU identifying the menu.
-#define MS_CLIST_MENUBUILDTRAY "CList/MenuBuildTray"
-
-//add a new item to the tray menus
-//wParam=0
-//lParam=(LPARAM)(CLISTMENUITEM*)&mi
-
-__forceinline HGENMENU Menu_AddTrayMenuItem(CLISTMENUITEM *mi)
-{
- mi->hLangpack = hLangpack;
- return (HGENMENU)CallService("CList/AddTrayMenuItem", 0, (LPARAM)mi);
-}
-
-//the tray menu is about to be built
-//wParam=lParam=0
-#define ME_CLIST_PREBUILDTRAYMENU "CList/PreBuildTrayMenu"
-
-// STATUS MENU
-
-//the status menu is about to be built
-//wParam=lParam=0
-#define ME_CLIST_PREBUILDSTATUSMENU "CList/PreBuildStatusMenu"
-
-//builds the main menu
-//wParam=lParam=0
-//returns a HMENU identifying the menu.
-#define MS_CLIST_MENUBUILDMAIN "CList/MenuBuildMain"
-
-//the main menu is about to be built
-//wParam=lParam=0
-#define ME_CLIST_PREBUILDMAINMENU "CList/PreBuildMainMenu"
-
-//processes a menu selection from a menu v0.1.1.0+
+/////////////////////////////////////////////////////////////////////////////////////////
+//processes a menu selection from a menu
//wParam = MAKEWPARAM(LOWORD(wParam from WM_COMMAND), flags)
//lParam = (LPARAM)(HANDLE)hContact
//returns TRUE if it processed the command, FALSE otherwise
@@ -402,8 +399,8 @@ __forceinline HGENMENU Menu_AddTrayMenuItem(CLISTMENUITEM *mi) #define CLISTMENUIDMIN 0x4000 // reserved range for clist menu ids
#define CLISTMENUIDMAX 0x7fff
-//////////////////////////////////////////////////////////////////////////
-// NOTE: v0.7.0.26+
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Due to it is generic practice to handle menu command via WM_COMMAND
// window message handle and practice to process it via calling service
// in form: CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) hContact))
@@ -421,43 +418,50 @@ __forceinline HGENMENU Menu_AddTrayMenuItem(CLISTMENUITEM *mi) #define MPCF_MAINMENU 2 //test commands from the main menu
#define MS_CLIST_MENUPROCESSCOMMAND "CList/MenuProcessCommand"
-//processes a menu hotkey v0.1.1.0+
-//wParam = virtual key code
-//lParam = MPCF_ flags
-//returns TRUE if it processed the command, FALSE otherwise
-//this should be called in WM_KEYDOWN
+/////////////////////////////////////////////////////////////////////////////////////////
+// processes a menu hotkey
+// wParam = virtual key code
+// lParam = MPCF_ flags
+// returns TRUE if it processed the command, FALSE otherwise
+// this should be called in WM_KEYDOWN
#define MS_CLIST_MENUPROCESSHOTKEY "CList/MenuProcessHotkey"
-//process all the messages required for docking v0.1.1.0+
-//wParam = (WPARAM)(MSG*)&msg
-//lParam = (LPARAM)(LRESULT*)&lResult
-//returns TRUE if the message should not be processed further, FALSE otherwise
-//only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
-//your wndproc should return lResult if and only if TRUE is returned
+/////////////////////////////////////////////////////////////////////////////////////////
+// process all the messages required for docking
+// wParam = (WPARAM)(MSG*)&msg
+// lParam = (LPARAM)(LRESULT*)&lResult
+// returns TRUE if the message should not be processed further, FALSE otherwise
+// only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
+// your wndproc should return lResult if and only if TRUE is returned
#define MS_CLIST_DOCKINGPROCESSMESSAGE "CList/DockingProcessMessage"
-//determines whether the contact list is docked v0.1.1.0+
-//wParam = lParam = 0
-//returns nonzero if the contact list is docked, of 0 if it is not
+/////////////////////////////////////////////////////////////////////////////////////////
+// determines whether the contact list is docked
+// wParam = lParam = 0
+// returns nonzero if the contact list is docked, of 0 if it is not
#define MS_CLIST_DOCKINGISDOCKED "CList/DockingIsDocked"
-//process all the messages required for hotkeys v0.1.1.0+
-//wParam = (WPARAM)(MSG*)&msg
-//lParam = (LPARAM)(LRESULT*)&lResult
-//returns TRUE if the message should not be processed further, FALSE otherwise
-//only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
-//your wndproc should return lResult if and only if TRUE is returned
+/////////////////////////////////////////////////////////////////////////////////////////
+// process all the messages required for hotkeys
+// wParam = (WPARAM)(MSG*)&msg
+// lParam = (LPARAM)(LRESULT*)&lResult
+// returns TRUE if the message should not be processed further, FALSE otherwise
+// only msg.hwnd, msg.message, msg.wParam and msg.lParam are used
+// your wndproc should return lResult if and only if TRUE is returned
#define MS_CLIST_HOTKEYSPROCESSMESSAGE "CList/HotkeysProcessMessage"
-//toggles the show/hide status of the contact list v0.1.1.0+
-//wParam = lParam = 0
-//returns 0 on success, nonzero on failure
+/////////////////////////////////////////////////////////////////////////////////////////
+// toggles the show/hide status of the contact list
+// wParam = lParam = 0
+// returns 0 on success, nonzero on failure
#define MS_CLIST_SHOWHIDE "CList/ShowHide"
-//sent when the group get modified (created, renamed or deleted)
-//or contact is moving from group to group
-//wParam = hContact - NULL if operation on group
-//lParam = pointer to CLISTGROUPCHANGE
+/////////////////////////////////////////////////////////////////////////////////////////
+// sent when the group get modified (created, renamed or deleted)
+// or contact is moving from group to group
+// wParam = hContact - NULL if operation on group
+// lParam = pointer to CLISTGROUPCHANGE
+
typedef struct {
int cbSize; //size in bytes of this structure
TCHAR* pszOldName; //old group name
@@ -466,148 +470,157 @@ typedef struct { #define ME_CLIST_GROUPCHANGE "CList/GroupChange"
-//checks that a group exists v0.1.1.0+
-//wParam = 0 (unused)
-//lParam = (TCHAR*)groupName
-//returns 0 if a group is not found or group handle on success
+/////////////////////////////////////////////////////////////////////////////////////////
+// checks that a group exists
+// wParam = 0 (unused)
+// lParam = (TCHAR*)groupName
+// returns 0 if a group is not found or group handle on success
#define MS_CLIST_GROUPEXISTS "CList/GroupExists"
__forceinline HANDLE Clist_GroupExists(LPCTSTR ptszGroupName)
{ return (HANDLE)CallService(MS_CLIST_GROUPEXISTS, 0, (LPARAM)ptszGroupName);
}
-//creates a new group and calls CLUI to display it v0.1.1.0+
-//wParam = hParentGroup
-//lParam = groupName
-//returns a handle to the new group
-//hParentGroup is NULL to create the new group at the root, or can be the
-//handle of the group of which the new group should be a subgroup.
-//groupName is a TCHAR* pointing to the group name to create or NULL for
-//API to create unique name by itself
+/////////////////////////////////////////////////////////////////////////////////////////
+// creates a new group and calls CLUI to display it
+// wParam = hParentGroup
+// lParam = groupName
+// returns a handle to the new group
+// hParentGroup is NULL to create the new group at the root, or can be the
+// handle of the group of which the new group should be a subgroup.
+// groupName is a TCHAR* pointing to the group name to create or NULL for
+// API to create unique name by itself
#define MS_CLIST_GROUPCREATE "CList/GroupCreate"
__forceinline HANDLE Clist_CreateGroup(HANDLE hParent, LPCTSTR ptszGroupName)
{ return (HANDLE)CallService(MS_CLIST_GROUPCREATE, (WPARAM)hParent, (LPARAM)ptszGroupName);
}
-//deletes a group and calls CLUI to display the change v0.1.1.0+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = 0
-//returns 0 on success, nonzero on failure
+/////////////////////////////////////////////////////////////////////////////////////////
+// deletes a group and calls CLUI to display the change
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = 0
+// returns 0 on success, nonzero on failure
#define MS_CLIST_GROUPDELETE "CList/GroupDelete"
-//change the expanded state flag for a group internally v0.1.1.0+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = newState
-//returns 0 on success, nonzero on failure
-//newState is nonzero if the group is expanded, 0 if it's collapsed
-//CLUI is not called when this change is made
+/////////////////////////////////////////////////////////////////////////////////////////
+// change the expanded state flag for a group internally
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = newState
+// returns 0 on success, nonzero on failure
+// newState is nonzero if the group is expanded, 0 if it's collapsed
+// CLUI is not called when this change is made
#define MS_CLIST_GROUPSETEXPANDED "CList/GroupSetExpanded"
-//changes the flags for a group v0.1.2.1+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = MAKELPARAM(flags, flagsMask)
-//returns 0 on success, nonzero on failure
-//Only the flags given in flagsMask are altered.
-//CLUI is called on changes to GROUPF_HIDEOFFLINE.
+/////////////////////////////////////////////////////////////////////////////////////////
+// changes the flags for a group
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = MAKELPARAM(flags, flagsMask)
+// returns 0 on success, nonzero on failure
+// Only the flags given in flagsMask are altered.
+// CLUI is called on changes to GROUPF_HIDEOFFLINE.
#define MS_CLIST_GROUPSETFLAGS "CList/GroupSetFlags"
-//get the name of a group v0.1.1.0+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = (LPARAM)(int*)&isExpanded
-//returns a static buffer pointing to the name of the group
-//returns NULL if hGroup is invalid.
-//this buffer is only valid until the next call to this service
-//&isExpanded can be NULL if you don't want to know if the group is expanded
-//or not.
+/////////////////////////////////////////////////////////////////////////////////////////
+// get the name of a group
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = (LPARAM)(int*)&isExpanded
+// returns a static buffer pointing to the name of the group
+// returns NULL if hGroup is invalid.
+// this buffer is only valid until the next call to this service
+// & isExpanded can be NULL if you don't want to know if the group is expanded or not.
#define MS_CLIST_GROUPGETNAME "CList/GroupGetName"
-//get the name of a group v0.1.2.1+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = (LPARAM)(DWORD*)&flags
-//returns a static buffer pointing to the name of the group
-//returns NULL if hGroup is invalid.
-//this buffer is only valid until the next call to this service
-//&flags can be NULL if you don't want any of that info.
+/////////////////////////////////////////////////////////////////////////////////////////
+// get the name of a group
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = (LPARAM)(DWORD*)&flags
+// returns a static buffer pointing to the name of the group
+// returns NULL if hGroup is invalid.
+// this buffer is only valid until the next call to this service
+// & flags can be NULL if you don't want any of that info.
#define GROUPF_EXPANDED 0x04
#define GROUPF_HIDEOFFLINE 0x08
#define MS_CLIST_GROUPGETNAME2 "CList/GroupGetName2"
-//move a group to directly before another group v0.1.2.1+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = (LPARAM)(HANDLE)hBeforeGroup
-//returns the new handle of the group on success, NULL on failure
-//The order is represented by the order in which MS_CLUI_GROUPADDED is called,
-//however UIs are free to ignore this order and sort alphabetically if they
-//wish.
+/////////////////////////////////////////////////////////////////////////////////////////
+// move a group to directly before another group
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = (LPARAM)(HANDLE)hBeforeGroup
+// returns the new handle of the group on success, NULL on failure
+// The order is represented by the order in which MS_CLUI_GROUPADDED is called,
+// however UIs are free to ignore this order and sort alphabetically if they wish.
#define MS_CLIST_GROUPMOVEBEFORE "CList/GroupMoveBefore"
-//rename a group internally v0.1.1.0+
-//wParam = (WPARAM)(HANDLE)hGroup
-//lParam = (LPARAM)(char*)szNewName
-//returns 0 on success, nonzero on failure
-//this will fail if the group name is a duplicate of an existing name
-//CLUI is not called when this change is made
+/////////////////////////////////////////////////////////////////////////////////////////
+// rename a group internally
+// wParam = (WPARAM)(HANDLE)hGroup
+// lParam = (LPARAM)(char*)szNewName
+// returns 0 on success, nonzero on failure
+// this will fail if the group name is a duplicate of an existing name
+// CLUI is not called when this change is made
#define MS_CLIST_GROUPRENAME "CList/GroupRename"
-//build a menu of the group tree v0.1.2.1+
-//wParam = 0
-//lParam = 0
-//returns a HMENU on success, or NULL on failure
-//The return value must be DestroyMenu()ed when you're done with it.
-//NULL will be returned if the user doesn't have any groups
-//The dwItemData of every menu item is the handle to that group.
-//Menu item IDs are assigned starting at 100, in no particular order.
+/////////////////////////////////////////////////////////////////////////////////////////
+// build a menu of the group tree
+// returns a HMENU on success, or NULL on failure
+// The return value must be DestroyMenu()ed when you're done with it.
+// NULL will be returned if the user doesn't have any groups
+// The dwItemData of every menu item is the handle to that group.
+// Menu item IDs are assigned starting at 100, in no particular order.
#define MS_CLIST_GROUPBUILDMENU "CList/GroupBuildMenu"
-//changes the 'hide offline contacts' flag and call CLUI v0.1.1.0+
-//wParam = newValue
-//lParam = 0
-//returns 0 on success, nonzero on failure
-//newValue is 0 to show all contacts, 1 to only show online contacts
-//or -1 to toggle the value
+/////////////////////////////////////////////////////////////////////////////////////////
+// changes the 'hide offline contacts' flag and call CLUI
+// wParam = newValue
+// lParam = 0
+// returns 0 on success, nonzero on failure
+// newValue is 0 to show all contacts, 1 to only show online contacts
+// or -1 to toggle the value
#define MS_CLIST_SETHIDEOFFLINE "CList/SetHideOffline"
-//do the message processing associated with double clicking a contact v0.1.1.0+
-//wParam = (MCONTACT)hContact
-//lParam = 0
-//returns 0 on success, nonzero on failure
+/////////////////////////////////////////////////////////////////////////////////////////
+// do the message processing associated with double clicking a contact
+// wParam = (MCONTACT)hContact
+// lParam = 0
+// returns 0 on success, nonzero on failure
#define MS_CLIST_CONTACTDOUBLECLICKED "CList/ContactDoubleClicked"
-//do the processing for when some files are dropped on a contact v0.1.2.1+
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(char**)ppFiles
-//returns 0 on success, nonzero on failure
-//ppFiles is an array of fully qualified filenames, ending with a NULL.
+/////////////////////////////////////////////////////////////////////////////////////////
+// do the processing for when some files are dropped on a contact
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(char**)ppFiles
+// returns 0 on success, nonzero on failure
+// ppFiles is an array of fully qualified filenames, ending with a NULL.
#define MS_CLIST_CONTACTFILESDROPPED "CList/ContactFilesDropped"
-//change the group a contact belongs to v0.1.1.0+
-//wParam = (MCONTACT)hContact
-//lParam = (LPARAM)(HANDLE)hGroup
-//returns 0 on success, nonzero on failure
-//use hGroup = NULL to put the contact in no group
+/////////////////////////////////////////////////////////////////////////////////////////
+// change the group a contact belongs to
+// wParam = (MCONTACT)hContact
+// lParam = (LPARAM)(HANDLE)hGroup
+// returns 0 on success, nonzero on failure
+// use hGroup = NULL to put the contact in no group
#define MS_CLIST_CONTACTCHANGEGROUP "CList/ContactChangeGroup"
-//determines the ordering of two contacts v0.1.1.0+
-//wParam = (WPARAM)(HANDLE)hContact1
-//lParam = (LPARAM)(HANDLE)hContact2
-//returns 0 if hContact1 is the same as hContact2
-//returns +1 if hContact2 should be displayed after hContact1
-//returns -1 if hContact1 should be displayed after hContact2
+/////////////////////////////////////////////////////////////////////////////////////////
+// determines the ordering of two contacts
+// wParam = (WPARAM)(HANDLE)hContact1
+// lParam = (LPARAM)(HANDLE)hContact2
+// returns 0 if hContact1 is the same as hContact2
+// returns +1 if hContact2 should be displayed after hContact1
+// returns -1 if hContact1 should be displayed after hContact2
#define MS_CLIST_CONTACTSCOMPARE "CList/ContactsCompare"
-/*
- wParam = 0 (not used)
- lParam = (LPARAM) &MIRANDASYSTRAYNOTIFY
-
- Affects: Show a message in a ballon tip against a protocol icon (if installed)
- Returns: 0 on success, non zero on failure
- Notes : This service will not be created on systems that haven't got the Windows
- support for ballontips, also note that it's upto Windows if it shows your
- message and it keeps check of delays (don't be stupid about showing messages)
+/////////////////////////////////////////////////////////////////////////////////////////
+// wParam = 0 (not used)
+// lParam = (LPARAM) &MIRANDASYSTRAYNOTIFY
+//
+// Affects: Show a message in a ballon tip against a protocol icon (if installed)
+// Returns: 0 on success, non zero on failure
+// Notes : This service will not be created on systems that haven't got the Windows
+// support for ballontips, also note that it's upto Windows if it shows your
+// message and it keeps check of delays (don't be stupid about showing messages)
- Version: 0.3.1a
-*/
#define NIIF_INFO 0x00000001
#define NIIF_WARNING 0x00000002
#define NIIF_ERROR 0x00000003
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 82d8f12ccd..eb57a282fe 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -71,7 +71,7 @@ static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) POINT pt;
HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), _T(MOD_NAME)_T("_MenuWindow"), 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInstance, NULL);
SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc);
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)wParam, 0);
+ HMENU hMenu = Menu_BuildContactMenu(wParam);
GetCursorPos(&pt);
SetForegroundWindow(hMenuWnd);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, NULL), MPCF_CONTACTMENU), (LPARAM)wParam);
diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp index a63d2279ae..1af388347a 100644 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp @@ -102,12 +102,12 @@ INT_PTR GroupMenuonAddService(WPARAM wParam, LPARAM lParam) }
if (hGroupMainMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii->hSubMenu = Menu_GetMainMenu();
}
if (hGroupStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
}
return TRUE;
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 049e105b36..5dfb00c715 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -196,12 +196,12 @@ INT_PTR TrayMenuonAddService(WPARAM wParam, LPARAM lParam) if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii->hSubMenu = Menu_GetMainMenu();
}
if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
}
return(TRUE);
@@ -239,7 +239,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam) case TIM_CALLBACK:
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && msg->lParam == WM_LBUTTONDOWN && !db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT)) {
POINT pt;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ HMENU hMenu = (HMENU)Menu_GetStatusMenu();
g_mutex_bOnTrayRightClick = 1;
IS_WM_MOUSE_DOWN_IN_TRAY = 1;
SetForegroundWindow(msg->hwnd);
@@ -357,8 +357,8 @@ void InitTrayMenus(void) mi.name.a = LPGEN("&About");
Menu_AddTrayMenuItem(&mi);
- hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
- hStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ hMainMenu = Menu_GetMainMenu();
+ hStatusMenu = (HMENU)Menu_GetStatusMenu();
}
void UninitTrayMenu()
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index d2945e1aa0..d4851203ce 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -213,17 +213,15 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM, LPARAM) INT_PTR CLUI::Service_ShowMainMenu(WPARAM, LPARAM)
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
-
POINT pt;
GetCursorPos(&pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
return 0;
}
INT_PTR CLUI::Service_ShowStatusMenu(WPARAM, LPARAM)
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ HMENU hMenu = (HMENU)Menu_GetStatusMenu();
POINT pt;
GetCursorPos(&pt);
@@ -254,10 +252,10 @@ HRESULT CLUI::CreateCluiFrames() MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
- mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii.hSubMenu = Menu_GetMainMenu();
SetMenuItemInfo(g_hMenuMain, 0, TRUE, &mii);
- mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii.hSubMenu = (HMENU)Menu_GetStatusMenu();
SetMenuItemInfo(g_hMenuMain, 1, TRUE, &mii);
CreateCLCWindow(pcli->hwndContactList);
@@ -1816,8 +1814,7 @@ LRESULT CLUI::OnUpdate(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) LRESULT CLUI::OnInitMenu(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/)
{
if (!CLUI::IsMainMenuInited()) {
- if (ServiceExists(MS_CLIST_MENUBUILDMAIN))
- CallService(MS_CLIST_MENUBUILDMAIN, 0, 0);
+ Menu_BuildMainMenu();
CLUI::m_fMainMenuInited = TRUE;
}
return FALSE;
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 1f087a1cb4..e2b429d3a5 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -832,12 +832,12 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (msg == WM_RBUTTONDOWN) {
BOOL a = ((g_StatusBarData.perProtoConfig && p.SBarRightClk) || g_StatusBarData.SBarRightClk);
if (a ^ bShift)
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ hMenu = Menu_GetMainMenu();
else
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ hMenu = (HMENU)Menu_GetStatusMenu();
}
else {
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ hMenu = (HMENU)Menu_GetStatusMenu();
HMENU hSubMenu = GetSubMenu(hMenu, p.iProtoPos);
if (hSubMenu)
hMenu = hSubMenu;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 61911d6617..fd96059baf 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -104,12 +104,12 @@ INT_PTR GroupMenuonAddService(WPARAM wParam, LPARAM lParam) }
if (hGroupMainMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii->hSubMenu = Menu_GetMainMenu();
}
if (hGroupStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
}
if (hAppearanceMenuItemProxy == (HANDLE)lParam) {
hMenuOldContext = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3);
@@ -393,13 +393,13 @@ INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM) if (hSubGroupMainMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
//mi.fType = MFT_STRING;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii->hSubMenu = Menu_GetMainMenu();
}
if (hSubGroupStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
//mi.fType = MFT_STRING;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii->hSubMenu = (HMENU)Menu_GetStatusMenu();
}
*/
return TRUE;
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 7e73793bfc..3d4195c00e 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -699,7 +699,7 @@ LBL_Def: return 0;
}
else if (contact->type == CLCIT_CONTACT)
- hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)contact->hContact, 0);
+ hMenu = Menu_BuildContactMenu(contact->hContact);
}
else {
//call parent for new group/hide offline menu
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index af4fc69042..b82d0f7e5d 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -388,8 +388,8 @@ int InitCustomMenus(void) mi.name.a = LPGEN("&Contact list settings...");
Menu_AddContactMenuItem(&mi);
- hMainStatusMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
- hMainMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ hMainStatusMenu = (HMENU)Menu_GetStatusMenu();
+ hMainMenu = Menu_GetMainMenu();
return 0;
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 753a30e51d..6b1021238a 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1440,7 +1440,7 @@ skipbg: case IDC_STBTOPMENU: { RECT rc; - HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); + HMENU hMenu = Menu_GetMainMenu(); GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBMENU ? rc.top : rc.bottom, 0, hwnd, NULL); } @@ -1451,7 +1451,7 @@ skipbg: case IDC_TBGLOBALSTATUS: { RECT rc; - HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + HMENU hmenu = (HMENU)Menu_GetStatusMenu(); GetButtonRect(GetDlgItem(hwnd, LOWORD(wParam)), &rc); TrackPopupMenu(hmenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, rc.left, LOWORD(wParam) == IDC_TBGLOBALSTATUS ? rc.top : rc.bottom, 0, hwnd, NULL); } @@ -1639,9 +1639,9 @@ buttons_done: if (PtInRect(&rc, pt)) { HMENU hMenu; if (cfg::getByte("CLUI", "SBarRightClk", 0)) - hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); + hMenu = Menu_GetMainMenu(); else - hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + hMenu = (HMENU)Menu_GetStatusMenu(); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); return 0; } @@ -1917,12 +1917,9 @@ static INT_PTR CLN_ShowAbout(WPARAM, LPARAM) static INT_PTR CLN_ShowMainMenu(WPARAM, LPARAM) { - HMENU hMenu; POINT pt; - - hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); GetCursorPos(&pt); - TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); + TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); return 0; } @@ -1931,7 +1928,7 @@ static INT_PTR CLN_ShowStatusMenu(WPARAM, LPARAM) HMENU hMenu; POINT pt; - hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + hMenu = (HMENU)Menu_GetStatusMenu(); GetCursorPos(&pt); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL); return 0; diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index d14df1492f..1c8596e94d 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -380,8 +380,8 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_USERMENU:
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)wndData->mhContact, 0);
GetWindowRect(GetDlgItem(hwndDlg,IDC_USERMENU), &rc);
+ HMENU hMenu = Menu_BuildContactMenu(wndData->mhContact);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index f5aaf412e7..ee96c01ea1 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -356,9 +356,8 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case IDC_USERMENU:
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)wndData->hContact, 0);
-
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
+ HMENU hMenu = Menu_BuildContactMenu(wndData->hContact);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index afe0f4131c..0649431ec4 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -245,8 +245,8 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (hContact != NULL)
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
GetWindowRect((HWND)lParam, &rc);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index f4aca7de25..471528de04 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -421,7 +421,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, if (!CallService(MS_DB_CONTACT_IS, mii.dwItemData, 0))
return FALSE;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
POINT pt;
GetCursorPos(&pt);
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 22a9c99a75..aa450c50b7 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -322,7 +322,7 @@ static void ShowContactMenu(HWND hwnd, POINT pt) {
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
if (pThumb != NULL) {
- hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)pThumb->hContact, 0);
+ hContactMenu = Menu_BuildContactMenu(pThumb->hContact);
if (hContactMenu == NULL)
return;
diff --git a/plugins/HistoryPlusPlus/GlobalSearch.pas b/plugins/HistoryPlusPlus/GlobalSearch.pas index cc8e087680..5454de3ffe 100644 --- a/plugins/HistoryPlusPlus/GlobalSearch.pas +++ b/plugins/HistoryPlusPlus/GlobalSearch.pas @@ -1369,7 +1369,7 @@ begin hContact := THandle(Item.Data);
if hContact = 0 then
exit;
- UserMenu := CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ UserMenu := Menu_BuildContactMenu(hContact);
if UserMenu <> 0 then
begin
UserMenuContact := hContact;
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index 095ce2f5b2..5593f130f1 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -3654,7 +3654,7 @@ procedure THistoryFrm.tbUserMenuClick(Sender: TObject); var
p: TPoint;
begin
- UserMenu := CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ UserMenu := Menu_BuildContactMenu(hContact);
if UserMenu <> 0 then
begin
p := tbUserMenu.ClientToScreen(Point(0, tbUserMenu.Height));
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 0f507c95fd..0dc9c42f6f 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -1384,7 +1384,7 @@ void MakeHover(HWND hwnd, bool draw, bool *hover, POINT *p, RECT *r) void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, POINT &p)
{
- HMENU submenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ HMENU submenu = Menu_GetStatusMenu();
p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left);
p.y = data->status_rect.bottom + 1;
@@ -1399,7 +1399,7 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, POINT &p) void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
{
- HMENU menu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ HMENU menu = Menu_GetStatusMenu();
HMENU submenu = NULL;
if (menu != NULL) {
diff --git a/plugins/NewAwaySysMod/src/ContactList.cpp b/plugins/NewAwaySysMod/src/ContactList.cpp index 6b5e192793..76791ae33e 100644 --- a/plugins/NewAwaySysMod/src/ContactList.cpp +++ b/plugins/NewAwaySysMod/src/ContactList.cpp @@ -316,7 +316,7 @@ static LRESULT CALLBACK ContactListSubclassProc(HWND hWnd, UINT Msg, WPARAM wPar if (hItem) {
MCONTACT hContact = dat->GetItemData(hItem).hContact;
if (IsHContactContact(hContact)) {
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
if (hMenu) {
ClientToScreen(hWnd, &pt);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL), MPCF_CONTACTMENU), hContact);
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index c25182270e..fff41162fe 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -55,7 +55,7 @@ static VOID CALLBACK ShowContactMenu(MCONTACT hContact) POINT pt;
HWND hMenuWnd = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), _T(MOD_NAME)_T("_MenuWindow"), 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, g_hInstance, NULL);
SetWindowLongPtr(hMenuWnd, GWLP_WNDPROC, (LONG_PTR)MenuWndProc);
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
GetCursorPos(&pt);
SetForegroundWindow(hMenuWnd);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hMenuWnd, NULL), MPCF_CONTACTMENU), hContact);
diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index 336b88f267..d92a93f525 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -123,8 +123,8 @@ void PopupAction(HWND hWnd, BYTE action) case PCA_OPENMENU:
{
POINT pt = { 0 };
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
GetCursorPos(&pt);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hWnd, NULL);
DestroyMenu(hMenu);
}
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 31dc8a4962..3c193c4848 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -1299,8 +1299,8 @@ LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM hContact = lParam;
{
POINT pt = { 0 };
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
GetCursorPos(&pt);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
HWND hwndSave = GetForegroundWindow();
SetForegroundWindow(hwnd);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL);
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 314ddb1740..e49a7a5318 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -934,7 +934,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MENU), &rc);
- HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
int ret = TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index 265bfbbfa1..7399147902 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -823,7 +823,7 @@ begin end;
GetCursorPos(pt);
- result:=CallService(MS_CLIST_MENUBUILDCONTACT,hContact,0);
+ result:=Menu_BuildContactMenu(hContact);
if result<>0 then
begin
TrackPopupMenu(result,0,pt.x,pt.y,0,wnd,nil);
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 1b1fa73cbd..3e1daa0cf7 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -127,7 +127,7 @@ BOOL ShowListMainDlgProc_OpenContactMenu(HWND hDlg, HWND hList, int item, LASTUC lvi.iSubItem = 0;
ListView_GetItem(hList, &lvi);
if (lvi.lParam != NULL) {
- HMENU hCMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)lvi.lParam, NULL);
+ HMENU hCMenu = Menu_BuildContactMenu(lvi.lParam);
if (hCMenu != NULL) {
POINT p;
GetCursorPos(&p);
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index a01119de72..895f2b7765 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -1946,12 +1946,12 @@ LABEL_SHOWWINDOW: return TRUE;
case DM_GETCONTEXTMENU:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CallService(MS_CLIST_MENUBUILDCONTACT, si->hContact, 0));
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LPARAM)Menu_BuildContactMenu(si->hContact));
return TRUE;
case WM_CONTEXTMENU:
if (GetParent(hwndDlg) == (HWND)wParam) {
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, si->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(si->hContact);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 027dc2dd47..5ffc65d91c 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -271,7 +271,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_RBUTTONUP:
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, idat->mwd->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(idat->mwd->hContact);
POINT pt;
GetCursorPos(&pt);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index aa95a35a46..5691a9d3c8 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -905,7 +905,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_GETCONTEXTMENU:
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)hMenu);
}
return TRUE;
@@ -913,7 +913,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_CONTEXTMENU:
if (dat->hwndParent == (HWND)wParam) {
POINT pt;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -1636,7 +1636,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
else {
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
GetWindowRect(GetDlgItem(hwndDlg, LOWORD(wParam)), &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index 9bc055125f..e5ffbfcc9e 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -222,8 +222,8 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA case IDC_USERMENU:
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index f863d29df0..eee8436feb 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -757,7 +757,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact) {
int iSel = 0;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (iSel)
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), hContact);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 7afb2db8dd..0d84f4381b 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -389,15 +389,14 @@ void CMenuBar::invoke(const int id) MCONTACT hContact = dat ? dat->hContact : 0;
if (index == 3 && hContact != 0) {
- hMenu = reinterpret_cast<HMENU>(::CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0));
+ hMenu = Menu_BuildContactMenu(hContact);
m_isContactMenu = true;
}
else if (index == 0) {
- hMenu = reinterpret_cast<HMENU>(::CallService(MS_CLIST_MENUBUILDMAIN, 0, 0));
+ hMenu = Menu_BuildMainMenu();
m_isMainMenu = true;
}
- else
- hMenu = reinterpret_cast<HMENU>(m_TbButtons[index].dwData);
+ else hMenu = reinterpret_cast<HMENU>(m_TbButtons[index].dwData);
RECT rcButton;
POINT pt;
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 5075eaef36..1f647c7d5a 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -559,7 +559,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, break; case IDC_PROTOCOL: - submenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0); + submenu = Menu_BuildContactMenu(dat->hContact); if (lParam == 0) GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc); else diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index 347bbc9620..ac0869d4a2 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -63,17 +63,15 @@ int OnSettingChanging(WPARAM hContact, LPARAM lParam) INT_PTR TTBInternalMainMenuButt(WPARAM wParam, LPARAM lParam)
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
-
POINT pt;
GetCursorPos(&pt);
- TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+ TrackPopupMenu(Menu_GetMainMenu(), TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
return 0;
}
INT_PTR TTBInternalStatusMenuButt(WPARAM wParam, LPARAM lParam)
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ HMENU hMenu = (HMENU)Menu_GetStatusMenu();
POINT pt;
GetCursorPos(&pt);
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 89acc46117..1921080234 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -411,7 +411,7 @@ class CAnnivList {
CItemData *pid = pDlg->ItemData(pDlg->_curSel);
if (pid) {
- HMENU hPopup = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)pid->_hContact, 0);
+ HMENU hPopup = Menu_BuildContactMenu(pid->_hContact);
if (hPopup) {
POINT pt;
GetCursorPos(&pt);
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 5e24376a91..3fa95e3616 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -60,9 +60,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_CONTEXTMENU:
{
POINT pt;
-
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)data->hContact, 0);
GetCursorPos(&pt);
+ HMENU hMenu = Menu_BuildContactMenu(data->hContact);
TrackPopupMenu(hMenu, TPM_LEFTALIGN, pt.x, pt.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
}
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index 30c4c2a78e..09c4e4fe6b 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -176,7 +176,7 @@ LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam break;
case IDM_M7: // display contact menu
- hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,wParam,0);
+ hMenu = Menu_BuildContactMenu(wParam);
GetCursorPos(&pt);
hPopupContact = (HANDLE)wParam;
TrackPopupMenu(hMenu,TPM_LEFTALIGN,pt.x,pt.y,0,hWnd,NULL);
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index caa196e5d8..899904ccb4 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -677,7 +677,7 @@ static LRESULT CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wP item.iItem = i;
ListView_GetItem(hWnd, &item);
hContact = (MCONTACT)item.lParam;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(hContact);
if (hMenu != NULL) {
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL), MPCF_CONTACTMENU), hContact);
DestroyMenu(hMenu);
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 22f63119f3..e8ba922db5 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -605,7 +605,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
gcmi->Item[3].uType = MENU_HMENU;
- gcmi->Item[3].dwID = CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ gcmi->Item[3].dwID = (INT_PTR)Menu_BuildContactMenu(hContact);
sttShowGcMenuItems(gcmi, sttRJidItems, 0);
}
else {
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 80ca0aba1e..3b2f40ea1f 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -1228,7 +1228,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM if (items[i].title) {
MCONTACT hContact;
if ((items[i].action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) {
- HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hContactMenu = Menu_BuildContactMenu(hContact);
AppendMenu(hMenu, MF_STRING|MF_POPUP, (UINT_PTR)hContactMenu, TranslateTS(items[i].title));
}
else AppendMenu(hMenu, MF_STRING, items[i].action, TranslateTS(items[i].title));
@@ -1392,7 +1392,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid());
item->bUseResource = TRUE;
}
- HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hContactMenu = Menu_BuildContactMenu(hContact);
GetCursorPos(&pt);
int res = TrackPopupMenu(hContactMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_pDlgServiceDiscovery->GetHwnd(), NULL);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(res, MPCF_CONTACTMENU), hContact);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 68b948cff9..f589828244 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1296,7 +1296,7 @@ void CJabberProto::InfoFrame_OnTransport(CJabberInfoFrame_Event *evt) {
if (evt->m_event == CJabberInfoFrame_Event::CLICK) {
MCONTACT hContact = (MCONTACT)evt->m_pUserData;
- HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hContactMenu = Menu_BuildContactMenu(hContact);
POINT pt;
GetCursorPos(&pt);
int res = TrackPopupMenu(hContactMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 09c19b331b..21842deb6e 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -386,8 +386,8 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_USERMENU:
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
GetWindowRect((HWND)lParam, &rc);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 56aaf3bb88..330dcaf295 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -338,9 +338,9 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_USERMENU:
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
RECT rc;
GetWindowRect((HWND)lParam, &rc);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 1db269962e..5b14d30c9d 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -357,7 +357,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_CONTACT: { RECT rc; - HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + HMENU hMenu = Menu_BuildContactMenu(dat->hContact); GetWindowRect((HWND)lParam, &rc); TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index acb7c0049d..21d47e4340 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -818,8 +818,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (pt.x >= rc.left)
break;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
-
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
TrackPopupMenu(hMenu, 0, pt2.x, pt2.y, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
}
@@ -1420,7 +1419,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
else {
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
GetWindowRect(GetDlgItem(hwndDlg, LOWORD(wParam)), &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index 0d781abc76..0e0cb5841a 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -192,7 +192,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_USERMENU:
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -584,7 +584,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_USERMENU:
{
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
+ HMENU hMenu = Menu_BuildContactMenu(dat->hContact);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 6c3a6c3125..8377782a84 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -1262,7 +1262,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
if (contact->type == CLCIT_CONTACT)
- hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)contact->hContact, 0);
+ hMenu = Menu_BuildContactMenu(contact->hContact);
}
else {
//call parent for new group/hide offline menu
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index c76360b886..79518f6aa9 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -143,6 +143,17 @@ int fnGetAverageMode(int *pNetProtoCount) return averageMode;
}
+static int RecursiveDeleteMenu(HMENU hMenu)
+{
+ int cnt = GetMenuItemCount(hMenu);
+ for (int i = 0; i < cnt; i++) {
+ HMENU submenu = GetSubMenu(hMenu, 0);
+ if (submenu) DestroyMenu(submenu);
+ DeleteMenu(hMenu, 0, MF_BYPOSITION);
+ }
+ return 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// MAIN MENU
@@ -153,13 +164,19 @@ struct MainMenuExecParam TMO_IntMenuItem *pimi;
};
-static INT_PTR BuildMainMenu(WPARAM, LPARAM)
+MIR_APP_DLL(HMENU) Menu_BuildMainMenu(void)
{
NotifyEventHooks(hPreBuildMainMenuEvent, 0, 0);
Menu_Build(hMainMenu, hMainMenuObject);
DrawMenuBar(cli.hwndContactList);
- return (INT_PTR)hMainMenu;
+ return hMainMenu;
+}
+
+MIR_APP_DLL(HMENU) Menu_GetMainMenu(void)
+{
+ RecursiveDeleteMenu(hMainMenu);
+ return Menu_BuildMainMenu();
}
MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(CLISTMENUITEM *mi, int _hLang)
@@ -230,6 +247,8 @@ struct ContactMenuExecParam TMO_IntMenuItem *pimi;
};
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(CLISTMENUITEM *mi, const char *pszProto, int _hLang)
{
TMO_MenuItem tmi;
@@ -266,7 +285,9 @@ MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(CLISTMENUITEM *mi, const char *psz return pimi;
}
-static INT_PTR BuildContactMenu(WPARAM hContact, LPARAM)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+EXTERN_C MIR_APP_DLL(HMENU) Menu_BuildContactMenu(MCONTACT hContact)
{
NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0);
@@ -279,26 +300,11 @@ static INT_PTR BuildContactMenu(WPARAM hContact, LPARAM) HMENU hMenu = CreatePopupMenu();
Menu_Build(hMenu, hContactMenuObject, (WPARAM)&bcp);
- return (INT_PTR)hMenu;
-}
-
-// called with:
-// wparam - ownerdata
-// lparam - lparam from winproc
-INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam)
-{
- if (wParam != 0) {
- ContactMenuExecParam *cmep = (ContactMenuExecParam*)wParam;
- if (cmep->pszContactOwner && cmep->szServiceName && cmep->szServiceName[0] == '/')
- ProtoCallService(cmep->pszContactOwner, cmep->szServiceName, lParam, cmep->pimi->execParam);
- else
- CallService(cmep->szServiceName, lParam, cmep->pimi->execParam);
- }
- return 0;
+ return hMenu;
}
// true - ok, false ignore
-INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
+static INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
if (pcpp == NULL)
@@ -326,7 +332,24 @@ INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM) return TRUE;
}
-INT_PTR FreeOwnerDataContactMenu(WPARAM, LPARAM lParam)
+// called with:
+// wparam - ContactMenuExecParam*
+// lparam - lparam from winproc
+static INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam != 0) {
+ ContactMenuExecParam *cmep = (ContactMenuExecParam*)wParam;
+ if (cmep->pszContactOwner && cmep->szServiceName && cmep->szServiceName[0] == '/')
+ ProtoCallService(cmep->pszContactOwner, cmep->szServiceName, lParam, cmep->pimi->execParam);
+ else
+ CallService(cmep->szServiceName, lParam, cmep->pimi->execParam);
+ }
+ return 0;
+}
+
+// called with:
+// lparam - ContactMenuExecParam*
+static INT_PTR FreeOwnerDataContactMenu(WPARAM, LPARAM lParam)
{
ContactMenuExecParam *cmep = (ContactMenuExecParam*)lParam;
if (cmep != NULL) {
@@ -387,6 +410,16 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(CLISTMENUITEM *mi, const char *pszP /////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(HMENU) Menu_GetStatusMenu()
+{
+ RecursiveDeleteMenu(hStatusMenu);
+
+ Menu_Build(hStatusMenu, hStatusMenuObject);
+ return hStatusMenu;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
BOOL FindMenuHandleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itdat)
{
if (!itdat)
@@ -708,33 +741,6 @@ static int MenuIconsChanged(WPARAM, LPARAM) return 0;
}
-int RecursiveDeleteMenu(HMENU hMenu)
-{
- int cnt = GetMenuItemCount(hMenu);
- for (int i = 0; i < cnt; i++) {
- HMENU submenu = GetSubMenu(hMenu, 0);
- if (submenu) DestroyMenu(submenu);
- DeleteMenu(hMenu, 0, MF_BYPOSITION);
- }
- return 0;
-}
-
-static INT_PTR MenuGetMain(WPARAM, LPARAM)
-{
- RecursiveDeleteMenu(hMainMenu);
-
- BuildMainMenu(0, 0);
- return (INT_PTR)hMainMenu;
-}
-
-static INT_PTR BuildStatusMenu(WPARAM, LPARAM)
-{
- RecursiveDeleteMenu(hStatusMenu);
-
- Menu_Build(hStatusMenu, hStatusMenuObject);
- return (INT_PTR)hStatusMenu;
-}
-
static INT_PTR SetStatusMode(WPARAM wParam, LPARAM)
{
prochotkey = true;
@@ -964,7 +970,7 @@ void RebuildMenuOrder(void) }
}
- BuildStatusMenu(0, 0);
+ Menu_GetStatusMenu();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1138,12 +1144,6 @@ void InitCustomMenus(void) CreateServiceFunction(MS_CLIST_SETSTATUSMODE, SetStatusMode);
- CreateServiceFunction(MS_CLIST_MENUGETMAIN, MenuGetMain);
- CreateServiceFunction(MS_CLIST_MENUBUILDMAIN, BuildMainMenu);
-
- CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT, BuildContactMenu);
-
- CreateServiceFunction(MS_CLIST_MENUGETSTATUS, BuildStatusMenu);
CreateServiceFunction(MS_CLIST_MENUPROCESSCOMMAND, MenuProcessCommand);
CreateServiceFunction(MS_CLIST_MENUPROCESSHOTKEY, MenuProcessHotkey);
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 2e45b26994..10ba26b081 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -685,7 +685,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) else if (msg->lParam == (db_get_b(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
POINT pt;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ HMENU hMenu = (HMENU)Menu_GetStatusMenu();
for (int i = 0; i < cli.trayIconCount; i++) {
if ((unsigned)cli.trayIcon[i].id == msg->wParam) {
@@ -727,10 +727,10 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU | MIIM_TYPE;
mii.fType = MFT_STRING;
- mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii.hSubMenu = Menu_GetMainMenu();
mii.dwTypeData = TranslateT("&Main menu");
InsertMenuItem(hMenu, 1, TRUE, &mii);
- mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii.hSubMenu = (HMENU)Menu_GetStatusMenu();
mii.dwTypeData = TranslateT("&Status");
InsertMenuItem(hMenu, 2, TRUE, &mii);
SetMenuDefaultItem(hMenu, ID_TRAY_HIDE, FALSE);
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index dc3413ee4c..d73eee5893 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -62,9 +62,9 @@ static int CluiModulesLoaded(WPARAM, LPARAM) MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
- mii.hSubMenu = (HMENU) CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii.hSubMenu = Menu_GetMainMenu();
SetMenuItemInfo(cli.hMenuMain, 0, TRUE, &mii);
- mii.hSubMenu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii.hSubMenu = Menu_GetStatusMenu();
SetMenuItemInfo(cli.hMenuMain, 1, TRUE, &mii);
}
return 0;
@@ -876,7 +876,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rc;
POINT pt;
- hMenu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ hMenu = Menu_GetStatusMenu();
nParts = SendMessage(cli.hwndStatus, SB_GETPARTS, 0, 0);
if (nm->dwItemSpec == 0xFFFFFFFE) {
nPanel = nParts - 1;
@@ -915,7 +915,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
- mii.hSubMenu = (HMENU)CallService((pos == 0) ? MS_CLIST_MENUGETMAIN : MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii.hSubMenu = (pos == 0) ? Menu_GetMainMenu() : Menu_GetStatusMenu();
SetMenuItemInfo(cli.hMenuMain, pos, TRUE, &mii);
}
}
@@ -955,9 +955,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (PtInRect(&rc, pt)) {
HMENU hMenu;
if (db_get_b(NULL, "CLUI", "SBarRightClk", 0))
- hMenu = (HMENU) CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ hMenu = Menu_GetMainMenu();
else
- hMenu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ hMenu = (HMENU) Menu_GetStatusMenu();
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
return 0;
}
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 6bb8e3a315..38d926147b 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -659,7 +659,7 @@ int Meta_ModulesLoaded(WPARAM, LPARAM) static VOID CALLBACK sttMenuThread(PVOID param)
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)param, 0);
+ HMENU hMenu = Menu_BuildContactMenu(MCONTACT(param));
TPMPARAMS tpmp = { 0 };
tpmp.cbSize = sizeof(tpmp);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 4daf0930f4..f8cb51b46f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -225,3 +225,7 @@ Menu_AddContactMenuItem @222 Menu_AddMainMenuItem @223
Menu_AddProtoMenuItem @224
Menu_AddStatusMenuItem @225
+Menu_BuildContactMenu @226
+Menu_BuildMainMenu @227
+Menu_GetMainMenu @228
+Menu_GetStatusMenu @229
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index e115db38c2..0e85f44f5c 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -225,3 +225,7 @@ Menu_AddContactMenuItem @222 Menu_AddMainMenuItem @223
Menu_AddProtoMenuItem @224
Menu_AddStatusMenuItem @225
+Menu_BuildContactMenu @226
+Menu_BuildMainMenu @227
+Menu_GetMainMenu @228
+Menu_GetStatusMenu @229
|