summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-02 19:04:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-02 19:04:21 +0000
commit209e1040e34c50e424a7aa0a7c860c7fc279a76f (patch)
tree96742a262043ca7155d75414ae48b3907f3e2881 /src
parent755eaef1f61577c44a9305fb7db3dd25990de52c (diff)
group menu services moved to core
git-svn-id: http://svn.miranda-ng.org/main/trunk@14472 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdclist/src/clistmenus.cpp12
-rw-r--r--src/core/stdclist/src/commonheaders.h2
-rw-r--r--src/core/stdclist/src/init.cpp1
-rw-r--r--src/mir_app/src/clc.cpp125
-rw-r--r--src/mir_app/src/clistmenus.cpp5
-rw-r--r--src/mir_app/src/groupmenu.cpp250
-rw-r--r--src/mir_app/src/mir_app.def4
-rw-r--r--src/mir_app/src/mir_app64.def4
-rw-r--r--src/mir_app/src/miranda.h2
-rw-r--r--src/mir_app/src/resource.h1
10 files changed, 340 insertions, 66 deletions
diff --git a/src/core/stdclist/src/clistmenus.cpp b/src/core/stdclist/src/clistmenus.cpp
index 3903953df5..89b4e8f7f4 100644
--- a/src/core/stdclist/src/clistmenus.cpp
+++ b/src/core/stdclist/src/clistmenus.cpp
@@ -36,3 +36,15 @@ void InitCustomMenus()
{
CreateServiceFunction("CloseAction", CloseAction);
}
+
+HMENU fnBuildGroupPopupMenu(ClcGroup *group)
+{
+ HMENU hMenu = LoadMenu(pcli->hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hGroupMenu = GetSubMenu(hMenu, 2);
+ RemoveMenu(hMenu, 2, MF_BYPOSITION);
+ DestroyMenu(hMenu);
+ TranslateMenu(hGroupMenu);
+
+ CheckMenuItem(hGroupMenu, POPUP_GROUPHIDEOFFLINE, group->hideOffline ? MF_CHECKED : MF_UNCHECKED);
+ return hGroupMenu;
+}
diff --git a/src/core/stdclist/src/commonheaders.h b/src/core/stdclist/src/commonheaders.h
index deff5b4d14..36f7a7bb33 100644
--- a/src/core/stdclist/src/commonheaders.h
+++ b/src/core/stdclist/src/commonheaders.h
@@ -63,3 +63,5 @@ extern HINSTANCE g_hInst;
extern CLIST_INTERFACE coreCli;
void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
+
+HMENU fnBuildGroupPopupMenu(ClcGroup *group);
diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp
index efb6a00d7c..be4175b8e9 100644
--- a/src/core/stdclist/src/init.cpp
+++ b/src/core/stdclist/src/init.cpp
@@ -139,6 +139,7 @@ extern "C" __declspec(dllexport) int CListInitialise()
pcli->hInst = g_hInst;
pcli->pfnPaintClc = PaintClc;
pcli->pfnLoadClcOptions = LoadClcOptions;
+ pcli->pfnBuildGroupPopupMenu = fnBuildGroupPopupMenu;
CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index 8377782a84..5e01f4a12c 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -61,16 +61,10 @@ void fnClcOptionsChanged(void)
cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
}
-HMENU fnBuildGroupPopupMenu(ClcGroup* group)
+// stub. does nothing
+HMENU fnBuildGroupPopupMenu(ClcGroup *group)
{
- HMENU hMenu = LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- HMENU hGroupMenu = GetSubMenu(hMenu, 2);
- RemoveMenu(hMenu, 2, MF_BYPOSITION);
- DestroyMenu(hMenu);
- TranslateMenu(hGroupMenu);
-
- CheckMenuItem(hGroupMenu, POPUP_GROUPHIDEOFFLINE, group->hideOffline ? MF_CHECKED : MF_UNCHECKED);
- return hGroupMenu;
+ return Menu_BuildSubGroupMenu(group);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -279,10 +273,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
cli.pfnRegisterFileDropping(hwnd);
if (dat == NULL) {
dat = (struct ClcData *) mir_calloc(sizeof(struct ClcData));
- SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat);
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
}
{
- for (int i=0; i <= FONTID_MAX; i++)
+ for (int i = 0; i <= FONTID_MAX; i++)
dat->fontInfo[i].changed = 1;
}
dat->selection = -1;
@@ -306,7 +300,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hdr.code = CLN_LISTREBUILT;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
}
break;
@@ -348,14 +342,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
HBITMAP hBmp = CreateBitmap(rc.right, rc.bottom, 1, depth, NULL);
HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, NULL);
HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp);
+ HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
HBRUSH hBrush = CreateSolidBrush(dat->useWindowsColours ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour);
FillRect(hdcMem, &rc, hBrush);
DeleteObject(hBrush);
HBITMAP hoMaskBmp = (HBITMAP)SelectObject(hdcMem, hBmpMask);
FillRect(hdcMem, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
- SelectObject(hdcMem, hoMaskBmp);
+ SelectObject(hdcMem, hoMaskBmp);
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
ReleaseDC(hwnd, hdc);
@@ -374,7 +368,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_GETDLGCODE:
if (lParam) {
- MSG *msg = (MSG *) lParam;
+ MSG *msg = (MSG *)lParam;
if (msg->message == WM_KEYDOWN) {
if (msg->wParam == VK_TAB)
return 0;
@@ -403,7 +397,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_GROUPSCHANGED:
{
- DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
+ DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
if (dbcws->value.type == DBVT_ASCIIZ || dbcws->value.type == DBVT_UTF8) {
int groupId = atoi(dbcws->szSetting) + 1;
TCHAR szFullName[512];
@@ -412,7 +406,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (cli.pfnFindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, NULL)) {
mir_tstrcpy(szFullName, contact->szText);
while (group->parent) {
- for (i=0; i < group->parent->cl.count; i++)
+ for (i = 0; i < group->parent->cl.count; i++)
if (group->parent->cl.items[i]->group == group)
break;
if (i == group->parent->cl.count) {
@@ -431,12 +425,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (dbcws->value.type == DBVT_ASCIIZ) {
- WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal+1);
+ WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal + 1);
eq = !mir_tstrcmp(szFullName, wszGrpName);
mir_free(wszGrpName);
}
else {
- char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal+1);
+ char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal + 1);
WCHAR* wszGrpName;
Utf8Decode(szGrpName, &wszGrpName);
eq = !mir_tstrcmp(szFullName, wszGrpName);
@@ -467,7 +461,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_HIDDENCHANGED:
{
- DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
+ DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN)
break;
if (dbcws->value.type == DBVT_DELETED || dbcws->value.bVal == 0) {
@@ -507,7 +501,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
nm.hItem = (HANDLE)wParam;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
dat->needsResort = 1;
}
}
@@ -542,14 +536,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
recalcScrollBar = 1;
cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL);
if (contact) {
- contact->iImage = (WORD) lParam;
+ contact->iImage = (WORD)lParam;
cli.pfnNotifyNewContact(hwnd, wParam);
dat->needsResort = 1;
}
}
}
else { // item in list already
- if (contact->iImage == (WORD) lParam)
+ if (contact->iImage == (WORD)lParam)
break;
if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
@@ -558,7 +552,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
recalcScrollBar = 1;
}
else {
- contact->iImage = (WORD) lParam;
+ contact->iImage = (WORD)lParam;
if (!cli.pfnIsHiddenMode(dat, status))
contact->flags |= CONTACTF_ONLINE;
else
@@ -601,7 +595,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
if (contact->type == CLCIT_CONTACT) {
- DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
+ DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
if (dbcws->value.type == DBVT_DELETED || dbcws->value.bVal == 0)
contact->flags &= ~CONTACTF_NOTONLIST;
else
@@ -650,7 +644,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_PRINTCLIENT:
- cli.pfnPaintClc(hwnd, dat, (HDC) wParam, NULL);
+ cli.pfnPaintClc(hwnd, dat, (HDC)wParam, NULL);
break;
case WM_NCPAINT:
@@ -659,7 +653,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
HRGN hClientRgn;
ClientToScreen(hwnd, &ptTopLeft);
hClientRgn = CreateRectRgn(0, 0, 1, 1);
- CombineRgn(hClientRgn, (HRGN) wParam, NULL, RGN_COPY);
+ CombineRgn(hClientRgn, (HRGN)wParam, NULL, RGN_COPY);
OffsetRgn(hClientRgn, -ptTopLeft.x, -ptTopLeft.y);
InvalidateRgn(hwnd, hClientRgn, FALSE);
DeleteObject(hClientRgn);
@@ -713,7 +707,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
UINT scrollLines;
if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE))
scrollLines = 3;
- cli.pfnScrollTo(hwnd, dat, dat->yScroll - (short) HIWORD(wParam) * dat->rowHeight * (signed) scrollLines / WHEEL_DELTA, 0);
+ cli.pfnScrollTo(hwnd, dat, dat->yScroll - (short)HIWORD(wParam) * dat->rowHeight * (signed)scrollLines / WHEEL_DELTA, 0);
}
return 0;
@@ -757,7 +751,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nmkey.hdr.code = NM_KEYDOWN;
nmkey.nVKey = wParam;
nmkey.uFlags = HIWORD(lParam);
- if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nmkey))
+ if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nmkey))
return 0;
}
}
@@ -822,11 +816,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
}
else {
TCHAR szNew[2];
- szNew[0] = (TCHAR) wParam;
+ szNew[0] = (TCHAR)wParam;
szNew[1] = '\0';
if (mir_tstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
MessageBeep(MB_OK);
@@ -845,7 +839,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
dat->selection = index;
else {
MessageBeep(MB_OK);
- dat->szQuickSearch[ mir_tstrlen(dat->szQuickSearch) - 1] = '\0';
+ dat->szQuickSearch[mir_tstrlen(dat->szQuickSearch) - 1] = '\0';
cli.pfnSaveStateAndRebuildList(hwnd, dat);
}
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -869,7 +863,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
return 0;
case WM_TIMER:
- switch(wParam) {
+ switch (wParam) {
case TIMERID_RENAME:
cli.pfnBeginRenameSelection(hwnd, dat);
break;
@@ -905,7 +899,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
it.hItem = (contact->type == CLCIT_GROUP) ? (HANDLE)contact->groupId : (HANDLE)contact->hContact;
it.cbSize = sizeof(it);
dat->hInfoTipItem = cli.pfnContactToHItem(contact);
- NotifyEventHooks(hShowInfoTipEvent, 0, (LPARAM) & it);
+ NotifyEventHooks(hShowInfoTipEvent, 0, (LPARAM)& it);
break;
}
case TIMERID_REBUILDAFTER:
@@ -932,12 +926,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
cli.pfnEndRename(hwnd, dat, 1);
- dat->ptDragStart.x = (short) LOWORD(lParam);
- dat->ptDragStart.y = (short) HIWORD(lParam);
+ dat->ptDragStart.x = (short)LOWORD(lParam);
+ dat->ptDragStart.y = (short)HIWORD(lParam);
if (!dat->filterSearch)
dat->szQuickSearch[0] = 0;
- hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, &group, &hitFlags);
+ hit = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, &group, &hitFlags);
if (hit != -1) {
if (hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) {
SetCapture(hwnd);
@@ -977,7 +971,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm);
}
if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) {
NMCLISTCONTROL nm;
@@ -991,7 +985,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
nm.iColumn = hitFlags & CLCHT_ONITEMEXTRA ? HIBYTE(HIWORD(hitFlags)) : -1;
nm.pt = dat->ptDragStart;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
}
if (hitFlags & (CLCHT_ONITEMCHECK | CLCHT_ONITEMEXTRA))
break;
@@ -1000,12 +994,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, hit, 0);
UpdateWindow(hwnd);
- if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP)
- && !(hitFlags & (CLCHT_ONITEMEXTRA | CLCHT_ONITEMCHECK))) {
- SetCapture(hwnd);
- dat->iDragItem = dat->selection;
- dat->dragStage = DRAGSTAGE_NOTMOVED;
- dat->dragAutoScrolling = 0;
+ if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA | CLCHT_ONITEMCHECK))) {
+ SetCapture(hwnd);
+ dat->iDragItem = dat->selection;
+ dat->dragStage = DRAGSTAGE_NOTMOVED;
+ dat->dragAutoScrolling = 0;
}
break;
@@ -1016,7 +1009,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
if (GetKeyState(VK_MENU) & 0x8000 || GetKeyState(VK_F10) & 0x8000)
break;
- dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), NULL, NULL, NULL);
+ dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, NULL);
if (iOldHotTrack != dat->iHotTrack) {
if (iOldHotTrack == -1)
SetCapture(hwnd);
@@ -1030,15 +1023,15 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
KillTimer(hwnd, TIMERID_INFOTIP);
if (wParam == 0 && dat->hInfoTipItem == NULL) {
- dat->ptInfoTip.x = (short) LOWORD(lParam);
- dat->ptInfoTip.y = (short) HIWORD(lParam);
+ dat->ptInfoTip.x = (short)LOWORD(lParam);
+ dat->ptInfoTip.y = (short)HIWORD(lParam);
SetTimer(hwnd, TIMERID_INFOTIP, dat->infoTipTimeout, NULL);
}
break;
}
if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_NOTMOVED && !(dat->exStyle & CLS_EX_DISABLEDRAGDROP)) {
- if (abs((short) LOWORD(lParam) - dat->ptDragStart.x) >= GetSystemMetrics(SM_CXDRAG)
- || abs((short) HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG))
+ if (abs((short)LOWORD(lParam) - dat->ptDragStart.x) >= GetSystemMetrics(SM_CXDRAG)
+ || abs((short)HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG))
dat->dragStage = (dat->dragStage & ~DRAGSTAGEM_STAGE) | DRAGSTAGE_ACTIVE;
}
if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) {
@@ -1048,8 +1041,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
int target;
GetClientRect(hwnd, &clRect);
- pt.x = (short) LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
hNewCursor = LoadCursor(NULL, IDC_NO);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
if (dat->dragAutoScrolling) {
@@ -1066,7 +1059,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
dat->dragStage &= ~DRAGSTAGEF_OUTSIDE;
}
switch (target) {
@@ -1085,15 +1078,15 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (pt.x >= 0 && pt.x < clRect.right
&& ((pt.y < 0 && pt.y > -dat->dragAutoScrollHeight)
- || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) {
- if (!dat->dragAutoScrolling) {
- if (pt.y < 0)
- dat->dragAutoScrolling = -1;
- else
- dat->dragAutoScrolling = 1;
- SetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, NULL);
- }
- SendMessage(hwnd, WM_TIMER, TIMERID_DRAGAUTOSCROLL, 0);
+ || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) {
+ if (!dat->dragAutoScrolling) {
+ if (pt.y < 0)
+ dat->dragAutoScrolling = -1;
+ else
+ dat->dragAutoScrolling = 1;
+ SetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, NULL);
+ }
+ SendMessage(hwnd, WM_TIMER, TIMERID_DRAGAUTOSCROLL, 0);
}
dat->dragStage |= DRAGSTAGEF_OUTSIDE;
@@ -1104,7 +1097,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.flags = 0;
nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
nm.pt = pt;
- if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm))
+ if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm))
return 0;
}
break;
@@ -1123,9 +1116,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (dat->iDragItem == -1)
break;
- SetCursor((HCURSOR) GetClassLongPtr(hwnd, GCLP_HCURSOR));
+ SetCursor((HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR));
if (dat->exStyle & CLS_EX_TRACKSELECT) {
- dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), NULL, NULL, NULL);
+ dat->iHotTrack = cli.pfnHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, NULL);
if (dat->iHotTrack == -1)
ReleaseCapture();
}
@@ -1180,7 +1173,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.flags = 0;
nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
nm.pt = pt;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
}
break;
default:
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp
index 596a5e3116..517feaef52 100644
--- a/src/mir_app/src/clistmenus.cpp
+++ b/src/mir_app/src/clistmenus.cpp
@@ -30,6 +30,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "clc.h"
#include "genmenu.h"
+void InitGroupMenus();
+
#define MS_CLIST_HKSTATUS "Clist/HK/SetStatus"
#define FIRSTCUSTOMMENUITEMID 30000
@@ -1145,6 +1147,9 @@ void InitCustomMenus(void)
Menu_ConfigureObject(hContactMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hContactMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");
+ // other menus
+ InitGroupMenus();
+
// initialize hotkeys
CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus);
diff --git a/src/mir_app/src/groupmenu.cpp b/src/mir_app/src/groupmenu.cpp
new file mode 100644
index 0000000000..ea7c929ee5
--- /dev/null
+++ b/src/mir_app/src/groupmenu.cpp
@@ -0,0 +1,250 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+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.
+
+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.
+*/
+
+#include "stdafx.h"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////// Group MENU //////////////////////////////
+
+int hGroupMenuObject, hSubGroupMenuObject;
+static HANDLE hEventPreBuildGroupMenu, hEventPreBuildSubGroupMenu;
+
+// Groupmenu exec param(ownerdata)
+
+struct GroupMenuExecParam
+{
+ char *szServiceName;
+ int Param1, Param2;
+};
+
+MIR_APP_DLL(HMENU) Menu_BuildGroupMenu()
+{
+ NotifyEventHooks(hEventPreBuildGroupMenu, 0, 0);
+
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hGroupMenuObject);
+ return hMenu;
+}
+
+MIR_APP_DLL(HGENMENU) Menu_AddGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp)
+{
+ GroupMenuExecParam *mmep = (GroupMenuExecParam*)mir_calloc(sizeof(GroupMenuExecParam));
+ if (mmep == NULL)
+ return 0;
+
+ // we need just one parametr.
+ mmep->szServiceName = mir_strdup(pmi->pszService);
+ if (gmp != NULL) {
+ mmep->Param1 = gmp->wParam;
+ mmep->Param2 = gmp->lParam;
+ }
+
+ HGENMENU hNewItem = Menu_AddItem(hGroupMenuObject, pmi, mmep);
+
+ char buf[1024];
+ mir_snprintf(buf, "%s/%s", pmi->pszService, pmi->name.a);
+ Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf);
+ return hNewItem;
+}
+
+// called with:
+// wparam - ownerdata
+// lparam - lparam from winproc
+INT_PTR GroupMenuExecService(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam != 0) {
+ GroupMenuExecParam * mmep = (GroupMenuExecParam *)wParam;
+ if (!mir_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, LPARAM lParam)
+{
+ GroupMenuExecParam * mmep = (GroupMenuExecParam *)lParam;
+ if (mmep != NULL) {
+ mir_free(mmep->szServiceName);
+ mir_free(mmep);
+ }
+
+ return 0;
+}
+
+INT_PTR HideGroupsHelper(WPARAM, LPARAM)
+{
+ int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS);
+ db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)newVal);
+ SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, newVal, 0);
+ return 0;
+}
+
+INT_PTR UseGroupsHelper(WPARAM, LPARAM)
+{
+ int newVal = !(GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
+ db_set_b(NULL, "CList", "UseGroups", (BYTE)newVal);
+ SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, newVal,0);
+ return 0;
+}
+
+INT_PTR HideOfflineRootHelper(WPARAM, LPARAM)
+{
+ SendMessage(cli.hwndContactTree, CLM_SETHIDEOFFLINEROOT,
+ !SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0),
+ 0);
+ return 0;
+}
+
+INT_PTR CreateGroupHelper(WPARAM, LPARAM)
+{
+ SendMessage(cli.hwndContactTree, CLM_SETHIDEEMPTYGROUPS, 0, 0);
+ SendMessage(cli.hwndContactTree, CLM_SETUSEGROUPS, 1, 0);
+ Clist_CreateGroup(0, 0);
+ return 0;
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////// SubGroup MENU //////////////////////////////
+
+struct SubGroupMenuExecParam
+{
+ char *szServiceName;
+ int Param1, Param2;
+};
+
+MIR_APP_DLL(HMENU) Menu_BuildSubGroupMenu(ClcGroup *group)
+{
+ NotifyEventHooks(hEventPreBuildSubGroupMenu, (WPARAM)group, 0);
+
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hSubGroupMenuObject, (WPARAM)group, 0);
+ return hMenu;
+}
+
+HMENU cliBuildGroupPopupMenu(ClcGroup *group)
+{
+ return Menu_BuildSubGroupMenu(group);
+}
+
+MIR_APP_DLL(HGENMENU) Menu_AddSubGroupMenuItem(TMO_MenuItem *pmi, GroupMenuParam *gmp)
+{
+ SubGroupMenuExecParam *mmep = (SubGroupMenuExecParam*)mir_calloc(sizeof(SubGroupMenuExecParam));
+ if (mmep == NULL)
+ return 0;
+
+ // we need just one parametr.
+ mmep->szServiceName = mir_strdup(pmi->pszService);
+ if (gmp != NULL) {
+ mmep->Param1 = gmp->wParam;
+ mmep->Param2 = gmp->lParam;
+ }
+
+ HGENMENU hNewItem = Menu_AddItem(hSubGroupMenuObject, pmi, mmep);
+
+ char buf[1024];
+ mir_snprintf(buf, "%s/%s", pmi->pszService, pmi->name.a);
+ Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, buf);
+ return hNewItem;
+}
+
+static INT_PTR SubGroupMenuCheckService(WPARAM wParam, LPARAM)
+{
+ TCheckProcParam * CParam = (TCheckProcParam*)wParam;
+ if (CParam) {
+ SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)(CParam->MenuItemOwnerData);
+ if (mmep)
+ mmep->Param2 = CParam->lParam;
+ }
+ return 1;
+}
+
+// called with:
+// wparam - ownerdata
+// lparam - lparam from winproc
+static INT_PTR SubGroupMenuExecService(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam != 0) {
+ SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)wParam;
+ if (!mir_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, lParam);
+ }
+ return 1;
+}
+
+static INT_PTR FreeOwnerDataSubGroupMenu(WPARAM, LPARAM lParam)
+{
+ SubGroupMenuExecParam * mmep = (SubGroupMenuExecParam *)lParam;
+ if (mmep != NULL) {
+ mir_free(mmep->szServiceName);
+ mir_free(mmep);
+ }
+ return 0;
+}
+
+// wparam menu handle to pass to clc.c
+// lparam WM_COMMAND HWND
+static INT_PTR GroupMenuExecProxy(WPARAM wParam, LPARAM lParam)
+{
+ SendMessage(lParam ? (HWND)lParam : (HWND)cli.hwndContactTree, WM_COMMAND, wParam, 0);
+ return 0;
+}
+
+void InitGroupMenus(void)
+{
+ // Group menu
+ CreateServiceFunction("CLISTMENUSGroup/ExecService", GroupMenuExecService);
+ CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu", FreeOwnerDataGroupMenu);
+ CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper", HideGroupsHelper);
+ CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper", UseGroupsHelper);
+ CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper", HideOfflineRootHelper);
+ CreateServiceFunction("CLISTMENUSGroup/CreateGroupHelper", CreateGroupHelper);
+
+ hEventPreBuildGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
+
+ hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
+ Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
+ Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
+ Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuOnAddService");
+
+ // SubGroup menu
+ CreateServiceFunction("CLISTMENUSSubGroup/ExecService", SubGroupMenuExecService);
+ CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu", FreeOwnerDataSubGroupMenu);
+ CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuCheckService", SubGroupMenuCheckService);
+ CreateServiceFunction("CLISTMENUSSubGroup/GroupMenuExecProxy", GroupMenuExecProxy);
+
+ hEventPreBuildSubGroupMenu = CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
+
+ hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
+ Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
+ Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");
+}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index f8cb51b46f..584a79020a 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -229,3 +229,7 @@ Menu_BuildContactMenu @226
Menu_BuildMainMenu @227
Menu_GetMainMenu @228
Menu_GetStatusMenu @229
+Menu_BuildSubGroupMenu @230
+Menu_AddGroupMenuItem @231
+Menu_AddSubGroupMenuItem @232
+Menu_BuildGroupMenu @233
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 0e85f44f5c..52c1014550 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -229,3 +229,7 @@ Menu_BuildContactMenu @226
Menu_BuildMainMenu @227
Menu_GetMainMenu @228
Menu_GetStatusMenu @229
+Menu_BuildSubGroupMenu @230
+Menu_AddGroupMenuItem @231
+Menu_AddSubGroupMenuItem @232
+Menu_BuildGroupMenu @233
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index aba85570c5..a93754f9a4 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -122,6 +122,8 @@ int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon
/**** clistmenus.cpp ********************************************************************/
+extern CLIST_INTERFACE cli;
+
extern int hMainMenuObject, hContactMenuObject, hStatusMenuObject;
extern HANDLE hPreBuildMainMenuEvent, hPreBuildContactMenuEvent;
extern HANDLE hShutdownEvent, hPreShutdownEvent;
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 7fd2a39ca5..00027b4c75 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -585,6 +585,7 @@
#define IDM_COPYLINK 40016
#define POPUP_HIDEMIRANDA 40017
#define ID_CANCELCHANGE 40018
+#define POPUP_GROUPSHOWOFFLINE 40019
#define ID_TRAY_HIDE 40038
#define ID_TRAY_EXIT 40040
#define POPUP_NEWGROUP 40050