示例#1
0
void InitSubGroupMenus(void)
{
	CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService);
	CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu);
	CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy",GroupMenuExecProxy);

	CreateServiceFunction("CList/AddSubGroupMenuItem",AddSubGroupMenuItem);
	CreateServiceFunction(MS_CLIST_REMOVESUBGROUPMENUITEM,RemoveSubGroupMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP,BuildSubGroupMenu);
	hPreBuildSubGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
	HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);

	//SubGroup menu
	hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");

	//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");
	gmp.lParam = 0;gmp.wParam = POPUP_NEWSUBGROUP;
	hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);

	memset(&mi,0,sizeof(mi));
	mi.cbSize = sizeof(mi);
	mi.position = 1001;
	mi.hIcon = NULL;
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	mi.pszName = LPGEN("&Hide Offline Users in here");
	gmp.lParam = 0;gmp.wParam = POPUP_GROUPHIDEOFFLINE;
	hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);

	memset(&mi,0,sizeof(mi));
	mi.cbSize = sizeof(mi);
	mi.position = 900001;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); //LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_RENAME));
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	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");
	gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP;
	AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);
}
示例#2
0
void gg_links_instancemenu_init()
{
	CreateServiceFunction(GGS_MENUCHOOSE, gg_menuchoose);
	hInstanceMenu = MO_CreateMenuObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), 0, GGS_MENUCHOOSE);

	TMO_MenuItem tmi = {0};
	tmi.cbSize = sizeof(tmi);
	tmi.pszName = "Cancel";
	tmi.position = 9999999;
	tmi.hIcolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE);
	CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&tmi);
}
示例#3
0
int InitFramesMenus(void)
{
	CreateServiceFunction("FrameMenuExecService", FrameMenuExecService);
	CreateServiceFunction("FrameMenuCheckService", FrameMenuCheckService);
	CreateServiceFunction("FrameMenuFreeService", FreeOwnerDataFrameMenu);

	CreateServiceFunction("CList/AddContextFrameMenuItem", AddContextFrameMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT, BuildContextFrameMenu);
	CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY, ContextFrameMenuNotify);
	hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);

	// frame menu object
	hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
	MO_SetMenuObjectParam(hFrameMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "FrameMenuFreeService");
	return 0;
}
示例#4
0
void CSteamProto::InitMenus()
{
	hChooserMenu = MO_CreateMenuObject("SkypeAccountChooser", LPGEN("Steam menu chooser"), 0, "Steam/MenuChoose");

	//////////////////////////////////////////////////////////////////////////////////////
	// Contact menu initialization
	CLISTMENUITEM mi = { 0 };
	mi.cbSize = sizeof(CLISTMENUITEM);
	mi.flags = CMIF_TCHAR;

	// "Request authorization"
	mi.pszService = MODULE "/AuthRequest";
	mi.ptszName = LPGENT("Request authorization");
	mi.position = -201001000 + CMI_AUTH_REQUEST;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
	contactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi);
	CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::AuthRequestCommand>);

	// "Block"
	mi.pszService = MODULE "/Block";
	mi.ptszName = LPGENT("Block");
	mi.position = -201001001 + CMI_BLOCK;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
	contactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
	CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::BlockCommand>);

	mi.flags |= CMIF_NOTOFFLINE;

	// "Join to game"
	mi.pszService = MODULE "/JoinToGame";
	mi.ptszName = LPGENT("Join to game");
	mi.position = -200001000 + CMI_JOIN_GAME;
	mi.icolibItem = NULL;
	contactMenuItems[CMI_JOIN_GAME] = Menu_AddContactMenuItem(&mi);
	CreateServiceFunction(mi.pszService, GlobalService<&CSteamProto::JoinToGameCommand>);
}
示例#5
0
void InitSubGroupMenus(void)
{
	CreateServiceFunction("CLISTMENUSSubGroup/ExecService", SubGroupMenuExecService);
	CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu", FreeOwnerDataSubGroupMenu);
	CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService", SubGroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService", SubGroupMenuCheckService);
	CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy);

	CreateServiceFunction("CList/AddSubGroupMenuItem", AddSubGroupMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDSUBGROUP, BuildSubGroupMenu);

	HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu);

	// SubGroup menu
	hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
	MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");

	// add exit command to menu
	GroupMenuParam gmp;

	CLISTMENUITEM mi = { sizeof(mi) };
	mi.position = 1000;
	mi.icolibItem = iconItem.hIcolib;
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	mi.pszName = LPGEN("&New subgroup");
	gmp.lParam = 0;
	gmp.wParam = POPUP_NEWSUBGROUP;
	hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
	DestroyIcon_protect(mi.hIcon);

	mi.position = 1001;
	mi.hIcon = NULL;
	mi.icolibItem = NULL;
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	mi.pszName = LPGEN("&Hide offline users in here");
	gmp.lParam = 0;
	gmp.wParam = POPUP_GROUPHIDEOFFLINE;
	hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);

	mi.position = 1002;
	mi.hIcon = NULL;
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	mi.pszName = LPGEN("&Show offline users in here");
	gmp.lParam = 0;
	gmp.wParam = POPUP_GROUPSHOWOFFLINE;
	hShowOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);

	memset(&mi, 0, sizeof(mi));
	mi.cbSize = sizeof(mi);
	mi.position = 900001;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME);
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	mi.pszName = LPGEN("&Rename group");
	gmp.lParam = 0;
	gmp.wParam = POPUP_RENAMEGROUP;
	AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);

	mi.position = 900002;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE);
	mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
	mi.pszName = LPGEN("&Delete group");
	gmp.lParam = 0;
	gmp.wParam = POPUP_DELETEGROUP;
	AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
}
示例#6
0
void GroupMenus_Init(void)
{
	Icon_RegisterT(g_hInst, LPGENT("Contact list"), &iconItem, 1);

	CreateServiceFunction("CLISTMENUSGroup/ExecService", GroupMenuExecService);
	CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu", FreeOwnerDataGroupMenu);
	CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService", GroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper", HideOfflineRootHelper);
	CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper", CreateGroupHelper);

	CreateServiceFunction("CList/AddGroupMenuItem", AddGroupMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDGROUP, BuildGroupMenu);

	HookEvent(ME_CLIST_PREBUILDGROUPMENU, OnBuildGroupMenu);

	InitSubGroupMenus();

	// Group menu
	hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");

	//add  exit command to menu
	GroupMenuParam gmp;

	CLISTMENUITEM mi = { sizeof(mi) };
	mi.position = 1900000;
	mi.pszService = "CloseAction";
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_EXIT);
	mi.pszName = LPGEN("E&xit");
	AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 500;
	mi.pszService = MS_CLIST_SHOWHIDE;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_SHOWHIDE);
	mi.pszName = LPGEN("&Hide/show");
	hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 200000;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER);
	mi.pszService = "FindAdd/FindAddCommand";
	mi.pszName = LPGEN("&Find/add contacts...");
	AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 300000;
	mi.pszService = "";
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MAINMENU); // eternity #004
	mi.pszName = LPGEN("&Main menu");
	hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 300100;
	mi.pszService = "";
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_STATUS); // eternity #004
	mi.pszName = LPGEN("&Status");
	hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 400000;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS);
	mi.pszService = "Options/OptionsCommand";
	mi.pszName = LPGEN("&Options...");
	AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 500000;
	mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA);
	mi.pszService = "Help/AboutCommand";
	mi.pszName = LPGEN("&About");
	AddGroupMenuItem(0, (LPARAM)&mi);

	mi.flags = 0;
	mi.position = 100000;
	mi.icolibItem = iconItem.hIcolib;
	mi.pszService = "CLISTMENUSGroup/CreateGroupHelper";
	mi.pszName = LPGEN("&New group");
	hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
	DestroyIcon_protect(mi.hIcon);

	mi.position = 100001;
	mi.hIcon = NULL;
	mi.icolibItem = NULL;
	mi.pszService = MS_CLIST_SETHIDEOFFLINE;
	mi.pszName = LPGEN("&Hide offline users");
	gmp.lParam = 0; gmp.wParam = -1;
	hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);

	mi.position = 100002;
	mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
	mi.pszName = LPGEN("Hide &offline users out here");
	hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 100003;
	mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
	mi.pszName = LPGEN("Hide &empty groups");
	hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

	mi.position = 100004;
	mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
	mi.pszName = LPGEN("Disable &groups");
	hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
}
示例#7
0
void InitMirOTRMenu(void)
{
	WNDCLASS wc = {0};
	wc.hInstance = hInst;
	wc.lpfnWndProc = PopupMenuWndProc;
	wc.lpszClassName = _T("MirOTRPopupMenuProcessor");
	RegisterClass(&wc);
	hDummyPaintWin = CreateWindowEx(0, _T("MirOTRPopupMenuProcessor"), NULL, 0, 0, 0, 1, 1, 0, 0, hInst, 0);

	CreateServiceFunction("MirOTRMenuExecService",MirOTRMenuExecService);
	CreateServiceFunction("MirOTRMenuCheckService",MirOTRMenuCheckService);

	// menu object
	CreateServiceFunction("MIROTRMENUS/FreeOwnerDataMirOTRMenu",FreeOwnerDataMirOTRMenu);
	CreateServiceFunction("MIROTRMENUS/OnAddMenuItemMirOTRMenu",OnAddMenuItemMirOTRMenu);

	CreateServiceFunction(MS_MIROTR_ADDMIROTRMENUITEM,AddMirOTRMenuItem);
	CreateServiceFunction(MS_MIROTR_MENUBUILDMIROTR,BuildMirOTRMenu);
	CreateServiceFunction(MS_MIROTR_REMOVEMIROTRMENUITEM,RemoveMirOTRMenuItem);

	hMirOTRMenuObject = MO_CreateMenuObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService");
	MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_USERDEFINEDITEMS, FALSE);
	MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "MIROTRMENUS/FreeOwnerDataMirOTRMenu");
	MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "MIROTRMENUS/OnAddMenuItemMirOTRMenu");

	// menu items
	MIROTRMENUITEM mi = {0};
	mi.cbSize = sizeof(mi);

	mi.flags = CMIF_DISABLED | CMIF_TCHAR;
	mi.ptszName = LPGENT("OTR Status");
	mi.position = 0;
	hStatusInfoItem = (HGENMENU) AddMirOTRMenuItem(0, (LPARAM) &mi);

	mi.flags = CMIF_TCHAR | CMIF_NOTPRIVATE | CMIF_NOTUNVERIFIED;
	mi.ptszName = _T(LANG_MENU_START);
	mi.position = 100001;
	mi.pszService = MS_OTR_MENUSTART;
	mi.icolibItem = GetIconHandle(ICON_UNVERIFIED);
	AddMirOTRMenuItem(0, (LPARAM) &mi);

	mi.flags = CMIF_TCHAR | CMIF_NOTNOTPRIVATE | CMIF_NOTFINISHED;
	mi.ptszName = _T(LANG_MENU_REFRESH);
	mi.position = 100002;
	mi.pszService = MS_OTR_MENUREFRESH;
	mi.icolibItem = GetIconHandle(ICON_FINISHED);
	AddMirOTRMenuItem(0, (LPARAM) &mi);

	mi.flags = CMIF_TCHAR | CMIF_NOTNOTPRIVATE;
	mi.ptszName = _T(LANG_MENU_STOP);
	mi.position = 100003;
	mi.pszService = MS_OTR_MENUSTOP;
	mi.icolibItem = GetIconHandle(ICON_NOT_PRIVATE);
	AddMirOTRMenuItem(0, (LPARAM) &mi);

	mi.flags = CMIF_TCHAR | CMIF_NOTNOTPRIVATE | CMIF_NOTFINISHED;
	mi.ptszName = _T(LANG_MENU_VERIFY);
	mi.position = 200001;
	mi.pszService = MS_OTR_MENUVERIFY;
	mi.icolibItem = GetIconHandle(ICON_PRIVATE);
	AddMirOTRMenuItem(0, (LPARAM) &mi);

	mi.flags = CMIF_TCHAR|CMIF_CHECKED;
	mi.ptszName = _T(LANG_MENU_TOGGLEHTML);
	mi.position = 300001;
	mi.pszService = MS_OTR_MENUTOGGLEHTML;
	hHTMLConvMenuItem = (HGENMENU) AddMirOTRMenuItem(0, (LPARAM) &mi);
}
示例#8
0
void  CSkypeProto::InitMenus()
{
	hChooserMenu = MO_CreateMenuObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");

	//////////////////////////////////////////////////////////////////////////////////////
	// Contact menu initialization

	CLISTMENUITEM mi = { 0 };
	mi.cbSize = sizeof(CLISTMENUITEM);
	mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE;

	// "Request authorization"
	mi.pszService = MODULE"/RequestAuth";
	mi.ptszName = LPGENT("Request authorization");
	mi.position = -201001000 + CMI_AUTH_REQUEST;
	mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_AUTH_REQUEST);
	CSkypeProto::contactMenuItems[CMI_AUTH_REQUEST] = ::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::RequestAuth>);

	// "Grant authorization"
	mi.pszService = MODULE"/GrantAuth";
	mi.ptszName = LPGENT("Grant authorization");
	mi.position = -201001000 + CMI_AUTH_GRANT;
	mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_AUTH_GRANT);
	CSkypeProto::contactMenuItems[CMI_AUTH_GRANT] = ::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::GrantAuth>);

	// "Revoke authorization"
	mi.pszService = MODULE"/RevokeAuth";
	mi.ptszName = LPGENT("Revoke authorization");
	mi.position = -201001000 + CMI_AUTH_REVOKE;
	mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_AUTH_REVOKE);
	CSkypeProto::contactMenuItems[CMI_AUTH_REVOKE] = ::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::RevokeAuth>);

	// "Block"
	mi.pszService = MODULE"/Block";
	mi.ptszName = LPGENT("Block this person...");
	mi.position = -200001000 + CMI_BLOCK;
	mi.icolibItem = CSkypeProto::GetSkinIconHandle("block");
	CSkypeProto::contactMenuItems[CMI_BLOCK] = ::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockCommand>);

	mi.pszService = MODULE"/SyncHistory";
	mi.ptszName = LPGENT("View old messages...");
	mi.flags = CMIF_TCHAR | CMIF_ROOTPOPUP;
	mi.position = -200001000 + CMI_HISTORY;
	mi.icolibItem = ::LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
	CSkypeProto::contactMenuItems[CMI_HISTORY] = ::Menu_AddContactMenuItem(&mi);
	
	mi.flags &= ~CMIF_ROOTPOPUP;

	mi.pszService = MODULE"/SyncHistoryDay";
	mi.ptszName = LPGENT("for last day");
	mi.flags |= CMIF_CHILDPOPUP;
	mi.position = -200001000 + CMI_HISTORY + 100;
	mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
	::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastDayHistoryCommand>);

	mi.pszService = MODULE"/SyncHistoryWeek";
	mi.ptszName = LPGENT("for last week");
	mi.flags |= CMIF_CHILDPOPUP;
	mi.position = -200001000 + CMI_HISTORY + 1001;
	mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
	::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastWeekHistoryCommand>);

	mi.pszService = MODULE"/SyncHistoryMonth";
	mi.ptszName = LPGENT("for last month");
	mi.flags |= CMIF_CHILDPOPUP;
	mi.position = -200001000 + CMI_HISTORY + 102;
	mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
	::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastMonthHistoryCommand>);

	mi.pszService = MODULE"/SyncHistory3Month";
	mi.ptszName = LPGENT("for last 3 month");
	mi.flags |= CMIF_CHILDPOPUP;
	mi.position = -200001000 + CMI_HISTORY + 103;
	mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
	::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLast3MonthHistoryCommand>);

	mi.pszService = MODULE"/SyncHistoryYear";
	mi.ptszName = LPGENT("for last year");
	mi.flags |= CMIF_CHILDPOPUP;
	mi.position = -200001000 + CMI_HISTORY + 104;
	mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
	::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncLastYearHistoryCommand>);

	mi.pszService = MODULE"/SyncHistoryAllTime";
	mi.ptszName = LPGENT("for all time");
	mi.flags |= CMIF_CHILDPOPUP;
	mi.position = -200001000 + CMI_HISTORY + 105;
	mi.hParentMenu = CSkypeProto::contactMenuItems[CMI_HISTORY];
	::Menu_AddContactMenuItem(&mi);
	::CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::SyncAllTimeHistoryCommand>);
}
示例#9
0
void InitGroupMenus(void)
{
	HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact list","New Group",-IDI_NEWGROUP2,0);
	NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon );

	CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
	CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu);
	CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService",GroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper",HideGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper",UseGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper",HideOfflineRootHelper);

	CreateServiceFunction("CList/AddGroupMenuItem",AddGroupMenuItem);
	CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu);
	hPreBuildGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
	HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu);

	InitSubGroupMenus();

	// Group menu
	hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
	{
		//add  exit command to menu
		GroupMenuParam gmp;

		CLISTMENUITEM mi = { sizeof(mi) };
		mi.position = 1900000;
		mi.pszService = "CloseAction";
		mi.pszName = LPGEN("E&xit");
		AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 500;
		mi.pszService = MS_CLIST_SHOWHIDE;
		mi.pszName = LPGEN("&Hide/Show");
		hHideShowMainMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 200000;
		mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER));
		mi.pszService = "FindAdd/FindAddCommand";
		mi.pszName = LPGEN("&Find/Add Contacts...");
		AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 300000;
		mi.pszService = "";
		mi.pszName = LPGEN("&Main menu");
		hGroupMainMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 300100;
		mi.pszService = "";
		mi.pszName = LPGEN("&Status");
		hGroupStatusMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 400000;
		mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS));
		mi.pszService = "Options/OptionsCommand";
		mi.pszName = LPGEN("&Options...");

		AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 500000;
		mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
		mi.pszService = "Help/AboutCommand";
		mi.pszName = LPGEN("&About");

		//AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100000;
		mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
		mi.pszService = MS_CLIST_GROUPCREATE;
		mi.pszName = LPGEN("&New Group");
		hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100001;
		mi.hIcon = NULL;
		mi.pszService = MS_CLIST_SETHIDEOFFLINE;
		mi.pszName = LPGEN("&Hide Offline Users");
		gmp.lParam = 0;gmp.wParam = -1;
		hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100002;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
		mi.pszName = LPGEN("Hide &Offline Users out here");
		hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100003;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
		mi.pszName = LPGEN("Hide &Empty Groups");
		hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100004;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
		mi.pszName = LPGEN("Disable &Groups");
		hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
	}
}
示例#10
0
void InitGroupMenus(void)
{
	CreateServiceFunction("CLISTMENUSGroup/ExecService", GroupMenuExecService);
	CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu", FreeOwnerDataGroupMenu);
	CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService", GroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper", HideOfflineRootHelper);

	CreateServiceFunction("CList/AddGroupMenuItem", AddGroupMenuItem);
	CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM, RemoveGroupMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDGROUP, BuildGroupMenu);
	hPreBuildGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
	HookEvent(ME_CLIST_PREBUILDGROUPMENU, OnBuildGroupMenu);

	InitSubGroupMenus();

	//Group menu
	hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
	{
		//add exit command to menu
		GroupMenuParam gmp;

		CLISTMENUITEM mi = { sizeof(mi) };
		mi.position = 1900000;
		mi.pszService = "CloseAction";
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_EXIT);
		mi.pszName = LPGEN("E&xit");
		AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 500;
		mi.pszService = MS_CLIST_SHOWHIDE;
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_SHOWHIDE);
		mi.pszName = LPGEN("&Hide/show");
		hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 200000;
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER);
		mi.pszService = "FindAdd/FindAddCommand";
		mi.pszName = LPGEN("&Find/add contacts...");
		AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 300000;
		mi.pszService = "";
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MAINMENU);
		mi.pszName = LPGEN("&Main menu");
		hGroupMainMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 300100;
		mi.pszService = "";
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_STATUS);
		mi.pszName = LPGEN("&Status");
		hGroupStatusMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 390100;
		mi.pszService = "";
		mi.icolibItem = iconItem[1].hIcolib;
		mi.pszName = LPGEN("Appearance");
		hAppearanceMenuItemProxy = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 400000;
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_OPTIONS);
		mi.pszService = "Options/OptionsCommand";
		mi.pszName = LPGEN("&Options...");
		AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 500000;
		mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_MIRANDA);
		mi.pszService = "CLN/About";
		mi.pszName = LPGEN("&About the contact list...");
		AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100000;
		mi.icolibItem = iconItem[0].hIcolib;
		mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
		mi.pszName = LPGEN("&New group");
		gmp.lParam = 0;
		gmp.wParam = POPUP_NEWGROUP;
		hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100001;
		mi.hIcon = NULL;
		mi.pszService = MS_CLIST_SETHIDEOFFLINE;
		mi.pszName = LPGEN("&Hide offline users");
		gmp.lParam = 0;
		gmp.wParam = -1;
		hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100002;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
		mi.pszName = LPGEN("Hide &offline users out here");
		hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100003;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
		mi.pszName = LPGEN("Hide &empty groups");
		hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);

		memset(&mi, 0, sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100004;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
		mi.pszName = LPGEN("Disable &groups");
		hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi);
	}
}
示例#11
0
void RebuildMenuOrder(void)
{
	BYTE bHideStatusMenu = db_get_b(NULL, "CLUI", "DontHideStatusMenu", 0); // cool perversion, though

	//clear statusmenu
	RecursiveDeleteMenu(hStatusMenu);

	//status menu
	if (hStatusMenuObject != 0) {
		CallService(MO_REMOVEMENUOBJECT, (WPARAM)hStatusMenuObject, 0);
		mir_free(hStatusMainMenuHandles);
		mir_free(hStatusMenuHandles);
	}

	hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
	MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");

	hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem*));
	hStatusMainMenuHandlesCnt = SIZEOF(statusModeList);

	hStatusMenuHandles = (tStatusMenuHandles*)mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
	hStatusMenuHandlesCnt = accounts.getCount();

	FreeMenuProtos();

	for (int s = 0; s < accounts.getCount(); s++) {
		int i = cli.pfnGetAccountIndexByPos(s);
		if (i == -1)
			continue;

		PROTOACCOUNT *pa = accounts[i];
		int pos = 0;
		if (!bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
			continue;

		DWORD flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
		HICON ic;
		TCHAR tbuf[256];

		//adding root
		TMO_MenuItem tmi = { 0 };
		tmi.cbSize = sizeof(tmi);
		tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED;
		tmi.position = pos++;
		tmi.hIcon = ic = (HICON)CallProtoServiceInt(NULL, pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);

		if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
			mir_sntprintf(tbuf, SIZEOF(tbuf), TranslateT("%s (locked)"), pa->tszAccountName);
			tmi.ptszName = tbuf;
		}
		else tmi.ptszName = pa->tszAccountName;

		//owner data
		StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
		smep->proto = mir_strdup(pa->szModuleName);
		tmi.ownerdata = smep;

		PMO_IntMenuItem rootmenu = MO_AddNewMenuItem(hStatusMenuObject, &tmi);

		memset(&tmi, 0, sizeof(tmi));
		tmi.cbSize = sizeof(tmi);
		tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED;
		tmi.root = rootmenu;
		tmi.position = pos++;
		tmi.hIcon = ic;

		//owner data
		smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
		smep->proto = mir_strdup(pa->szModuleName);
		tmi.ownerdata = smep;

		if (Proto_IsAccountLocked(pa))
			tmi.flags |= CMIF_CHECKED;

		if ((tmi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
			mir_sntprintf(tbuf, SIZEOF(tbuf), TranslateT("%s (locked)"), pa->tszAccountName);
			tmi.ptszName = tbuf;
		}
		else tmi.ptszName = pa->tszAccountName;

		PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
		((StatusMenuExecParam*)tmi.ownerdata)->protoindex = (int)menuHandle;
		MO_ModifyMenuItem(menuHandle, &tmi);

		cli.menuProtos = (MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount + 1));
		memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
		cli.menuProtos[cli.menuProtoCount].pMenu = rootmenu;
		cli.menuProtos[cli.menuProtoCount].szProto = mir_strdup(pa->szModuleName);

		cli.menuProtoCount++;

		char buf[256];
		mir_snprintf(buf, SIZEOF(buf), "RootProtocolIcon_%s", pa->szModuleName);
		MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);

		DestroyIcon(ic);
		pos += 500000;

		for (int j = 0; j < SIZEOF(statusModeList); j++) {
			if (!(flags & statusModePf2List[j]))
				continue;

			// adding
			memset(&tmi, 0, sizeof(tmi));
			tmi.cbSize = sizeof(tmi);
			tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
			if (statusModeList[j] == ID_STATUS_OFFLINE)
				tmi.flags |= CMIF_CHECKED;
			tmi.root = rootmenu;
			tmi.position = pos++;
			tmi.ptszName = cli.pfnGetStatusModeDescription(statusModeList[j], GSMDF_UNTRANSLATED);
			tmi.hIcon = LoadSkinProtoIcon(pa->szModuleName, statusModeList[j]);

			// owner data
			StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
			smep->custom = FALSE;
			smep->status = statusModeList[j];
			smep->protoindex = i;
			smep->proto = mir_strdup(pa->szModuleName);
			tmi.ownerdata = smep;

			hStatusMenuHandles[i].protoindex = i;
			hStatusMenuHandles[i].protostatus[j] = statusModeList[j];
			hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);

			char buf[256];
			mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
			MO_SetOptionsMenuItem(hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);

			IcoLib_ReleaseIcon(tmi.hIcon, 0);
		}
	}

	NotifyEventHooks(cli.hPreBuildStatusMenuEvent, 0, 0);
	int pos = 200000;

	// add to root menu
	for (int j = 0; j < SIZEOF(statusModeList); j++) {
		for (int i = 0; i < accounts.getCount(); i++) {
			PROTOACCOUNT *pa = accounts[i];
			if (!bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
				continue;

			DWORD flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
			if (!(flags & statusModePf2List[j]))
				continue;

			TMO_MenuItem tmi = { sizeof(tmi) };
			tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
			if (statusModeList[j] == ID_STATUS_OFFLINE)
				tmi.flags |= CMIF_CHECKED;

			tmi.hIcon = LoadSkinIcon(skinIconStatusList[j]);
			tmi.position = pos++;
			tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0' + j);

			//owner data
			StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
			smep->status = statusModeList[j];
			tmi.ownerdata = smep;
			{
				TCHAR buf[256], hotkeyName[100];
				WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
				HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
				mir_sntprintf(buf, SIZEOF(buf), _T("%s\t%s"),
					cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
				tmi.ptszName = buf;
				tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
				hStatusMainMenuHandles[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
			}

			char buf[256];
			mir_snprintf(buf, SIZEOF(buf), "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
			MO_SetOptionsMenuItem(hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);

			IcoLib_ReleaseIcon(tmi.hIcon, 0);
			break;
		}
	}

	BuildStatusMenu(0, 0);
}
示例#12
0
void InitCustomMenus(void)
{
	CreateServiceFunction("MainMenuExecService", MainMenuExecService);

	CreateServiceFunction("ContactMenuExecService", ContactMenuExecService);
	CreateServiceFunction("ContactMenuCheckService", ContactMenuCheckService);

	CreateServiceFunction("StatusMenuExecService", StatusMenuExecService);
	CreateServiceFunction("StatusMenuCheckService", StatusMenuCheckService);

	//free services
	CreateServiceFunction("CLISTMENUS/FreeOwnerDataMainMenu", FreeOwnerDataMainMenu);
	CreateServiceFunction("CLISTMENUS/FreeOwnerDataContactMenu", FreeOwnerDataContactMenu);
	CreateServiceFunction("CLISTMENUS/FreeOwnerDataStatusMenu", FreeOwnerDataStatusMenu);

	CreateServiceFunction(MS_CLIST_SETSTATUSMODE, SetStatusMode);

	CreateServiceFunction("CList/AddMainMenuItem", AddMainMenuItem);
	CreateServiceFunction("CList/AddStatusMenuItem", AddStatusMenuItem);
	CreateServiceFunction(MS_CLIST_MENUGETMAIN, MenuGetMain);
	CreateServiceFunction(MS_CLIST_MENUBUILDMAIN, BuildMainMenu);

	CreateServiceFunction("CList/AddContactMenuItem", AddContactMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT, BuildContactMenu);

	CreateServiceFunction(MS_CLIST_SHOWHIDEMENUITEM, ShowHideMenuItem);
	CreateServiceFunction(MS_CLIST_MODIFYMENUITEM, ModifyCustomMenuItem);
	CreateServiceFunction(MS_CLIST_MENUMEASUREITEM, MeasureMenuItem);
	CreateServiceFunction(MS_CLIST_MENUDRAWITEM, DrawMenuItem);

	CreateServiceFunction(MS_CLIST_MENUGETSTATUS, BuildStatusMenu);
	CreateServiceFunction(MS_CLIST_MENUPROCESSCOMMAND, MenuProcessCommand);
	CreateServiceFunction(MS_CLIST_MENUPROCESSHOTKEY, MenuProcessHotkey);

	CreateServiceFunction("CList/AddProtoMenuItem", AddProtoMenuItem);

	hPreBuildContactMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDCONTACTMENU);
	hPreBuildMainMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDMAINMENU);
	cli.hPreBuildStatusMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDSTATUSMENU);
	hStatusModeChangeEvent = CreateHookableEvent(ME_CLIST_STATUSMODECHANGE);

	HookEvent(ME_PROTO_ACK, MenuProtoAck);

	hMainMenu = CreatePopupMenu();
	hStatusMenu = CreatePopupMenu();

	hStatusMainMenuHandles = NULL;
	hStatusMainMenuHandlesCnt = 0;

	hStatusMenuHandles = NULL;
	hStatusMenuHandlesCnt = 0;

	// new menu sys
	InitGenMenu();

	// main menu
	hMainMenuObject = MO_CreateMenuObject("MainMenu", LPGEN("Main menu"), 0, "MainMenuExecService");
	MO_SetOptionsMenuObject(hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetOptionsMenuObject(hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");

	// contact menu
	hContactMenuObject = MO_CreateMenuObject("ContactMenu", LPGEN("Contact menu"), "ContactMenuCheckService", "ContactMenuExecService");
	MO_SetOptionsMenuObject(hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetOptionsMenuObject(hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");

	// initialize hotkeys
	CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus);

	HOTKEYDESC hkd = { sizeof(hkd) };
	hkd.ptszSection = _T("Status");
	hkd.dwFlags = HKD_TCHAR;
	for (int i = 0; i < SIZEOF(statusHotkeys); i++) {
		char szName[30];
		mir_snprintf(szName, SIZEOF(szName), "StatusHotKey_%d", i);
		hkd.pszName = szName;
		hkd.lParam = statusModeList[i];
		hkd.ptszDescription = fnGetStatusModeDescription(hkd.lParam, 0);
		hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, '0' + i) | HKF_MIRANDA_LOCAL;
		hkd.pszService = MS_CLIST_HKSTATUS;
		statusHotkeys[i] = Hotkey_Register(&hkd);
	}

	HookEvent(ME_HOTKEYS_CHANGED, sttRebuildHotkeys);

	// add exit command to menu

	CLISTMENUITEM mi = { sizeof(mi) };
	mi.position = 0x7fffffff;
	mi.pszService = "CloseAction";
	mi.pszName = LPGEN("E&xit");
	mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_EXIT);
	AddMainMenuItem(0, (LPARAM)&mi);

	cli.currentStatusMenuItem = ID_STATUS_OFFLINE;
	cli.currentDesiredStatusMode = ID_STATUS_OFFLINE;

	HookEvent(ME_SKIN_ICONSCHANGED, MenuIconsChanged);
}