summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h15
-rw-r--r--include/m_gui.h2
-rw-r--r--libs/win32/mir_app.libbin103574 -> 105242 bytes
-rw-r--r--libs/win64/mir_app.libbin98950 -> 100732 bytes
-rw-r--r--src/mir_app/res/resource.rc3
-rw-r--r--src/mir_app/src/mir_app64.def6
-rw-r--r--src/mir_app/src/resource.h5
-rw-r--r--src/mir_app/src/srmm_base.cpp104
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp8
9 files changed, 137 insertions, 6 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index c2a29e3d00..34dd52cdb9 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_string.h>
#include <m_chat.h>
+#include <m_gui.h>
#include <m_utils.h>
#define OPTIONS_FONTCOUNT 20
@@ -412,4 +413,18 @@ extern int hLangpack;
EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pData = NULL, int = hLangpack);
+/////////////////////////////////////////////////////////////////////////////////////////
+
+class MIR_APP_EXPORT CSrmmBaseDialog : public CDlgBase
+{
+protected:
+ CSrmmBaseDialog(HINSTANCE hInst, int idDialog);
+
+protected:
+ virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
+
+protected:
+ CCtrlEdit *m_pLog, *m_pEntry;
+};
+
#endif // M_CHAT_INT_H__
diff --git a/include/m_gui.h b/include/m_gui.h
index b784ad95f1..d55ffaa3f9 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __M_GUI_H
#define __M_GUI_H
+#include <CommCtrl.h>
+
#include <m_protoint.h>
#include <m_clc.h>
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index cb3b4ca566..362c1f11a6 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index a7e9e79a95..0c94107480 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index 59797591f5..28b3100092 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -1278,8 +1278,7 @@ BEGIN
END
POPUP "LogLink"
BEGIN
- MENUITEM "Open in &new window", IDM_OPENNEW
- MENUITEM "&Open in existing window", IDM_OPENEXISTING
+ MENUITEM "&Open link", IDM_OPENLINK
MENUITEM "&Copy link", IDM_COPYLINK
END
END
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b60684fb88..fee7aec60a 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -399,3 +399,9 @@ Chat_UnescapeTags @399 NONAME
ProtoGetAvatarFormatByMimeType @400
ProtoGetAvatarMimeType @401
?set_uin@DB_AUTH_BLOB@@QEAAXK@Z @402 NONAME
+??0CSrmmBaseDialog@@IEAA@PEAUHINSTANCE__@@H@Z @403 NONAME
+??0CSrmmBaseDialog@@QEAA@AEBV0@@Z @404 NONAME
+??1CSrmmBaseDialog@@UEAA@XZ @405 NONAME
+??4CSrmmBaseDialog@@QEAAAEAV0@AEBV0@@Z @406 NONAME
+??_7CSrmmBaseDialog@@6B@ @407 NONAME
+?DlgProc@CSrmmBaseDialog@@MEAA_JI_K_J@Z @408 NONAME
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h
index 95d7111a7b..30d9aed425 100644
--- a/src/mir_app/src/resource.h
+++ b/src/mir_app/src/resource.h
@@ -589,9 +589,8 @@
#define IDM_COPYALL 40011
#define IDM_SELECTALL 40012
#define IDM_CLEAR 40013
-#define IDM_OPENNEW 40014
-#define IDM_OPENEXISTING 40015
-#define IDM_COPYLINK 40016
+#define IDM_OPENLINK 40014
+#define IDM_COPYLINK 40015
#define POPUP_HIDEMIRANDA 40017
#define ID_CANCELCHANGE 40018
#define POPUP_GROUPSHOWOFFLINE 40019
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
new file mode 100644
index 0000000000..b28549b6c0
--- /dev/null
+++ b/src/mir_app/src/srmm_base.cpp
@@ -0,0 +1,104 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-17 Miranda NG 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.
+*/
+
+#include "stdafx.h"
+
+extern HCURSOR g_hCurHyperlinkHand;
+
+CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog) :
+ CDlgBase(hInst, idDialog),
+ m_pLog(NULL),
+ m_pEntry(NULL)
+{
+}
+
+INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ CHARRANGE sel;
+
+ if (msg == WM_NOTIFY && m_pLog != nullptr) {
+ LPNMHDR hdr = (LPNMHDR)lParam;
+ if (hdr->hwndFrom == m_pLog->GetHwnd() && hdr->code == EN_LINK) {
+ ENLINK *pLink = (ENLINK*)lParam;
+ switch (pLink->msg) {
+ case WM_SETCURSOR:
+ SetCursor(g_hCurHyperlinkHand);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_LBUTTONDBLCLK:
+ m_pLog->SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin != sel.cpMax)
+ break;
+
+ CMStringW wszText(' ', pLink->chrg.cpMax - pLink->chrg.cpMin + 1);
+ {
+ TEXTRANGE tr;
+ tr.chrg = pLink->chrg;
+ tr.lpstrText = wszText.GetBuffer();
+ m_pLog->SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+ if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL)
+ wszText.Insert(0, L"mailto:");
+ }
+
+ if (pLink->msg == WM_RBUTTONDOWN) {
+ HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 6);
+ TranslateMenu(hSubMenu);
+
+ POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) };
+ ClientToScreen(((NMHDR *)lParam)->hwndFrom, &pt);
+
+ switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) {
+ case IDM_OPENLINK:
+ Utils_OpenUrlW(wszText);
+ break;
+
+ case IDM_COPYLINK:
+ if (OpenClipboard(m_hwnd)) {
+ EmptyClipboard();
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (wszText.GetLength()+1) * sizeof(wchar_t));
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), wszText);
+ GlobalUnlock(hData);
+ SetClipboardData(CF_UNICODETEXT, hData);
+ CloseClipboard();
+ }
+ break;
+ }
+
+ DestroyMenu(hMenu);
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+
+ Utils_OpenUrlW(wszText);
+ if (m_pEntry != nullptr)
+ SetFocus(m_pEntry->GetHwnd());
+ }
+ }
+ }
+
+ return CDlgBase::DlgProc(msg, wParam, lParam);
+}
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index 050bc25e43..bbd7202582 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+HCURSOR g_hCurHyperlinkHand;
+
void LoadSrmmToolbarModule();
void UnloadSrmmToolbarModule();
@@ -205,6 +207,8 @@ void KillModuleSrmmIcons(int _hLang)
int LoadSrmmModule()
{
+ g_hCurHyperlinkHand = LoadCursor(NULL, IDC_HAND);
+
LoadSrmmToolbarModule();
hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED);
@@ -216,6 +220,8 @@ void UnloadSrmmModule()
arIcons.destroy();
NotifyEventHooks(hHookIconsChanged, NULL, NULL);
DestroyHookableEvent(hHookIconsChanged);
-
+
+ DestroyCursor(g_hCurHyperlinkHand);
+
UnloadSrmmToolbarModule();
}