[Mono-list] C# script editor

Andrus Moor kobruleht2 at hot.ee
Tue Mar 11 12:23:32 EDT 2008


I'm looking for a open source C# script editor to be embedded to MONO 2 
application.

I found SyntaxBox  in 
http://www.puzzleframework.com/wikiengine/WikiPageViewer.aspx?ID=90  (last 
link).

SyntaxBox uses DllImports in 3 files (NativeMethods.cs, AutoListForm.cs, 
InfoTipform.cs) , code shown below.

What to you think which is best way to solve this:

1. Change SyntaxBox source code not to use direct WinAPI calls when running 
under MONO.
Is it possible/reasonable to try it to port this MONO ?

2. Use Scincilla or FireBall Editorcontrol.

3. Create new implementation form scratch.

Andrus.


DllImport occurances:

NativeMethods.cs:

        [DllImport("uxtheme.dll", SetLastError = true, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern IntPtr OpenThemeData(IntPtr hwnd, 
[MarshalAs(UnmanagedType.LPWStr)] string pszClassList);

        [DllImport("uxtheme.dll", CharSet = CharSet.Auto, CallingConvention 
= CallingConvention.StdCall)]
        public static extern IntPtr CloseThemeData(IntPtr hTheme);

        [DllImport("uxtheme.dll", CharSet = CharSet.Auto, CallingConvention 
= CallingConvention.StdCall)]
        public static extern bool IsThemeActive();

        [DllImport("uxtheme.dll", CharSet = CharSet.Auto, CallingConvention 
= CallingConvention.StdCall)]
        public static extern int DrawThemeBackground(IntPtr hTheme, IntPtr 
hdc, int iPartId, int iStateId, ref APIRect rect, ref APIRect clipRect);

        [DllImport("uxtheme.dll", CharSet = CharSet.Auto, CallingConvention 
= CallingConvention.StdCall)]
        public static extern int DrawThemeText(IntPtr hTheme, IntPtr hdc, 
int iPartId, int iStateId, string pszText, int iCharCount, uint dwTextFlags, 
uint dwTextFlags2, [MarshalAs(UnmanagedType.Struct)] ref APIRect rect);

        [DllImport("uxtheme.dll", CharSet = CharSet.Auto, CallingConvention 
= CallingConvention.StdCall)]
        public static extern int GetThemeColor(IntPtr hTheme, int iPartId, 
int iStateId, int iPropId, out ulong color);


  [DllImport("imm32.dll")]
  public static extern IntPtr ImmGetDefaultIMEWnd(IntPtr hWnd);

  [DllImport("user32.dll")]
  public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, 
COMPOSITIONFORM lParam);

  [DllImport("user32.dll")]
  public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, 
LogFont lParam);

        [DllImport("user32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int DrawText(IntPtr hDC, string lpString, int 
nCount, ref APIRect Rect, int wFormat);

        public const int GWL_STYLE = -16;
        public const int WS_CHILD = 0x40000000;


        [DllImport("gdi32", SetLastError = true, CharSet = CharSet.Ansi, 
CallingConvention = CallingConvention.StdCall)]
        public static extern int EnumFontFamiliesEx(IntPtr hDC, 
[MarshalAs(UnmanagedType.LPStruct)] LogFont lf, FONTENUMPROC proc, Int64 
LParam, Int64 DW);

        [DllImport("shlwapi.dll", SetLastError = true)]
        public static extern int SHAutoComplete(IntPtr hWnd, UInt32 flags);

        [DllImport("user32.dll")]
        public static extern IntPtr GetDesktopWindow();

        [DllImport("user32.DLL")]
        public static extern IntPtr GetWindowRect(IntPtr hWND, ref APIRect 
Rect);

        [DllImport("user32.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessage(IntPtr hWND, int message, int 
WParam, int LParam);

        [DllImport("user32.dll")]
        public static extern bool ReleaseCapture();

        [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int 
dwNewLong);

        [DllImport("gdi32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int SetBkColor(IntPtr hDC, int crColor);

        [DllImport("gdi32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int SetBkMode(IntPtr hDC, int Mode);

        [DllImport("user32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr ReleaseDC(IntPtr hWND, IntPtr hDC);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr DeleteDC(IntPtr hDC);


        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr GdiFlush();

        [DllImport("user32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr GetWindowDC(IntPtr hWND);

        [DllImport("user32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr GetDC(IntPtr hWND);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int 
nWidth, int nHeight);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr CreateCompatibleDC(IntPtr hDC);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr SelectObject(IntPtr hDC, IntPtr 
hObject);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr DeleteObject(IntPtr hObject);

        [DllImport("gdi32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int GetTextColor(IntPtr hDC);

        [DllImport("gdi32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int SetTextColor(IntPtr hDC, int crColor);

        [DllImport("gdi32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int GetBkColor(IntPtr hDC);


        [DllImport("gdi32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int GetBkMode(IntPtr hDC);

        [DllImport("user32", SetLastError = false, CharSet = CharSet.Auto, 
CallingConvention = CallingConvention.StdCall)]
        public static extern int DrawFocusRect(IntPtr hDC, ref APIRect 
rect);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr CreateSolidBrush(int crColor);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern int Rectangle(IntPtr hDC, int left, int top, 
int right, int bottom);

        [DllImport("gdi32.DLL", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr CreateHatchBrush(int Style, int 
crColor);

        [DllImport("user32.DLL", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int TabbedTextOut(IntPtr hDC, int x, int y, 
string lpString, int nCount, int nTabPositions, ref int lpnTabStopPositions, 
int nTabOrigin);

        [DllImport("gdi32.dll", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern IntPtr BitBlt(IntPtr hDestDC, int x, int y, int 
nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);

        [DllImport("user32.dll", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int FillRect(IntPtr hDC, ref APIRect rect, 
IntPtr hBrush);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern int GetTextFace(IntPtr hDC, int nCount, string 
lpFacename);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern int GetTextMetrics(IntPtr hDC, ref 
GDITextMetric TextMetric);

        [DllImport("gdi32.dll", CharSet = CharSet.Ansi, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr 
CreateFontIndirect([MarshalAs(UnmanagedType.LPStruct)]LogFont LogFont);

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = 
false)]
        public static extern int GetTabbedTextExtent(IntPtr hDC, string 
lpString, int nCount, int nTabPositions, ref int lpnTabStopPositions);

        [DllImport("user32.dll", SetLastError = false, CharSet = 
CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern int InvertRect(IntPtr hDC, ref APIRect rect);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr CreatePen(int nPenStyle, int nWidth, int 
crColor);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern int SetBrushOrgEx(IntPtr hDC, int x, int y, ref 
APIPoint p);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr CreatePatternBrush(IntPtr hBMP);

        [DllImport("User32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern int ShowWindow(IntPtr hWnd, short cmdShow);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr MoveToEx(IntPtr hDC, int x, int y, ref 
APIPoint lpPoint);

        [DllImport("gdi32.dll", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern IntPtr LineTo(IntPtr hDC, int x, int y);

        [DllImport("user32", CharSet = CharSet.Auto, CallingConvention = 
CallingConvention.StdCall)]
        public static extern UInt16 GetAsyncKeyState(int vKey);


AutoListForm.cs, InfoTipform.cs:

[DllImport("user32.dll", EntryPoint = "SendMessage")]
private static extern
   int SendMessage(IntPtr hWnd, int message, int _data, int _id);





More information about the Mono-list mailing list