diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-07-12 16:18:29 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-07-12 16:18:29 +0000 |
commit | 3c78001172fa76c0cffe715c719ae2c1d0fade77 (patch) | |
tree | b2cb72892b9ce644df2407a837b69f9e2cf66902 /plugins/Clist_ng | |
parent | f4ce2b5c214cce406dbd7a73dc7f35ae409546ad (diff) |
CList NG:
-Sync
git-svn-id: http://svn.miranda-ng.org/main/trunk@14544 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_ng')
-rw-r--r-- | plugins/Clist_ng/CLUIFrames/groupmenu.cpp | 589 | ||||
-rw-r--r-- | plugins/Clist_ng/INCLUDE/clui.h | 2 | ||||
-rw-r--r-- | plugins/Clist_ng/INCLUDE/commonheaders.h | 279 | ||||
-rw-r--r-- | plugins/Clist_ng/SRC/clui.cpp | 6 | ||||
-rw-r--r-- | plugins/Clist_ng/SRC/commonheaders.cpp | 1 | ||||
-rw-r--r-- | plugins/Clist_ng/clist_ng_10.vcxproj | 1 |
6 files changed, 369 insertions, 509 deletions
diff --git a/plugins/Clist_ng/CLUIFrames/groupmenu.cpp b/plugins/Clist_ng/CLUIFrames/groupmenu.cpp index f7567b5527..810ec0d9c9 100644 --- a/plugins/Clist_ng/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_ng/CLUIFrames/groupmenu.cpp @@ -2,8 +2,8 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-03 Miranda ICQ/IM project,
+Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-08 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -24,550 +24,129 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <commonheaders.h>
-//////////////////////////////Group MENU/////////////////////////
-HANDLE hGroupMenuObject;
-HANDLE hPreBuildGroupMenuEvent;
+/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////// Group MENU //////////////////////////////
-HGENMENU hGroupMainMenuItemProxy;
-HGENMENU hHideShowMainMenuItem;
-HGENMENU hGroupStatusMenuItemProxy;
-HGENMENU hAppearanceMenuItemProxy;
-HGENMENU hEventAreaMenuItemProxy;
+static HGENMENU hGroupMainMenuItemProxy;
+static HGENMENU hHideShowMainMenuItem;
+static HGENMENU hGroupStatusMenuItemProxy;
+static HGENMENU hEventAreaMenuItemProxy;
-static HMENU hMenuOldContext;
-
-HGENMENU hHideOfflineUsersMenuItem;
-HGENMENU hHideOfflineUsersOutHereMenuItem;
-HGENMENU hHideEmptyGroupsMenuItem;
-HGENMENU hDisableGroupsMenuItem;
-HGENMENU hNewGroupMenuItem;
-HGENMENU hNewSubGroupMenuItem;
-
-void InitSubGroupMenus(void);
-
-//Groupmenu exec param(ownerdata)
-typedef struct {
- char *szServiceName;
- int Param1, Param2;
-} GroupMenuExecParam, *lpGroupMenuExecParam;
-
-static INT_PTR BuildGroupMenu(WPARAM wParam, LPARAM lParam)
+struct
{
- int tick;
- HMENU hMenu;
- ListParam param = { 0 };
- param.MenuObjectHandle = hGroupMenuObject;
-
- //hMenu = hMainMenu;
- hMenu = CreatePopupMenu();
- //hMenu = wParam;
- tick = GetTickCount();
-
- NotifyEventHooks(hPreBuildGroupMenuEvent, 0, 0);
-
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m);
- //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0));
- tick = GetTickCount() - tick;
- return (INT_PTR)hMenu;
+ char *name;
+ int command, mask, position;
+ HGENMENU hMenu;
}
-
-static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam)
+static hAppearanceItems[] =
{
- TMO_MenuItem tmi;
- CLISTMENUITEM *mi = (CLISTMENUITEM *)lParam;
- if (!pcli->pfnConvertMenu(mi, &tmi))
- return NULL;
-
- lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_alloc(sizeof(GroupMenuExecParam));
- if (mmep == NULL)
- return 0;
-
- //we need just one parametr.
- mmep->szServiceName = mir_strdup(mi->pszService);
- mmep->Param1 = mi->popupPosition;
- lpGroupMenuParam gmp = (lpGroupMenuParam)wParam;
- if (gmp != NULL) {
- mmep->Param1 = gmp->wParam;
- mmep->Param2 = gmp->lParam;
- }
- tmi.ownerdata = mmep;
-
- char buf[1024];
- mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName);
-
- OptParam op;
- op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi);
- op.Setting = OPT_MENUITEMSETUNIQNAME;
- op.Value = (INT_PTR)buf;
- CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
- return (INT_PTR)op.Handle;
-}
+ { LPGEN("Show status icons"), POPUP_SHOWSTATUSICONS, CLUI_FRAME_STATUSICONS, 10001 },
+ { LPGEN("Show metacontact protocol icons"), POPUP_SHOWMETAICONS, CLUI_USEMETAICONS, 10002 },
+ { LPGEN("Show additional buttons"), POPUP_BUTTONS, CLUI_FRAME_SHOWBOTTOMBUTTONS, 110001 },
+ { LPGEN("Draw sunken frame"), POPUP_FRAME, CLUI_FRAME_CLISTSUNKEN, 110002 }
+};
-INT_PTR GroupMenuCheckService(WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
+static HMENU hMenuOldContext;
-INT_PTR GroupMenuonAddService(WPARAM wParam, LPARAM lParam)
+static INT_PTR GroupMenu_OnAddService(WPARAM wParam, LPARAM lParam)
{
- MENUITEMINFO *mii = (MENUITEMINFO *)wParam;
- if (mii == NULL) return 0;
-
- if (hHideShowMainMenuItem == (HANDLE)lParam) {
- mii->fMask |= MIIM_STATE;
- mii->fState |= MFS_DEFAULT;
+ MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
+ if (mii == NULL)
+ return 0;
- }
if (hGroupMainMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- //mi.fType = MFT_STRING;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
+ mii->hSubMenu = Menu_GetMainMenu();
}
if (hGroupStatusMenuItemProxy == (HANDLE)lParam) {
mii->fMask |= MIIM_SUBMENU;
- //mi.fType = MFT_STRING;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
+ mii->hSubMenu = Menu_GetStatusMenu();
}
- if (hAppearanceMenuItemProxy == (HANDLE)lParam) {
- hMenuOldContext = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3);
- TranslateMenu(hMenuOldContext);
-
- CheckMenuItem(hMenuOldContext, POPUP_FRAME, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(hMenuOldContext, POPUP_BUTTONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_SHOWBOTTOMBUTTONS ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(hMenuOldContext, POPUP_SHOWMETAICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_USEMETAICONS ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(hMenuOldContext, POPUP_SHOWSTATUSICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_STATUSICONS ? MF_CHECKED : MF_UNCHECKED));
-
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = (HMENU)hMenuOldContext;
- }
- return (TRUE);
-};
-
-//called with:
-//wparam - ownerdata
-//lparam - lparam from winproc
-INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam)
-{
- if (wParam != 0) {
- 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);
- }
- else
- CallService(mmep->szServiceName, mmep->Param1, mmep->Param2);
-
- }
- return 1;
-}
-
-INT_PTR FreeOwnerDataGroupMenu(WPARAM wParam, LPARAM lParam)
-{
- lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)lParam;
- if (mmep != NULL) {
- mir_free(mmep->szServiceName);
- mir_free(mmep);
- }
- return 0;
-}
-
-INT_PTR HideGroupsHelper(WPARAM wParam, LPARAM lParam)
-{
- int newVal = !(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
- cfg::writeByte("CList", "HideEmptyGroups", (BYTE)newVal);
- SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEEMPTYGROUPS, newVal, 0);
- return 0;
+ return TRUE;
}
-INT_PTR UseGroupsHelper(WPARAM wParam, LPARAM lParam)
+static INT_PTR CommandHelper(WPARAM wParam, LPARAM)
{
- int newVal = !(GetWindowLongPtr((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), GWL_STYLE) & CLS_USEGROUPS);
- cfg::writeByte("CList", "UseGroups", (BYTE)newVal);
- SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETUSEGROUPS, newVal, 0);
+ SendMessage(pcli->hwndContactList, WM_COMMAND, MAKELONG(wParam, BN_CLICKED), 1);
return 0;
}
-INT_PTR HideOfflineRootHelper(WPARAM wParam, LPARAM lParam)
+static int OnBuildGroupMenu(WPARAM, LPARAM)
{
- SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_SETHIDEOFFLINEROOT,
- !SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), CLM_GETHIDEOFFLINEROOT, 0, 0),
- 0);
- return 0;
-}
-
-static int OnBuildGroupMenu(WPARAM wParam, LPARAM lParam)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
-
- mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
-
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
-
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED);
- Menu_ModifyItem(hDisableGroupsMenuItem, &mi);
-
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(hGroupMainMenuItemProxy, &mi);
-
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(hAppearanceMenuItemProxy, &mi);
+ for (int i = 0; i < _countof(hAppearanceItems); i++)
+ Menu_SetChecked(hAppearanceItems[i].hMenu, (cfg::dat.dwFlags & hAppearanceItems[i].mask) != 0);
return 0;
}
IconItemT iconItem[] = {
- { LPGENT("New group"), "new_group", IDI_ADDGROUP },
{ LPGENT("Contact list"), "clist", IDI_CLIST }
};
void InitIconLibMenuIcons(void)
{
- Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem));
+ Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, _countof(iconItem));
}
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("CLISTMENUSGroup/GroupMenuOnAddService", GroupMenu_OnAddService);
- CreateServiceFunction("CList/AddGroupMenuItem", AddGroupMenuItem);
- 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
+ // add exit command to menu
+ CMenuItem mi;
+ mi.position = 500;
+ mi.pszService = MS_CLIST_SHOWHIDE;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SHOWHIDE);
+ mi.name.a = LPGEN("&Hide/show");
+ hHideShowMainMenuItem = Menu_AddGroupMenuItem(&mi);
+
+ mi.position = 200000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_FINDUSER);
+ mi.pszService = "FindAdd/FindAddCommand";
+ mi.name.a = LPGEN("&Find/add contacts...");
+ Menu_AddGroupMenuItem(&mi);
+
+ mi.position = 300000;
+ mi.pszService = "";
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU);
+ mi.name.a = LPGEN("&Main menu");
+ hGroupMainMenuItemProxy = Menu_AddGroupMenuItem(&mi);
+
+ mi.position = 300100;
+ mi.pszService = "";
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS);
+ mi.name.a = LPGEN("&Status");
+ hGroupStatusMenuItemProxy = Menu_AddGroupMenuItem(&mi);
+
+ // Appearance menu
+ mi.position = 390100;
+ mi.hIcolibItem = iconItem[0].hIcolib;
+ mi.name.a = LPGEN("Appearance");
+ mi.root = Menu_AddGroupMenuItem(&mi);
+
+ mi.hIcolibItem = NULL;
+ mi.pszService = "CLISTMENUSGroup/CommandHelper";
+ CreateServiceFunction(mi.pszService, CommandHelper);
+ for (int i = 0; i < _countof(hAppearanceItems); i++) {
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);
- }
-}
-
-HANDLE hSubGroupMenuObject;
-
-HANDLE hSubGroupMainMenuItemProxy;
-//HANDLE hHideShowMainMenuItem;
-HANDLE hSubGroupStatusMenuItemProxy;
-HANDLE hPreBuildSubGroupMenuEvent;
-HGENMENU hHideOfflineUsersHereMenuItem;
-
-//SubGroupmenu exec param(ownerdata)
-typedef struct {
- char *szServiceName;
- int Param1, Param2;
-} SubGroupMenuExecParam, *lpSubGroupMenuExecParam;
-
-static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM lParam)
-{
- ClcGroup *group = (ClcGroup *)wParam;
- if (group == 0)
- return 0;
-
- //contact->group
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS | (group->hideOffline ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
- return 0;
-}
-
-static INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM lParam)
-{
- ListParam param = { 0 };
- param.MenuObjectHandle = hSubGroupMenuObject;
- param.wParam = wParam;
-
- HMENU hMenu = CreatePopupMenu();
- int tick = GetTickCount();
- NotifyEventHooks(hPreBuildSubGroupMenuEvent, wParam, 0);
-
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m);
- tick = GetTickCount() - tick;
- return (INT_PTR)hMenu;
-}
-
-static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam)
-{
- TMO_MenuItem tmi;
- CLISTMENUITEM *mi = (CLISTMENUITEM *)lParam;
- if (!pcli->pfnConvertMenu(mi, &tmi))
- return NULL;
-
- lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_alloc(sizeof(SubGroupMenuExecParam));
- if (mmep == NULL)
- return 0;
-
- //we need just one parametr.
- lpGroupMenuParam gmp = (lpGroupMenuParam)wParam;
- mmep->szServiceName = mir_strdup(mi->pszService);
- mmep->Param1 = mi->popupPosition;
- if (gmp != NULL) {
- mmep->Param1 = gmp->wParam;
- mmep->Param2 = gmp->lParam;
+ gmp.wParam = hAppearanceItems[i].command;
+ mi.name.a = hAppearanceItems[i].name;
+ mi.position = hAppearanceItems[i].position;
+ hAppearanceItems[i].hMenu = Menu_AddGroupMenuItem(&mi, &gmp);
}
- tmi.ownerdata = mmep;
- char buf[1024];
- mir_snprintf(buf, SIZEOF(buf), "%s/%s", mi->pszService, mi->pszName);
+ mi.root = NULL;
+ mi.position = 400000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_OPTIONS);
+ mi.pszService = "Options/OptionsCommand";
+ mi.name.a = LPGEN("&Options...");
+ Menu_AddGroupMenuItem(&mi);
- OptParam op;
- op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi);
- op.Setting = OPT_MENUITEMSETUNIQNAME;
- op.Value = (INT_PTR)buf;
- CallService(MO_SETOPTIONSMENUITEM, 0, (LPARAM)&op);
- return (INT_PTR)op.Handle;
+ mi.position = 1000000;
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA);
+ mi.pszService = "CLN/About";
+ mi.name.a = LPGEN("&About the contact list...");
+ Menu_AddGroupMenuItem(&mi);
}
-
-INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM lParam) {
- //not used
- return 0;
-};
-
-INT_PTR SubGroupMenuonAddService(WPARAM wParam, LPARAM lParam) {
-
- MENUITEMINFO *mii = (MENUITEMINFO *)wParam;
-
- if (mii == NULL) return 0;
-
- /*
- if (hHideShowMainMenuItem == (HANDLE)lParam) {
- mii->fMask |= MIIM_STATE;
- mii->fState |= MFS_DEFAULT;
- }
- if (hSubGroupMainMenuItemProxy == (HANDLE)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- //mi.fType = MFT_STRING;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
- }
-
- if (hSubGroupStatusMenuItemProxy == (HANDLE)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- //mi.fType = MFT_STRING;
- mii->hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
- }
- */
- return TRUE;
-};
-
-//called with:
-//wparam - ownerdata
-//lparam - lparam from winproc
-INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam) {
- if (wParam != 0) {
- 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);
- }
- else
- CallService(mmep->szServiceName, mmep->Param1, mmep->Param2);
- }
- return 1;
-}
-
-INT_PTR FreeOwnerDataSubGroupMenu(WPARAM wParam, LPARAM lParam)
-{
- lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)lParam;
- if (mmep != NULL) {
- mir_free(mmep->szServiceName);
- mir_free(mmep);
- }
- return 0;
-}
-
-//wparam menu handle to pass to clc.c
-INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam)
-{
- SendMessage((HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0), WM_COMMAND, wParam, 0);
- return 0;
-}
-
-void InitSubGroupMenus(void)
-{
- CreateServiceFunction("CLISTMENUSSubGroup/ExecService", SubGroupMenuExecService);
- CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu", FreeOwnerDataSubGroupMenu);
- CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService", SubGroupMenuonAddService);
- CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy);
-
- //CreateServiceFunction("CLISTMENUSSubGroup/HideSubGroupsHelper", HideSubGroupsHelper);
- //CreateServiceFunction("CLISTMENUSSubGroup/UseSubGroupsHelper", UseSubGroupsHelper);
- //CreateServiceFunction("CLISTMENUSSubGroup/HideOfflineRootHelper", HideOfflineRootHelper);
-
- CreateServiceFunction("CList/AddSubGroupMenuItem", AddSubGroupMenuItem);
- 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.icolibItem = iconItem[0].hIcolib;
- 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);
- 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);
- mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy";
- mi.pszName = LPGEN("&Delete group");
- gmp.lParam = 0;
- gmp.wParam = POPUP_DELETEGROUP;
- AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi);
- }
-}
-
-//////////////////////////////END SubGroup MENU/////////////////////////
diff --git a/plugins/Clist_ng/INCLUDE/clui.h b/plugins/Clist_ng/INCLUDE/clui.h index a09aa7f43a..bd8dee714c 100644 --- a/plugins/Clist_ng/INCLUDE/clui.h +++ b/plugins/Clist_ng/INCLUDE/clui.h @@ -163,6 +163,6 @@ void CLUI::Redraw() }
int MTG_OnmodulesLoad (WPARAM wParam,LPARAM lParam);
-//void InitGroupMenus ();
+void InitGroupMenus ();
#endif /* __CLUI_H_ */
diff --git a/plugins/Clist_ng/INCLUDE/commonheaders.h b/plugins/Clist_ng/INCLUDE/commonheaders.h new file mode 100644 index 0000000000..6575dbfe92 --- /dev/null +++ b/plugins/Clist_ng/INCLUDE/commonheaders.h @@ -0,0 +1,279 @@ +/*
+ * astyle --force-indent=tab=4 --brackets=linux --indent-switches
+ * --pad=oper --one-line=keep-blocks --unpad=paren
+ *
+ * Miranda IM: the free IM client for Microsoft* Windows*
+ *
+ * Copyright 2000-2010 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
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.
+ *
+ * part of clist_ng plugin for Miranda.
+ *
+ * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
+ *
+ * $Id: commonheaders.h 133 2010-09-30 06:27:18Z silvercircle $
+ *
+ */
+
+//#define _USE_D2D 1
+
+#define _WIN32_WINNT 0x0502
+#define _WIN32_IE 0x0501
+
+#undef FASTCALL
+
+#define TSAPI __stdcall
+#define FASTCALL __fastcall
+
+#ifdef _MSC_VER
+ #if _MSC_VER < 1400
+ #define uintptr_t UINT_PTR
+ #define _localtime32 localtime
+ #define __time32_t time_t
+ #endif
+#endif
+
+int _DebugTraceW(const wchar_t *fmt, ...);
+int _DebugTraceA(const char *fmt, ...);
+
+#include <windows.h>
+#include <uxtheme.h>
+#include <vssym32.h>
+#include <time.h>
+#include <shlwapi.h>
+#include <Richedit.h>
+
+#include <newpluginapi.h>
+#include <win2k.h>
+#include <m_clistint.h>
+#include <m_database.h>
+#include <m_system_cpp.h>
+#include <m_langpack.h>
+#include <m_avatars.h>
+#include <m_button.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_skin.h>
+#include <m_addcontact.h>
+#include <m_timezones.h>
+#include <m_cluiframes.h>
+#include <m_clui.h>
+#include <m_icolib.h>
+#include <m_fontservice.h>
+#include <m_xstatus.h>
+#include <m_extraicons.h>
+#include <m_variables.h>
+#include <m_ignore.h>
+
+#include <m_metacontacts.h>
+
+#include <agg_rendering_buffer.h>
+#include <agg_renderer_base.h>
+#include <agg_pixfmt_rgba.h>
+#include <agg_renderer_scanline.h>
+#include <agg_scanline_p.h>
+#include <agg_rasterizer_scanline_aa.h>
+#include <agg_rasterizer_outline_aa.h>
+#include <agg_ellipse.h>
+#include <agg_rounded_rect.h>
+#include <agg_path_storage.h>
+#include <agg_path_storage_integer.h>
+#include <agg_span_allocator.h>
+#include <agg_span_gouraud_rgba.h>
+#include <agg_span_gradient.h>
+#include <agg_span_interpolator_linear.h>
+#include <agg_span_interpolator_trans.h>
+#include "../cluiframes/cluiframes.h"
+
+#ifdef _USE_D2D
+ #include <d2d1Helper.h>
+#endif
+
+#include <resource.h>
+
+#include <win2k.h>
+#include <newpluginapi.h>
+#include <m_imgsrvc.h>
+#include <m_system.h>
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_button.h>
+#include <m_clist.h>
+#include <m_clistint.h>
+#include <m_cluiframes.h>
+#include <m_genmenu.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_utils.h>
+#include <m_skin.h>
+#include <m_contacts.h>
+#include <m_icolib.h>
+#include <m_clc.h>
+#include <m_clui.h>
+#include <m_userinfo.h>
+#include <m_history.h>
+#include <m_addcontact.h>
+#include <m_file.h>
+#include <m_fontservice.h>
+#include <m_acc.h>
+#include <m_hotkeys.h>
+#include <m_genmenu.h>
+#include <m_timezones.h>
+
+#include <m_metacontacts.h>
+
+extern IconItemT iconItem[];
+
+ /*
+ * text shadow types (DrawThemeTextEx() / Vista+ uxtheme)
+ */
+ #define TST_NONE 0
+ #define TST_SINGLE 1
+ #define TST_CONTINUOUS 2
+
+ typedef struct _DWM_THUMBNAIL_PROPERTIES
+ {
+ DWORD dwFlags;
+ RECT rcDestination;
+ RECT rcSource;
+ BYTE opacity;
+ BOOL fVisible;
+ BOOL fSourceClientAreaOnly;
+ } DWM_THUMBNAIL_PROPERTIES, *PDWM_THUMBNAIL_PROPERTIES;
+
+ enum DWMWINDOWATTRIBUTE
+ {
+ DWMWA_NCRENDERING_ENABLED = 1, // [get] Is non-client rendering enabled/disabled
+ DWMWA_NCRENDERING_POLICY, // [set] Non-client rendering policy
+ DWMWA_TRANSITIONS_FORCEDISABLED, // [set] Potentially enable/forcibly disable transitions
+ DWMWA_ALLOW_NCPAINT, // [set] Allow contents rendered in the non-client area to be visible on the DWM-drawn frame.
+ DWMWA_CAPTION_BUTTON_BOUNDS, // [get] Bounds of the caption button area in window-relative space.
+ DWMWA_NONCLIENT_RTL_LAYOUT, // [set] Is non-client content RTL mirrored
+ DWMWA_FORCE_ICONIC_REPRESENTATION, // [set] Force this window to display iconic thumbnails.
+ DWMWA_FLIP3D_POLICY, // [set] Designates how Flip3D will treat the window.
+ DWMWA_EXTENDED_FRAME_BOUNDS, // [get] Gets the extended frame bounds rectangle in screen space
+ DWMWA_HAS_ICONIC_BITMAP, // [set] Indicates an available bitmap when there is no better thumbnail representation.
+ DWMWA_DISALLOW_PEEK, // [set] Don't invoke Peek on the window.
+ DWMWA_EXCLUDED_FROM_PEEK, // [set] LivePreview exclusion information
+ DWMWA_LAST
+ };
+
+ #define DWM_TNP_RECTDESTINATION 0x00000001
+ #define DWM_TNP_RECTSOURCE 0x00000002
+ #define DWM_TNP_OPACITY 0x00000004
+ #define DWM_TNP_VISIBLE 0x00000008
+ #define DWM_TNP_SOURCECLIENTAREAONLY 0x00000010
+
+ #define DWM_SIT_DISPLAYFRAME 0x00000001 // Display a window frame around the provided bitmap
+
+ typedef HANDLE HTHUMBNAIL;
+ typedef HTHUMBNAIL* PHTHUMBNAIL;
+
+#ifndef BPPF_ERASE
+ typedef enum _BP_BUFFERFORMAT
+ {
+ BPBF_COMPATIBLEBITMAP, // Compatible bitmap
+ BPBF_DIB, // Device-independent bitmap
+ BPBF_TOPDOWNDIB, // Top-down device-independent bitmap
+ BPBF_TOPDOWNMONODIB // Top-down monochrome device-independent bitmap
+ } BP_BUFFERFORMAT;
+
+
+ typedef struct _BP_PAINTPARAMS
+ {
+ DWORD cbSize;
+ DWORD dwFlags; // BPPF_ flags
+ const RECT * prcExclude;
+ const BLENDFUNCTION * pBlendFunction;
+ } BP_PAINTPARAMS, *PBP_PAINTPARAMS;
+
+ #define BPPF_ERASE 1
+ #define BPPF_NOCLIP 2
+ #define BPPF_NONCLIENT 4
+#endif
+
+ typedef struct _DWM_BLURBEHIND
+ {
+ DWORD dwFlags;
+ BOOL fEnable;
+ HRGN hRgnBlur;
+ BOOL fTransitionOnMaximized;
+ } DWM_BLURBEHIND, *PDWM_BLURBEHIND;
+
+ #define DWM_BB_ENABLE 1
+
+#ifndef LOCALE_SISO3166CTRYNAME2
+ #define LOCALE_SISO3166CTRYNAME2 0x00000068 // 3 character ISO country name, eg "USA Vista+
+ #define LOCALE_SISO639LANGNAME2 0x00000067 // 3 character ISO abbreviated language name, eg "eng"
+#endif
+
+#ifndef WM_DWMCOMPOSITIONCHANGED
+ #define WM_DWMCOMPOSITIONCHANGED 0x031E
+ #define WM_DWMCOLORIZATIONCOLORCHANGED 0x0320
+#endif
+
+#ifndef WM_DWMSENDICONICTHUMBNAIL
+ #define WM_DWMSENDICONICTHUMBNAIL 0x0323
+ #define WM_DWMSENDICONICLIVEPREVIEWBITMAP 0x0326
+#endif
+
+ // some typedefs
+
+#include <memory>
+typedef std::unique_ptr<std::basic_string<wchar_t> > pSmartWstring;
+
+#include "m_cln_skinedit.h"
+#include "clui.h"
+#include <m_avatars.h>
+#include "config.h"
+#include "clc.h"
+#include "skin.h"
+#include "gfx.h"
+#include "utils.h"
+#include "clist.h"
+#include "rowheight_funcs.h"
+
+// shared vars
+extern HINSTANCE g_hInst;
+
+#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0]))
+#define CXSMICON 16
+#define CYSMICON 16
+
+extern CLIST_INTERFACE coreCli;
+
+#define safe_sizeof(a) (sizeof((a)) / sizeof((a)[0]))
+
+BOOL __forceinline GetItemByStatus(int status, TStatusItem *retitem);
+
+void FreeAndNil( void** );
+
+#define EXTRA_ICON_RES0 0 // only used by nicer
+#define EXTRA_ICON_EMAIL 1
+#define EXTRA_ICON_PROTO 2 // used by mwclist and modern
+#define EXTRA_ICON_RES1 2 // only used by nicer
+#define EXTRA_ICON_SMS 3
+#define EXTRA_ICON_ADV1 4
+#define EXTRA_ICON_ADV2 5
+#define EXTRA_ICON_WEB 6
+#define EXTRA_ICON_CLIENT 7
+#define EXTRA_ICON_VISMODE 8 // only used by modern
+#define EXTRA_ICON_RES2 8 // only used by nicer
+#define EXTRA_ICON_ADV3 9
+#define EXTRA_ICON_ADV4 10
+
diff --git a/plugins/Clist_ng/SRC/clui.cpp b/plugins/Clist_ng/SRC/clui.cpp index 81545a7894..500a0af195 100644 --- a/plugins/Clist_ng/SRC/clui.cpp +++ b/plugins/Clist_ng/SRC/clui.cpp @@ -118,7 +118,7 @@ struct CluiTopButton top_buttons[] = { (HWND) - 1, 0, 0, 0, 0, 0, 0, 0, 0
};
-IconItemT iconItem[] = {
+IconItemT myIcons[] = {
{ LPGENT("Toggle show online/offline"), "CLN_online", IDI_HIDEOFFLINE },
{ LPGENT("Toggle groups"), "CLN_groups", IDI_HIDEGROUPS },
{ LPGENT("Find contacts"), "CLN_findadd", IDI_FINDANDADD },
@@ -326,7 +326,7 @@ static void CacheClientIcons() static void InitIcoLib()
{
- Icon_RegisterT(g_hInst, LPGENT("Contact list")_T("/")LPGENT("Default"),iconItem, _countof(iconItem));
+ Icon_RegisterT(g_hInst, LPGENT("Contact list")_T("/")LPGENT("Default"),myIcons, _countof(myIcons));
for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
char szBuffer[128];
@@ -1975,7 +1975,7 @@ void CLUI::loadModule(void) HookEvent(ME_MC_DEFAULTTCHANGED, MetaChanged);
HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaChanged);
-// InitGroupMenus();
+ InitGroupMenus();
wndclass.style = 0;
wndclass.lpfnWndProc = eventAreaWndProc;
diff --git a/plugins/Clist_ng/SRC/commonheaders.cpp b/plugins/Clist_ng/SRC/commonheaders.cpp new file mode 100644 index 0000000000..b317365c87 --- /dev/null +++ b/plugins/Clist_ng/SRC/commonheaders.cpp @@ -0,0 +1 @@ +#include <commonheaders.h>
\ No newline at end of file diff --git a/plugins/Clist_ng/clist_ng_10.vcxproj b/plugins/Clist_ng/clist_ng_10.vcxproj index 1bedfc6465..b9274695be 100644 --- a/plugins/Clist_ng/clist_ng_10.vcxproj +++ b/plugins/Clist_ng/clist_ng_10.vcxproj @@ -446,6 +446,7 @@ <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Level1</WarningLevel>
</ClCompile>
<ClCompile Include="CLUIFrames\cluiframes.cpp" />
+ <ClCompile Include="CLUIFrames\groupmenu.cpp" />
<ClCompile Include="CLUIFrames\movetogroup.cpp" />
<ClCompile Include="coolsb\coolsblib.cpp" />
<ClCompile Include="coolsb\coolscroll.cpp" />
|