replaced script editing control with a potentially better control (using Scintilla)

This commit is contained in:
codeimp 2008-10-30 20:13:12 +00:00
parent f81bd4058f
commit b4a77cdfb5
10 changed files with 5329 additions and 353 deletions

BIN
Build/Scintilla.dll Normal file

Binary file not shown.

View file

@ -79,11 +79,10 @@
<Compile Include="Controls\ArgumentBox.Designer.cs">
<DependentUpon>ArgumentBox.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ScriptLineInfo.cs" />
<Compile Include="Controls\ScriptEditConstants.cs" />
<Compile Include="Controls\ScriptEditControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\ScriptMarking.cs" />
<Compile Include="Data\DirectoryReader.cs" />
<Compile Include="Data\FileImage.cs" />
<Compile Include="Data\FlatImage.cs" />

View file

@ -0,0 +1,414 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* 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.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Diagnostics;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
public struct NotifyHeader
{
// hwndFrom is really an environment specifc window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
//WindowID hwndFrom;
public IntPtr hwndFrom;
public uint idFrom;
public uint code;
};
public struct SCNotification
{
public NotifyHeader nmhdr;
public int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND
public int ch; // SCN_CHARADDED, SCN_KEY
public int modifiers; // SCN_KEY
public int modificationType; // SCN_MODIFIED
public IntPtr text; // SCN_MODIFIED
public int length; // SCN_MODIFIED
public int linesAdded; // SCN_MODIFIED
public int message; // SCN_MACRORECORD
public IntPtr wParam; // SCN_MACRORECORD
public IntPtr lParam; // SCN_MACRORECORD
public int line; // SCN_MODIFIED
public int foldLevelNow; // SCN_MODIFIED
public int foldLevelPrev; // SCN_MODIFIED
public int margin; // SCN_MARGINCLICK
public int listType; // SCN_USERLISTSELECTION
public int x; // SCN_DWELLSTART, SCN_DWELLEND
public int y; // SCN_DWELLSTART, SCN_DWELLEND
};
internal enum ScriptWhiteSpace
{
Invisible = 0,
VisibleAlways = 1,
VisibleAfterIndent = 2
}
internal enum ScriptEndOfLine
{
CRLF = 0,
CR = 1,
LF = 2
}
internal enum ScriptMarkerSymbol
{
Circle = 0,
Roundrect = 1,
Arrow = 2,
SmallRect = 3,
ShortArrow = 4,
Empty = 5,
ArrowDown = 6,
Minus = 7,
Plus = 8,
VLine = 9,
LCorner = 10,
TCorner = 11,
BoxPlus = 12,
BoxPlusConnected = 13,
BoxMinus = 14,
BoxMinusConnected = 15,
LCornerCurve = 16,
TCornerCurve = 17,
CirclePlus = 18,
CirclePlusConnected = 19,
CircleMinus = 20,
CircleMinusConnected = 21,
Background = 22,
DotDotDot = 23,
Arrows = 24,
Pixmap = 25,
Character = 10000
}
internal enum ScriptMarkerOutline
{
FolderEnd = 25,
FolderOpenMid = 26,
FolderMidTail = 27,
FolderTail = 28,
FolderSub = 29,
Folder = 30,
FolderOpen = 31
}
internal enum ScriptMarginType
{
Symbol = 0,
Number = 1
}
internal enum ScriptStylesCommon
{
Default = 32,
LineNumber = 33,
BraceLight = 34,
BraceBad = 35,
ControlChar = 36,
IndentGuide = 37,
LastPredefined = 39,
Max = 127
}
internal enum ScriptCharacterSet
{
Ansi = 0,
Default = 1,
Baltic = 186,
ChineseBig5 = 136,
EastEurope = 238,
GB2312 = 134,
Greek = 161,
Hangul = 129,
Mac = 77,
Oem = 255,
Russian = 204,
Shiftjis = 128,
Symbol = 2,
Turkish = 162,
Johab = 130,
Hebrew = 177,
Arabic = 178,
Vietnamese = 163,
Thai = 222
}
internal enum ScriptCaseVisible
{
Mixed = 0,
Upper = 1,
Lower = 2
}
internal enum ScriptIndicatorStyle
{
Max = 7,
Plain = 0,
Squiggle = 1,
TT = 2,
Diagonal = 3,
Strike = 4,
Hidden = 5,
Box = 6
}
internal enum ScriptPrintOption
{
Normal = 0,
InvertLight = 1,
BlackOnWhite = 2,
ColourOnWhite = 3,
ColourOnWhiteDefaultBG = 4
}
internal enum ScriptFindOption
{
WholeWord = 2,
MatchCase = 4,
WordStart = 0x00100000,
RegExp = 0x00200000,
Posix = 0x00400000
}
internal enum ScriptFoldLevel
{
Base = 0x400,
WhiteFlag = 0x1000,
HeaderFlag = 0x2000,
BoxHeaderFlag = 0x4000,
BoxFooterFlag = 0x8000,
Contracted = 0x10000,
Unindent = 0x20000,
NumberMask = 0x0FFF
}
internal enum ScriptFoldFlag
{
LineBefore_Expanded = 0x0002,
LineBefore_Contracted = 0x0004,
LineAfter_Expanded = 0x0008,
LineAfter_Contracted = 0x0010,
LevelNumbers = 0x0040,
Box = 0x0001
}
internal enum ScriptWrap
{
None = 0,
Word = 1
}
internal enum ScriptWrapVisualFlag
{
None = 0x0000,
End = 0x0001,
Start = 0x0002
}
internal enum ScriptWrapVisualLocation
{
Default = 0x0000,
EndByText = 0x0001,
StartByText = 0x0002
}
internal enum ScriptLineCache
{
None = 0,
Caret = 1,
Page = 2,
Document = 3
}
internal enum ScriptEdgeVisualStyle
{
None = 0,
Line = 1,
Background = 2
}
internal enum ScriptCursorShape
{
Normal = -1,
Wait = 4
}
internal enum ScriptCaretPolicy
{
Slop = 0x01,
Strict = 0x04,
Jumps = 0x10,
Even = 0x08
}
internal enum ScriptSelectionMode
{
Stream = 0,
Rectangle = 1,
Lines = 2
}
internal enum ScriptModificationFlags
{
InsertText = 0x1,
DeleteText = 0x2,
ChangeStyle = 0x4,
ChangeFold = 0x8,
User = 0x10,
Undo = 0x20,
Redo = 0x40,
StepInUndoRedo = 0x100,
ChangeMarker = 0x200,
BeforeInsert = 0x400,
BeforeDelete = 0x800
}
internal enum ScriptKeys
{
Down = 300,
Up = 301,
Left = 302,
Right = 303,
Home = 304,
End = 305,
Prior = 306,
Next = 307,
Delete = 308,
Insert = 309,
Escape = 7,
Back = 8,
Tab = 9,
Return = 13,
Add = 310,
Subtract = 311,
Divide = 312
}
internal enum ScriptKeyMod
{
Shift = 1,
Ctrl = 2,
Alt = 4
}
internal enum ScriptLexer
{
Container = 0,
Null = 1,
Python = 2,
Cpp = 3,
Html = 4,
Xml = 5,
Perl = 6,
Sql = 7,
Vb = 8,
Properties = 9,
Errorlist = 10,
Makefile = 11,
Batch = 12,
Xcode = 13,
Latex = 14,
Lua = 15,
Diff = 16,
Conf = 17,
Pascal = 18,
Ave = 19,
Ada = 20,
Lisp = 21,
Ruby = 22,
Eiffel = 23,
Eiffelkw = 24,
Tcl = 25,
NncronTab = 26,
Bullant = 27,
VBScript = 28,
Asp = 29,
Php = 30,
Baan = 31,
Matlab = 32,
Scriptol = 33,
Asm = 34,
CppNoCase = 35,
Fortran = 36,
F77 = 37,
Css = 38,
Pov = 39,
Lout = 40,
Escript = 41,
Ps = 42,
Nsis = 43,
Mmixal = 44,
Clw = 45,
Clwnocase = 46,
Lot = 47,
Yaml = 48,
Tex = 49,
Metapost = 50,
Powerbasic = 51,
Forth = 52,
Erlang = 53,
Octave = 54,
Mssql = 55,
Verilog = 56,
Kix = 57,
Gui4cli = 58,
Specman = 59,
Au3 = 60,
Apdl = 61,
Bash = 62,
Automatic = 1000
}
internal enum ScintillaEvents
{
StyleNeeded = 2000,
CharAdded = 2001,
SavePointReached = 2002,
SavePointLeft = 2003,
ModifyAttemptRO = 2004,
Key = 2005,
DoubleClick = 2006,
UpdateUI = 2007,
Modified = 2008,
MacroRecord = 2009,
MarginClick = 2010,
NeedShown = 2011,
Painted = 2013,
UserlistSelection = 2014,
UriDropped = 2015,
DwellStart = 2016,
DwellEnd = 2017,
Zoom = 2018,
HotspotClick = 2019,
HotspotDoubleClick = 2020,
CallTipClick = 2021
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,46 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* 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.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Diagnostics;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
internal struct ScriptLineInfo
{
// Members
public ScriptMarking mark;
// Constructor
public ScriptLineInfo(ScriptMarking marking)
{
mark = marking;
}
}
}

