diff options
-rw-r--r-- | include/m_gui.h | 3 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 316556 -> 316862 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 317528 -> 317840 bytes | |||
-rw-r--r-- | plugins/Scriver/src/chat_window.cpp | 1 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 3 | ||||
-rw-r--r-- | plugins/Scriver/src/msgoptions.cpp | 1 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 96 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 28 | ||||
-rw-r--r-- | plugins/Scriver/src/stdafx.h | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 95 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 28 | ||||
-rw-r--r-- | plugins/TabSRMM/src/stdafx.h | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 25 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 90 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 1 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlRichEdit.cpp | 86 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 1 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 1 |
23 files changed, 95 insertions, 380 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index e94d43f3d3..36e3e0289f 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -811,6 +811,9 @@ public: // these methods return text length in Unicode chars
int SetRichText(const wchar_t *text);
int SetRichTextRtf(const char *text);
+
+ // enables or disables content editing
+ void SetReadOnly(bool bReadOnly);
};
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex 8481522342..b7c8a48d49 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex eec22a1b26..5669d1285b 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index 40ed6a6db3..e8536333e9 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -235,7 +235,6 @@ void CChatRoomDlg::OnInitDialog() int mask = (int)m_log.SendMsg(EM_GETEVENTMASK, 0, 0);
m_log.SendMsg(EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS);
m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0);
- m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
if (db_get_b(0, CHAT_MODULE, "UseIEView", 0)) {
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 4709a0a2e6..18e8100153 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -276,15 +276,14 @@ void CSrmmWindow::OnInitDialog() Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISIMBUTTON);
SendMessage(m_hwnd, DM_CHANGEICONS, 0, 0);
- m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS);
m_log.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
+ m_message.SetReadOnly(false);
m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
- m_message.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE);
if (m_hContact && m_szProto) {
int nMax = CallProtoService(m_szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, m_hContact);
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index ab9309f5af..e5511c842a 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -680,7 +680,6 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_AUTOURLDETECT, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_SRMM_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
}
ShowPreview(hwndDlg);
return TRUE;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index de7091340f..3c56bc9a2f 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -678,99 +678,3 @@ int OnLoadModule(void) Chat_Load();
return 0;
}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-
-CREOleCallback reOleCallback;
-CREOleCallback2 reOleCallback2;
-
-STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)
-{
- if (IsEqualIID(riid, IID_IRichEditOleCallback)) {
- *ppvObj = this;
- AddRef();
- return S_OK;
- }
- *ppvObj = nullptr;
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
-{
- if (refCount == 0)
- StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
-
- return ++refCount;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::Release()
-{
- if (--refCount == 0) {
- if (pictStg) {
- pictStg->Release();
- pictStg = nullptr;
- }
- }
- return refCount;
-}
-
-STDMETHODIMP CREOleCallback::ContextSensitiveHelp(BOOL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::DeleteObject(LPOLEOBJECT)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetClipboardData(CHARRANGE*, DWORD, LPDATAOBJECT*)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CREOleCallback::GetContextMenu(WORD, LPOLEOBJECT, CHARRANGE*, HMENU*)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetDragDropEffect(BOOL, DWORD, LPDWORD)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEUIWINDOW*, LPOLEINPLACEFRAMEINFO)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg)
-{
- wchar_t sztName[64];
- mir_snwprintf(sztName, L"s%u", nextStgId++);
- if (pictStg == nullptr)
- return STG_E_MEDIUMFULL;
- return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
-}
-
-STDMETHODIMP CREOleCallback::QueryAcceptData(LPDATAOBJECT, CLIPFORMAT*, DWORD, BOOL, HGLOBAL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID, LPSTORAGE, LONG)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback2::QueryAcceptData(LPDATAOBJECT, CLIPFORMAT *lpcfFormat, DWORD, BOOL, HGLOBAL)
-{
- *lpcfFormat = CF_UNICODETEXT;
- return S_OK;
-}
-
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 3ecd32a47a..ff758a3416 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -275,34 +275,6 @@ public: #define EVENTTYPE_JABBER_CHATSTATES 2000
#define EVENTTYPE_JABBER_PRESENCE 2001
-struct CREOleCallback : public IRichEditOleCallback
-{
- CREOleCallback() : refCount(0), nextStgId(0), pictStg(nullptr) {}
- unsigned refCount;
- IStorage *pictStg;
- int nextStgId;
-
- STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR *lplpObj);
- STDMETHOD_(ULONG,AddRef)(THIS);
- STDMETHOD_(ULONG,Release)(THIS);
-
- STDMETHOD(ContextSensitiveHelp) (BOOL fEnterMode);
- STDMETHOD(GetNewStorage) (LPSTORAGE FAR *lplpstg);
- STDMETHOD(GetInPlaceContext) (LPOLEINPLACEFRAME FAR *lplpFrame, LPOLEINPLACEUIWINDOW FAR *lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo);
- STDMETHOD(ShowContainerUI) (BOOL fShow);
- STDMETHOD(QueryInsertObject) (LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp);
- STDMETHOD(DeleteObject) (LPOLEOBJECT lpoleobj);
- STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
- STDMETHOD(GetClipboardData) (CHARRANGE FAR *lpchrg, DWORD reco, LPDATAOBJECT FAR *lplpdataobj);
- STDMETHOD(GetDragDropEffect) (BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect);
- STDMETHOD(GetContextMenu) (WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE FAR *lpchrg, HMENU FAR *lphmenu);
-};
-
-struct CREOleCallback2 : public CREOleCallback
-{
- STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
-};
-
INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int DbEventIsShown(DBEVENTINFO &dbei);
int DbEventIsCustomForMsgWindow(DBEVENTINFO *dbei);
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h index 7100a13efb..d6ff0fed26 100644 --- a/plugins/Scriver/src/stdafx.h +++ b/plugins/Scriver/src/stdafx.h @@ -120,7 +120,4 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam); extern GlobalMessageData g_dat;
-extern CREOleCallback reOleCallback;
-extern CREOleCallback2 reOleCallback2;
-
#endif
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 4d45b95a44..e31874b986 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -524,11 +524,10 @@ void CChatRoomDlg::OnInitDialog() m_pPanel.getVisibility(); m_pPanel.Configure(); - m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); - m_log.SendMsg(EM_AUTOURLDETECT, 1, 0); SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_PANELSPLITTER), GWLP_WNDPROC, (LONG_PTR)SplitterSubclassProc); NotifyEvent(MSG_WINDOW_EVT_OPENING); + m_log.SendMsg(EM_AUTOURLDETECT, 1, 0); m_log.SendMsg(EM_SETEVENTMASK, 0, m_log.SendMsg(EM_GETEVENTMASK, 0, 0) | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS); m_log.SendMsg(EM_LIMITTEXT, 0x7FFFFFFF, 0); m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 512d30b786..37c09e2782 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -750,10 +750,9 @@ void CSrmmWindow::OnInitDialog() m_log.SendMsg(EM_SETUNDOLIMIT, 0, 0);
m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_LINK);
- m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE);
- m_message.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
+ m_message.SetReadOnly(false);
m_bActualHistory = M.GetByte(m_hContact, "ActualHistory", 0) != 0;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 8efe5d6fe2..ea324dd809 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -1056,98 +1056,3 @@ int LoadSendRecvMessageModule(void) LoadDefaultTemplates();
return 0;
}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-
-CREOleCallback reOleCallback;
-CREOleCallback2 reOleCallback2;
-
-STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)
-{
- if (IsEqualIID(riid, IID_IRichEditOleCallback)) {
- *ppvObj = this;
- AddRef();
- return S_OK;
- }
- *ppvObj = nullptr;
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
-{
- if (refCount == 0)
- StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
-
- return ++refCount;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::Release()
-{
- if (--refCount == 0) {
- if (pictStg) {
- pictStg->Release();
- pictStg = nullptr;
- }
- }
- return refCount;
-}
-
-STDMETHODIMP CREOleCallback::ContextSensitiveHelp(BOOL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::DeleteObject(LPOLEOBJECT)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetClipboardData(CHARRANGE*, DWORD, LPDATAOBJECT*)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CREOleCallback::GetContextMenu(WORD, LPOLEOBJECT, CHARRANGE*, HMENU*)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetDragDropEffect(BOOL, DWORD, LPDWORD)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEUIWINDOW*, LPOLEINPLACEFRAMEINFO)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg)
-{
- wchar_t sztName[64];
- mir_snwprintf(sztName, L"s%u", nextStgId++);
- if (pictStg == nullptr)
- return STG_E_MEDIUMFULL;
- return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
-}
-
-STDMETHODIMP CREOleCallback::QueryAcceptData(LPDATAOBJECT, CLIPFORMAT*, DWORD, BOOL, HGLOBAL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID, LPSTORAGE, LONG)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback2::QueryAcceptData(LPDATAOBJECT, CLIPFORMAT *lpcfFormat, DWORD, BOOL, HGLOBAL)
-{
- *lpcfFormat = CF_UNICODETEXT;
- return S_OK;
-}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index a735db1f04..b1e261bd79 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -764,34 +764,6 @@ struct TIconDescW // can be added to the richedit control.
// this class has to implement the GetNewStorage() method
-struct CREOleCallback : public IRichEditOleCallback
-{
- CREOleCallback() : refCount(0), nextStgId(0), pictStg(nullptr) {}
- unsigned refCount;
- IStorage *pictStg;
- int nextStgId;
-
- STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR *lplpObj);
- STDMETHOD_(ULONG, AddRef)(THIS);
- STDMETHOD_(ULONG, Release)(THIS);
-
- STDMETHOD(ContextSensitiveHelp) (BOOL fEnterMode);
- STDMETHOD(GetNewStorage) (LPSTORAGE FAR *lplpstg);
- STDMETHOD(GetInPlaceContext) (LPOLEINPLACEFRAME FAR *lplpFrame, LPOLEINPLACEUIWINDOW FAR *lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo);
- STDMETHOD(ShowContainerUI) (BOOL fShow);
- STDMETHOD(QueryInsertObject) (LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp);
- STDMETHOD(DeleteObject) (LPOLEOBJECT lpoleobj);
- STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
- STDMETHOD(GetClipboardData) (CHARRANGE FAR *lpchrg, DWORD reco, LPDATAOBJECT FAR *lplpdataobj);
- STDMETHOD(GetDragDropEffect) (BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect);
- STDMETHOD(GetContextMenu) (WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE FAR *lpchrg, HMENU FAR *lphmenu);
-};
-
-struct CREOleCallback2 : public CREOleCallback
-{
- STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
-};
-
#define MSGFONTID_MYMSG 0
#define MSGFONTID_MYMISC 1
#define MSGFONTID_YOURMSG 2
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index b8af3d7540..3cd811adca 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -239,12 +239,8 @@ extern bool g_bShutdown; extern pfnDoPopup oldDoPopup, oldLogToFile;
extern pfnDoTrayIcon oldDoTrayIcon;
-extern CREOleCallback reOleCallback;
-extern CREOleCallback2 reOleCallback2;
-
int LoadSendRecvMessageModule(void);
int SplitmsgShutdown(void);
-void LogErrorMessage(HWND hwndDlg, CSrmmWindow *dat, int i, wchar_t *szMsg);
int Chat_Load(), Chat_Unload();
void FreeLogFonts();
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index ce6928a20d..d405be1514 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -69,7 +69,6 @@ void CChatRoomDlg::OnInitDialog() int mask = (int)m_log.SendMsg(EM_GETEVENTMASK, 0, 0); m_log.SendMsg(EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS); m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0); - m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); m_log.SendMsg(EM_HIDESELECTION, TRUE, 0); UpdateOptions(); diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index fb92e0beb7..3f25e9ee63 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -61,29 +61,4 @@ void ReloadGlobals(); extern GlobalMessageData g_dat;
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CREOleCallback : public IRichEditOleCallback
-{
- CREOleCallback() : refCount(0), nextStgId(0), pictStg(nullptr) {}
- unsigned refCount;
- IStorage *pictStg;
- int nextStgId;
-
- STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * lplpObj);
- STDMETHOD_(ULONG, AddRef)(THIS);
- STDMETHOD_(ULONG, Release)(THIS);
-
- STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
- STDMETHOD(GetNewStorage)(LPSTORAGE FAR * lplpstg);
- STDMETHOD(GetInPlaceContext)(LPOLEINPLACEFRAME FAR * lplpFrame, LPOLEINPLACEUIWINDOW FAR * lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo);
- STDMETHOD(ShowContainerUI)(BOOL fShow);
- STDMETHOD(QueryInsertObject)(LPCLSID lpclsid, LPSTORAGE lpstg, LONG cp);
- STDMETHOD(DeleteObject)(LPOLEOBJECT lpoleobj);
- STDMETHOD(QueryAcceptData)(LPDATAOBJECT lpdataobj, CLIPFORMAT FAR * lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
- STDMETHOD(GetClipboardData)(CHARRANGE FAR *lpchrg, DWORD reco, LPDATAOBJECT FAR * lplpdataobj);
- STDMETHOD(GetDragDropEffect)(BOOL fDrag, DWORD grfKeyState, LPDWORD pdwEffect);
- STDMETHOD(GetContextMenu)(WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE FAR * lpchrg, HMENU FAR * lphmenu);
-};
-
#endif
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index f855ec9c6b..ac2b92bf73 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -162,7 +162,6 @@ void CSrmmWindow::OnInitDialog() m_avatar.Enable(false);
- m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_SCROLL);
m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index f050209d20..bd0301088b 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -546,93 +546,3 @@ void SplitmsgShutdown(void) FreeLibrary(hMsftEdit);
msgQueue_destroy();
}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////
-
-CREOleCallback reOleCallback;
-
-STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)
-{
- if (IsEqualIID(riid, IID_IRichEditOleCallback)) {
- *ppvObj = this;
- AddRef();
- return S_OK;
- }
- *ppvObj = nullptr;
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
-{
- if (refCount == 0)
- StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
-
- return ++refCount;
-}
-
-STDMETHODIMP_(ULONG) CREOleCallback::Release()
-{
- if (--refCount == 0) {
- if (pictStg) {
- pictStg->Release();
- pictStg = nullptr;
- }
- }
- return refCount;
-}
-
-STDMETHODIMP CREOleCallback::ContextSensitiveHelp(BOOL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::DeleteObject(LPOLEOBJECT)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetClipboardData(CHARRANGE*, DWORD, LPDATAOBJECT*)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CREOleCallback::GetContextMenu(WORD, LPOLEOBJECT, CHARRANGE*, HMENU*)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetDragDropEffect(BOOL, DWORD, LPDWORD)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEUIWINDOW*, LPOLEINPLACEFRAMEINFO)
-{
- return E_INVALIDARG;
-}
-
-STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg)
-{
- WCHAR szwName[64];
- char szName[64];
- mir_snprintf(szName, "s%u", nextStgId++);
- MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName));
- if (pictStg == nullptr)
- return STG_E_MEDIUMFULL;
- return pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg);
-}
-
-STDMETHODIMP CREOleCallback::QueryAcceptData(LPDATAOBJECT, CLIPFORMAT*, DWORD, BOOL, HGLOBAL)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::QueryInsertObject(LPCLSID, LPSTORAGE, LONG)
-{
- return S_OK;
-}
-
-STDMETHODIMP CREOleCallback::ShowContainerUI(BOOL)
-{
- return S_OK;
-}
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index d199fd10d3..dc0b0dbe05 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -82,7 +82,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HINSTANCE g_hInst;
extern HANDLE hHookWinPopup, hHookWinWrite;
-extern CREOleCallback reOleCallback;
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 0bf810aa5f..55f43a5362 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -582,6 +582,7 @@ void CSrmmBaseDialog::OnInitDialog() SetWindowLongPtr(m_log.GetHwnd(), GWLP_USERDATA, LPARAM(this)); mir_subclassWindow(m_log.GetHwnd(), stubLogProc); + m_log.SetReadOnly(true); SetWindowLongPtr(m_message.GetHwnd(), GWLP_USERDATA, LPARAM(this)); mir_subclassWindow(m_message.GetHwnd(), stubMessageProc); diff --git a/src/mir_core/src/CCtrlRichEdit.cpp b/src/mir_core/src/CCtrlRichEdit.cpp index cc87958e66..7c874f50f5 100644 --- a/src/mir_core/src/CCtrlRichEdit.cpp +++ b/src/mir_core/src/CCtrlRichEdit.cpp @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +#include <RichOle.h> + ///////////////////////////////////////////////////////////////////////////////////////// // CCtrlRichEdit class @@ -121,3 +123,87 @@ char* CCtrlRichEdit::GetRichTextRtf(bool bText, bool bSelection) const SendMessage(m_hwnd, EM_STREAMOUT, dwFlags, (LPARAM)&stream); return pszText; // pszText contains the text } + +/////////////////////////////////////////////////////////////////////////////////////////////////////// + +struct CREOleCallback : public IRichEditOleCallback +{ + CREOleCallback() : refCount(0), nextStgId(0), pictStg(nullptr) {} + unsigned refCount; + IStorage *pictStg; + int nextStgId; + + STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR *ppvObj) + { + if (IsEqualIID(riid, IID_IRichEditOleCallback)) { + *ppvObj = this; + AddRef(); + return S_OK; + } + *ppvObj = nullptr; + return E_NOINTERFACE; + } + + STDMETHOD_(ULONG, AddRef)(THIS) + { + if (refCount == 0) + StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg); + + return ++refCount; + } + + STDMETHOD_(ULONG, Release)(THIS) + { + if (--refCount == 0) { + if (pictStg) { + pictStg->Release(); + pictStg = nullptr; + } + } + return refCount; + } + + STDMETHOD(GetNewStorage)(LPSTORAGE *lplpstg) + { + wchar_t sztName[64]; + mir_snwprintf(sztName, L"s%u", nextStgId++); + if (pictStg == nullptr) + return STG_E_MEDIUMFULL; + return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); + } + + STDMETHOD(ContextSensitiveHelp)(BOOL) + { return S_OK; } + STDMETHOD(GetInPlaceContext)(LPOLEINPLACEFRAME*, LPOLEINPLACEUIWINDOW*, LPOLEINPLACEFRAMEINFO) + { return E_INVALIDARG; } + STDMETHOD(ShowContainerUI)(BOOL) + { return S_OK; } + STDMETHOD(QueryInsertObject)(LPCLSID, LPSTORAGE, LONG) + { return S_OK; } + STDMETHOD(DeleteObject)(LPOLEOBJECT) + { return S_OK; } + STDMETHOD(QueryAcceptData)(LPDATAOBJECT, CLIPFORMAT*, DWORD, BOOL, HGLOBAL) + { return S_OK; } + STDMETHOD(GetClipboardData)(CHARRANGE*, DWORD, LPDATAOBJECT*) + { return E_NOTIMPL; } + STDMETHOD(GetDragDropEffect)(BOOL, DWORD, LPDWORD) + { return S_OK; } + STDMETHOD(GetContextMenu)(WORD, LPOLEOBJECT, CHARRANGE*, HMENU*) + { return E_INVALIDARG; } +}; + +struct CREOleCallback2 : public CREOleCallback +{ + STDMETHOD(QueryAcceptData)(LPDATAOBJECT, CLIPFORMAT *lpcfFormat, DWORD, BOOL, HGLOBAL) + { *lpcfFormat = CF_UNICODETEXT; + return S_OK; + } +}; + +CREOleCallback reOleCallback; +CREOleCallback2 reOleCallback2; + +void CCtrlRichEdit::SetReadOnly(bool bReadOnly) +{ + SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)(bReadOnly ? &reOleCallback : &reOleCallback2)); +} diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index ee3c8ca055..cc09ff681f 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1047,3 +1047,4 @@ CallFunctionSync @1170 ?SetRichTextRtf@CCtrlRichEdit@@QAEHPBD@Z @1234 NONAME
?GetRichTextUtf@CCtrlRichEdit@@QBEPADXZ @1235 NONAME
?GetRichTextRtf@CCtrlRichEdit@@QBEPAD_N0@Z @1236 NONAME
+?SetReadOnly@CCtrlRichEdit@@QAEX_N@Z @1237 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 215d63fec8..6d4473cab5 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1047,3 +1047,4 @@ CallFunctionSync @1170 ?SetRichTextRtf@CCtrlRichEdit@@QEAAHPEBD@Z @1234 NONAME
?GetRichTextUtf@CCtrlRichEdit@@QEBAPEADXZ @1235 NONAME
?GetRichTextRtf@CCtrlRichEdit@@QEBAPEAD_N0@Z @1236 NONAME
+?SetReadOnly@CCtrlRichEdit@@QEAAX_N@Z @1237 NONAME
|