diff options
author | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-04-26 18:44:43 +0000 |
---|---|---|
committer | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-04-26 18:44:43 +0000 |
commit | e2f90238bdb44aafdc9ecc37ffc051cbe68a14a6 (patch) | |
tree | 306882be20b9d9d897cd3f6994536da8aa4561f8 /ExternalAPI | |
parent | af4324f676d705d1ea092f885a0470dfcc27f9ee (diff) |
move api to folder
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@39 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'ExternalAPI')
-rw-r--r-- | ExternalAPI/m_MathModule.h | 166 | ||||
-rw-r--r-- | ExternalAPI/m_text.h | 370 |
2 files changed, 536 insertions, 0 deletions
diff --git a/ExternalAPI/m_MathModule.h b/ExternalAPI/m_MathModule.h new file mode 100644 index 0000000..2100b8b --- /dev/null +++ b/ExternalAPI/m_MathModule.h @@ -0,0 +1,166 @@ +#ifndef M_MATHMODULE_H_
+#define M_MATHMODULE_H_
+//---------------------------------------------------
+
+
+/*
+ **************************
+ * 2 *
+ ** * x + 2 Pi
+ ** ************* + R
+ * Sin(wt)
+ *
+
+ Math-Module
+ **************
+
+ Miranda Plugin by Stephan Kassemeyer
+
+
+ MathModule API - (c) Stephan Kassemeyer
+ 8 May, 2004
+
+*/
+
+
+typedef struct
+{
+ int top;
+ int left;
+ int right;
+ int bottom;
+} TMathWindowInfo;
+
+typedef struct
+{
+ HWND EditHandle;
+ char* Substitute;
+} TMathSubstInfo;
+
+// ---------
+
+/*
+ Miranda Service-functions defined by MathModule
+ call with the
+ int (*CallService)(const char * servicename,WPARAM,LPARAM)
+ that you get from miranda when Miranda calls the
+ Load(PLUGINLINK * link)
+ of your PlugIn-dll
+ the CallService function then is:
+ link->CallServiceSync(Servicename,wparam,lparam)
+*/
+
+// ---------
+
+#define MATH_GET_STARTDELIMITER "Math/GetStartDelimiter"
+// returns the delimiter that marks the beginning of a formula
+// wparam=0
+// lparam=0
+// result=*char Delimiter
+// !!! the result-buffer must be deleted with MTH_FREE_MATH_BUFFER
+
+#define MATH_GETENDDELIMITER "Math/GetEndDelimiter"
+// returns the delimiter that marks the end of a formula
+// wparam=0
+// lparam=0
+// result=*char Delimiter
+// !!! the result-buffer must be deleted with MTH_FREE_MATH_BUFFER
+
+#define MTH_FREE_MATH_BUFFER "Math/FreeRTFBitmapText"
+// deletes any buffer that MathModule has created.
+// wparam=0
+// lparam=(*char) buffer
+// result=0
+
+#define MATH_SETBKGCOLOR "Math/SetBackGroundColor"
+// changes the background color of the next formula to be rendered.
+// wparam=0
+// lparam=(COLORREF) color
+// result=0
+
+#define MTH_GETBITMAP "Math/GetBitmap"
+//returns Bitmap that represents the formula given in lparam (string-pointer)
+//this formula has NO Delimiters.
+//wparam=0
+//lparam=(*char)Formula
+//result=(HBITMAP) bitmap
+//!!! the bitmap must be deleted with DeleteObject(hobject)
+
+//example:
+//HBITMAP Bmp=(HBITMAP)CallService(MTH_GETBITMAP,0, (LPARAM)formula);
+
+#define MTH_GET_RTF_BITMAPTEXT "Math/GetRTFBitmapText"
+// returns rich-text stream that includes bitmaps from text given in lparam
+// text included between MATH_GET_STARTDELIMITER and MATH_GETENDDELIMITER
+// hereby is replaced with a rtf-bitmap-stream that represents the corresponding formula
+// wparam=0
+// lparam=*char text
+// result=*char rtfstream
+// !!! the result-buffer must be deleted with MTH_FREE_RTF_BITMAPTEXT
+
+#define MTH_FREE_RTF_BITMAPTEXT "Math/FreeRTFBitmapText"
+// deletes the buffer that MTH_GET_RTF_BITMAPTEXT has created.
+// wparam=0
+// lparam=(*char) buffer
+// result=0
+
+
+// **************************************************************
+// The following is still SRMM - specific.
+// I plan to modify it, so that other PlugIns can take advantage of e.g. preview-window....
+
+#define MTH_SHOW "Math/Show"
+// shows the preview-window
+// wparam=0
+// lparam=0
+// result=0
+
+#define MTH_HIDE "Math/Hide"
+// hides the preview-window
+// wparam=0
+// lparam=0
+// result=0
+
+#define MTH_RESIZE "Math/Resize"
+// sets the size of the preview-window
+// wparam=0
+// lparam=(*TMathWindowInfo)
+// result=0
+
+#define MTH_SETFORMULA "Math/SetFormula"
+// sets the text that the preview-window should parse to display formulas found inside
+// wparam=0
+// lparam=(*char) text
+// result=0
+
+#define MTH_Set_Srmm_HWND "Math/SetSrmmHWND" //übergibt fenster-Handle des aktuellen Message-Dialogs
+// If MathModule knows the handle of a SRMM-based window, following features exist:
+// - preview window resizes Math-Srmm when it is being resized.
+// - Toolbox places text in the Send-Window of the SRMM-window
+// wparam=0
+// lparam=handle
+// result=0
+
+#define MTH_GET_PREVIEW_HEIGHT "Math/getPreviewHeight"
+// returns the height of the whole preview-window (including system-menu-bar)
+// consider this when maximizing a window to that preview-window is hooked on top or bottom
+// it returns the height no matter whether preview-window is visible or not
+// wparam=0
+// lparam=0
+// result=(int) height
+
+#define MTH_GET_PREVIEW_SHOWN "Math/getPreviewShown"
+// returns 1 if preview window is visible
+// returns 0 if preview window is invisible
+// result=(int) shown
+
+#define MTH_SUBSTITUTE_DELIMITER "Math/SubstituteDelimiter"
+// replaces Substitute given lparam-structure with internal Math-Delimiter
+// wparam=0
+// lparam=(TMathSubstInfo) substInfo
+// result=0
+
+//---------------------------------------------------
+#endif
+//#ifndef M_MATHMODULE_H_
+
diff --git a/ExternalAPI/m_text.h b/ExternalAPI/m_text.h new file mode 100644 index 0000000..be1b3e4 --- /dev/null +++ b/ExternalAPI/m_text.h @@ -0,0 +1,370 @@ +#ifndef __mtext_h__
+#define __mtext_h__
+
+// NEW mtextcontrol interface:
+//
+// obtain the full mtextcontrol interface from the library. it is much faster as use of
+// miranda core CallService to access to mtextcontrol (no core traffic).
+// This interface provides full access to mtextcontrol internal functions,
+// thus enabling devs to fully utilize the mtextcontrol API.
+// All functions will be exported as miranda services for compatibility.
+//
+// the interface is populated during the Load(PLUGINLINK *link) handler, so you can assume it is ready when Miranda
+// throw the ME_SYSTEM_MODULESLOADED event and you can generate a warning in your ModulesLoaded() when
+// it depends on the mtextcontrol interface and the mtextcontrol plugin is missing.
+//
+// example:
+//
+// MTEXT_INTERFACE MText = {0};
+//
+// mir_getMTI(&MText);
+//
+// all interface function designed as old mtextcontrol helper functions.
+// therefore it is easy to convert your old plugin code to new interface.
+//
+// example:
+//
+// old code: MTextCreate (...
+// new code: MText.Create(...
+
+// Text control
+#define MTEXTCONTROLCLASS "MTextControl"
+#define MTM_SETUSER WM_USER
+#define MTM_UPDATE WM_USER+1
+
+#if defined(_WIN32) || defined(__WIN32__)
+ #define DLL_CALLCONV __stdcall
+#endif
+
+typedef struct _tagMTEXT_interface {
+ size_t cbSize;
+ DWORD version;
+ HANDLE (DLL_CALLCONV *Register) (const char *userTitle, DWORD options);
+ HANDLE (DLL_CALLCONV *Create) (HANDLE userHandle, char *text);
+ HANDLE (DLL_CALLCONV *CreateW) (HANDLE userHandle, WCHAR *text);
+ #if defined(UNICODE) || defined (_UNICODE)
+ HANDLE (DLL_CALLCONV *CreateT) (HANDLE userHandle, WCHAR *text);
+ #else
+ HANDLE (DLL_CALLCONV *CreateT) (HANDLE userHandle, char *text);
+ #endif
+ HANDLE (DLL_CALLCONV *CreateEx) (HANDLE userHandle, HANDLE hContact, void *text, DWORD flags);
+ int (DLL_CALLCONV *Measure) (HDC dc, SIZE *sz, HANDLE text);
+ int (DLL_CALLCONV *Display) (HDC dc, POINT pos, SIZE sz, HANDLE text);
+ int (DLL_CALLCONV *SetParent) (HANDLE text, HWND hwnd, RECT rect);
+ int (DLL_CALLCONV *SendMsg) (HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lParam);
+ HWND (DLL_CALLCONV *CreateProxy) (HANDLE text);
+ int (DLL_CALLCONV *Destroy) (HANDLE text);
+} MTEXT_INTERFACE;
+
+// get access to the interface
+// wParam = 0
+// lParam = (LPARAM)(MTEXT_INTERFACE*)Mtext
+// dont vorget to set cbSize before call service
+#define MS_TEXT_GETINTERFACE "MText/GetInterface"
+
+__forceinline INT_PTR mir_getMTI( MTEXT_INTERFACE* dest )
+{
+ dest->cbSize = sizeof(*dest);
+ INT_PTR result = CallService( MS_TEXT_GETINTERFACE, 0, (LPARAM)dest );
+ #if defined(UNICODE) || defined (_UNICODE)
+ dest->CreateT = dest->CreateW;
+ #else
+ dest->CreateT = dest->Create;
+ #endif
+ return result;
+}
+
+enum
+{
+ // visual text options, used in MS_TEXT_REGISTER
+ MTEXT_FANCY_SMILEYS = 0x00000010, // SmileyAdd smileys
+ MTEXT_FANCY_BBCODES = 0x00000020, // [b], [u], [i]
+ MTEXT_FANCY_MATHMOD = 0x00000040, // enable math module formula parsing
+ MTEXT_FANCY_URLS = 0x00000080, // underline urls
+ MTEXT_FANCY_BBCODES2 = 0x00000100, // [color], [img], [url], not implemented yet
+ MTEXT_FANCY_SIMPLEFMT = 0x00000200, // simple formatting ("_", "/" and "*")
+ MTEXT_FANCY_MASK = 0x00007fff,
+ MTEXT_FANCY_DEFAULT = 0x00008000, // Use default options
+
+ // text options, used in MS_TEXT_REGISTER
+ MTEXT_SYSTEM_HICONS = 0x00010000, // [$handle=i<HICON as dword>$]
+ MTEXT_SYSTEM_HBITMAPS = 0x00010000, // [$handle=b<HBITMAP as dword>$], not implemented yet
+ MTEXT_SYSTEM_ESCAPED = 0x00020000, // passed text is escaped with slashes, not implemented yet
+ MTEXT_SYSTEM_MASK = 0x7fff0000,
+ MTEXT_SYSTEM_DEFAULT = 0x80000000, // Use default option -- just nothing system is used :)
+
+ // text object flags
+ MTEXT_FLG_CHAR = 0x00000000,
+ MTEXT_FLG_WCHAR = 0x00000001,
+ MTEXT_FLG_BIDI_RTL = 0x00000002
+};
+
+#if defined(UNICODE) || defined (_UNICODE)
+ #define MTEXT_FLG_TCHAR MTEXT_FLG_WCHAR
+#else
+ #define MTEXT_FLG_TCHAR MTEXT_FLG_CHAR
+#endif
+
+// used in MS_TEXT_CREATEEX
+typedef struct tagMTEXTCREATE
+{
+ DWORD cbSize;
+ HANDLE hContact;
+ void *text; // this is 'char *' or 'WCHAR *'
+ DWORD flags;
+
+ #ifdef __cplusplus
+ tagMTEXTCREATE():
+ text(0), hContact(0), flags(0)
+ {
+ cbSize = sizeof(*this);
+ }
+ #endif
+} MTEXTCREATE, *LPMTEXTCREATE;
+
+// used in MS_TEXT_MEASURE and MS_TEXT_DISPLAY
+typedef struct tagMTEXTDISPLAY
+{
+ DWORD cbSize;
+ HDC dc;
+ POINT pos;
+ SIZE sz;
+ HANDLE text;
+
+ #ifdef __cplusplus
+ tagMTEXTDISPLAY():
+ dc(0), text(0)
+ {
+ cbSize = sizeof(*this);
+ pos.x = pos.y = 0;
+ sz.cx = sz.cy = 0;
+ }
+ #endif
+} MTEXTDISPLAY, *LPMTEXTDISPLAY;
+
+// used in MS_TEXT_SETPARENT
+typedef struct tagMTEXTSETPARENT
+{
+ HANDLE text;
+ HWND hwnd;
+ RECT rc;
+
+ #ifdef __cplusplus
+ tagMTEXTSETPARENT():
+ hwnd(0), text(0)
+ {
+ }
+ #endif
+} MTEXTSETPARENT, *LPMTEXTSETPARENT;
+
+// used in MS_TEXT_SENDMESSAGE
+typedef struct tagMTEXTMESSAGE
+{
+ HWND hwnd;
+ HANDLE text;
+ UINT msg;
+ WPARAM wParam;
+ LPARAM lParam;
+
+ #ifdef __cplusplus
+ tagMTEXTMESSAGE():
+ hwnd(0), text(0), msg(0), wParam(0), lParam(0)
+ {
+ }
+ #endif
+} MTEXTMESSAGE, *LPMTEXTMESSAGE;
+
+//---------------------------------------------------------------------------
+// deprecatet service and helper functions
+// replaced by new mtext interface !!!!!!!
+//---------------------------------------------------------------------------
+#if defined(NOHELPERS) || defined(MIRANDA_NOHELPERS)
+ #define MTEXT_NOHELPERS
+#endif
+
+// subscribe to MText services
+// wParam = (WPARAM)(DOWRD)defaultOptions
+// lParam = (LPARAM)(char *)userTitle
+// result = (LRESULT)(HANDLE)userHandle
+#define MS_TEXT_REGISTER "MText/Register"
+
+#ifndef MTEXT_NOHELPERS
+__inline HANDLE MTextRegister(const char *userTitle, DWORD options)
+{
+ return (HANDLE)CallService(MS_TEXT_REGISTER, (WPARAM)options, (LPARAM)userTitle);
+}
+#endif // MTEXT_NOHELPERS
+
+// allocate text object
+// wParam = (WPARAM)(HANDLE)userHandle
+// lParam = (LPARAM)(char *)text
+// result = (LRESULT)(HANDLE)textHandle
+#define MS_TEXT_CREATE "MText/Create"
+
+#ifndef MTEXT_NOHELPERS
+__inline HANDLE MTextCreate(HANDLE userHandle, char *text)
+{
+ return (HANDLE)CallService(MS_TEXT_CREATE, (WPARAM)userHandle, (LPARAM)text);
+}
+#endif // MTEXT_NOHELPERS
+
+// allocate text object (unicode)
+// wParam = (WPARAM)(HANDLE)userHandle
+// lParam = (LPARAM)(WCHAR *)text
+// result = (LRESULT)(HANDLE)textHandle
+#define MS_TEXT_CREATEW "MText/CreateW"
+
+#ifndef MTEXT_NOHELPERS
+__inline HANDLE MTextCreateW(HANDLE userHandle, WCHAR *text)
+{
+ return (HANDLE)CallService(MS_TEXT_CREATEW, (WPARAM)userHandle, (LPARAM)text);
+}
+#endif // MTEXT_NOHELPERS
+
+// allocate text object (advanced)
+// wParam = (WPARAM)(HANDLE)userHandle
+// lParam = (LPARAM)(LPMTEXTCREATE)createInfo
+// result = (LRESULT)(HANDLE)textHandle
+#define MS_TEXT_CREATEEX "MText/CreateEx"
+
+#ifndef MTEXT_NOHELPERS
+__inline HANDLE MTextCreateEx(HANDLE userHandle, HANDLE hContact, void *text, DWORD flags)
+{
+ #ifdef __cplusplus
+ MTEXTCREATE textCreate;
+ #else
+ MTEXTCREATE textCreate = {0};
+ textCreate.cbSize = sizeof(textCreate);
+ #endif
+ textCreate.hContact = hContact;
+ textCreate.text = text;
+ textCreate.flags = flags;
+ return (HANDLE)CallService(MS_TEXT_CREATEEX, (WPARAM)userHandle, (LPARAM)&textCreate);
+}
+#endif // MTEXT_NOHELPERS
+
+// measure text object
+// wParam = (LPARAM)(LPMTEXTDISPLAY)displayInfo
+// result = 1 (success), 0 (failure)
+// displayInfo->size.cx is interpreted as maximum width allowed.
+// wrapped text size is stored in displayInfo->size, text
+#define MS_TEXT_MEASURE "MText/Measure"
+
+#ifndef MTEXT_NOHELPERS
+__inline int MTextMeasure(HDC dc, SIZE *sz, HANDLE text)
+{
+ #ifdef __cplusplus
+ MTEXTDISPLAY displayInfo;
+ #else
+ MTEXTDISPLAY displayInfo = {0};
+ displayInfo.cbSize = sizeof(displayInfo);
+ #endif
+ displayInfo.dc = dc;
+ displayInfo.pos.x = displayInfo.pos.y = 0;
+ displayInfo.sz = *sz;
+ displayInfo.text = text;
+ int result = (int)CallService(MS_TEXT_MEASURE, (WPARAM)&displayInfo, (LPARAM)0);
+ *sz = displayInfo.sz;
+ return result;
+}
+#endif // MTEXT_NOHELPERS
+
+// display text object
+// wParam = (LPARAM)(LPMTEXTDISPLAY)displayInfo
+// result = 1 (success), 0 (failure)
+#define MS_TEXT_DISPLAY "MText/Display"
+
+#ifndef MTEXT_NOHELPERS
+__inline int MTextDisplay(HDC dc, POINT pos, SIZE sz, HANDLE text)
+{
+ #ifdef __cplusplus
+ MTEXTDISPLAY displayInfo;
+ #else
+ MTEXTDISPLAY displayInfo = {0};
+ displayInfo.cbSize = sizeof(displayInfo);
+ #endif
+ displayInfo.dc = dc;
+ displayInfo.pos = pos;
+ displayInfo.sz = sz;
+ displayInfo.text = text;
+ return (int)CallService(MS_TEXT_DISPLAY, (WPARAM)&displayInfo, (LPARAM)0);
+}
+#endif // MTEXT_NOHELPERS
+
+// set parent window for text object (this is required for mouse handling, etc)
+// wParam = (WPARAM)(LPMTEXTSETPARENT)info
+// result = message result
+#define MS_TEXT_SETPARENT "MText/SetParent"
+
+#ifndef MTEXT_NOHELPERS
+__inline int MTextSetParent(HANDLE text, HWND hwnd, RECT rect)
+{
+ MTEXTSETPARENT info;
+ info.text = text;
+ info.hwnd = hwnd;
+ info.rc = rect;
+ return (int)CallService(MS_TEXT_SETPARENT, (WPARAM)&info, (LPARAM)0);
+}
+#endif // MTEXT_NOHELPERS
+
+// send message to an object
+// wParam = (WPARAM)(LPMTEXTMESSAGE)message
+// result = message result
+#define MS_TEXT_SENDMESSAGE "MText/SendMessage"
+
+#ifndef MTEXT_NOHELPERS
+__inline int MTextSendMessage(HWND hwnd, HANDLE text, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ #ifdef __cplusplus
+ MTEXTMESSAGE message;
+ #else
+ MTEXTMESSAGE message = {0};
+ #endif
+ message.hwnd = hwnd;
+ message.text = text;
+ message.msg = msg;
+ message.wParam = wParam;
+ message.lParam = lParam;
+ return (int)CallService(MS_TEXT_SENDMESSAGE, (WPARAM)&message, (LPARAM)0);
+}
+#endif // MTEXT_NOHELPERS
+
+// create a proxy window
+// wParam = (LPARAM)(HANDLE)textHandle
+#define MS_TEXT_CREATEPROXY "MText/CreateProxy"
+
+#ifndef MTEXT_NOHELPERS
+__inline HWND MTextCreateProxy(HANDLE text)
+{
+ return (HWND)CallService(MS_TEXT_CREATEPROXY, (WPARAM)text, (LPARAM)0);
+}
+#endif // MTEXT_NOHELPERS
+
+// destroy text object
+// wParam = (LPARAM)(HANDLE)textHandle
+#define MS_TEXT_DESTROY "MText/Destroy"
+
+#ifndef MTEXT_NOHELPERS
+__inline int MTextDestroy(HANDLE text)
+{
+ return (int)CallService(MS_TEXT_DESTROY, (WPARAM)text, (LPARAM)0);
+}
+#endif // MTEXT_NOHELPERS
+
+//#define MS_TEXT_QDISPLAY "MText/QDisplay"
+//#define MS_TEXT_QDISPLAYW "MText/QDisplayW"
+
+// T-definitions for unicode
+#if defined(UNICODE) || defined (_UNICODE)
+ #define MS_TEXT_CREATET MS_TEXT_CREATEW
+ #ifndef MTEXT_NOHELPERS
+ #define MTextCreateT MTextCreateW
+ #endif
+#else
+ #define MS_TEXT_CREATET MS_TEXT_CREATE
+ #ifndef MTEXT_NOHELPERS
+ #define MTextCreateT MTextCreate
+ #endif
+#endif
+
+#endif // __mtext_h__
|