View file

@ -1,43 +0,0 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* 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.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Diagnostics;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
internal enum ScriptMarking
{
None,
LineComment,
BlockComment,
Function,
Constant,
Literal
}
}

View file

@ -63,6 +63,23 @@ namespace CodeImp.DoomBuilder
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MessageBeep(MessageBeepType type);
[DllImport("kernel32.dll")]
internal extern static IntPtr LoadLibrary(string filename);
[DllImport("kernel32.dll")]
internal extern static bool FreeLibrary(IntPtr moduleptr);
[DllImport("user32.dll")]
internal static extern IntPtr CreateWindowEx(uint exstyle, string classname, string windowname, uint style,
int x, int y, int width, int height, IntPtr parentptr, int menu,
IntPtr instanceptr, string param);
[DllImport("user32.dll")]
internal static extern bool DestroyWindow(IntPtr windowptr);
[DllImport("user32.dll")]
internal static extern int SetWindowPos(IntPtr windowptr, int insertafterptr, int x, int y, int cx, int cy, int flags);
#endregion
#region ================== Constants

View file

@ -33,12 +33,79 @@ namespace CodeImp.DoomBuilder.Windows
//
// scriptedit
//
this.scriptedit.Font = new System.Drawing.Font("Lucida Console", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.scriptedit.AnchorPosition = 0;
this.scriptedit.AutoCSeparator = 0;
this.scriptedit.AutoCTypeSeparator = 0;
this.scriptedit.BackColor = System.Drawing.SystemColors.Window;
this.scriptedit.CaretFore = 0;
this.scriptedit.CaretLineBack = 0;
this.scriptedit.CaretPeriod = 0;
this.scriptedit.CaretWidth = 0;
this.scriptedit.CodePage = 0;
this.scriptedit.ControlCharSymbol = 0;
this.scriptedit.CurrentPos = 0;
this.scriptedit.CursorType = 0;
this.scriptedit.DocPointer = 0;
this.scriptedit.EdgeColour = 0;
this.scriptedit.EdgeColumn = 0;
this.scriptedit.EdgeMode = 0;
this.scriptedit.EndAtLastLine = 0;
this.scriptedit.EndOfLineMode = CodeImp.DoomBuilder.Controls.ScriptEndOfLine.CRLF;
this.scriptedit.EOLMode = 0;
this.scriptedit.HighlightGuide = 0;
this.scriptedit.Indent = 0;
this.scriptedit.IsAutoCGetAutoHide = false;
this.scriptedit.IsAutoCGetCancelAtStart = false;
this.scriptedit.IsAutoCGetChooseSingle = false;
this.scriptedit.IsAutoCGetDropRestOfWord = false;
this.scriptedit.IsAutoCGetIgnoreCase = false;
this.scriptedit.IsBackSpaceUnIndents = false;
this.scriptedit.IsBufferedDraw = false;
this.scriptedit.IsCaretLineVisible = false;
this.scriptedit.IsFocus = false;
this.scriptedit.IsHScrollBar = false;
this.scriptedit.IsIndentationGuides = false;
this.scriptedit.IsMouseDownCaptures = false;
this.scriptedit.IsOvertype = false;
this.scriptedit.IsReadOnly = false;
this.scriptedit.IsTabIndents = false;
this.scriptedit.IsTwoPhaseDraw = false;
this.scriptedit.IsUndoCollection = false;
this.scriptedit.IsUsePalette = false;
this.scriptedit.IsUseTabs = false;
this.scriptedit.IsViewEOL = false;
this.scriptedit.IsVScrollBar = false;
this.scriptedit.LayoutCache = 0;
this.scriptedit.Lexer = 0;
this.scriptedit.Location = new System.Drawing.Point(12, 12);
this.scriptedit.MarginLeft = 0;
this.scriptedit.MarginRight = 0;
this.scriptedit.ModEventMask = 0;
this.scriptedit.MouseDwellTime = 0;
this.scriptedit.Name = "scriptedit";
this.scriptedit.PrintColourMode = 0;
this.scriptedit.PrintMagnification = 0;
this.scriptedit.PrintWrapMode = 0;
this.scriptedit.ScrollWidth = 0;
this.scriptedit.SearchFlags = 0;
this.scriptedit.SelectionEnd = 0;
this.scriptedit.SelectionMode = 0;
this.scriptedit.SelectionStart = 0;
this.scriptedit.Size = new System.Drawing.Size(643, 487);
this.scriptedit.Status = 0;
this.scriptedit.StyleBits = 0;
this.scriptedit.TabIndex = 0;
this.scriptedit.Text = "";
this.scriptedit.TabWidth = 0;
this.scriptedit.TargetEnd = 0;
this.scriptedit.TargetStart = 0;
this.scriptedit.ViewWhitespace = CodeImp.DoomBuilder.Controls.ScriptWhiteSpace.Invisible;
this.scriptedit.ViewWS = 0;
this.scriptedit.WrapMode = 0;
this.scriptedit.WrapStartIndent = 0;
this.scriptedit.WrapVisualFlags = 0;
this.scriptedit.WrapVisualFlagsLocation = 0;
this.scriptedit.XOffset = 0;
this.scriptedit.ZoomLevel = 0;
//
// ScriptEditTestForm
//
@ -55,5 +122,6 @@ namespace CodeImp.DoomBuilder.Windows
#endregion
private CodeImp.DoomBuilder.Controls.ScriptEditControl scriptedit;
}
}

View file

@ -36,6 +36,7 @@ namespace CodeImp.DoomBuilder.Windows
public ScriptEditTestForm()
{
InitializeComponent();
scriptedit.Initialize();
}
}
}

View file

@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="scriptedit.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>