diff options
Diffstat (limited to 'plugins/Clist_mw/src/groupmenu.cpp')
-rw-r--r-- | plugins/Clist_mw/src/groupmenu.cpp | 86 |
1 files changed, 44 insertions, 42 deletions
diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index c6fd1ea357..fdd3af5b08 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -1,9 +1,10 @@ /*
-Miranda IM: the free IM client for Microsoft* Windows*
+Miranda NG: the free IM client for Microsoft* Windows*
-Copyright 2000-2003 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-03 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -20,6 +21,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "commonheaders.h"
#include "m_clui.h"
#include "clist.h"
@@ -72,7 +74,7 @@ static INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam) hMenu = CreatePopupMenu();
//hMenu = wParam;
tick = GetTickCount();
-
+
NotifyEventHooks(hPreBuildGroupMenuEvent,0,0);
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
@@ -87,11 +89,11 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
if ( !pcli->pfnConvertMenu(mi, &tmi))
return 0;
-
+
lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam));
if (mmep == NULL)
return 0;
-
+
//we need just one parametr.
mmep->szServiceName = mir_strdup(mi->pszService);
mmep->Param1 = mi->popupPosition;
@@ -107,7 +109,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam) OptParam op;
op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi);
- op.Setting = OPT_MENUITEMSETUNIQNAME;
+ op.Setting = OPT_MENUITEMSETUNIQNAME;
op.Value = (INT_PTR)buf;
CallService(MO_SETOPTIONSMENUITEM,0,(LPARAM)&op);
return (INT_PTR)op.Handle;
@@ -133,14 +135,14 @@ 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 = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
}
if (hGroupStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
}
-
+
return TRUE;
}
@@ -150,17 +152,17 @@ INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam) { INT_PTR GroupMenuExecService(WPARAM wParam,LPARAM lParam) {
if (wParam != 0)
{
- lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)wParam;
+ lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)wParam;
if ( !strcmp(mmep->szServiceName,"Help/AboutCommand"))
{
//bug in help.c,it used wparam as parent window handle without reason.
mmep->Param1 = 0;
- CallService(mmep->szServiceName,mmep->Param1,lParam);
+ CallService(mmep->szServiceName,mmep->Param1,lParam);
}else
{
- CallService(mmep->szServiceName,mmep->Param1,mmep->Param2);
+ CallService(mmep->szServiceName,mmep->Param1,mmep->Param2);
}
-
+
}
return(1);
}
@@ -184,7 +186,7 @@ INT_PTR HideGroupsHelper(WPARAM wParam,LPARAM lParam) }
INT_PTR UseGroupsHelper(WPARAM wParam,LPARAM lParam)
-{
+{
int newVal = !(GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS);
db_set_b(NULL,"CList","UseGroups",(BYTE)newVal);
SendMessage(pcli->hwndContactTree,CLM_SETUSEGROUPS,newVal,0);
@@ -205,13 +207,13 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) {
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | ( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
- Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
+ Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree,CLM_GETHIDEOFFLINEROOT,0,0)?CMIF_CHECKED:0);
- Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
-
+ Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
+
mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_HIDEEMPTYGROUPS?CMIF_CHECKED:0);
- Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
+ Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE)&CLS_USEGROUPS?0:CMIF_CHECKED);
Menu_ModifyItem(hDisableGroupsMenuItem, &mi);
@@ -221,8 +223,8 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
{
HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP,0);
- NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon);
-
+ NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon);
+
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ICON;
mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
@@ -234,7 +236,7 @@ int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam) void InitGroupMenus(void)
{
HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0);
- NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon );
+ NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon );
CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu);
@@ -256,7 +258,7 @@ void InitGroupMenus(void) MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
- {
+ {
//add exit command to menu
GroupMenuParam gmp;
@@ -318,7 +320,7 @@ void InitGroupMenus(void) mi.position = 100000;
mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
mi.pszService = MS_CLIST_GROUPCREATE;
- mi.pszName = LPGEN("&New Group");
+ mi.pszName = LPGEN("&New Group");
hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
memset(&mi,0,sizeof(mi));
@@ -326,7 +328,7 @@ void InitGroupMenus(void) mi.position = 100001;
mi.hIcon = NULL;
mi.pszService = MS_CLIST_SETHIDEOFFLINE;
- mi.pszName = LPGEN("&Hide Offline Users");
+ mi.pszName = LPGEN("&Hide Offline Users");
gmp.lParam = 0;gmp.wParam = -1;
hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
@@ -335,7 +337,7 @@ void InitGroupMenus(void) mi.position = 100002;
mi.hIcon = NULL;
mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
- mi.pszName = LPGEN("Hide &Offline Users out here");
+ mi.pszName = LPGEN("Hide &Offline Users out here");
hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
memset(&mi,0,sizeof(mi));
@@ -343,7 +345,7 @@ void InitGroupMenus(void) mi.position = 100003;
mi.hIcon = NULL;
mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
- mi.pszName = LPGEN("Hide &Empty Groups");
+ mi.pszName = LPGEN("Hide &Empty Groups");
hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
memset(&mi,0,sizeof(mi));
@@ -351,7 +353,7 @@ void InitGroupMenus(void) mi.position = 100004;
mi.hIcon = NULL;
mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
- mi.pszName = LPGEN("Disable &Groups");
+ mi.pszName = LPGEN("Disable &Groups");
hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);
HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
@@ -396,7 +398,7 @@ static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) //contact->group
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0);
- Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
+ Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
return 0;
}
@@ -412,7 +414,7 @@ static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) hMenu = CreatePopupMenu();
//hMenu = wParam;
tick = GetTickCount();
-
+
NotifyEventHooks(hPreBuildSubGroupMenuEvent,wParam,0);
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
@@ -427,11 +429,11 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam) CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
if ( !pcli->pfnConvertMenu(mi, &tmi))
return 0;
-
+
lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam));
if ( mmep == NULL)
return 0;
-
+
//we need just one parametr.
mmep->szServiceName = mir_strdup(mi->pszService);
mmep->Param1 = mi->popupPosition;
@@ -473,13 +475,13 @@ INT_PTR SubGroupMenuonAddService(WPARAM wParam,LPARAM lParam) INT_PTR SubGroupMenuExecService(WPARAM wParam,LPARAM lParam)
{
if (wParam != 0) {
- lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)wParam;
+ lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)wParam;
if ( !strcmp(mmep->szServiceName,"Help/AboutCommand")) {
//bug in help.c,it used wparam as parent window handle without reason.
mmep->Param1 = 0;
- CallService(mmep->szServiceName,mmep->Param1,lParam);
+ CallService(mmep->szServiceName,mmep->Param1,lParam);
}
- else CallService(mmep->szServiceName,mmep->Param1,mmep->Param2);
+ else CallService(mmep->szServiceName,mmep->Param1,mmep->Param2);
}
return 1;
@@ -516,19 +518,19 @@ void InitSubGroupMenus(void) HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);
//SubGroup menu
- hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
//add exit command to menu
GroupMenuParam gmp;
-
+
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 1000;
mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&New SubGroup");
+ mi.pszName = LPGEN("&New SubGroup");
gmp.lParam = 0;gmp.wParam = POPUP_NEWSUBGROUP;
hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
@@ -537,7 +539,7 @@ void InitSubGroupMenus(void) mi.position = 1001;
mi.hIcon = NULL;
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Hide Offline Users in here");
+ mi.pszName = LPGEN("&Hide Offline Users in here");
gmp.lParam = 0;gmp.wParam = POPUP_GROUPHIDEOFFLINE;
hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
@@ -546,16 +548,16 @@ void InitSubGroupMenus(void) mi.position = 900001;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_RENAME));
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Rename Group");
+ mi.pszName = LPGEN("&Rename Group");
gmp.lParam = 0;gmp.wParam = POPUP_RENAMEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
-
+
memset(&mi,0,sizeof(mi));
mi.cbSize = sizeof(mi);
mi.position = 900002;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_DELETE));
mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Delete Group");
+ mi.pszName = LPGEN("&Delete Group");
gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP;
AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
}
|