mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
Merge branch 'texteditor'
This commit is contained in:
commit
275b841e31
10 changed files with 539 additions and 335 deletions
|
@ -179,6 +179,7 @@
|
|||
<DependentUpon>ArgumentBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\FolderSelectDialog.cs" />
|
||||
<Compile Include="Controls\Scripting\TextEditorControl.cs" />
|
||||
<Compile Include="Controls\TransparentTrackBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -176,12 +176,19 @@
|
|||
<DependentUpon>ArgumentBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\FolderSelectDialog.cs" />
|
||||
<Compile Include="Controls\Scripting\TextEditorControl.cs" />
|
||||
<Compile Include="Controls\TransparentTrackBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptDocumentTab.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptEditorPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptEditorPanel.Designer.cs">
|
||||
<DependentUpon>ScriptEditorPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptFileDocumentTab.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -870,6 +877,18 @@
|
|||
<Compile Include="Controls\PasteOptionsControl.Designer.cs">
|
||||
<DependentUpon>PasteOptionsControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptEditorControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptEditorControl.Designer.cs">
|
||||
<DependentUpon>ScriptEditorControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptEditorPreviewControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\ScriptEditorPreviewControl.Designer.cs">
|
||||
<DependentUpon>ScriptEditorPreviewControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\SectorSlopeControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -906,9 +925,6 @@
|
|||
<Compile Include="Data\ColormapImage.cs" />
|
||||
<Compile Include="Data\CvarsCollection.cs" />
|
||||
<Compile Include="Data\HiResImage.cs" />
|
||||
<Compile Include="NoScintilla.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Data\Scripting\ZScriptScriptHandler.cs" />
|
||||
<Compile Include="Data\Scripting\ScriptHandler.cs" />
|
||||
<Compile Include="Data\Scripting\AccScriptHandler.cs" />
|
||||
|
|
|
@ -21,9 +21,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
#if !NO_SCINTILLA
|
||||
using ScintillaNET;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -77,9 +75,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private readonly string[] extensions;
|
||||
private readonly bool casesensitive;
|
||||
private readonly int insertcase;
|
||||
#if !NO_SCINTILLA
|
||||
private readonly Lexer lexer;
|
||||
#endif
|
||||
private readonly string keywordhelp;
|
||||
private readonly string functionopen;
|
||||
private readonly string functionclose;
|
||||
|
@ -118,9 +114,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public string[] Extensions { get { return extensions; } }
|
||||
public bool CaseSensitive { get { return casesensitive; } }
|
||||
public int InsertCase { get { return insertcase; } }
|
||||
#if !NO_SCINTILLA
|
||||
public Lexer Lexer { get { return lexer; } }
|
||||
#endif
|
||||
public string KeywordHelp { get { return keywordhelp; } }
|
||||
public string FunctionOpen { get { return functionopen; } }
|
||||
public string FunctionClose { get { return functionclose; } }
|
||||
|
@ -161,9 +155,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.braces = new HashSet<char>(); //mxd
|
||||
|
||||
// Settings
|
||||
#if !NO_SCINTILLA
|
||||
lexer = Lexer.Null;
|
||||
#endif
|
||||
casesensitive = false;
|
||||
codepage = 65001;
|
||||
parameters = "";
|
||||
|
@ -208,9 +200,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
resultlump = cfg.ReadSetting("resultlump", "");
|
||||
casesensitive = cfg.ReadSetting("casesensitive", true);
|
||||
insertcase = cfg.ReadSetting("insertcase", 0);
|
||||
#if !NO_SCINTILLA
|
||||
lexer = (Lexer)cfg.ReadSetting("lexer", (int)Lexer.Container);
|
||||
#endif
|
||||
keywordhelp = cfg.ReadSetting("keywordhelp", "");
|
||||
functionopen = cfg.ReadSetting("functionopen", "");
|
||||
functionclose = cfg.ReadSetting("functionclose", "");
|
||||
|
|
|
@ -28,87 +28,10 @@ using CodeImp.DoomBuilder.Config;
|
|||
using CodeImp.DoomBuilder.Compilers;
|
||||
using CodeImp.DoomBuilder.ZDoom.Scripting;
|
||||
using System.Text;
|
||||
using ScintillaNET;
|
||||
|
||||
#endregion
|
||||
|
||||
#if NO_SCINTILLA
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
internal abstract class ScriptDocumentTab : TabPage
|
||||
{
|
||||
protected readonly ScriptEditorControl editor;
|
||||
protected ScriptConfiguration config;
|
||||
protected readonly ScriptEditorPanel panel;
|
||||
protected ScriptDocumentTabType tabtype;
|
||||
|
||||
public virtual bool ExplicitSave { get { return true; } }
|
||||
public virtual bool IsSaveAsRequired { get { return true; } }
|
||||
public virtual bool IsClosable { get { return true; } }
|
||||
public virtual bool IsReconfigurable { get { return true; } }
|
||||
public virtual bool IsReadOnly { get { return false; } }
|
||||
public virtual string Filename { get { return ""; } }
|
||||
public ScriptEditorPanel Panel { get { return panel; } }
|
||||
public ScriptEditorControl Editor { get; private set; }
|
||||
public string Title { get; private set; }
|
||||
public bool IsChanged { get { return false; } }
|
||||
public int SelectionStart { get; set; }
|
||||
public int SelectionEnd { get; set; }
|
||||
public bool ShowWhitespace { get; set; }
|
||||
public bool WrapLongLines { get; set; }
|
||||
public string SelectedText { get { return ""; } }
|
||||
public ScriptConfiguration Config { get { return config; } }
|
||||
|
||||
public new event EventHandler OnTextChanged;
|
||||
|
||||
protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config)
|
||||
{
|
||||
this.panel = panel;
|
||||
this.config = config;
|
||||
|
||||
editor = new ScriptEditorControl();
|
||||
this.Controls.Add(editor);
|
||||
}
|
||||
|
||||
public bool LaunchKeywordHelp() { return false; }
|
||||
public virtual void RefreshSettings() { }
|
||||
public virtual void MoveToLine(int linenumber) { }
|
||||
public virtual void ClearMarks() { }
|
||||
public virtual void MarkScriptErrors(IEnumerable<CompilerError> errors) { }
|
||||
public virtual bool VerifyErrorForScript(CompilerError e) { return false; }
|
||||
public virtual void Compile() { }
|
||||
public virtual bool Save() { return false; }
|
||||
public virtual bool SaveAs(string filename) { return false; }
|
||||
public virtual void ChangeScriptConfig(ScriptConfiguration newconfig) { }
|
||||
public void Undo() { }
|
||||
public void Redo() { }
|
||||
public void Cut() { }
|
||||
public void Copy() { }
|
||||
public void Paste() { }
|
||||
public bool FindNext(FindReplaceOptions options) { return false; }
|
||||
public bool FindNext(FindReplaceOptions options, bool useselectionstart) { return false; }
|
||||
public bool FindPrevious(FindReplaceOptions options) { return false; }
|
||||
public void ReplaceSelection(string replacement) { }
|
||||
|
||||
internal virtual ScriptDocumentSettings GetViewSettings() { return new ScriptDocumentSettings {}; }
|
||||
internal virtual void SetViewSettings(ScriptDocumentSettings settings) { }
|
||||
internal void SetDefaultViewSettings() { }
|
||||
|
||||
internal List<CompilerError> UpdateNavigator() { return new List<CompilerError>(); }
|
||||
internal ScriptType VerifyScriptType() { return ScriptType.UNKNOWN; }
|
||||
internal void InsertSnippet(string name) { }
|
||||
internal void IndentSelection(bool indent) { }
|
||||
|
||||
protected void SetTitle(string title) { }
|
||||
protected void UpdateTitle() { }
|
||||
protected void RemoveTrailingWhitespace() { }
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
using ScintillaNET;
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
internal abstract class ScriptDocumentTab : TabPage
|
||||
|
@ -607,5 +530,3 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -102,7 +102,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.infoicons = new System.Windows.Forms.ImageList(this.components);
|
||||
this.scriptsplitter = new CodeImp.DoomBuilder.Controls.CollapsibleSplitContainer();
|
||||
this.tabs = new CodeImp.DoomBuilder.Controls.VSTabControl();
|
||||
#if !MONO_WINFORMS
|
||||
this.infotabs = new Dotnetrix.Controls.TabControlEX();
|
||||
#else
|
||||
this.infotabs = new System.Windows.Forms.TabControl();
|
||||
#endif
|
||||
this.taberrors = new System.Windows.Forms.TabPage();
|
||||
this.errorlist = new System.Windows.Forms.ListView();
|
||||
this.colIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
|
@ -875,6 +879,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
//
|
||||
// infotabs
|
||||
//
|
||||
#if !MONO_WINFORMS
|
||||
this.infotabs.Alignment = System.Windows.Forms.TabAlignment.Bottom;
|
||||
this.infotabs.Appearance = Dotnetrix.Controls.TabAppearanceEX.FlatTab;
|
||||
this.infotabs.Controls.Add(this.taberrors);
|
||||
|
@ -890,6 +895,19 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.infotabs.Size = new System.Drawing.Size(928, 187);
|
||||
this.infotabs.TabIndex = 0;
|
||||
this.infotabs.UseVisualStyles = false;
|
||||
#else
|
||||
this.infotabs.Alignment = System.Windows.Forms.TabAlignment.Bottom;
|
||||
this.infotabs.Controls.Add(this.taberrors);
|
||||
this.infotabs.Controls.Add(this.tabsearchresults);
|
||||
this.infotabs.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.infotabs.ImageList = this.infoicons;
|
||||
this.infotabs.ItemSize = new System.Drawing.Size(74, 19);
|
||||
this.infotabs.Location = new System.Drawing.Point(0, 0);
|
||||
this.infotabs.Name = "infotabs";
|
||||
this.infotabs.SelectedIndex = 1;
|
||||
this.infotabs.Size = new System.Drawing.Size(928, 187);
|
||||
this.infotabs.TabIndex = 0;
|
||||
#endif
|
||||
//
|
||||
// taberrors
|
||||
//
|
||||
|
@ -981,7 +999,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
private System.Windows.Forms.ToolStrip toolbar;
|
||||
private System.Windows.Forms.OpenFileDialog openfile;
|
||||
private System.Windows.Forms.SaveFileDialog savefile;
|
||||
|
@ -1054,7 +1072,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
private System.Windows.Forms.ImageList infoicons;
|
||||
private CollapsibleSplitContainer scriptsplitter;
|
||||
private VSTabControl tabs;
|
||||
#if !MONO_WINFORMS
|
||||
private Dotnetrix.Controls.TabControlEX infotabs;
|
||||
#else
|
||||
private System.Windows.Forms.TabControl infotabs;
|
||||
#endif
|
||||
private System.Windows.Forms.TabPage taberrors;
|
||||
private System.Windows.Forms.ListView errorlist;
|
||||
private System.Windows.Forms.ColumnHeader colIndex;
|
||||
|
|
|
@ -68,9 +68,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
// Set text and view settings
|
||||
tabtype = ScriptDocumentTabType.FILE;
|
||||
#if !NO_SCINTILLA
|
||||
editor.Scintilla.Text = sourcetab.Editor.Scintilla.Text;
|
||||
#endif
|
||||
SetViewSettings(sourcetab.GetViewSettings());
|
||||
|
||||
// Set title
|
||||
|
|
|
@ -10,68 +10,6 @@ using CodeImp.DoomBuilder.Data.Scripting;
|
|||
|
||||
#endregion
|
||||
|
||||
#if NO_SCINTILLA
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
//mxd. Document tab bound to a resource entry. Script type can't be changed. Can be readonly.
|
||||
//Must be replaced with ScriptFileDocumentTab when unable to locate target resource entry to save to.
|
||||
internal sealed class ScriptResourceDocumentTab : ScriptDocumentTab
|
||||
{
|
||||
private ScriptResource source;
|
||||
private string hash;
|
||||
private string filepathname;
|
||||
|
||||
public override bool IsReconfigurable { get { return false; } }
|
||||
public override bool IsSaveAsRequired { get { return false; } }
|
||||
public override bool IsReadOnly { get { return source.IsReadOnly; } }
|
||||
public override string Filename { get { return filepathname; } }
|
||||
internal ScriptResource Resource { get { return source; } }
|
||||
|
||||
internal ScriptResourceDocumentTab(ScriptEditorPanel panel, ScriptResource resource, ScriptConfiguration config) : base(panel, config)
|
||||
{
|
||||
source = resource;
|
||||
filepathname = source.FilePathName;
|
||||
this.ToolTipText = filepathname;
|
||||
}
|
||||
|
||||
public override void Compile()
|
||||
{
|
||||
}
|
||||
|
||||
// This checks if a script error applies to this script
|
||||
public override bool VerifyErrorForScript(CompilerError e)
|
||||
{
|
||||
return (string.Compare(e.filename, source.Filename, true) == 0);
|
||||
}
|
||||
|
||||
public override bool Save()
|
||||
{
|
||||
if(source.IsReadOnly) return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal override ScriptDocumentSettings GetViewSettings()
|
||||
{
|
||||
// Store resource location
|
||||
var settings = base.GetViewSettings();
|
||||
DataReader reader = source.Resource;
|
||||
if(reader != null)
|
||||
{
|
||||
settings.ResourceLocation = reader.Location.location;
|
||||
settings.Filename = Path.Combine(reader.Location.location, filepathname); // Make unique location
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
internal void OnReloadResources()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
//mxd. Document tab bound to a resource entry. Script type can't be changed. Can be readonly.
|
||||
|
@ -227,5 +165,3 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
495
Source/Core/Controls/Scripting/TextEditorControl.cs
Normal file
495
Source/Core/Controls/Scripting/TextEditorControl.cs
Normal file
|
@ -0,0 +1,495 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#if NO_SCINTILLA
|
||||
|
||||
namespace ScintillaNET
|
||||
{
|
||||
public enum Lexer
|
||||
{
|
||||
Container = 0,
|
||||
Null = 1,
|
||||
Python = 2,
|
||||
Cpp = 3,
|
||||
Html = 4,
|
||||
Xml = 5,
|
||||
Perl = 6,
|
||||
Sql = 7,
|
||||
Vb = 8,
|
||||
Properties = 9,
|
||||
Batch = 12,
|
||||
Lua = 15,
|
||||
Pascal = 18,
|
||||
Ada = 20,
|
||||
Lisp = 21,
|
||||
Ruby = 22,
|
||||
VbScript = 28,
|
||||
Asm = 34,
|
||||
Fortran = 36,
|
||||
Css = 38,
|
||||
Verilog = 56,
|
||||
BlitzBasic = 66,
|
||||
PureBasic = 67,
|
||||
PhpScript = 69,
|
||||
Smalltalk = 72,
|
||||
FreeBasic = 75,
|
||||
R = 86,
|
||||
PowerShell = 88,
|
||||
Markdown = 98,
|
||||
Json = 120
|
||||
}
|
||||
|
||||
public enum WhitespaceMode
|
||||
{
|
||||
Invisible,
|
||||
VisibleAlways,
|
||||
VisibleAfterIndent,
|
||||
VisibleOnlyIndent
|
||||
}
|
||||
|
||||
public enum WrapMode
|
||||
{
|
||||
None,
|
||||
Word,
|
||||
Char,
|
||||
Whitespace
|
||||
}
|
||||
|
||||
public enum Command
|
||||
{
|
||||
Null
|
||||
}
|
||||
|
||||
public enum FoldAction
|
||||
{
|
||||
Contract
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FoldFlags
|
||||
{
|
||||
LineAfterContracted
|
||||
}
|
||||
|
||||
public class Line
|
||||
{
|
||||
public Line()
|
||||
{
|
||||
Text = "";
|
||||
}
|
||||
|
||||
public int Position { get; private set; }
|
||||
public int EndPosition { get; private set; }
|
||||
public string Text { get; private set; }
|
||||
public int WrapCount { get; private set; }
|
||||
public int Indentation { get; set; }
|
||||
public int FoldLevel { get; set; }
|
||||
public bool Expanded { get; set; }
|
||||
|
||||
public void FoldLine(FoldAction action) { }
|
||||
public void Goto() { }
|
||||
public void MarkerAdd(int marker) { }
|
||||
}
|
||||
|
||||
public class LineCollection // : IEnumerable<Line>
|
||||
{
|
||||
public LineCollection()
|
||||
{
|
||||
lines.Add(new Line());
|
||||
}
|
||||
|
||||
public int Count { get { return lines.Count; } }
|
||||
public Line this[int index] { get { return lines[index]; } }
|
||||
|
||||
internal List<Line> lines = new List<Line>();
|
||||
}
|
||||
|
||||
public enum StyleCase
|
||||
{
|
||||
Mixed
|
||||
}
|
||||
|
||||
public class Style
|
||||
{
|
||||
public const int Default = 0;
|
||||
public const int LineNumber = 1;
|
||||
public const int CallTip = 2;
|
||||
public const int IndentGuide = 3;
|
||||
public const int BraceLight = 4;
|
||||
public const int BraceBad = 5;
|
||||
public const int FoldDisplayText = 6;
|
||||
|
||||
public Color BackColor { get; set; }
|
||||
public Color ForeColor { get; set; }
|
||||
public string Font { get; set; }
|
||||
public int Size { get; set; }
|
||||
public bool Bold { get; set; }
|
||||
public bool Italic { get; set; }
|
||||
public bool Underline { get; set; }
|
||||
public StyleCase Case { get; set; }
|
||||
}
|
||||
|
||||
public class StyleCollection // : IEnumerable<Style>
|
||||
{
|
||||
public StyleCollection()
|
||||
{
|
||||
for (int i = 0; i < styles.Length; i++) styles[i] = new Style();
|
||||
}
|
||||
|
||||
public Style this[int index] { get { return styles[index]; } }
|
||||
|
||||
Style[] styles = new Style[256];
|
||||
}
|
||||
|
||||
public enum MarginType
|
||||
{
|
||||
Symbol,
|
||||
Number
|
||||
}
|
||||
|
||||
public enum MarginCursor
|
||||
{
|
||||
Arrow
|
||||
}
|
||||
|
||||
public class Margin
|
||||
{
|
||||
public MarginType Type { get; set; }
|
||||
public int Width { get; set; }
|
||||
public uint Mask { get; set; }
|
||||
public MarginCursor Cursor { get; set; }
|
||||
public bool Sensitive { get; set; }
|
||||
}
|
||||
|
||||
public class MarginCollection // : IEnumerable<Margin>
|
||||
{
|
||||
public MarginCollection()
|
||||
{
|
||||
for (int i = 0; i < margins.Length; i++) margins[i] = new Margin();
|
||||
}
|
||||
|
||||
public int Count { get { return margins.Length; } }
|
||||
public Margin this[int index] { get { return margins[index]; } }
|
||||
|
||||
Margin[] margins = new Margin[4];
|
||||
}
|
||||
|
||||
public enum MarkerSymbol
|
||||
{
|
||||
BoxPlus,
|
||||
BoxMinus,
|
||||
BoxPlusConnected,
|
||||
BoxMinusConnected,
|
||||
TCorner,
|
||||
LCorner,
|
||||
VLine,
|
||||
RgbaImage
|
||||
}
|
||||
|
||||
public class Marker
|
||||
{
|
||||
public const uint MaskFolders = 0xfe000000;
|
||||
public const int FolderEnd = 25;
|
||||
public const int FolderOpenMid = 26;
|
||||
public const int FolderMidTail = 27;
|
||||
public const int FolderTail = 28;
|
||||
public const int FolderSub = 29;
|
||||
public const int Folder = 30;
|
||||
public const int FolderOpen = 31;
|
||||
|
||||
public MarkerSymbol Symbol { get; set; }
|
||||
|
||||
public void SetBackColor(Color color) { }
|
||||
public void SetForeColor(Color color) { }
|
||||
public void DefineRgbaImage(Bitmap image) { }
|
||||
}
|
||||
|
||||
public class MarkerCollection // : IEnumerable<Marker>
|
||||
{
|
||||
public MarkerCollection()
|
||||
{
|
||||
for (int i = 0; i < marker.Length; i++) marker[i] = new Marker();
|
||||
}
|
||||
|
||||
public int Count { get { return marker.Length; } }
|
||||
public Marker this[int index] { get { return marker[index]; } }
|
||||
|
||||
Marker[] marker = new Marker[32];
|
||||
}
|
||||
|
||||
public enum IndicatorStyle
|
||||
{
|
||||
RoundBox
|
||||
}
|
||||
|
||||
public class Indicator
|
||||
{
|
||||
public IndicatorStyle Style { get; set; }
|
||||
public bool Under { get; set; }
|
||||
public Color ForeColor { get; set; }
|
||||
public int OutlineAlpha { get; set; }
|
||||
public int Alpha { get; set; }
|
||||
}
|
||||
|
||||
public class IndicatorCollection // : IEnumerable<Indicator>
|
||||
{
|
||||
public IndicatorCollection()
|
||||
{
|
||||
for (int i = 0; i < indicators.Length; i++) indicators[i] = new Indicator();
|
||||
}
|
||||
|
||||
public Indicator this[int index] { get { return indicators[index]; } }
|
||||
|
||||
Indicator[] indicators = new Indicator[32];
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum AutomaticFold
|
||||
{
|
||||
None = 0,
|
||||
Show = 1,
|
||||
Click = 2,
|
||||
Change = 4
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SearchFlags
|
||||
{
|
||||
None = 0,
|
||||
MatchCase = 1,
|
||||
WholeWord = 2
|
||||
}
|
||||
|
||||
public enum FontQuality
|
||||
{
|
||||
Default,
|
||||
LcdOptimized
|
||||
}
|
||||
|
||||
public enum Order
|
||||
{
|
||||
Presorted,
|
||||
PerformSort,
|
||||
Custom
|
||||
}
|
||||
|
||||
public class Scintilla : UserControl
|
||||
{
|
||||
TextBox textbox;
|
||||
|
||||
public Scintilla()
|
||||
{
|
||||
Lines = new LineCollection();
|
||||
Styles = new StyleCollection();
|
||||
Margins = new MarginCollection();
|
||||
Markers = new MarkerCollection();
|
||||
Indicators = new IndicatorCollection();
|
||||
|
||||
textbox = new TextBox();
|
||||
textbox.Location = new Point(0, 0);
|
||||
textbox.Multiline = true;
|
||||
textbox.Font = new Font(FontFamily.GenericMonospace, 10.0f);
|
||||
|
||||
Controls.Add(textbox);
|
||||
Size = textbox.PreferredSize;
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
textbox.Size = Size;
|
||||
}
|
||||
|
||||
public const int InvalidPosition = -1;
|
||||
|
||||
[DefaultValue(BorderStyle.Fixed3D)]
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates whether the control should have a border.")]
|
||||
public new BorderStyle BorderStyle { get { return textbox.BorderStyle; } set { textbox.BorderStyle = value; } }
|
||||
|
||||
[DefaultValue(1)]
|
||||
[Category("Caret")]
|
||||
[Description("The width of the caret line measured in pixels (between 0 and 3).")]
|
||||
public int CaretWidth { get; set; }
|
||||
|
||||
[DefaultValue(0)]
|
||||
[Category("Whitespace")]
|
||||
[Description("Extra whitespace added to the ascent (top) of each line.")]
|
||||
public int ExtraAscent { get; set; }
|
||||
|
||||
[DefaultValue(0)]
|
||||
[Category("Whitespace")]
|
||||
[Description("Extra whitespace added to the descent (bottom) of each line.")]
|
||||
public int ExtraDescent { get; set; }
|
||||
|
||||
[DefaultValue(FontQuality.Default)]
|
||||
[Category("Misc")]
|
||||
[Description("Specifies the anti-aliasing method to use when rendering fonts.")]
|
||||
public FontQuality FontQuality { get; set; }
|
||||
|
||||
[DefaultValue(2000)]
|
||||
[Category("Scrolling")]
|
||||
[Description("The range in pixels of the horizontal scroll bar.")]
|
||||
public int ScrollWidth { get; set; }
|
||||
|
||||
[DefaultValue(1)]
|
||||
[Category("Whitespace")]
|
||||
[Description("The size of whitespace dots.")]
|
||||
public int WhitespaceSize { get; set; }
|
||||
|
||||
[DefaultValue(false)]
|
||||
[Category("Autocompletion")]
|
||||
[Description("Whether autocompletion word matching can ignore case.")]
|
||||
public bool AutoCIgnoreCase { get; set; }
|
||||
|
||||
[DefaultValue(5)]
|
||||
[Category("Autocompletion")]
|
||||
[Description("The maximum number of rows to display in an autocompletion list.")]
|
||||
public int AutoCMaxHeight { get; set; }
|
||||
|
||||
[DefaultValue(Order.Presorted)]
|
||||
[Category("Autocompletion")]
|
||||
[Description("The order of words in an autocompletion list.")]
|
||||
public Order AutoCOrder { get; set; }
|
||||
|
||||
public override string Text { get { return textbox.Text; } set { textbox.Text = value.Replace("\r\n", "\n").Replace("\n", "\r\n"); } }
|
||||
public int TextLength { get { return textbox.TextLength; } }
|
||||
public int GetCharAt(int position) { return textbox.Text[position]; }
|
||||
public int CurrentPosition { get; set; }
|
||||
public int CurrentLine { get; private set; }
|
||||
public int IndicatorCurrent { get; set; }
|
||||
public int TargetStart { get; set; }
|
||||
public int TargetEnd { get; set; }
|
||||
public int FirstVisibleLine { get; set; }
|
||||
public int LinesOnScreen { get; private set; }
|
||||
public bool AutoCActive { get; private set; }
|
||||
public bool CallTipActive { get; private set; }
|
||||
public Lexer Lexer { get; set; }
|
||||
public int SelectionStart { get { return textbox.SelectionStart; } set { textbox.SelectionStart = value; } }
|
||||
public int SelectionEnd { get { return textbox.SelectionStart + textbox.SelectionLength; } set { textbox.SelectionLength = SelectionStart - value; } }
|
||||
public string SelectedText { get { return textbox.SelectedText; } }
|
||||
public int TabWidth { get; set; }
|
||||
public bool ReadOnly { get { return textbox.ReadOnly; } set { textbox.ReadOnly = value; } }
|
||||
public bool CanUndo { get { return textbox.CanUndo; } }
|
||||
public bool CanRedo { get { return false; } }
|
||||
public bool CanPaste { get { return true; } }
|
||||
public bool Modified { get { return textbox.Modified; } }
|
||||
public Color CaretForeColor { get; set; }
|
||||
public int CaretPeriod { get; set; }
|
||||
public bool UseTabs { get; set; }
|
||||
public WhitespaceMode ViewWhitespace { get; set; }
|
||||
public WrapMode WrapMode { get; set; }
|
||||
public AutomaticFold AutomaticFold { get; set; }
|
||||
public SearchFlags SearchFlags { get; set; }
|
||||
|
||||
public LineCollection Lines { get; private set; }
|
||||
public StyleCollection Styles { get; private set; }
|
||||
public MarginCollection Margins { get; private set; }
|
||||
public MarkerCollection Markers { get; private set; }
|
||||
public IndicatorCollection Indicators { get; private set; }
|
||||
|
||||
public int WordStartPosition(int position, bool onlyWordCharacters) { return 0; }
|
||||
public int WordEndPosition(int position, bool onlyWordCharacters) { return 0; }
|
||||
public int LineFromPosition(int position) { return 0; }
|
||||
public string GetWordFromPosition(int position) { return ""; }
|
||||
public string GetTextRange(int position, int length) { return textbox.Text.Substring(position, length); }
|
||||
public void SetEmptySelection(int pos) { textbox.DeselectAll(); }
|
||||
public void ReplaceSelection(string text) { textbox.Text = textbox.Text.Substring(0, textbox.SelectionStart) + text + textbox.Text.Substring(textbox.SelectionStart + textbox.SelectionLength); }
|
||||
public int PointXFromPosition(int pos) { return 0; }
|
||||
public int PointYFromPosition(int pos) { return 0; }
|
||||
public int CharPositionFromPointClose(int x, int y) { return 0; }
|
||||
public void ShowLines(int lineStart, int lineEnd) { }
|
||||
public void GotoPosition(int position) { }
|
||||
public void MarkerDeleteAll(int marker) { }
|
||||
public void IndicatorClearRange(int position, int length) { }
|
||||
public void IndicatorFillRange(int position, int length) { }
|
||||
public void EmptyUndoBuffer() { textbox.ClearUndo(); }
|
||||
public void Undo() { textbox.Undo(); }
|
||||
public void Redo() { }
|
||||
public void Cut() { textbox.Cut(); }
|
||||
public void Copy() { textbox.Copy(); }
|
||||
public void Paste() { textbox.Paste(); }
|
||||
public void SelectAll() { textbox.SelectAll(); }
|
||||
public void DeleteRange(int position, int length) { }
|
||||
public int SearchInTarget(string text) { return 0; }
|
||||
public void InsertText(int position, string text) { textbox.Text = textbox.Text.Substring(0, position) + text + textbox.Text.Substring(position); }
|
||||
public void SetSavePoint() { textbox.Modified = false; }
|
||||
|
||||
public void RegisterRgbaImage(int type, Bitmap image) { }
|
||||
public int TextWidth(int style, string text) { return 0; }
|
||||
|
||||
public void BraceHighlight(int position1, int position2) { }
|
||||
public int BraceMatch(int position) { return 0; }
|
||||
public void BraceBadLight(int position) { }
|
||||
|
||||
public string WordChars { get; set; }
|
||||
|
||||
public int GetStyleAt(int position) { return 0; }
|
||||
public void StyleClearAll() { }
|
||||
public void ClearDocumentStyle() { }
|
||||
public void StyleResetDefault() { }
|
||||
public void SetKeywords(int set, string keywords) { }
|
||||
public void SetProperty(string name, string value) { }
|
||||
public void SetWhitespaceBackColor(bool use, Color color) { }
|
||||
public void SetWhitespaceForeColor(bool use, Color color) { }
|
||||
public void SetSelectionBackColor(bool use, Color color) { }
|
||||
public void SetSelectionForeColor(bool use, Color color) { }
|
||||
public void SetFoldMarginColor(bool use, Color color) { }
|
||||
public void SetFoldMarginHighlightColor(bool use, Color color) { }
|
||||
public void SetFoldFlags(FoldFlags flags) { }
|
||||
|
||||
public void AutoCCancel() { }
|
||||
public void AutoCShow(int lenEntered, string list) { }
|
||||
|
||||
public void CallTipShow(int posStart, string definition) { }
|
||||
public void CallTipCancel() { }
|
||||
public void CallTipSetHlt(int hlStart, int hlEnd) { }
|
||||
|
||||
public void DirectMessage(int message, IntPtr param1, IntPtr param2) { }
|
||||
|
||||
public void AssignCmdKey(Keys keyDefinition, Command sciCommand) { }
|
||||
|
||||
[Category("Notifications")]
|
||||
[Description("Occurs when the user types a character.")]
|
||||
public event EventHandler<CharAddedEventArgs> CharAdded;
|
||||
|
||||
[Category("Notifications")]
|
||||
[Description("Occurs after autocompleted text has been inserted.")]
|
||||
public event EventHandler<AutoCSelectionEventArgs> AutoCCompleted;
|
||||
|
||||
[Category("Notifications")]
|
||||
[Description("Occurs before text is inserted. Permits changing the inserted text.")]
|
||||
public event EventHandler<InsertCheckEventArgs> InsertCheck;
|
||||
|
||||
[Category("Notifications")]
|
||||
[Description("Occurs when the control UI is updated.")]
|
||||
public event EventHandler<UpdateUIEventArgs> UpdateUI;
|
||||
}
|
||||
|
||||
public class UpdateUIEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
public class CharAddedEventArgs
|
||||
{
|
||||
public char Char { get; set; }
|
||||
}
|
||||
|
||||
public class InsertCheckEventArgs
|
||||
{
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
public class AutoCSelectionEventArgs
|
||||
{
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -13,28 +13,6 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
#endregion
|
||||
|
||||
#if NO_SCINTILLA
|
||||
|
||||
namespace CodeImp.DoomBuilder.Data.Scripting
|
||||
{
|
||||
[ScriptHandler(ScriptType.UNKNOWN)]
|
||||
internal class ScriptHandler
|
||||
{
|
||||
public virtual void Initialize(ScriptEditorControl scriptcontrol, ScriptConfiguration scriptconfig)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual List<CompilerError> UpdateFunctionBarItems(ScriptDocumentTab tab, MemoryStream stream, ComboBox target)
|
||||
{
|
||||
// Unsupported script type. Just clear the items
|
||||
target.Items.Clear();
|
||||
return new List<CompilerError>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
using ScintillaNET;
|
||||
|
||||
namespace CodeImp.DoomBuilder.Data.Scripting
|
||||
|
@ -475,5 +453,3 @@ namespace CodeImp.DoomBuilder.Data.Scripting
|
|||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,151 +0,0 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
using CodeImp.DoomBuilder.Data.Scripting;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Compilers;
|
||||
using CodeImp.DoomBuilder.Controls.Scripting;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
|
||||
#if NO_SCINTILLA
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
internal class ScriptEditorPanel : UserControl
|
||||
{
|
||||
public ScriptDocumentTab ActiveTab { get { return null; } }
|
||||
public bool ShowWhitespace { get { return false; } }
|
||||
public bool WrapLongLines { get { return false; } }
|
||||
public void Initialize(ScriptEditorForm form) { }
|
||||
public void ApplySettings() { }
|
||||
public void SaveSettings() { }
|
||||
public int FindReplace(FindReplaceOptions options) { return 0; }
|
||||
public bool FindNext(FindReplaceOptions options) { return false; }
|
||||
public bool FindNext() { return false; }
|
||||
public bool FindPrevious(FindReplaceOptions options) { return false; }
|
||||
public bool FindPrevious() { return false; }
|
||||
public bool FindNextWrapAround(FindReplaceOptions options) { return false; }
|
||||
public bool FindPreviousWrapAround(FindReplaceOptions options) { return false; }
|
||||
public bool Replace(FindReplaceOptions options) { return false; }
|
||||
public bool FindUsages(FindReplaceOptions options, ScriptType scripttype) { return false; }
|
||||
public void CloseFindReplace(bool closing) { }
|
||||
public void OpenFindAndReplace() { }
|
||||
public void GoToLine() { }
|
||||
public void RefreshSettings() { }
|
||||
public void ClearErrors() { }
|
||||
public void ShowErrors(IEnumerable<CompilerError> errors, bool combine) { }
|
||||
public void WriteOpenFilesToConfiguration() { }
|
||||
public bool AskSaveAll() { return true; }
|
||||
public bool CheckImplicitChanges() { return false; }
|
||||
public void ForceFocus() { }
|
||||
public void ImplicitSave() { }
|
||||
public ScriptFileDocumentTab OpenFile(string filename, ScriptType scripttype) { return null; }
|
||||
public void ExplicitSaveCurrentTab() { }
|
||||
public void OpenBrowseScript() { }
|
||||
public bool LaunchKeywordHelp() { return false; }
|
||||
public void OnClose() { }
|
||||
|
||||
internal ScriptIconsManager Icons { get; private set; }
|
||||
internal ScriptResourceDocumentTab OpenResource(ScriptResource resource) { return null; }
|
||||
//internal ScriptResourcesControl ScriptResourcesControl { get; private set; }
|
||||
|
||||
public void DisplayStatus(ScriptStatusType type, string message) { }
|
||||
public void ShowError(TextResourceErrorItem error) { }
|
||||
|
||||
public void OnReloadResources() { }
|
||||
}
|
||||
|
||||
internal class ScriptEditorControl : UserControl
|
||||
{
|
||||
private static Encoding encoding = Encoding.GetEncoding(1251); //mxd. ASCII with cyrillic support...
|
||||
internal static Encoding Encoding { get { return encoding; } }
|
||||
|
||||
public delegate void ExplicitSaveTabDelegate();
|
||||
public delegate void OpenScriptBrowserDelegate();
|
||||
public delegate void OpenFindReplaceDelegate();
|
||||
public delegate bool FindNextDelegate();
|
||||
public delegate bool FindPreviousDelegate();
|
||||
public delegate bool FindNextWrapAroundDelegate(FindReplaceOptions options);
|
||||
public delegate bool FindPreviousWrapAroundDelegate(FindReplaceOptions options);
|
||||
public delegate void GoToLineDelegate();
|
||||
public delegate void CompileScriptDelegate();
|
||||
|
||||
public event ExplicitSaveTabDelegate OnExplicitSaveTab;
|
||||
public event OpenScriptBrowserDelegate OnOpenScriptBrowser;
|
||||
public event OpenFindReplaceDelegate OnOpenFindAndReplace;
|
||||
public event FindNextDelegate OnFindNext;
|
||||
public event FindPreviousDelegate OnFindPrevious;
|
||||
public event FindNextWrapAroundDelegate OnFindNextWrapAround;
|
||||
public event FindPreviousWrapAroundDelegate OnFindPreviousWrapAround;
|
||||
public new event EventHandler OnTextChanged;
|
||||
public event EventHandler OnFunctionBarDropDown;
|
||||
public event GoToLineDelegate OnGoToLine;
|
||||
public event CompileScriptDelegate OnCompileScript;
|
||||
|
||||
public bool IsChanged { get { return false; } }
|
||||
public int SelectionStart { get; set; }
|
||||
public int SelectionEnd { get; set; }
|
||||
public new string Text { get; set; }
|
||||
public string SelectedText { get; set; }
|
||||
public bool ShowWhitespace { get; set; }
|
||||
public bool WrapLongLines { get; set; }
|
||||
|
||||
public bool LaunchKeywordHelp() { return false; }
|
||||
public void ReplaceSelection(string replacement) { }
|
||||
public void MoveToLine(int linenumber) { }
|
||||
public void EnsureLineVisible(int linenumber) { }
|
||||
public int LineFromPosition(int position) { return 0; }
|
||||
public void ClearMarks() { }
|
||||
public void AddMark(int linenumber) { }
|
||||
public void RefreshStyle() { }
|
||||
public void SetupStyles(ScriptConfiguration config) { }
|
||||
public string GetCurrentWord() { return ""; }
|
||||
public string GetWordAt(int position) { return ""; }
|
||||
public void Undo() { }
|
||||
public void Redo() { }
|
||||
public void ClearUndoRedo() { }
|
||||
public void SetSavePoint() { }
|
||||
public void Cut() { }
|
||||
public void Copy() { }
|
||||
public void Paste() { }
|
||||
public void GrabFocus() { }
|
||||
public byte[] GetText() { return null; }
|
||||
public void SetText(byte[] text) { }
|
||||
public void InsertSnippet(string[] lines) { }
|
||||
public bool FindNext(FindReplaceOptions options, bool useselectionstart) { return false; }
|
||||
public bool FindPrevious(FindReplaceOptions options) { return false; }
|
||||
public void IndentSelection(bool indent) { }
|
||||
public void DuplicateLine() { }
|
||||
}
|
||||
|
||||
internal class ScriptEditorPreviewControl : UserControl
|
||||
{
|
||||
public string FontName { set; private get; }
|
||||
public int FontSize { set; private get; }
|
||||
public bool FontBold { set; private get; }
|
||||
public int TabWidth { set; private get; }
|
||||
public bool ShowLineNumbers { set; private get; }
|
||||
public bool ShowFolding { set; private get; }
|
||||
public Color ScriptBackground { set; private get; }
|
||||
public Color FoldForeColor { set; private get; }
|
||||
public Color FoldBackColor { set; private get; }
|
||||
public Color LineNumbers { set; private get; }
|
||||
public Color PlainText { set; private get; }
|
||||
public Color Comments { set; private get; }
|
||||
public Color Keywords { set; private get; }
|
||||
public Color Properties { set; private get; }
|
||||
public Color Literals { set; private get; }
|
||||
public Color Constants { set; private get; }
|
||||
public Color Strings { set; private get; }
|
||||
public Color Includes { set; private get; }
|
||||
public Color SelectionForeColor { set; private get; }
|
||||
public Color SelectionBackColor { set; private get; }
|
||||
public Color WhitespaceColor { set; private get; }
|
||||
public Color BraceHighlight { set; private get; }
|
||||
public Color BadBraceHighlight { set; private get; }
|
||||
public Color ScriptIndicator { set; private get; }
|
||||
}
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue