summaryrefslogtreecommitdiff
path: root/plugins/Tabsrmm/chat
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-05-19 19:04:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-05-19 19:04:21 +0000
commit0e92833a9b0a24057df265337636943517d5d262 (patch)
tree8895b40d8970067404721b0a55daab1433359b6e /plugins/Tabsrmm/chat
parentb1509f22892dc98057c750e7fae39ded5cea3b09 (diff)
patch for tipper drawn tooltip in tabSRMM сhats
git-svn-id: http://svn.miranda-ng.org/main/trunk@84 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Tabsrmm/chat')
-rw-r--r--plugins/Tabsrmm/chat/tools.cpp10
-rw-r--r--plugins/Tabsrmm/chat/window.cpp87
2 files changed, 86 insertions, 11 deletions
diff --git a/plugins/Tabsrmm/chat/tools.cpp b/plugins/Tabsrmm/chat/tools.cpp
index fa36716efb..0726a01869 100644
--- a/plugins/Tabsrmm/chat/tools.cpp
+++ b/plugins/Tabsrmm/chat/tools.cpp
@@ -352,10 +352,10 @@ static BOOL DoPopup(SESSION_INFO* si, GCEVENT* gce, struct TWindowData* dat)
if (pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE) {
if (pContainer->dwFlags & CNT_DONTREPORTFOCUSED)
goto passed;
-
+
if (pContainer->hwndActive == si->hWnd)
return 0;
-
+
goto passed;
}
return 0;
@@ -1255,7 +1255,7 @@ void Chat_SetFilters(SESSION_INFO *si)
}
dwFlags_default = M->GetDword("Chat", "DiskLogFlags", 0xFFFF);
- si->iDiskLogFlags = dwFlags_default;
+ si->iDiskLogFlags = dwFlags_default;
if (si->iLogFilterFlags == 0)
@@ -1273,7 +1273,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
bool fReparse = false;
if(!tTime)
- time(&tTime);
+ time(&tTime);
/*
* check whether relevant parts of the timestamp have changed and
@@ -1345,7 +1345,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|' )
*p = _T('_');
}
- }
+ }
return si->pszLogFileName;
}
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;
}