diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-02 13:24:08 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-02 13:24:08 +0300 |
commit | 2fccd1a7a6f642c30fc4cbd2281c6feba5f8d82d (patch) | |
tree | 4ed7ab693d63e7823d112fa5842801bb21b28149 /plugins | |
parent | d4531ad72545eeaedd28ffd331c9f8d8a9e23928 (diff) |
code cleanup in tabSRMM
- unused cursor removed (IDC_HYPERLINKHAND);
- unused header file removed (all functions from generic_msghandlers.h are now declared inside a class)
- code reorder;
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/TabSRMM/res/resource.rc | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 62 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 230 | ||||
-rw-r--r-- | plugins/TabSRMM/src/controls.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 261 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.h | 31 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sidebar.cpp | 10 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sidebar.h | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/stdafx.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/utils.cpp | 21 | ||||
-rw-r--r-- | plugins/TabSRMM/src/utils.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/version.h | 2 |
18 files changed, 293 insertions, 362 deletions
diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index f4d2b86f29..5035997a5a 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -676,7 +676,6 @@ END // Cursor
//
-IDC_HYPERLINKHAND CURSOR "..\\..\\..\\src\\mir_app\\res\\cursor_hyperlink.cur"
IDC_DROP CURSOR "..\\..\\..\\src\\mir_app\\res\\cursor_drag_copy.cur"
IDC_DROPUSER CURSOR "..\\..\\..\\src\\mir_app\\res\\cursor_drop_user.cur"
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 81c747b439..17c40a43a6 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -38,7 +38,6 @@ int g_iWheelCarryover = 0; extern HMENU g_hMenu; static HKL hkl = NULL; -static HCURSOR hCurHyperlinkHand; char szIndicators[] = { 0, '+', '%', '@', '!', '*' }; struct MESSAGESUBDATA @@ -1135,7 +1134,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return CSkin::DrawRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, LogSubclassProc); case WM_COPY: - return DM_WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); + return Utils::WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); case WM_SETCURSOR: if (g_Settings.bClickableNicks && (LOWORD(lParam) == HTCLIENT)) { @@ -1180,7 +1179,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return TRUE; } if (wParam == VK_INSERT && GetKeyState(VK_CONTROL) & 0x8000) - return DM_WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); + return Utils::WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); break; case WM_SYSKEYUP: @@ -1220,7 +1219,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bool isCtrl, isShift, isAlt; mwdat->KbdState(isShift, isCtrl, isAlt); if (wParam == 0x03 && isCtrl) // Ctrl+C - return DM_WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); + return Utils::WMCopyHandler(hwnd, LogSubclassProc, msg, wParam, lParam); SetFocus(GetDlgItem(hwndParent, IDC_MESSAGE)); SendDlgItemMessage(hwndParent, IDC_MESSAGE, WM_CHAR, wParam, lParam); @@ -1682,9 +1681,6 @@ void CChatRoomDlg::OnDestroy() if (m_hwndTip) DestroyWindow(m_hwndTip); - if (hCurHyperlinkHand) - DestroyCursor(hCurHyperlinkHand); - int i = GetTabIndexFromHWND(m_hwndParent, m_hwnd); if (i >= 0) { SendMessage(m_hwndParent, WM_USER + 100, 0, 0); // clean up tooltip @@ -2458,16 +2454,6 @@ LABEL_SHOWWINDOW: case EN_LINK: if (((LPNMHDR)lParam)->idFrom == IDC_LOG) { switch (((ENLINK*)lParam)->msg) { - case WM_SETCURSOR: - if (g_Settings.bClickableNicks) { - if (!hCurHyperlinkHand) - hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND); - if (hCurHyperlinkHand != GetCursor()) - SetCursor(hCurHyperlinkHand); - return TRUE; - } - break; - case WM_RBUTTONDOWN: case WM_LBUTTONUP: case WM_LBUTTONDBLCLK: @@ -2484,36 +2470,11 @@ LABEL_SHOWWINDOW: SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); BOOL isLink = IsStringValidLink(tr.lpstrText); - if (isLink) { - if (((ENLINK*)lParam)->msg == WM_RBUTTONDOWN) { - HMENU hSubMenu = GetSubMenu(g_hMenu, 2); - TranslateMenu(hSubMenu); - pt.x = (short)LOWORD(((ENLINK*)lParam)->lParam); - pt.y = (short)HIWORD(((ENLINK*)lParam)->lParam); - ClientToScreen(((NMHDR*)lParam)->hwndFrom, &pt); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) { - case ID_NEW: - Utils_OpenUrlW(tr.lpstrText); - break; - case ID_CURR: - Utils_OpenUrlW(tr.lpstrText,false); - break; - case ID_COPY: - Utils::CopyToClipBoard(tr.lpstrText, m_hwnd); - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); - break; - } - mir_free(tr.lpstrText); - return TRUE; - } - if (((ENLINK*)lParam)->msg == WM_LBUTTONUP) { - Utils_OpenUrlW(tr.lpstrText); - SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE)); - mir_free(tr.lpstrText); - return TRUE; - } - } - else if (g_Settings.bClickableNicks) { // clicked a nick name + if (isLink) // handled by core + break; + + // clicked a nick name + if (g_Settings.bClickableNicks) { if (msg == WM_RBUTTONDOWN) { HMENU hMenu = 0; USERINFO uiNew; @@ -2543,7 +2504,8 @@ LABEL_SHOWWINDOW: } return TRUE; } - else if (msg == WM_LBUTTONUP) { + + if (msg == WM_LBUTTONUP) { CHARRANGE chr; SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); @@ -2590,9 +2552,9 @@ LABEL_SHOWWINDOW: return TRUE; } } - return TRUE; + break; } - return TRUE; + break; } break; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index cfd98c15f1..d4cbb47f6a 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -55,7 +55,7 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) return;
}
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ CTabBaseDlg *dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (!dat)
return;
@@ -436,6 +436,51 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwndDlg, ContainerWndProc, msg, wParam, lParam);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class CAboutDlg : public CDlgBase
+{
+ CCtrlButton m_btnSupport;
+
+public:
+ CAboutDlg() :
+ CDlgBase(g_hInst, IDD_ABOUT),
+ m_btnSupport(this, IDC_SUPPORT)
+ {
+ m_btnSupport.OnClick = Callback(this, &CAboutDlg::OnClick_Support);
+ }
+
+ virtual void OnInitDialog() override
+ {
+ MFileVersion v;
+ Miranda_GetFileVersion(&v);
+
+ wchar_t tStr[80];
+ mir_snwprintf(tStr, L"%s %d.%d.%d.%d [build %d]", TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]);
+ SetDlgItemText(m_hwnd, IDC_HEADERBAR, tStr);
+
+ Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_EVENT_MESSAGE);
+ }
+
+ virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override
+ {
+ switch (uMsg) {
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORSTATIC:
+ SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+ }
+ return CDlgBase::DlgProc(uMsg, wParam, lParam);
+ }
+
+ void OnClick_Support(CCtrlButton*)
+ {
+ Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM");
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
// container window procedure...
static BOOL fHaveTipper = FALSE;
@@ -612,7 +657,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->MenuBar->getClientRect();
if (pContainer->hwndStatus) {
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)dat);
RECT rcs;
@@ -664,7 +709,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowPos((HWND)tci.lParam, 0, rcClient.left, rcClient.top, (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
SWP_NOSENDCHANGING | SWP_NOACTIVATE/*|SWP_NOCOPYBITS*/);
if (!pContainer->bSizingLoop && sizeChanged) {
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
dat->DM_ScrollToBottom(0, 1);
}
}
@@ -728,10 +773,10 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, else nPanel = nm->dwItemSpec;
panel_found:
if (nPanel == 2) {
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
if (dat)
- CheckStatusIconClick(dat, nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
+ dat->CheckStatusIconClick(nm->pt, rc, 2, ((LPNMHDR)lParam)->code);
}
else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
GetCursorPos(&pt);
@@ -778,7 +823,7 @@ panel_found: GetCursorPos(&pt);
HMENU subMenu = GetSubMenu(PluginConfig.g_hMenuContext, 0);
- dat = 0;
+ dat = nullptr;
if (((LPNMHDR)lParam)->idFrom == IDC_MSGTABS) {
if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1)
break;
@@ -786,12 +831,12 @@ panel_found: tci.mask = TCIF_PARAM;
TabCtrl_GetItem(hwndTab, iItem, &tci);
if (tci.lParam && IsWindow((HWND)tci.lParam))
- dat = (CSrmmWindow*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr((HWND)tci.lParam, GWLP_USERDATA);
}
// sent from a sidebar button (RMB click) instead of the tab control
else if (((LPNMHDR)lParam)->idFrom == 5000) {
TSideBarNotify* n = reinterpret_cast<TSideBarNotify *>(lParam);
- dat = const_cast<CTabBaseDlg*>(n->dat);
+ dat = n->dat;
fFromSidebar = true;
}
@@ -862,7 +907,7 @@ panel_found: bool fProcessMainMenu = pContainer->MenuBar->isMainMenu();
pContainer->MenuBar->Cancel();
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
DWORD dwOldFlags = pContainer->dwFlags;
if (dat) {
@@ -908,8 +953,147 @@ panel_found: }
break;
- default:
- DM_ContainerCmdHandler(pContainer, LOWORD(wParam), wParam, lParam);
+ case IDC_CLOSE:
+ SendMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0);
+ break;
+
+ case IDC_MINIMIZE:
+ PostMessage(hwndDlg, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ break;
+
+ case IDC_MAXIMIZE:
+ SendMessage(hwndDlg, WM_SYSCOMMAND, IsZoomed(hwndDlg) ? SC_RESTORE : SC_MAXIMIZE, 0);
+ break;
+
+ case IDOK:
+ SendMessage(pContainer->hwndActive, WM_COMMAND, wParam, lParam); // pass the IDOK command to the active child - fixes the "enter not working
+ break;
+
+ case ID_FILE_SAVEMESSAGELOGAS:
+ SendMessage(pContainer->hwndActive, DM_SAVEMESSAGELOG, 0, 0);
+ break;
+
+ case ID_FILE_CLOSEMESSAGESESSION:
+ PostMessage(pContainer->hwndActive, WM_CLOSE, 0, 1);
+ break;
+
+ case ID_FILE_CLOSE:
+ PostMessage(hwndDlg, WM_CLOSE, 0, 1);
+ break;
+
+ case ID_VIEW_SHOWSTATUSBAR:
+ ApplyContainerSetting(pContainer, CNT_NOSTATUSBAR, pContainer->dwFlags & CNT_NOSTATUSBAR ? 0 : 1, true);
+ break;
+
+ case ID_VIEW_VERTICALMAXIMIZE:
+ ApplyContainerSetting(pContainer, CNT_VERTICALMAX, pContainer->dwFlags & CNT_VERTICALMAX ? 0 : 1, false);
+ break;
+
+ case ID_VIEW_BOTTOMTOOLBAR:
+ ApplyContainerSetting(pContainer, CNT_BOTTOMTOOLBAR, pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 0 : 1, false);
+ M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1);
+ return 0;
+
+ case ID_VIEW_SHOWTOOLBAR:
+ ApplyContainerSetting(pContainer, CNT_HIDETOOLBAR, pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1, false);
+ M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1);
+ return 0;
+
+ case ID_VIEW_SHOWMENUBAR:
+ ApplyContainerSetting(pContainer, CNT_NOMENUBAR, pContainer->dwFlags & CNT_NOMENUBAR ? 0 : 1, true);
+ break;
+
+ case ID_VIEW_SHOWTITLEBAR:
+ ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->dwFlags & CNT_NOTITLE ? 0 : 1, true);
+ break;
+
+ case ID_VIEW_TABSATBOTTOM:
+ ApplyContainerSetting(pContainer, CNT_TABSBOTTOM, pContainer->dwFlags & CNT_TABSBOTTOM ? 0 : 1, false);
+ break;
+
+ case ID_VIEW_SHOWMULTISENDCONTACTLIST:
+ SendMessage(pContainer->hwndActive, WM_COMMAND, MAKEWPARAM(IDC_SENDMENU, ID_SENDMENU_SENDTOMULTIPLEUSERS), 0);
+ break;
+
+ case ID_VIEW_STAYONTOP:
+ SendMessage(hwndDlg, WM_SYSCOMMAND, IDM_STAYONTOP, 0);
+ break;
+
+ case ID_CONTAINER_CONTAINEROPTIONS:
+ SendMessage(hwndDlg, WM_SYSCOMMAND, IDM_MOREOPTIONS, 0);
+ break;
+
+ case ID_EVENTPOPUPS_DISABLEALLEVENTPOPUPS:
+ ApplyContainerSetting(pContainer, (CNT_DONTREPORT | CNT_DONTREPORTUNFOCUSED | CNT_DONTREPORTFOCUSED | CNT_ALWAYSREPORTINACTIVE), 0, false);
+ return 0;
+
+ case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISMINIMIZED:
+ ApplyContainerSetting(pContainer, CNT_DONTREPORT, pContainer->dwFlags & CNT_DONTREPORT ? 0 : 1, false);
+ return 0;
+
+ case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISUNFOCUSED:
+ ApplyContainerSetting(pContainer, CNT_DONTREPORTUNFOCUSED, pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED ? 0 : 1, false);
+ return 0;
+
+ case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISFOCUSED:
+ ApplyContainerSetting(pContainer, CNT_DONTREPORTFOCUSED, pContainer->dwFlags & CNT_DONTREPORTFOCUSED ? 0 : 1, false);
+ return 0;
+
+ case ID_EVENTPOPUPS_SHOWPOPUPSFORALLINACTIVESESSIONS:
+ ApplyContainerSetting(pContainer, CNT_ALWAYSREPORTINACTIVE, pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE ? 0 : 1, false);
+ return 0;
+
+ case ID_WINDOWFLASHING_DISABLEFLASHING:
+ ApplyContainerSetting(pContainer, CNT_NOFLASH, 1, false);
+ ApplyContainerSetting(pContainer, CNT_FLASHALWAYS, 0, false);
+ return 0;
+
+ case ID_WINDOWFLASHING_FLASHUNTILFOCUSED:
+ ApplyContainerSetting(pContainer, CNT_NOFLASH, 0, false);
+ ApplyContainerSetting(pContainer, CNT_FLASHALWAYS, 1, false);
+ return 0;
+
+ case ID_WINDOWFLASHING_USEDEFAULTVALUES:
+ ApplyContainerSetting(pContainer, (CNT_NOFLASH | CNT_FLASHALWAYS), 0, false);
+ return 0;
+
+ case ID_OPTIONS_SAVECURRENTWINDOWPOSITIONASDEFAULT:
+ {
+ WINDOWPLACEMENT wp = { 0 };
+ wp.length = sizeof(wp);
+ if (GetWindowPlacement(hwndDlg, &wp)) {
+ db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left);
+ db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top);
+ db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left);
+ db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
+ }
+ }
+ return 0;
+
+ case ID_VIEW_INFOPANEL:
+ if (dat) {
+ RECT rc;
+ POINT pt;
+ GetWindowRect(pContainer->hwndActive, &rc);
+ pt.x = rc.left + 10;
+ pt.y = rc.top + dat->m_Panel->getHeight() - 10;
+ dat->m_Panel->invokeConfigDialog(pt);
+ }
+ return 0;
+
+ // commands from the message log popup will be routed to the
+ // message log menu handler
+ case ID_MESSAGELOGSETTINGS_FORTHISCONTACT:
+ case ID_MESSAGELOGSETTINGS_GLOBAL:
+ if (dat) {
+ dat->MsgWindowMenuHandler((int)LOWORD(wParam), MENU_LOGMENU);
+ return 1;
+ }
+ break;
+
+ case ID_HELP_ABOUTTABSRMM:
+ (new CAboutDlg())->Show();
+ break;
}
if (pContainer->dwFlags != dwOldFlags)
@@ -931,7 +1115,7 @@ panel_found: case WM_EXITSIZEMOVE:
GetClientRect(hwndTab, &rc);
if (!((rc.right - rc.left) == pContainer->oldSize.cx && (rc.bottom - rc.top) == pContainer->oldSize.cy)) {
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
dat->DM_ScrollToBottom(0, 0);
SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
}
@@ -1002,11 +1186,11 @@ panel_found: case DM_UPDATETITLE:
hContact = 0;
- dat = NULL;
+ dat = nullptr;
if (lParam) { // lParam != 0 means sent by a chat window
wchar_t szText[512];
- dat = (CSrmmWindow*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
GetWindowText((HWND)wParam, szText, _countof(szText));
szText[_countof(szText) - 1] = 0;
SetWindowText(hwndDlg, szText);
@@ -1019,7 +1203,7 @@ panel_found: SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
else
break;
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
}
else {
HWND hwnd = M.FindWindow(wParam);
@@ -1032,7 +1216,7 @@ panel_found: }
hContact = wParam;
if (hwnd && hContact)
- dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
if (dat) {
SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->m_hXStatusIcon ? dat->m_hXStatusIcon : dat->m_hTabStatusIcon));
@@ -1052,7 +1236,7 @@ panel_found: PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat && dat->m_bType == SESSIONTYPE_IM) {
if (dat->m_idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
dat->m_Panel->Invalidate(TRUE);
@@ -1090,7 +1274,7 @@ panel_found: memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS));
break;
case SC_MINIMIZE:
- dat = reinterpret_cast<CSrmmWindow *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
+ dat = (CTabBaseDlg*)(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
if (dat) {
GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
@@ -1397,7 +1581,7 @@ panel_found: SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
if (pContainer->hwndActive != 0) {
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
dat->DM_ScrollToBottom(0, 0);
}
}
@@ -1497,7 +1681,7 @@ panel_found: case DM_SETICON:
{
- dat = (CSrmmWindow*)wParam;
+ dat = (CTabBaseDlg*)wParam;
HICON hIconMsg = PluginConfig.g_IconMsgEvent;
HICON hIconBig = (dat && dat->m_cache) ? Skin_LoadProtoIcon(dat->m_cache->getProto(), dat->m_cache->getStatus(), true) : 0;
@@ -1567,9 +1751,9 @@ panel_found: {
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
if (dis->hwndItem == pContainer->hwndStatus && !(pContainer->dwFlags & CNT_NOSTATUSBAR)) {
- dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+ dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat)
- DrawStatusIcons(dat, dis->hDC, dis->rcItem, 2);
+ dat->DrawStatusIcons(dis->hDC, dis->rcItem, 2);
return TRUE;
}
}
@@ -2193,7 +2377,7 @@ void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WP if (bType == SESSIONTYPE_ANY)
SendMessage((HWND)item.lParam, message, wParam, lParam);
else {
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
+ CTabBaseDlg *dat = (CTabBaseDlg*)GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
if (dat && dat->m_bType == bType)
SendMessage((HWND)item.lParam, message, wParam, lParam);
}
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index a9433a39c9..ed30146c8f 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -839,7 +839,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (i == 2 && pContainer) {
CSrmmWindow *pDat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (pDat)
- DrawStatusIcons(pDat, hdcMem, itemRect, 2);
+ pDat->DrawStatusIcons(hdcMem, itemRect, 2);
}
else {
if (hIcon) {
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index cb7d69697a..653f580545 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -556,182 +556,6 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar } ///////////////////////////////////////////////////////////////////////////////////////// - -class CAboutDlg : public CDlgBase -{ - CCtrlButton m_btnSupport; - -public: - CAboutDlg() : - CDlgBase(g_hInst, IDD_ABOUT), - m_btnSupport(this, IDC_SUPPORT) - { - m_btnSupport.OnClick = Callback(this, &CAboutDlg::OnClick_Support); - } - - virtual void OnInitDialog() override - { - MFileVersion v; - Miranda_GetFileVersion(&v); - - wchar_t tStr[80]; - mir_snwprintf(tStr, L"%s %d.%d.%d.%d [build %d]", TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]); - SetDlgItemText(m_hwnd, IDC_HEADERBAR, tStr); - - Window_SetSkinIcon_IcoLib(m_hwnd, SKINICON_EVENT_MESSAGE); - } - - virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override - { - switch (uMsg) { - case WM_CTLCOLOREDIT: - case WM_CTLCOLORSTATIC: - SetTextColor((HDC)wParam, RGB(60, 60, 150)); - SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); - return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); - } - return CDlgBase::DlgProc(uMsg, wParam, lParam); - } - - void OnClick_Support(CCtrlButton*) - { - Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM"); - } -}; - -LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARAM wParam, LPARAM lParam) -{ - if (pContainer == NULL) - return 0; - - HWND hwndDlg = pContainer->hwnd; - CTabBaseDlg *dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); - - switch (cmd) { - case IDC_CLOSE: - SendMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0); - break; - case IDC_MINIMIZE: - PostMessage(hwndDlg, WM_SYSCOMMAND, SC_MINIMIZE, 0); - break; - case IDC_MAXIMIZE: - SendMessage(hwndDlg, WM_SYSCOMMAND, IsZoomed(hwndDlg) ? SC_RESTORE : SC_MAXIMIZE, 0); - break; - case IDOK: - SendMessage(pContainer->hwndActive, WM_COMMAND, wParam, lParam); // pass the IDOK command to the active child - fixes the "enter not working - break; - case ID_FILE_SAVEMESSAGELOGAS: - SendMessage(pContainer->hwndActive, DM_SAVEMESSAGELOG, 0, 0); - break; - case ID_FILE_CLOSEMESSAGESESSION: - PostMessage(pContainer->hwndActive, WM_CLOSE, 0, 1); - break; - case ID_FILE_CLOSE: - PostMessage(hwndDlg, WM_CLOSE, 0, 1); - break; - case ID_VIEW_SHOWSTATUSBAR: - ApplyContainerSetting(pContainer, CNT_NOSTATUSBAR, pContainer->dwFlags & CNT_NOSTATUSBAR ? 0 : 1, true); - break; - case ID_VIEW_VERTICALMAXIMIZE: - ApplyContainerSetting(pContainer, CNT_VERTICALMAX, pContainer->dwFlags & CNT_VERTICALMAX ? 0 : 1, false); - break; - case ID_VIEW_BOTTOMTOOLBAR: - ApplyContainerSetting(pContainer, CNT_BOTTOMTOOLBAR, pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 0 : 1, false); - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); - return 0; - case ID_VIEW_SHOWTOOLBAR: - ApplyContainerSetting(pContainer, CNT_HIDETOOLBAR, pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1, false); - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); - return 0; - case ID_VIEW_SHOWMENUBAR: - ApplyContainerSetting(pContainer, CNT_NOMENUBAR, pContainer->dwFlags & CNT_NOMENUBAR ? 0 : 1, true); - break; - case ID_VIEW_SHOWTITLEBAR: - ApplyContainerSetting(pContainer, CNT_NOTITLE, pContainer->dwFlags & CNT_NOTITLE ? 0 : 1, true); - break; - case ID_VIEW_TABSATBOTTOM: - ApplyContainerSetting(pContainer, CNT_TABSBOTTOM, pContainer->dwFlags & CNT_TABSBOTTOM ? 0 : 1, false); - break; - case ID_VIEW_SHOWMULTISENDCONTACTLIST: - SendMessage(pContainer->hwndActive, WM_COMMAND, MAKEWPARAM(IDC_SENDMENU, ID_SENDMENU_SENDTOMULTIPLEUSERS), 0); - break; - case ID_VIEW_STAYONTOP: - SendMessage(hwndDlg, WM_SYSCOMMAND, IDM_STAYONTOP, 0); - break; - case ID_CONTAINER_CONTAINEROPTIONS: - SendMessage(hwndDlg, WM_SYSCOMMAND, IDM_MOREOPTIONS, 0); - break; - case ID_EVENTPOPUPS_DISABLEALLEVENTPOPUPS: - ApplyContainerSetting(pContainer, (CNT_DONTREPORT | CNT_DONTREPORTUNFOCUSED | CNT_DONTREPORTFOCUSED | CNT_ALWAYSREPORTINACTIVE), 0, false); - return 0; - case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISMINIMIZED: - ApplyContainerSetting(pContainer, CNT_DONTREPORT, pContainer->dwFlags & CNT_DONTREPORT ? 0 : 1, false); - return 0; - case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISUNFOCUSED: - ApplyContainerSetting(pContainer, CNT_DONTREPORTUNFOCUSED, pContainer->dwFlags & CNT_DONTREPORTUNFOCUSED ? 0 : 1, false); - return 0; - case ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISFOCUSED: - ApplyContainerSetting(pContainer, CNT_DONTREPORTFOCUSED, pContainer->dwFlags & CNT_DONTREPORTFOCUSED ? 0 : 1, false); - return 0; - case ID_EVENTPOPUPS_SHOWPOPUPSFORALLINACTIVESESSIONS: - ApplyContainerSetting(pContainer, CNT_ALWAYSREPORTINACTIVE, pContainer->dwFlags & CNT_ALWAYSREPORTINACTIVE ? 0 : 1, false); - return 0; - case ID_WINDOWFLASHING_DISABLEFLASHING: - ApplyContainerSetting(pContainer, CNT_NOFLASH, 1, false); - ApplyContainerSetting(pContainer, CNT_FLASHALWAYS, 0, false); - return 0; - case ID_WINDOWFLASHING_FLASHUNTILFOCUSED: - ApplyContainerSetting(pContainer, CNT_NOFLASH, 0, false); - ApplyContainerSetting(pContainer, CNT_FLASHALWAYS, 1, false); - return 0; - case ID_WINDOWFLASHING_USEDEFAULTVALUES: - ApplyContainerSetting(pContainer, (CNT_NOFLASH | CNT_FLASHALWAYS), 0, false); - return 0; - case ID_OPTIONS_SAVECURRENTWINDOWPOSITIONASDEFAULT: - { - WINDOWPLACEMENT wp = { 0 }; - wp.length = sizeof(wp); - if (GetWindowPlacement(hwndDlg, &wp)) { - db_set_dw(0, SRMSGMOD_T, "splitx", wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splity", wp.rcNormalPosition.top); - db_set_dw(0, SRMSGMOD_T, "splitwidth", wp.rcNormalPosition.right - wp.rcNormalPosition.left); - db_set_dw(0, SRMSGMOD_T, "splitheight", wp.rcNormalPosition.bottom - wp.rcNormalPosition.top); - } - } - return 0; - - case ID_VIEW_INFOPANEL: - if (dat) { - RECT rc; - POINT pt; - GetWindowRect(pContainer->hwndActive, &rc); - pt.x = rc.left + 10; - pt.y = rc.top + dat->m_Panel->getHeight() - 10; - dat->m_Panel->invokeConfigDialog(pt); - } - return 0; - - // commands from the message log popup will be routed to the - // message log menu handler - case ID_MESSAGELOGSETTINGS_FORTHISCONTACT: - case ID_MESSAGELOGSETTINGS_GLOBAL: - if (dat) { - dat->MsgWindowMenuHandler((int)LOWORD(wParam), MENU_LOGMENU); - return 1; - } - break; - - case ID_HELP_ABOUTTABSRMM: - (new CAboutDlg())->Show(); - break; - - default: - return 0; // not handled - } - return 1; // handled -} - -///////////////////////////////////////////////////////////////////////////////////////// // initialize rich edit control (log and edit control) for both MUC and // standard IM session windows. @@ -1035,27 +859,6 @@ void CTabBaseDlg::DM_SaveLocale(WPARAM, LPARAM lParam) } ///////////////////////////////////////////////////////////////////////////////////////// -// generic handler for the WM_COPY message in message log/chat history richedit control(s). -// it filters out the invisible event boundary markers from the text copied to the clipboard. -// WINE Fix: overwrite clippboad data from original control data - -LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM wParam, LPARAM lParam) -{ - LRESULT result = mir_callNextSubclass(hwnd, oldWndProc, msg, wParam, lParam); - - ptrA szFromStream(Message_GetFromStream(hwnd, SF_TEXT | SFF_SELECTION)); - if (szFromStream != NULL) { - ptrW converted(mir_utf8decodeW(szFromStream)); - if (converted != NULL) { - Utils::FilterEventMarkers(converted); - Utils::CopyToClipBoard(converted, hwnd); - } - } - - return result; -} - -///////////////////////////////////////////////////////////////////////////////////////// // create embedded contact list control HWND CTabBaseDlg::DM_CreateClist() @@ -1740,7 +1543,7 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM) return 0; } -void DrawStatusIcons(CTabBaseDlg *dat, HDC hDC, const RECT &rc, int gap) +void CTabBaseDlg::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) { int x = rc.left; int y = (rc.top + rc.bottom - PluginConfig.m_smcxicon) >> 1; @@ -1748,37 +1551,37 @@ void DrawStatusIcons(CTabBaseDlg *dat, HDC hDC, const RECT &rc, int gap) SetBkMode(hDC, TRANSPARENT); int nIcon = 0; - while (StatusIconData *si = Srmm_GetNthIcon(dat->m_hContact, nIcon++)) { - if (!mir_strcmp(si->szModule, MSG_ICON_MODULE)) { - if (si->dwId == MSG_ICON_SOUND) { + while (StatusIconData *sid = Srmm_GetNthIcon(m_hContact, nIcon++)) { + if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) { + if (sid->dwId == MSG_ICON_SOUND) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_SOUNDS], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); - DrawIconEx(hDC, x, y, dat->m_pContainer->dwFlags & CNT_NOSOUND ? + DrawIconEx(hDC, x, y, m_pContainer->dwFlags & CNT_NOSOUND ? PluginConfig.g_iconOverlayDisabled : PluginConfig.g_iconOverlayEnabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); } - else if (si->dwId == MSG_ICON_UTN) { - if (dat->m_bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS) { + else if (sid->dwId == MSG_ICON_UTN) { + if (m_bType == SESSIONTYPE_IM || si->iType == GCW_PRIVMESS) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); - DrawIconEx(hDC, x, y, db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? + DrawIconEx(hDC, x, y, db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); } else CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], 50); } - else if (si->dwId == MSG_ICON_SESSION) { + else if (sid->dwId == MSG_ICON_SESSION) { DrawIconEx(hDC, x, y, PluginConfig.g_sideBarIcons[0], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); } } else { HICON hIcon; - if ((si->flags & MBF_DISABLED) && si->hIconDisabled) - hIcon = si->hIconDisabled; + if ((sid->flags & MBF_DISABLED) && sid->hIconDisabled) + hIcon = sid->hIconDisabled; else - hIcon = si->hIcon; + hIcon = sid->hIcon; - if ((si->flags & MBF_DISABLED) && si->hIconDisabled == NULL) + if ((sid->flags & MBF_DISABLED) && sid->hIconDisabled == NULL) CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hIcon, 50); else DrawIconEx(hDC, x, y, hIcon, 16, 16, 0, NULL, DI_NORMAL); @@ -1788,9 +1591,9 @@ void DrawStatusIcons(CTabBaseDlg *dat, HDC hDC, const RECT &rc, int gap) } } -void CheckStatusIconClick(CTabBaseDlg *dat, POINT pt, const RECT &rc, int gap, int code) +void CTabBaseDlg::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int code) { - if (dat && (code == NM_CLICK || code == NM_RCLICK)) { + if (code == NM_CLICK || code == NM_RCLICK) { POINT ptScreen; GetCursorPos(&ptScreen); if (!PtInRect(&rcLastStatusBarClick, ptScreen)) @@ -1798,31 +1601,29 @@ void CheckStatusIconClick(CTabBaseDlg *dat, POINT pt, const RECT &rc, int gap, i } UINT iconNum = (pt.x - (rc.left + 0)) / (PluginConfig.m_smcxicon + gap); - if (dat == NULL) - return; - StatusIconData *si = Srmm_GetNthIcon(dat->m_hContact, iconNum); - if (si == NULL) + StatusIconData *sid = Srmm_GetNthIcon(m_hContact, iconNum); + if (sid == NULL) return; - if (!mir_strcmp(si->szModule, MSG_ICON_MODULE)) { - if (si->dwId == MSG_ICON_SOUND && code != NM_RCLICK) { + if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) { + if (sid->dwId == MSG_ICON_SOUND && code != NM_RCLICK) { if (GetKeyState(VK_SHIFT) & 0x8000) { for (TContainerData *p = pFirstContainer; p; p = p->pNext) { - p->dwFlags = ((dat->m_pContainer->dwFlags & CNT_NOSOUND) ? p->dwFlags | CNT_NOSOUND : p->dwFlags & ~CNT_NOSOUND); - InvalidateRect(dat->m_pContainer->hwndStatus, NULL, TRUE); + p->dwFlags = ((m_pContainer->dwFlags & CNT_NOSOUND) ? p->dwFlags | CNT_NOSOUND : p->dwFlags & ~CNT_NOSOUND); + InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); } } else { - dat->m_pContainer->dwFlags ^= CNT_NOSOUND; - InvalidateRect(dat->m_pContainer->hwndStatus, NULL, TRUE); + m_pContainer->dwFlags ^= CNT_NOSOUND; + InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); } } - else if (si->dwId == MSG_ICON_UTN && code != NM_RCLICK && (dat->m_bType == SESSIONTYPE_IM || dat->si->iType == GCW_PRIVMESS)) { - SendMessage(dat->m_pContainer->hwndActive, WM_COMMAND, IDC_SELFTYPING, 0); - InvalidateRect(dat->m_pContainer->hwndStatus, NULL, TRUE); + else if (sid->dwId == MSG_ICON_UTN && code != NM_RCLICK && (m_bType == SESSIONTYPE_IM || si->iType == GCW_PRIVMESS)) { + SendMessage(m_pContainer->hwndActive, WM_COMMAND, IDC_SELFTYPING, 0); + InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); } - else if (si->dwId == MSG_ICON_SESSION) { + else if (sid->dwId == MSG_ICON_SESSION) { if (code == NM_CLICK) PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_LBUTTONUP); else if (code == NM_RCLICK) @@ -1832,11 +1633,11 @@ void CheckStatusIconClick(CTabBaseDlg *dat, POINT pt, const RECT &rc, int gap, i else { StatusIconClickData sicd = { sizeof(sicd) }; GetCursorPos(&sicd.clickLocation); - sicd.dwId = si->dwId; - sicd.szModule = si->szModule; + sicd.dwId = sid->dwId; + sicd.szModule = sid->szModule; sicd.flags = (code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0); - NotifyEventHooks(hHookIconPressedEvt, dat->m_hContact, (LPARAM)&sicd); - InvalidateRect(dat->m_pContainer->hwndStatus, NULL, TRUE); + NotifyEventHooks(hHookIconPressedEvt, m_hContact, (LPARAM)&sicd); + InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); } } diff --git a/plugins/TabSRMM/src/generic_msghandlers.h b/plugins/TabSRMM/src/generic_msghandlers.h deleted file mode 100644 index 373baa4e8e..0000000000 --- a/plugins/TabSRMM/src/generic_msghandlers.h +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////
-// Miranda NG: the free IM client for Microsoft* Windows*
-//
-// Copyright (ñ) 2012-17 Miranda NG project,
-// Copyright (c) 2000-09 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.
-//
-// part of tabSRMM messaging plugin for Miranda.
-//
-// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
-//
-// prototypes from generic_msghandlers.c
-
-LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-LRESULT TSAPI DM_ContainerCmdHandler(TContainerData *pContainer, UINT cmd, WPARAM wParam, LPARAM lParam);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index c7a1e185c3..21215d7ac8 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -76,9 +76,6 @@ void CGlobals::reloadSystemStartup() hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
- hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
- if (hCurHyperlinkHand == NULL)
- hCurHyperlinkHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HYPERLINKHAND));
HDC hScrnDC = GetDC(0);
m_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0;
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 1e2d89dd5e..38cc60a681 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -68,7 +68,7 @@ public: HWND g_hwndHotkeyHandler;
HICON g_iconIn, g_iconOut, g_iconErr, g_iconContainer, g_iconStatus;
HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
- HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand;
+ HCURSOR hCurSplitNS, hCurSplitWE;
HBITMAP g_hbmUnknown;
bool g_SmileyAddAvail, g_WantIEView, g_bPopupAvail, g_WantHPP;
HIMAGELIST g_hImageList;
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 7739c32e65..d899201b24 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -452,7 +452,7 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_CHAR:
if (wParam == 0x03 && isCtrl) // Ctrl+C
- return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+ return Utils::WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
if (wParam == 0x11 && isCtrl)
SendMessage(mwdat->GetHwnd(), WM_COMMAND, IDC_QUOTE, 0);
break;
@@ -481,11 +481,11 @@ static LRESULT CALLBACK MessageLogSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_KEYDOWN:
if (wParam == VK_INSERT && isCtrl)
- return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+ return Utils::WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
break;
case WM_COPY:
- return DM_WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
+ return Utils::WMCopyHandler(hwnd, MessageLogSubclassProc, msg, wParam, lParam);
case WM_NCCALCSIZE:
return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, MessageLogSubclassProc);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index a77bcde709..29597c7215 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -388,7 +388,6 @@ int SplitmsgShutdown(void) WindowList_Destroy(PluginConfig.hUserPrefsWindowList);
DestroyCursor(PluginConfig.hCurSplitNS);
- DestroyCursor(PluginConfig.hCurHyperlinkHand);
DestroyCursor(PluginConfig.hCurSplitWE);
FreeLibrary(g_hMsftedit);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index bfd474b382..26648a98ad 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -407,8 +407,10 @@ public: void AdjustBottomAvatarDisplay();
void CalcDynamicAvatarSize(BITMAP *bminfo);
+ void CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int code);
void ClearLog();
BOOL DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors) const;
+ void DrawStatusIcons(HDC hDC, const RECT &rc, int gap);
void EnableSendButton(bool bMode) const;
void FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei);
void FlashTab(bool bInvertMode);
@@ -1080,8 +1082,6 @@ int SI_InitStatusIcons(); int SI_DeinitStatusIcons();
int GetStatusIconsCount();
-void DrawStatusIcons(CTabBaseDlg *dat, HDC hdc, const RECT &r, int gap);
-void CheckStatusIconClick(CTabBaseDlg *dat, POINT pt, const RECT &rc, int gap, int code);
struct SKINDESC
{
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index 610daca35e..5a789f815c 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -70,7 +70,6 @@ #define IDC_SKINFILE 1002
#define IDC_MESSAGE 1002
#define IDC_THEMEEXPORT 1002
-#define IDC_HYPERLINKHAND 1003
#define IDC_THEMEEXPORT2 1003
#define IDC_THEMEIMPORT 1003
#define IDC_EXPORT 1005
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 5ac3ee7231..647d4ddf80 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -71,7 +71,7 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { }
};
-CSideBarButton::CSideBarButton(const CTabBaseDlg *dat, CSideBar *sideBar)
+CSideBarButton::CSideBarButton(CTabBaseDlg *dat, CSideBar *sideBar)
{
m_dat = dat;
m_id = UINT(dat->m_hContact); // set the control id
@@ -530,7 +530,7 @@ void CSideBar::populateAll() * (that is, it can only be used after WM_INITIALOG completed).
*position: -1 = append, otherwise insert it at the given position
*/
-void CSideBar::addSession(const CTabBaseDlg *dat, int position)
+void CSideBar::addSession(CTabBaseDlg *dat, int position)
{
if (!m_isActive)
return;
@@ -563,7 +563,7 @@ void CSideBar::addSession(const CTabBaseDlg *dat, int position) *
* @param dat _MessageWindowData *: session data for a client session.
*/
-HRESULT CSideBar::removeSession(const CTabBaseDlg *dat)
+HRESULT CSideBar::removeSession(CTabBaseDlg *dat)
{
if (dat) {
CSideBarButton *item = findSession(dat);
@@ -649,7 +649,7 @@ void CSideBar::scrollIntoView(const CSideBarButton *item) *
* @param dat _MessageWindowData*: Session data
*/
-void CSideBar::updateSession(const CTabBaseDlg *dat)
+void CSideBar::updateSession(CTabBaseDlg *dat)
{
if (!m_isVisible || !m_isActive)
return;
@@ -865,7 +865,7 @@ void CSideBar::resizeScrollWnd(LONG x, LONG y, LONG, LONG height) const SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
}
-void CSideBar::invalidateButton(const CTabBaseDlg *dat)
+void CSideBar::invalidateButton(CTabBaseDlg *dat)
{
if (m_isActive && m_isVisible) {
CSideBarButton *item = findSession(dat);
diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index 2ee7f35d90..7cfbfa8470 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -32,7 +32,7 @@ struct TSideBarNotify
{
NMHDR nmHdr;
- const CTabBaseDlg *dat;
+ CTabBaseDlg *dat;
};
/* layout description structure */
@@ -61,7 +61,7 @@ class CSideBarButton {
public:
CSideBarButton(const UINT id, CSideBar *sideBar);
- CSideBarButton(const CTabBaseDlg *dat, CSideBar *sideBar);
+ CSideBarButton(CTabBaseDlg *dat, CSideBar *sideBar);
~CSideBarButton();
LONG getHeight() const { return(m_sz.cy); }
@@ -71,7 +71,7 @@ public: const HWND getHwnd() const { return(m_hwnd); }
const UINT getID() const { return(m_id); }
const MCONTACT getContactHandle() const { return(m_dat->m_hContact); }
- const CTabBaseDlg* getDat() const { return(m_dat); }
+ const CTabBaseDlg* getDat() const { return(m_dat); }
const TSideBarLayout* getLayout() const { return(m_sideBarLayout); }
void RenderThis(const HDC hdc) const;
@@ -91,7 +91,7 @@ private: private:
const TSideBarLayout* m_sideBarLayout;
HWND m_hwnd; // window handle for the TSButton object
- const CTabBaseDlg* m_dat; // session data
+ CTabBaseDlg *m_dat; // session data
UINT m_id; // control id
bool m_isTopAligned;
SIZE m_sz;
@@ -130,9 +130,9 @@ public: ~CSideBar();
void Init();
- void addSession(const CTabBaseDlg *dat, int position);
- HRESULT removeSession(const CTabBaseDlg *dat);
- void updateSession(const CTabBaseDlg *dat);
+ void addSession(CTabBaseDlg *dat, int position);
+ HRESULT removeSession(CTabBaseDlg *dat);
+ void updateSession(CTabBaseDlg *dat);
void processScrollerButtons(UINT cmd);
void Layout(const RECT *rc = 0, bool fOnlyCalc = false);
@@ -149,7 +149,7 @@ public: const CSideBarButton* getScrollDown() const { return(m_down); }
bool isSkinnedContainer() const { return(CSkin::m_skinEnabled ? true : false); }
const UINT getLayoutId() const { return(m_uLayout); }
- void invalidateButton(const CTabBaseDlg *dat);
+ void invalidateButton(CTabBaseDlg *dat);
const CSideBarButton* setActiveItem(const CSideBarButton *newItem)
{
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index d37e847728..2c0a0972a3 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -118,7 +118,6 @@ typedef struct _DWM_THUMBNAIL_PROPERTIES #include "msgs.h"
#include "msgdlgutils.h"
#include "typingnotify.h"
-#include "generic_msghandlers.h"
#include "nen.h"
#include "functions.h"
#include "chat/chat.h"
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 6d6d2d2dc5..05ce83105c 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -923,6 +923,27 @@ size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner) }
/////////////////////////////////////////////////////////////////////////////////////////
+// generic handler for the WM_COPY message in message log/chat history richedit control(s).
+// it filters out the invisible event boundary markers from the text copied to the clipboard.
+// WINE Fix: overwrite clippboad data from original control data
+
+LRESULT Utils::WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT result = mir_callNextSubclass(hwnd, oldWndProc, msg, wParam, lParam);
+
+ ptrA szFromStream(Message_GetFromStream(hwnd, SF_TEXT | SFF_SELECTION));
+ if (szFromStream != NULL) {
+ ptrW converted(mir_utf8decodeW(szFromStream));
+ if (converted != NULL) {
+ Utils::FilterEventMarkers(converted);
+ Utils::CopyToClipBoard(converted, hwnd);
+ }
+ }
+
+ return result;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// file list handler
void Utils::AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR szFilename)
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index f35963f505..4af0af042a 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -88,6 +88,7 @@ public: static LPTSTR extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich);
static size_t CopyToClipBoard(const wchar_t *str, const HWND hwndOwner);
+ static LRESULT WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT uMsg, WPARAM wParam, LPARAM lParam);
static void AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR szFilename);
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index c12022c2db..15aa63e569 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3
#define __MINOR_VERSION 5
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
|