From 0e92833a9b0a24057df265337636943517d5d262 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 19 May 2012 19:04:21 +0000 Subject: =?UTF-8?q?patch=20for=20tipper=20drawn=20tooltip=20in=20tabSRMM?= =?UTF-8?q?=20=D1=81hats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.miranda-ng.org/main/trunk@84 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Tabsrmm/chat/tools.cpp | 10 ++--- plugins/Tabsrmm/chat/window.cpp | 87 +++++++++++++++++++++++++++++++++++--- plugins/Tabsrmm/include/msgs.h | 1 + plugins/Tabsrmm/src/msgs.cpp | 6 +-- plugins/Tabsrmm/src/translator.cpp | 7 +-- 5 files changed, 94 insertions(+), 17 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("%s:\t%s\n%s:\t%s\n%s:\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; } diff --git a/plugins/Tabsrmm/include/msgs.h b/plugins/Tabsrmm/include/msgs.h index dec5d3313d..51c59a1561 100644 --- a/plugins/Tabsrmm/include/msgs.h +++ b/plugins/Tabsrmm/include/msgs.h @@ -465,6 +465,7 @@ struct TNewWindowData { #define CNT_NEED_UPDATETITLE 0x20000 #define CNT_DEFERREDSIZEREQUEST 0x40000 #define CNT_DONTREPORTUNFOCUSED 0x80000 +#define CNT_DONTREPORTFOCUSED 0x400 #define CNT_ALWAYSREPORTINACTIVE 0x100000 #define CNT_NEWCONTAINERFLAGS 0x200000 #define CNT_DEFERREDTABSELECT 0x400000 diff --git a/plugins/Tabsrmm/src/msgs.cpp b/plugins/Tabsrmm/src/msgs.cpp index 775d6405fc..5c67a6a797 100644 --- a/plugins/Tabsrmm/src/msgs.cpp +++ b/plugins/Tabsrmm/src/msgs.cpp @@ -570,7 +570,7 @@ int LoadSendRecvMessageModule(void) INITCOMMONCONTROLSEX icex; if(FIF == 0) { - MessageBox(0, _T("The image service plugin (advaimg.dll) is not properly installed.\n\nTabSRMM is disabled."), _T("TabSRMM fatal error"), MB_OK | MB_ICONERROR); + MessageBox(0, TranslateT("The image service plugin (advaimg.dll) is not properly installed.\n\nTabSRMM is disabled."), TranslateT("TabSRMM fatal error"), MB_OK | MB_ICONERROR); return(1); } icex.dwSize = sizeof(INITCOMMONCONTROLSEX); @@ -1036,7 +1036,7 @@ static int GetIconPackVersion(HMODULE hDLL) } if (version < 5) - CWarning::show(CWarning::WARN_ICONPACK_VERSION, CWarning::CWF_UNTRANSLATED|MB_OK|MB_ICONERROR); + CWarning::show(CWarning::WARN_ICONPACK_VERSION, MB_OK|MB_ICONERROR); return version; } /* @@ -1053,7 +1053,7 @@ static int TSAPI SetupIconLibConfig() strncpy(szFilename, "icons\\tabsrmm_icons.dll", MAX_PATH); g_hIconDLL = LoadLibraryA(szFilename); if (g_hIconDLL == 0) { - CWarning::show(CWarning::WARN_ICONPACKMISSING, CWarning::CWF_NOALLOWHIDE|CWarning::CWF_UNTRANSLATED|MB_ICONERROR|MB_OK); + CWarning::show(CWarning::WARN_ICONPACKMISSING, CWarning::CWF_NOALLOWHIDE|MB_ICONERROR|MB_OK); return 0; } diff --git a/plugins/Tabsrmm/src/translator.cpp b/plugins/Tabsrmm/src/translator.cpp index ecf2faed45..1e801152ea 100644 --- a/plugins/Tabsrmm/src/translator.cpp +++ b/plugins/Tabsrmm/src/translator.cpp @@ -446,11 +446,11 @@ wchar_t* CTranslator::m_OptStrings[OPT_LAST] = { */ wchar_t* CTranslator::m_Warnings[WARN_LAST] = { LPGENT("Important release notes|A test warning message"), /* WARN_TEST */ /* reserved for important notes after upgrade - NOT translatable */ - L"Icon pack version check|The installed icon pack is outdated and might be incompatible with TabSRMM version 3.\n\n\\b1Missing or misplaced icons are possible issues with the currently installed icon pack.\\b0 ", /* WARN_ICONPACKVERSION */ /* NOT TRANSLATABLE */ + LPGENT("Icon pack version check|The installed icon pack is outdated and might be incompatible with TabSRMM version 3.\n\n\\b1Missing or misplaced icons are possible issues with the currently installed icon pack.\\b0"), /* WARN_ICONPACKVERSION */ /* NOT TRANSLATABLE */ LPGENT("Edit user notes|You are editing the user notes. Click the button again or use the hotkey (default: Alt-N) to save the notes and return to normal messaging mode"), /* WARN_EDITUSERNOTES */ - L"Missing component|The icon pack is missing. Please install it to the default icons folder.\n\nNo icons will be available", /* WARN_ICONPACKMISSING */ /* NOT TRANSLATABLE */ + LPGENT("Missing component|The icon pack is missing. Please install it to the default icons folder.\n\nNo icons will be available"), /* WARN_ICONPACKMISSING */ /* NOT TRANSLATABLE */ LPGENT("Aero peek warning|You have enabled Aero Peek features and loaded a custom container window skin\n\nThis can result in minor visual anomalies in the live preview feature."), /* WARN_AEROPEEKSKIN */ - L"TabSRMM group chat module|TabSRMM could not enable its group chat module. The most likely cause is that you have installed and enabled \\b1chat.dll\\b0 or another plugin that provides groupchat services.\n\nShould I try to fix this now \\b1(a restart of Miranda is required to apply these changes)?\\b0", /* WARN_CHAT_ENABLED */ /* NOT TRANSLATABLE */ + LPGENT("TabSRMM group chat module|TabSRMM could not enable its group chat module. The most likely cause is that you have installed and enabled \\b1chat.dll\\b0 or another plugin that provides groupchat services.\n\nShould I try to fix this now \\b1(a restart of Miranda is required to apply these changes)?\\b0"), /* WARN_CHAT_ENABLED */ /* NOT TRANSLATABLE */ L"Filetransfer problem|Sending the image by file transfer failed.\n\nPossible reasons: File transfers not supported, either you or the target contact is offline, or you are invisible and the target contact is not on your visibilty list.", /* WARN_IMGSVC_MISSING */ /* NOT TRANSLATABLE */ LPGENT("Settings problem|The option \\b1 History->Imitate IEView API\\b0 is enabled and the History++ plugin is active. This can cause problems when using IEView as message log viewer.\n\nShould I correct the option (a restart is required)?"), /* WARN_HPP_APICHECK */ L" ", /* WARN_NO_SENDLATER */ /*uses QMGR_ERROR_NOMULTISEND */ @@ -471,6 +471,7 @@ TOptionListGroup CTranslator::m_lvGroupsModPlus[] = { TOptionListItem CTranslator::m_lvItemsModPlus[] = { 0, LPGENT("Show client icon in status bar (fingerprint plugin required)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"adv_ClientIconInStatusBar", 0, + 0, LPGENT("Show skinnable tooltip in chat (tipper plugin required)"), 1, LOI_TYPE_SETTING, (UINT_PTR)"adv_TipperTooltip", 0, 0, LPGENT("Enable typing sounds"), 0, LOI_TYPE_SETTING, (UINT_PTR)"adv_soundontyping", 0, 0, LPGENT("Disable animated GIF avatars (will not affect already open message windows)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"adv_DisableAniAvatars", 0, 0, LPGENT("Close current tab on send"), 0, LOI_TYPE_SETTING, (UINT_PTR)"adv_AutoClose_2", 0, -- cgit v1.2.3