summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-08 22:00:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-08 22:00:25 +0000
commit18aec330d11e9e5acdfd032e5f614beed08eaa0c (patch)
treee31c1794a91738740537092b663ff7e567459ca3 /src/modules
parent3be534c7528386c00bc31fca9c15b87d214f5cc1 (diff)
fix for clicking on extra icons (for all plugins but clist nicer+)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2250 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/clist/clc.cpp2
-rw-r--r--src/modules/clist/clcmsgs.cpp43
-rw-r--r--src/modules/clist/clui.cpp44
-rw-r--r--src/modules/extraicons/extraicons.cpp3
4 files changed, 50 insertions, 42 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 20f966515b..2da2c7701f 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -389,7 +389,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_GETFONT:
- return (LRESULT) dat->fontInfo[FONTID_CONTACTS].hFont;
+ return (LRESULT)dat->fontInfo[FONTID_CONTACTS].hFont;
case INTM_GROUPSCHANGED:
{
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp
index c27564729c..c6f7ad3157 100644
--- a/src/modules/clist/clcmsgs.cpp
+++ b/src/modules/clist/clcmsgs.cpp
@@ -53,12 +53,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
ClcGroup *group;
CLCINFOITEM *cii = (CLCINFOITEM *) lParam;
if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
if (cii->hParentGroup == NULL)
group = &dat->list;
else {
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
group = groupContact->group;
}
if (msg == CLM_ADDINFOITEMA)
@@ -68,7 +68,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
}
else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
cli.pfnRecalcScrollBar(hwnd, dat);
- return (LRESULT) group->cl.items[i]->hContact | HCONTACT_ISINFO;
+ return (LRESULT)group->cl.items[i]->hContact | HCONTACT_ISINFO;
}
case CLM_AUTOREBUILD:
@@ -116,12 +116,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_FINDCONTACT:
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
return wParam;
case CLM_FINDGROUP:
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
return wParam | HCONTACT_ISGROUP;
case CLM_GETBKCOLOR:
@@ -139,7 +139,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return cli.pfnGetGroupContentsCount(&dat->list, 0);
case CLM_GETEDITCONTROL:
- return (LRESULT) dat->hwndRenameEdit;
+ return (LRESULT)dat->hwndRenameEdit;
case CLM_GETEXPAND:
{
@@ -168,12 +168,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return EMPTY_EXTRA_ICON;
case CLM_GETEXTRAIMAGELIST:
- return (LRESULT) dat->himlExtraColumns;
+ return (LRESULT)dat->himlExtraColumns;
case CLM_GETFONT:
if (wParam < 0 || wParam > FONTID_MAX)
return 0;
- return (LRESULT) dat->fontInfo[wParam].hFont;
+ return (LRESULT)dat->fontInfo[wParam].hFont;
case CLM_GETHIDEOFFLINEROOT:
return db_get_b(NULL, "CLC", "HideOfflineRoot", 0);
@@ -209,7 +209,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
{
if (wParam == CLGN_ROOT) {
if (dat->list.cl.count)
- return (LRESULT) cli.pfnContactToHItem(dat->list.cl.items[0]);
+ return (LRESULT)cli.pfnContactToHItem(dat->list.cl.items[0]);
return NULL;
}
@@ -222,11 +222,11 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
switch (wParam) {
case CLGN_CHILD:
if (contact->type != CLCIT_GROUP)
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
group = contact->group;
if (group->cl.count == 0)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[0]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[0]);
case CLGN_PARENT:
return group->groupId | HCONTACT_ISGROUP;
@@ -237,7 +237,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return NULL;
}
while (group->cl.items[i]->type == CLCIT_DIVIDER);
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUS:
do {
@@ -245,7 +245,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return NULL;
}
while (group->cl.items[i]->type == CLCIT_DIVIDER);
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_NEXTCONTACT:
for (i++; i < group->cl.count; i++)
@@ -253,7 +253,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
break;
if (i >= group->cl.count)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUSCONTACT:
if (i >= group->cl.count)
@@ -263,7 +263,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
break;
if (i < 0)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_NEXTGROUP:
for (i++; i < group->cl.count; i++)
@@ -271,7 +271,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
break;
if (i >= group->cl.count)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUSGROUP:
if (i >= group->cl.count)
@@ -281,7 +281,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
break;
if (i < 0)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
}
return NULL;
}
@@ -294,25 +294,24 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(contact);
+ return (LRESULT)cli.pfnContactToHItem(contact);
}
case CLM_GETTEXTCOLOR:
if (wParam < 0 || wParam > FONTID_MAX)
return 0;
- return (LRESULT) dat->fontInfo[wParam].colour;
+ return (LRESULT)dat->fontInfo[wParam].colour;
case CLM_HITTEST:
{
ClcContact *contact;
DWORD hitFlags;
- int hit;
- hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
+ int hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
if (wParam)
*(PDWORD) wParam = hitFlags;
if (hit == -1)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(contact);
+ return (LRESULT)cli.pfnContactToHItem(contact);
}
case CLM_SELECTITEM:
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index 1a29948f44..383ab66dd8 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -28,6 +28,7 @@
#define MENU_MIRANDAMENU 0xFFFF1234
extern BOOL(WINAPI * MySetProcessWorkingSetSize) (HANDLE, SIZE_T, SIZE_T);
+extern HANDLE hEventExtraClick;
static HMODULE hUserDll;
static HANDLE hContactDraggingEvent, hContactDroppedEvent, hContactDragStopEvent;
@@ -143,9 +144,10 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP
mir_sntprintf(szFinal, SIZEOF(szFinal), szFormat, cli.pfnGetContactDisplayName((HANDLE)lParam, 0));
SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
}
- SetFocus( GetDlgItem(hWnd, IDNO));
+ SetFocus( GetDlgItem(hWnd, IDNO));
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
break;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDYES:
@@ -519,13 +521,13 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case M_RESTORESTATUS:
- #ifndef _DEBUG
- {
- int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE);
- if (nStatus != ID_STATUS_OFFLINE) CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0);
- }
- #endif
- break;
+ #ifndef _DEBUG
+ {
+ int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE);
+ if (nStatus != ID_STATUS_OFFLINE) CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0);
+ }
+ #endif
+ break;
// Power management
case WM_POWERBROADCAST:
@@ -581,7 +583,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
RECT rc;
GetWindowRect(hwnd, &rc);
- if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
db_set_dw(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
db_set_dw(NULL, "CList", "x", (DWORD) rc.left);
db_set_dw(NULL, "CList", "y", (DWORD) rc.top);
@@ -805,7 +808,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_DISPLAYCHANGE:
DefWindowProc(hwnd, msg, wParam, lParam);
- SendMessage(cli.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
+ SendMessage(cli.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
break;
//MSG FROM CHILD CONTROL
@@ -895,15 +898,21 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NM_CLICK:
{
DWORD hitFlags;
- if (SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM) & hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y)))
+ HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y));
+ if (hItem) {
+ if (hitFlags & CLCHT_ONITEMEXTRA) {
+ if ( !IsHContactGroup(hItem) && !IsHContactInfo(hItem))
+ if ( cli.pfnGetCacheEntry(nmc->hItem))
+ NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn+1);
+ }
break;
+ }
if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0)
break;
if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
- POINT pt;
- pt = nmc->pt;
+ POINT pt = nmc->pt;
ClientToScreen(cli.hwndContactTree, &pt);
return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
@@ -954,10 +963,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
int pos = LOWORD(wParam);
POINT pt;
GetCursorPos(&pt);
- if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) &&
- ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
- MENUITEMINFO mii = { 0 };
- mii.cbSize = MENUITEMINFO_V4_SIZE;
+ if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
+ MENUITEMINFO mii = { MENUITEMINFO_V4_SIZE };
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = (HMENU)CallService((pos == 0) ? MS_CLIST_MENUGETMAIN : MS_CLIST_MENUGETSTATUS, 0, 0);
SetMenuItemInfo(cli.hMenuMain, pos, TRUE, &mii);
@@ -1089,7 +1096,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
RECT rc;
GetWindowRect(hwnd, &rc);
- if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
db_set_dw(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
db_set_dw(NULL, "CList", "x", (DWORD) rc.left);
db_set_dw(NULL, "CList", "y", (DWORD) rc.top);
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp
index eef801f408..5119034c79 100644
--- a/src/modules/extraicons/extraicons.cpp
+++ b/src/modules/extraicons/extraicons.cpp
@@ -273,7 +273,8 @@ int ClistExtraClick(WPARAM wParam, LPARAM lParam)
///////////////////////////////////////////////////////////////////////////////
// Extra image list functions
-static HANDLE hEventExtraImageListRebuilding, hEventExtraImageApplying, hEventExtraClick;
+HANDLE hEventExtraImageListRebuilding, hEventExtraImageApplying, hEventExtraClick;
+
static bool bImageCreated = false;
static int g_mutex_bSetAllExtraIconsCycle = 0;
static HIMAGELIST hExtraImageList;