summaryrefslogtreecommitdiff
path: root/plugins/Tabsrmm/chat/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Tabsrmm/chat/window.cpp')
-rw-r--r--plugins/Tabsrmm/chat/window.cpp87
1 files changed, 81 insertions, 6 deletions
diff --git a/plugins/Tabsrmm/chat/window.cpp b/plugins/Tabsrmm/chat/window.cpp
index 026a87a8e8..0c7d3c8f99 100644
--- a/plugins/Tabsrmm/chat/window.cpp
+++ b/plugins/Tabsrmm/chat/window.cpp
@@ -1517,6 +1517,9 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
HWND hwndParent = GetParent(hwnd);
struct TWindowData *mwdat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ static BOOL isToolTip = NULL;
+ static int currentHovered = -1;
+
switch (msg) {
//MAD: attemp to fix weird bug, when combobox with hidden vscroll
//can't be scrolled with mouse-wheel.
@@ -1623,6 +1626,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
si->iSearchItem = -1;
}
break;
+
case WM_CHAR:
case WM_UNICHAR: {
/*
@@ -1681,6 +1685,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
break;
}
+
case WM_RBUTTONDOWN: {
int iCounts = SendMessage(hwnd, LB_GETSELCOUNT, 0, 0);
@@ -1700,6 +1705,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
return FALSE;
}
+
case WM_DRAWITEM: {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU)
@@ -1801,15 +1807,14 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
}
break;
+
case WM_MOUSEMOVE: {
POINT pt;
RECT clientRect;
- BOOL bInClient;
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
GetClientRect(hwnd, &clientRect);
- bInClient = PtInRect(&clientRect, pt);
- if (bInClient) {
+ if (PtInRect(&clientRect, pt)) {
//hit test item under mouse
struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
SESSION_INFO *parentdat = (SESSION_INFO *)dat->si;
@@ -1820,9 +1825,79 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
else
nItemUnderMouse &= 0xFFFF;
- ProcessNickListHovering(hwnd, (int)nItemUnderMouse, &pt, parentdat);
- } else
- ProcessNickListHovering(hwnd, -1, &pt, NULL);
+ if (M->GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")) {
+ if ((int)nItemUnderMouse == currentHovered) break;
+ currentHovered = (int)nItemUnderMouse;
+
+ KillTimer(hwnd, 1);
+
+ if (isToolTip) {
+ CallService("mToolTip/HideTip", 0, 0);
+ isToolTip = FALSE;
+ }
+
+ if (nItemUnderMouse != -1)
+ SetTimer(hwnd, 1, 450, 0);
+ }
+ else ProcessNickListHovering(hwnd, (int)nItemUnderMouse, &pt, parentdat);
+ }
+ else
+ {
+ if (M->GetByte("adv_TipperTooltip", 1) && ServiceExists("mToolTip/HideTip")) {
+ KillTimer(hwnd, 1);
+ if (isToolTip) {
+ CallService("mToolTip/HideTip", 0, 0);
+ isToolTip = FALSE;
+ }
+ }
+ else ProcessNickListHovering(hwnd, -1, &pt, NULL);
+ }
+ }
+ break;
+
+ case WM_TIMER:
+ {
+ CLCINFOTIP ti = {0};
+ USERINFO *ui1 = NULL;
+ TCHAR ptszBuf[1024];
+ char serviceName[256];
+ POINT pt;
+
+ struct TWindowData *dat = (struct TWindowData *)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
+ SESSION_INFO * parentdat = dat->si;
+
+ GetCursorPos(&pt);
+ ScreenToClient(hwnd, &pt);
+
+ DWORD nItemUnderMouse = (DWORD)SendMessage(GetDlgItem(dat->hwnd, IDC_LIST), LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y));
+ if (HIWORD(nItemUnderMouse) == 1)
+ nItemUnderMouse = (DWORD)(-1);
+ else
+ nItemUnderMouse &= 0xFFFF;
+ if (((int)nItemUnderMouse != currentHovered) || (nItemUnderMouse == -1)) {
+ KillTimer(hwnd, 1);
+ break;
+ }
+
+ ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
+
+ if (ui1) {
+ ti.cbSize = sizeof(ti);
+ mir_snprintf(serviceName, SIZEOF(serviceName), "%s"MS_GC_PROTO_GETTOOLTIPTEXT, parentdat->pszModule);
+
+ if (ServiceExists(serviceName))
+ mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s"), (TCHAR*)CallService(serviceName, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID));
+ else
+ mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s"),
+ TranslateT("Nick"), ui1->pszNick,
+ TranslateT("Unique id"), ui1->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui1->Status));
+
+ if (ptszBuf != NULL)
+ if (CallService("mToolTip/ShowTipW", (WPARAM)mir_tstrdup(ptszBuf), (LPARAM)&ti))
+ isToolTip = TRUE;
+ }
+ KillTimer(hwnd, 1);
}
break;
}