diff options
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/commonheaders.h | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 110 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 70 |
5 files changed, 127 insertions, 67 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index f4db3d6fb4..d1d2b7b050 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -31,7 +31,6 @@ // externs... extern LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern HRESULT(WINAPI *MyCloseThemeData)(HANDLE); -extern REOLECallback *mREOLECallback; int g_cLinesPerPage=0; int g_iWheelCarryover=0; @@ -1829,7 +1828,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar M.AddWindow(hwndDlg, dat->hContact); BroadCastContainer(dat->pContainer, DM_REFRESHTABINDEX, 0, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)mREOLECallback); + SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); BB_InitDlgButtons(dat); DM_InitTip(dat); diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index 46ae2bc458..ea2c3718e2 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -249,6 +249,9 @@ extern HMODULE g_hIconDLL; extern HMENU g_hMenu;
extern bool g_bShutdown;
+extern CREOleCallback reOleCallback;
+extern CREOleCallback2 reOleCallback2;
+
int LoadSendRecvMessageModule(void);
int SplitmsgShutdown(void);
void LogErrorMessage(HWND hwndDlg, TWindowData *dat, int i, TCHAR *szMsg);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 993342ae94..cd0eb278fc 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1345,7 +1345,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETUNDOLIMIT, 0, 0); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_LINK); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); + SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2); dat->bActualHistory = M.GetByte(dat->hContact, "ActualHistory", 0); @@ -3106,10 +3109,7 @@ quote_from_last: if (dat->wStatus == ID_STATUS_OFFLINE) { pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0); if (!(pcaps & PF4_OFFLINEFILES)) { - TCHAR szBuffer[256]; - - mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("Contact is offline and this protocol does not support sending files to offline users.")); - SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)szBuffer); + SendMessage(hwndDlg, DM_ACTIVATETOOLTIP, IDC_MESSAGE, (LPARAM)TranslateT("Contact is offline and this protocol does not support sending files to offline users.")); break; } } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 28b182396a..ead45174f6 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -31,7 +31,6 @@ #define IDI_CORE_LOAD 132 // icon id for the "connecting" icon -REOLECallback *mREOLECallback; NEN_OPTIONS nen_options; static HANDLE hUserPrefsWindowLis = 0; HMODULE g_hIconDLL = 0; @@ -365,7 +364,6 @@ int SplitmsgShutdown(void) ImageList_Destroy(PluginConfig.g_hImageList); delete Win7Taskbar; - delete mREOLECallback; DestroyMenu(PluginConfig.g_hMenuContext); if (PluginConfig.g_hMenuContainer) @@ -393,18 +391,6 @@ int MyAvatarChanged(WPARAM wParam, LPARAM lParam) return 0; } -STDMETHODIMP REOLECallback::GetNewStorage(LPSTORAGE FAR *lplpstg) -{ - LPLOCKBYTES lpLockBytes = NULL; - SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes); - if (sc != S_OK) - return sc; - sc = ::StgCreateDocfileOnILockBytes(lpLockBytes, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, lplpstg); - if (sc != S_OK) - lpLockBytes->Release(); - return sc; -} - ///////////////////////////////////////////////////////////////////////////////////////// // tabbed mode support functions... // (C) by Nightwish @@ -966,7 +952,6 @@ int LoadSendRecvMessageModule(void) Utils::loadSystemLibrary(L"\\Msftedit.dll"); - mREOLECallback = new REOLECallback; Win7Taskbar = new CTaskbarInteract; Win7Taskbar->updateMetrics(); @@ -991,3 +976,98 @@ int LoadSendRecvMessageModule(void) BuildCodePageList(); 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 = NULL;
+ return E_NOINTERFACE;
+}
+
+STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
+{
+ if (refCount == 0) {
+ if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg))
+ pictStg = NULL;
+ nextStgId = 0;
+ }
+ return ++refCount;
+}
+
+STDMETHODIMP_(ULONG) CREOleCallback::Release()
+{
+ if (--refCount == 0) {
+ if (pictStg)
+ pictStg->Release();
+ }
+ 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)
+{
+ TCHAR sztName[64];
+ mir_sntprintf(sztName, SIZEOF(sztName), _T("s%u"), nextStgId++);
+ if (pictStg == NULL)
+ 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_TEXT;
+ return S_OK;
+}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index d510046ba1..a4db3ef8b4 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -602,54 +602,32 @@ struct TNewWindowData * this class has to implement the GetNewStorage() method
*/
-class REOLECallback : IRichEditOleCallback
+struct CREOleCallback : public IRichEditOleCallback
{
+ CREOleCallback() : refCount(0) {}
+ 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);
+};
-public:
-
- REOLECallback()
- {
- mRefCounter = 0;
- }
-
- ~REOLECallback()
- {}
-
- STDMETHOD_(ULONG, AddRef)(void)
- {
- mRefCounter++;
- return (mRefCounter);
- }
-
- STDMETHOD_(ULONG, Release)(void)
- {
- --mRefCounter;
- //if (--mRefCounter == 0)
- // delete this;
- return (mRefCounter);
- }
-
- STDMETHOD(QueryInterface)(REFIID iid, void** ppvObject)
- {
- if ( iid == IID_IUnknown || iid == IID_IRichEditOleCallback ) {
- *ppvObject = this; AddRef(); return (S_OK);
- }
- else
- return (E_NOINTERFACE);
- }
-
- STDMETHOD(ContextSensitiveHelp) (BOOL) { return (E_NOTIMPL); }
- STDMETHOD(DeleteObject) (LPOLEOBJECT) { return (E_NOTIMPL); }
- STDMETHOD(GetClipboardData) (CHARRANGE*, DWORD, LPDATAOBJECT*) { return (E_NOTIMPL); }
- STDMETHOD(GetContextMenu) (WORD, LPOLEOBJECT, CHARRANGE*, HMENU*) { return (E_NOTIMPL); }
- STDMETHOD(GetDragDropEffect) (BOOL, DWORD, LPDWORD) { return (E_NOTIMPL); }
- STDMETHOD(GetInPlaceContext) (LPOLEINPLACEFRAME*, LPOLEINPLACEUIWINDOW*, LPOLEINPLACEFRAMEINFO) { return (E_NOTIMPL); }
- STDMETHOD(GetNewStorage) (LPSTORAGE*);
- STDMETHOD(QueryAcceptData) (LPDATAOBJECT, CLIPFORMAT*, DWORD, BOOL, HGLOBAL) { return (E_NOTIMPL); }
- STDMETHOD(QueryInsertObject) (LPCLSID, LPSTORAGE, LONG) { return (S_OK); }
- STDMETHOD(ShowContainerUI) (BOOL) { return (E_NOTIMPL); }
-private:
- UINT mRefCounter;
+struct CREOleCallback2 : public CREOleCallback
+{
+ STDMETHOD(QueryAcceptData) (LPDATAOBJECT lpdataobj, CLIPFORMAT FAR *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
};
#define MSGFONTID_MYMSG 0
|