diff --git a/MakeSVNRelease.bat b/MakeSVNRelease.bat index e678b7f..9deeec0 100644 --- a/MakeSVNRelease.bat +++ b/MakeSVNRelease.bat @@ -160,7 +160,7 @@ ECHO. ECHO Packing release... ECHO. IF EXIST "SVN_Build\*.7z" DEL /F /Q "SVN_Build\*.7z" > NUL -"%SEVENZIPDIR%\7z" a .\SVN_Build\gzdb.7z .\Build\* -xr!*.xml -xr!JetBrains.Profiler.Core.Api.dll -x!Setup +"%SEVENZIPDIR%\7z" a .\SVN_Build\gzdb.7z .\Build\* -xr!*.xml -xr!JetBrains.Profiler.Core.Api.dll -xr!ScintillaNET.3.5.pdb -x!Setup IF %ERRORLEVEL% NEQ 0 GOTO PACKFAIL IF NOT EXIST .\SVN_Build\gzdb.7z GOTO FILEFAIL diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 0e4071d..d0fda96 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -121,7 +121,7 @@ ArgumentBox.cs - + Component @@ -493,8 +493,8 @@ - - True + + True True Resources.resx @@ -529,7 +529,7 @@ - + False @@ -577,7 +577,7 @@ Designer ResXFileCodeGenerator - Resources.Designer.cs + Resources.Designer.cs @@ -706,7 +706,10 @@ ScriptEditorControl.cs - + + ScriptEditorPreviewControl.cs + + @@ -773,12 +776,18 @@ PasteOptionsControl.cs - + UserControl ScriptEditorControl.cs + + UserControl + + + ScriptEditorPreviewControl.cs + UserControl @@ -1141,7 +1150,7 @@ - + diff --git a/Source/Core/Config/ProgramConfiguration.cs b/Source/Core/Config/ProgramConfiguration.cs index e74462b..54e0612 100644 --- a/Source/Core/Config/ProgramConfiguration.cs +++ b/Source/Core/Config/ProgramConfiguration.cs @@ -62,15 +62,7 @@ namespace CodeImp.DoomBuilder.Config private int movespeed; private float viewdistance; private bool invertyaxis; - private string scriptfontname; - private int scriptfontsize; - private bool scriptfontbold; - private bool scriptontop; - private bool scriptautoindent; - private bool scriptusetabs; //mxd - private bool snippetsallmanstyle; //mxd private string screenshotspath; //mxd - private int scripttabwidth; private int previewimagesize; private int autoscrollspeed; private int zoomfactor; @@ -93,10 +85,24 @@ namespace CodeImp.DoomBuilder.Config private float filteranisotropy; private bool showtexturesizes; private bool locatetexturegroup; //mxd - private SplitLineBehavior splitlinebehavior; //mxd + private SplitLineBehavior splitlinebehavior; //mxd - //mxd - private ModelRenderMode gzDrawModelsMode; + //mxd. Script editor settings + private string scriptfontname; + private int scriptfontsize; + private bool scriptfontbold; + private bool scriptontop; + private bool scriptautoindent; + private bool scriptallmanstyle; //mxd + private bool scriptusetabs; //mxd + private int scripttabwidth; + private bool scriptautoclosebrackets; //mxd + private bool scriptshowlinenumbers; //mxd + private bool scriptshowfolding; //mxd + private bool scriptautoshowautocompletion; //mxd + + //mxd + private ModelRenderMode gzDrawModelsMode; private LightRenderMode gzDrawLightsMode; private bool gzDrawFog; private bool gzDrawSky; @@ -159,19 +165,11 @@ namespace CodeImp.DoomBuilder.Config public int MoveSpeed { get { return movespeed; } internal set { movespeed = value; } } public float ViewDistance { get { return viewdistance; } internal set { viewdistance = value; } } public bool InvertYAxis { get { return invertyaxis; } internal set { invertyaxis = value; } } - public string ScriptFontName { get { return scriptfontname; } internal set { scriptfontname = value; } } - public int ScriptFontSize { get { return scriptfontsize; } internal set { scriptfontsize = value; } } - public bool ScriptFontBold { get { return scriptfontbold; } internal set { scriptfontbold = value; } } - public bool ScriptOnTop { get { return scriptontop; } internal set { scriptontop = value; } } public int PreviewImageSize { get { return previewimagesize; } internal set { previewimagesize = value; } } public int AutoScrollSpeed { get { return autoscrollspeed; } internal set { autoscrollspeed = value; } } public int ZoomFactor { get { return zoomfactor; } internal set { zoomfactor = value; } } public bool ShowErrorsWindow { get { return showerrorswindow; } internal set { showerrorswindow = value; } } public bool AnimateVisualSelection { get { return animatevisualselection; } internal set { animatevisualselection = value; } } - public bool ScriptUseTabs { get { return scriptusetabs; } internal set { scriptusetabs = value; } } //mxd - public int ScriptTabWidth { get { return scripttabwidth; } internal set { scripttabwidth = value; } } - public bool ScriptAutoIndent { get { return scriptautoindent; } internal set { scriptautoindent = value; } } - public bool SnippetsAllmanStyle { get { return snippetsallmanstyle; } internal set { snippetsallmanstyle = value; } } //mxd internal string ScreenshotsPath { get { return screenshotspath; } set { screenshotspath = value; } } //mxd internal int PreviousVersion { get { return previousversion; } } internal PasteOptions PasteOptions { get { return pasteoptions; } set { pasteoptions = value; } } @@ -192,8 +190,22 @@ namespace CodeImp.DoomBuilder.Config public bool LocateTextureGroup { get { return locatetexturegroup; } internal set { locatetexturegroup = value; } } //mxd public SplitLineBehavior SplitLineBehavior { get { return splitlinebehavior; } set { splitlinebehavior = value; } } //mxd - //mxd - public ModelRenderMode GZDrawModelsMode { get { return gzDrawModelsMode; } internal set { gzDrawModelsMode = value; } } + //mxd. Script editor settings + public string ScriptFontName { get { return scriptfontname; } internal set { scriptfontname = value; } } + public int ScriptFontSize { get { return scriptfontsize; } internal set { scriptfontsize = value; } } + public bool ScriptFontBold { get { return scriptfontbold; } internal set { scriptfontbold = value; } } + public bool ScriptOnTop { get { return scriptontop; } internal set { scriptontop = value; } } + public bool ScriptAutoIndent { get { return scriptautoindent; } internal set { scriptautoindent = value; } } + public bool ScriptAllmanStyle { get { return scriptallmanstyle; } internal set { scriptallmanstyle = value; } } //mxd + public bool ScriptUseTabs { get { return scriptusetabs; } internal set { scriptusetabs = value; } } //mxd + public int ScriptTabWidth { get { return scripttabwidth; } internal set { scripttabwidth = value; } } + public bool ScriptAutoCloseBrackets { get { return scriptautoclosebrackets; } internal set { scriptautoclosebrackets = value; } } //mxd + public bool ScriptShowLineNumbers { get { return scriptshowlinenumbers; } internal set { scriptshowlinenumbers = value; } } //mxd + public bool ScriptShowFolding { get { return scriptshowfolding; } internal set { scriptshowfolding = value; } } //mxd + public bool ScriptAutoShowAutocompletion { get { return scriptautoshowautocompletion; } internal set { scriptautoshowautocompletion = value; } } //mxd + + //mxd + public ModelRenderMode GZDrawModelsMode { get { return gzDrawModelsMode; } internal set { gzDrawModelsMode = value; } } public LightRenderMode GZDrawLightsMode { get { return gzDrawLightsMode; } internal set { gzDrawLightsMode = value; } } public bool GZDrawFog { get { return gzDrawFog; } internal set { gzDrawFog = value; } } public bool GZDrawSky { get { return gzDrawSky; } internal set { gzDrawSky = value; } } @@ -279,15 +291,7 @@ namespace CodeImp.DoomBuilder.Config movespeed = cfg.ReadSetting("movespeed", 100); viewdistance = cfg.ReadSetting("viewdistance", 3000.0f); invertyaxis = cfg.ReadSetting("invertyaxis", false); - scriptfontname = cfg.ReadSetting("scriptfontname", "Courier New"); - scriptfontsize = cfg.ReadSetting("scriptfontsize", 10); - scriptfontbold = cfg.ReadSetting("scriptfontbold", false); - scriptautoindent = cfg.ReadSetting("scriptautoindent", true); - snippetsallmanstyle = cfg.ReadSetting("snippetsallmanstyle", false); //mxd screenshotspath = cfg.ReadSetting("screenshotspath", General.DefaultScreenshotsPath); //mxd - scriptontop = cfg.ReadSetting("scriptontop", true); - scriptusetabs = cfg.ReadSetting("scriptusetabs", true); //mxd - scripttabwidth = cfg.ReadSetting("scripttabwidth", 4); previewimagesize = cfg.ReadSetting("previewimagesize", 1); autoscrollspeed = cfg.ReadSetting("autoscrollspeed", 0); zoomfactor = cfg.ReadSetting("zoomfactor", 3); @@ -312,8 +316,22 @@ namespace CodeImp.DoomBuilder.Config locatetexturegroup = cfg.ReadSetting("locatetexturegroup", true); //mxd splitlinebehavior = (SplitLineBehavior) General.Clamp(cfg.ReadSetting("splitlinebehavior", 0), 0, 3); //mxd - //mxd - gzDrawModelsMode = (ModelRenderMode)cfg.ReadSetting("gzdrawmodels", (int)ModelRenderMode.ALL); + //mxd. Script editor + scriptfontname = cfg.ReadSetting("scriptfontname", "Courier New"); + scriptfontsize = cfg.ReadSetting("scriptfontsize", 10); + scriptfontbold = cfg.ReadSetting("scriptfontbold", false); + scriptontop = cfg.ReadSetting("scriptontop", true); + scriptautoindent = cfg.ReadSetting("scriptautoindent", true); + scriptallmanstyle = cfg.ReadSetting("scriptallmanstyle", false); //mxd + scriptusetabs = cfg.ReadSetting("scriptusetabs", true); //mxd + scripttabwidth = cfg.ReadSetting("scripttabwidth", 4); + scriptautoclosebrackets = cfg.ReadSetting("scriptautoclosebrackets", true); //mxd + scriptshowlinenumbers = cfg.ReadSetting("scriptshowlinenumbers", true); //mxd + scriptshowfolding = cfg.ReadSetting("scriptshowfolding", true); //mxd + scriptautoshowautocompletion = cfg.ReadSetting("scriptautoshowautocompletion", true); //mxd + + //mxd + gzDrawModelsMode = (ModelRenderMode)cfg.ReadSetting("gzdrawmodels", (int)ModelRenderMode.ALL); gzDrawLightsMode = (LightRenderMode)cfg.ReadSetting("gzdrawlights", (int)LightRenderMode.ALL); gzDrawFog = cfg.ReadSetting("gzdrawfog", false); gzDrawSky = cfg.ReadSetting("gzdrawsky", true); @@ -380,14 +398,6 @@ namespace CodeImp.DoomBuilder.Config cfg.WriteSetting("movespeed", movespeed); cfg.WriteSetting("viewdistance", viewdistance); cfg.WriteSetting("invertyaxis", invertyaxis); - cfg.WriteSetting("scriptfontname", scriptfontname); - cfg.WriteSetting("scriptfontsize", scriptfontsize); - cfg.WriteSetting("scriptfontbold", scriptfontbold); - cfg.WriteSetting("scriptontop", scriptontop); - cfg.WriteSetting("scriptusetabs", scriptusetabs); //mxd - cfg.WriteSetting("scripttabwidth", scripttabwidth); - cfg.WriteSetting("scriptautoindent", scriptautoindent); - cfg.WriteSetting("snippetsallmanstyle", snippetsallmanstyle); //mxd cfg.WriteSetting("screenshotspath", screenshotspath); //mxd cfg.WriteSetting("previewimagesize", previewimagesize); cfg.WriteSetting("autoscrollspeed", autoscrollspeed); @@ -413,8 +423,22 @@ namespace CodeImp.DoomBuilder.Config cfg.WriteSetting("locatetexturegroup", locatetexturegroup); //mxd cfg.WriteSetting("splitlinebehavior", (int)splitlinebehavior); //mxd - //mxd - cfg.WriteSetting("gzdrawmodels", (int)gzDrawModelsMode); + //mxd. Script editor + cfg.WriteSetting("scriptfontname", scriptfontname); + cfg.WriteSetting("scriptfontsize", scriptfontsize); + cfg.WriteSetting("scriptfontbold", scriptfontbold); + cfg.WriteSetting("scriptontop", scriptontop); + cfg.WriteSetting("scriptusetabs", scriptusetabs); //mxd + cfg.WriteSetting("scripttabwidth", scripttabwidth); + cfg.WriteSetting("scriptautoindent", scriptautoindent); + cfg.WriteSetting("scriptallmanstyle", scriptallmanstyle); //mxd + cfg.WriteSetting("scriptautoclosebrackets", scriptautoclosebrackets); //mxd + cfg.WriteSetting("scriptshowlinenumbers", scriptshowlinenumbers); //mxd + cfg.WriteSetting("scriptshowfolding", scriptshowfolding); //mxd + cfg.WriteSetting("scriptautoshowautocompletion", scriptautoshowautocompletion); //mxd + + //mxd + cfg.WriteSetting("gzdrawmodels", (int)gzDrawModelsMode); cfg.WriteSetting("gzdrawlights", (int)gzDrawLightsMode); cfg.WriteSetting("gzdrawfog", gzDrawFog); cfg.WriteSetting("gzdrawsky", gzDrawSky); diff --git a/Source/Core/Controls/ScriptEditorControl.cs b/Source/Core/Controls/ScriptEditorControl.cs index f4b4629..41817ef 100644 --- a/Source/Core/Controls/ScriptEditorControl.cs +++ b/Source/Core/Controls/ScriptEditorControl.cs @@ -35,22 +35,22 @@ using ScintillaNET; namespace CodeImp.DoomBuilder.Controls { + internal enum ScriptStyleType + { + PlainText = 0, + Keyword = 1, + Constant = 2, + Comment = 3, + Literal = 4, + LineNumber = 5, + String = 6, //mxd + Include = 7, //mxd + } + internal partial class ScriptEditorControl : UserControl { #region ================== Enums - private enum ScriptStyleType - { - PlainText = 0, - Keyword = 1, - Constant = 2, - Comment = 3, - Literal = 4, - LineNumber = 5, - String = 6, //mxd - Include = 7, //mxd - } - // Index for registered images private enum ImageIndex { @@ -147,8 +147,11 @@ namespace CodeImp.DoomBuilder.Controls scriptedit.Margins[0].Sensitive = true; // Line numbers margin - scriptedit.Margins[1].Type = MarginType.Number; - scriptedit.Margins[1].Width = 16; + if (General.Settings.ScriptShowLineNumbers) + { + scriptedit.Margins[1].Type = MarginType.Number; + scriptedit.Margins[1].Width = 16; + } scriptedit.Margins[1].Mask = 0; // No markers here // Spacing margin @@ -354,10 +357,17 @@ namespace CodeImp.DoomBuilder.Controls // Set style for linenumbers and margins scriptedit.Styles[Style.LineNumber].BackColor = General.Colors.ScriptBackground.ToColor(); + scriptedit.SetFoldMarginColor(true, General.Colors.ScriptFoldBackColor.ToColor()); + scriptedit.SetFoldMarginHighlightColor(true, General.Colors.ScriptFoldBackColor.ToColor()); + for (int i = 25; i < 32; i++) + { + scriptedit.Markers[i].SetForeColor(General.Colors.ScriptFoldBackColor.ToColor()); + scriptedit.Markers[i].SetBackColor(General.Colors.ScriptFoldForeColor.ToColor()); + } //mxd. Set style for (mis)matching braces - scriptedit.Styles[Style.BraceLight].BackColor = General.Colors.ScriptBraceHighlight.ToColor(); //Color.Cyan; - scriptedit.Styles[Style.BraceBad].BackColor = General.Colors.ScriptBadBraceHighlight.ToColor(); //Color.Red; + scriptedit.Styles[Style.BraceLight].BackColor = General.Colors.ScriptBraceHighlight.ToColor(); + scriptedit.Styles[Style.BraceBad].BackColor = General.Colors.ScriptBadBraceHighlight.ToColor(); //mxd. Set whitespace color scriptedit.SetWhitespaceForeColor(true, General.Colors.ScriptWhitespace.ToColor()); @@ -399,9 +409,6 @@ namespace CodeImp.DoomBuilder.Controls } scriptedit.Styles[stylenum].ForeColor = General.Colors.Colors[colorindex].ToColor(); - - //mxd. Display constants as uppercase - if (type == ScriptStyleType.Constant) scriptedit.Styles[stylenum].Case = StyleCase.Upper; } } @@ -470,7 +477,7 @@ namespace CodeImp.DoomBuilder.Controls autocompletelist = new List(autocompletedict.Values); // Setup folding (https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Code-Folding) - if (scriptconfig.Lexer == Lexer.Cpp || scriptconfig.Lexer == Lexer.CppNoCase) + if (General.Settings.ScriptShowFolding && (scriptconfig.Lexer == Lexer.Cpp || scriptconfig.Lexer == Lexer.CppNoCase)) { // Instruct the lexer to calculate folding scriptedit.SetProperty("fold", "1"); @@ -482,13 +489,6 @@ namespace CodeImp.DoomBuilder.Controls scriptedit.Margins[2].Sensitive = true; scriptedit.Margins[2].Width = 12; - // Set colors for all folding markers - for (int i = 25; i < 32; i++) - { - scriptedit.Markers[i].SetForeColor(SystemColors.ControlLightLight); - scriptedit.Markers[i].SetBackColor(SystemColors.ControlDark); - } - // Configure folding markers with respective symbols scriptedit.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus; scriptedit.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus; @@ -907,7 +907,7 @@ namespace CodeImp.DoomBuilder.Controls { if (line.IndexOf(separator[0], StringComparison.Ordinal) != -1) { - if (General.Settings.SnippetsAllmanStyle) + if (General.Settings.ScriptAllmanStyle) result.AddRange(line.Split(separator, StringSplitOptions.RemoveEmptyEntries)); else result.Add(line.Replace(separator[0], " ")); @@ -1097,27 +1097,35 @@ namespace CodeImp.DoomBuilder.Controls } // Auto-match braces - //TODO: Auto-match quotes - bool endpos = (scriptedit.CurrentPosition == scriptedit.TextLength); - if (!string.IsNullOrEmpty(scriptconfig.CodeBlockOpen) && e.Char == scriptconfig.CodeBlockOpen[0] && !string.IsNullOrEmpty(scriptconfig.CodeBlockClose) && - (endpos || (char)scriptedit.GetCharAt(scriptedit.CurrentPosition + 1) != scriptconfig.CodeBlockClose[0])) + if (General.Settings.ScriptAutoCloseBrackets) { - scriptedit.InsertText(scriptedit.CurrentPosition, scriptconfig.CodeBlockClose); + //TODO: Auto-match quotes + bool endpos = (scriptedit.CurrentPosition == scriptedit.TextLength); + if (!string.IsNullOrEmpty(scriptconfig.CodeBlockOpen) && e.Char == scriptconfig.CodeBlockOpen[0] && !string.IsNullOrEmpty(scriptconfig.CodeBlockClose) && + (endpos || (char)scriptedit.GetCharAt(scriptedit.CurrentPosition + 1) != scriptconfig.CodeBlockClose[0])) + { + scriptedit.InsertText(scriptedit.CurrentPosition, scriptconfig.CodeBlockClose); + return; + } + + if (!string.IsNullOrEmpty(scriptconfig.FunctionOpen) && e.Char == scriptconfig.FunctionOpen[0] && !string.IsNullOrEmpty(scriptconfig.FunctionClose) && + (endpos || (char)scriptedit.GetCharAt(scriptedit.CurrentPosition + 1) != scriptconfig.FunctionClose[0])) + { + scriptedit.InsertText(scriptedit.CurrentPosition, scriptconfig.FunctionClose); + return; + } + + if (!string.IsNullOrEmpty(scriptconfig.ArrayOpen) && e.Char == scriptconfig.ArrayOpen[0] && !string.IsNullOrEmpty(scriptconfig.ArrayClose) && + (endpos || (char)scriptedit.GetCharAt(scriptedit.CurrentPosition + 1) != scriptconfig.ArrayClose[0])) + { + scriptedit.InsertText(scriptedit.CurrentPosition, scriptconfig.ArrayClose); + return; + } } - else if (!string.IsNullOrEmpty(scriptconfig.FunctionOpen) && e.Char == scriptconfig.FunctionOpen[0] && !string.IsNullOrEmpty(scriptconfig.FunctionClose) && - (endpos || (char)scriptedit.GetCharAt(scriptedit.CurrentPosition + 1) != scriptconfig.FunctionClose[0])) - { - scriptedit.InsertText(scriptedit.CurrentPosition, scriptconfig.FunctionClose); - } - else if (!string.IsNullOrEmpty(scriptconfig.ArrayOpen) && e.Char == scriptconfig.ArrayOpen[0] && !string.IsNullOrEmpty(scriptconfig.ArrayClose) && - (endpos || (char)scriptedit.GetCharAt(scriptedit.CurrentPosition + 1) != scriptconfig.ArrayClose[0])) - { - scriptedit.InsertText(scriptedit.CurrentPosition, scriptconfig.ArrayClose); - } - else + + if (General.Settings.ScriptAutoShowAutocompletion) { // Display the autocompletion list - // TODO: make this behaviour optional? ShowAutoCompletionList(); } } @@ -1205,23 +1213,19 @@ namespace CodeImp.DoomBuilder.Controls // Need to increase indentation? We do this when: // 1. Line contains '{' and '}' and the cursor is between them - // 2. Line either doesn't contain '}', or it's before '{', it contains '{' and the cursor is after it - // 3. Line doesn't contain ';', line contains ')' and the cursor is after it + // 2. Line either doesn't contain '}', or it's before '{', or the line contains '{' and the cursor is after it int blockopenpos = (string.IsNullOrEmpty(scriptconfig.CodeBlockOpen) ? -1 : linetext.LastIndexOf(scriptconfig.CodeBlockOpen, selectionpos, StringComparison.Ordinal)); int blockclosepos = (string.IsNullOrEmpty(scriptconfig.CodeBlockOpen) ? -1 : linetext.IndexOf(scriptconfig.CodeBlockClose, selectionpos, StringComparison.Ordinal)); - int funcclosepos = (string.IsNullOrEmpty(scriptconfig.FunctionClose) ? -1 : linetext.LastIndexOf(scriptconfig.FunctionClose, StringComparison.Ordinal)); // Add indentation when the cursor is between { and } bool addindent = (blockopenpos != -1 && blockopenpos < selectionpos) && (blockclosepos == -1 || (blockopenpos < blockclosepos && blockclosepos >= selectionpos)); - bool isblockindent = addindent; - addindent |= funcclosepos != -1 && blockopenpos == -1 && funcclosepos < selectionpos && !linetext.Contains(scriptconfig.Terminator); if (addindent) indent += scriptedit.TabWidth; // Calculate indentation string indentstr = GetIndentationString(indent); - // Move CodeBlockOpen to the new line (will be applied in scriptedit_CharAdded)? - expandcodeblock = (isblockindent && General.Settings.SnippetsAllmanStyle); + // Move CodeBlockOpen to the new line? (will be applied in scriptedit_CharAdded) + expandcodeblock = General.Settings.ScriptAllmanStyle; // Offset closing block char? if (addindent && blockclosepos != -1) diff --git a/Source/Core/Controls/ScriptEditorPreviewControl.Designer.cs b/Source/Core/Controls/ScriptEditorPreviewControl.Designer.cs new file mode 100644 index 0000000..d2381ce --- /dev/null +++ b/Source/Core/Controls/ScriptEditorPreviewControl.Designer.cs @@ -0,0 +1,68 @@ +namespace CodeImp.DoomBuilder.Controls +{ + partial class ScriptEditorPreviewControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.scriptedit = new ScintillaNET.Scintilla(); + this.SuspendLayout(); + // + // scriptedit + // + this.scriptedit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.scriptedit.CaretWidth = 2; + this.scriptedit.Dock = System.Windows.Forms.DockStyle.Fill; + this.scriptedit.ExtraAscent = 1; + this.scriptedit.ExtraDescent = 1; + this.scriptedit.FontQuality = ScintillaNET.FontQuality.LcdOptimized; + this.scriptedit.Location = new System.Drawing.Point(0, 0); + this.scriptedit.Name = "scriptedit"; + this.scriptedit.ScrollWidth = 200; + this.scriptedit.Size = new System.Drawing.Size(300, 150); + this.scriptedit.TabIndex = 1; + this.scriptedit.TabStop = false; + this.scriptedit.UseTabs = true; + this.scriptedit.ViewWhitespace = ScintillaNET.WhitespaceMode.VisibleAlways; + this.scriptedit.WhitespaceSize = 2; + this.scriptedit.UpdateUI += new System.EventHandler(this.scriptedit_UpdateUI); + // + // ScriptEditorPreviewControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.scriptedit); + this.Name = "ScriptEditorPreviewControl"; + this.Size = new System.Drawing.Size(300, 150); + this.ResumeLayout(false); + + } + + #endregion + + private ScintillaNET.Scintilla scriptedit; + } +} diff --git a/Source/Core/Controls/ScriptEditorPreviewControl.cs b/Source/Core/Controls/ScriptEditorPreviewControl.cs new file mode 100644 index 0000000..2d7240e --- /dev/null +++ b/Source/Core/Controls/ScriptEditorPreviewControl.cs @@ -0,0 +1,413 @@ +#region ================== Namespaces + +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Rendering; +using ScintillaNET; + +#endregion + +namespace CodeImp.DoomBuilder.Controls +{ + internal partial class ScriptEditorPreviewControl : UserControl + { + #region ================== Constants + + private const int HIGHLIGHT_INDICATOR = 8; + + #endregion + + #region ================== Variables + + private Dictionary styletranslation; + private string highlightedword; + private Color indicatorcolor; + private int lastcaretpos; + private readonly HashSet bracechars; + + #endregion + + #region ================== Properties + + public string FontName { set { ApplyFont(value); } } + public int FontSize { set { ApplyFontSize(value); } } + public bool FontBold { set { ApplyFontBold(value); } } + public int TabWidth { set { scriptedit.TabWidth = value; } } + public bool ShowLineNumbers { set { UpdateLineNumbers(value); } } + public bool ShowFolding { set { UpdateFolding(value); } } + + // Colors + public Color ScriptBackground + { + set + { + scriptedit.Styles[Style.Default].BackColor = value; + scriptedit.CaretForeColor = PixelColor.FromColor(value).Inverse().ToColor(); + scriptedit.Styles[Style.LineNumber].BackColor = value; + scriptedit.SetWhitespaceBackColor(true, value); + + foreach(KeyValuePair group in styletranslation) + scriptedit.Styles[group.Key].BackColor = value; + } + } + + public Color FoldForeColor { set { for(int i = 25; i < 32; i++) scriptedit.Markers[i].SetBackColor(value); } } + public Color FoldBackColor + { + set + { + scriptedit.SetFoldMarginColor(true, value); + scriptedit.SetFoldMarginHighlightColor(true, value); + for(int i = 25; i < 32; i++) scriptedit.Markers[i].SetForeColor(value); + } + } + + public Color LineNumbers { set { ApplyStyleColor(ScriptStyleType.LineNumber, value); } } + public Color PlainText { set { ApplyStyleColor(ScriptStyleType.PlainText, value); } } + public Color Comments { set { ApplyStyleColor(ScriptStyleType.Comment, value); } } + public Color Keywords { set { ApplyStyleColor(ScriptStyleType.Keyword, value); } } + public Color Literals { set { ApplyStyleColor(ScriptStyleType.Literal, value); } } + public Color Constants { set { ApplyStyleColor(ScriptStyleType.Constant, value); } } + public Color Strings { set { ApplyStyleColor(ScriptStyleType.String, value); } } + public Color Includes { set { ApplyStyleColor(ScriptStyleType.Include, value); } } + + public Color SelectionForeColor { set { scriptedit.SetSelectionForeColor(true, value); } } + public Color SelectionBackColor { set { scriptedit.SetSelectionBackColor(true, value); } } + public Color WhitespaceColor { set { scriptedit.SetWhitespaceForeColor(true, value); } } + public Color BraceHighlight { set { scriptedit.Styles[Style.BraceLight].BackColor = value; } } + public Color BadBraceHighlight { set { scriptedit.Styles[Style.BraceBad].BackColor = value; } } + public Color ScriptIndicator { set { indicatorcolor = value; UpdateWordHighlight(); } } + + #endregion + + #region ================== Constructor / Setup + + public ScriptEditorPreviewControl() + { + InitializeComponent(); + + if(LicenseManager.UsageMode != LicenseUsageMode.Designtime) + { + bracechars = new HashSet { '{', '}', '(', ')', '[', ']' }; + SetupStyles(); + } + } + + // This sets up the script editor with default settings + private void SetupStyles() + { + // Symbol margin + scriptedit.Margins[0].Type = MarginType.Symbol; + scriptedit.Margins[0].Width = 20; + scriptedit.Margins[0].Mask = 0; // No markers here + scriptedit.Margins[0].Cursor = MarginCursor.Arrow; + scriptedit.Margins[0].Sensitive = true; + + // Line numbers margin + if(General.Settings.ScriptShowLineNumbers) + { + scriptedit.Margins[1].Type = MarginType.Number; + scriptedit.Margins[1].Width = 16; + } + scriptedit.Margins[1].Mask = 0; // No markers here + + // Spacing margin + scriptedit.Margins[2].Type = MarginType.Symbol; + scriptedit.Margins[2].Width = 5; + scriptedit.Margins[2].Cursor = MarginCursor.Arrow; + scriptedit.Margins[2].Mask = 0; // No markers here + + // Set lexer + scriptedit.Lexer = Lexer.CppNoCase; + + // Set script editor preview text + scriptedit.Text = "#include \"zcommon.acs\"" + "\n" + + "script 667 ENTER //A simple script example" + "\n" + + "{" + "\n" + + " int red = CR_RED;" + "\n" + + "\tPrint(s:\"Welcome!\");" + "\n" + + "\tThing_ChangeTID(0, 667);" + "\n" + + "} } // <- A spare brace!"; + + // No text editing beyond this point! + scriptedit.ReadOnly = true; + + // Set keywords (0) + const string keywords = "script enter Print int HudMessageBold Thing_ChangeTID"; + scriptedit.SetKeywords(0, keywords.ToLowerInvariant()); + + // Set constants (1); + const string constants = "CR_RED"; + scriptedit.SetKeywords(1, constants.ToLowerInvariant()); + + // Reset document slyle + scriptedit.ClearDocumentStyle(); + scriptedit.StyleResetDefault(); + + // Create style translation dictionary + styletranslation = new Dictionary + { + { 0, ScriptStyleType.PlainText }, // End of line + { 10, ScriptStyleType.PlainText }, // Operator + { 11, ScriptStyleType.PlainText }, // Identifier + { 33, ScriptStyleType.LineNumber }, + { 1, ScriptStyleType.Comment }, + { 2, ScriptStyleType.Comment }, + { 5, ScriptStyleType.Keyword }, + { 4, ScriptStyleType.Literal }, + { 7, ScriptStyleType.Literal }, + { 16, ScriptStyleType.Constant }, + { 37, ScriptStyleType.LineNumber }, + { 6, ScriptStyleType.String }, + { 9, ScriptStyleType.Include }, + }; + + // Set the default style and settings + scriptedit.Styles[Style.Default].Font = General.Settings.ScriptFontName; + scriptedit.Styles[Style.Default].Size = General.Settings.ScriptFontSize; + scriptedit.Styles[Style.Default].Bold = General.Settings.ScriptFontBold; + scriptedit.Styles[Style.Default].Italic = false; + scriptedit.Styles[Style.Default].Underline = false; + scriptedit.Styles[Style.Default].Case = StyleCase.Mixed; + scriptedit.Styles[Style.Default].ForeColor = General.Colors.PlainText.ToColor(); + scriptedit.Styles[Style.Default].BackColor = General.Colors.ScriptBackground.ToColor(); + scriptedit.CaretPeriod = SystemInformation.CaretBlinkTime; + scriptedit.CaretForeColor = General.Colors.ScriptBackground.Inverse().ToColor(); + + // Set tabulation settings + scriptedit.UseTabs = General.Settings.ScriptUseTabs; + scriptedit.TabWidth = General.Settings.ScriptTabWidth; + + // This applies the default style to all styles + scriptedit.StyleClearAll(); + + // Set style for linenumbers and margins + scriptedit.Styles[Style.LineNumber].BackColor = General.Colors.ScriptBackground.ToColor(); + scriptedit.SetFoldMarginColor(true, General.Colors.ScriptFoldBackColor.ToColor()); + scriptedit.SetFoldMarginHighlightColor(true, General.Colors.ScriptFoldBackColor.ToColor()); + for(int i = 25; i < 32; i++) + { + scriptedit.Markers[i].SetForeColor(General.Colors.ScriptFoldBackColor.ToColor()); + scriptedit.Markers[i].SetBackColor(General.Colors.ScriptFoldForeColor.ToColor()); + } + + // Set style for (mis)matching braces + scriptedit.Styles[Style.BraceLight].BackColor = General.Colors.ScriptBraceHighlight.ToColor(); + scriptedit.Styles[Style.BraceBad].BackColor = General.Colors.ScriptBadBraceHighlight.ToColor(); + + // Set whitespace color + scriptedit.SetWhitespaceForeColor(true, General.Colors.ScriptWhitespace.ToColor()); + + // Set selection colors + scriptedit.SetSelectionForeColor(true, General.Colors.ScriptSelectionForeColor.ToColor()); + scriptedit.SetSelectionBackColor(true, General.Colors.ScriptSelectionBackColor.ToColor()); + indicatorcolor = General.Colors.ScriptIndicator.ToColor(); + + // Set words colors + foreach(KeyValuePair group in styletranslation) + { + // Apply color to style + int colorindex; + switch(group.Value) + { + case ScriptStyleType.PlainText: colorindex = ColorCollection.PLAINTEXT; break; + case ScriptStyleType.Comment: colorindex = ColorCollection.COMMENTS; break; + case ScriptStyleType.Constant: colorindex = ColorCollection.CONSTANTS; break; + case ScriptStyleType.Keyword: colorindex = ColorCollection.KEYWORDS; break; + case ScriptStyleType.LineNumber: colorindex = ColorCollection.LINENUMBERS; break; + case ScriptStyleType.Literal: colorindex = ColorCollection.LITERALS; break; + case ScriptStyleType.String: colorindex = ColorCollection.STRINGS; break; + case ScriptStyleType.Include: colorindex = ColorCollection.INCLUDES; break; + default: colorindex = ColorCollection.PLAINTEXT; break; + } + + scriptedit.Styles[group.Key].ForeColor = General.Colors.Colors[colorindex].ToColor(); + scriptedit.Styles[group.Key].BackColor = General.Colors.ScriptBackground.ToColor(); + } + + // Setup folding + UpdateFolding(General.Settings.ScriptShowFolding); + + // Rearrange the layout + this.PerformLayout(); + } + + #endregion + + #region ================== Methods + + private void ApplyStyleColor(ScriptStyleType type, Color color) + { + foreach(KeyValuePair group in styletranslation) + if(group.Value == type) scriptedit.Styles[group.Key].ForeColor = color; + } + + private void ApplyFont(string font) + { + foreach(KeyValuePair group in styletranslation) + scriptedit.Styles[group.Key].Font = font; + } + + private void ApplyFontBold(bool bold) + { + foreach(KeyValuePair group in styletranslation) + scriptedit.Styles[group.Key].Bold = bold; + } + + private void ApplyFontSize(int size) + { + foreach(KeyValuePair group in styletranslation) + scriptedit.Styles[group.Key].Size = size; + } + + private void UpdateLineNumbers(bool show) + { + if(show) + { + scriptedit.Margins[1].Type = MarginType.Number; + scriptedit.Margins[1].Width = 16; + } + else + { + scriptedit.Margins[1].Type = MarginType.Symbol; + scriptedit.Margins[1].Width = 0; + } + } + + private void UpdateFolding(bool show) + { + if(show) + { + // Instruct the lexer to calculate folding + scriptedit.SetProperty("fold", "1"); + scriptedit.SetProperty("fold.compact", "1"); + + // Configure a margin to display folding symbols + scriptedit.Margins[2].Type = MarginType.Symbol; + scriptedit.Margins[2].Mask = Marker.MaskFolders; + scriptedit.Margins[2].Sensitive = true; + scriptedit.Margins[2].Width = 12; + + // Configure folding markers with respective symbols + scriptedit.Markers[Marker.Folder].Symbol = MarkerSymbol.BoxPlus; + scriptedit.Markers[Marker.FolderOpen].Symbol = MarkerSymbol.BoxMinus; + scriptedit.Markers[Marker.FolderEnd].Symbol = MarkerSymbol.BoxPlusConnected; + scriptedit.Markers[Marker.FolderMidTail].Symbol = MarkerSymbol.TCorner; + scriptedit.Markers[Marker.FolderOpenMid].Symbol = MarkerSymbol.BoxMinusConnected; + scriptedit.Markers[Marker.FolderSub].Symbol = MarkerSymbol.VLine; + scriptedit.Markers[Marker.FolderTail].Symbol = MarkerSymbol.LCorner; + + // Enable automatic folding + scriptedit.AutomaticFold = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change); + } + else + { + // Disable folding + scriptedit.SetProperty("fold", "0"); + scriptedit.SetProperty("fold.compact", "0"); + + scriptedit.Margins[2].Type = MarginType.Symbol; + scriptedit.Margins[2].Mask = 0; // No markers here + scriptedit.Margins[2].Sensitive = false; + scriptedit.Margins[2].Width = 5; + + scriptedit.AutomaticFold = AutomaticFold.None; + } + } + + private void UpdateWordHighlight() + { + // If a word is selected, highlight the same words + if(scriptedit.SelectedText != highlightedword) + { + // Highlight only when whole word is selected + if(!string.IsNullOrEmpty(scriptedit.SelectedText) && scriptedit.GetWordFromPosition(scriptedit.SelectionStart) == scriptedit.SelectedText) { + HighlightWord(scriptedit.SelectedText); + } + else + { + // Clear highlight + scriptedit.IndicatorCurrent = HIGHLIGHT_INDICATOR; + scriptedit.IndicatorClearRange(0, scriptedit.TextLength); + } + + highlightedword = scriptedit.SelectedText; + } + } + + private void HighlightWord(string text) + { + // Remove all uses of our indicator + scriptedit.IndicatorCurrent = HIGHLIGHT_INDICATOR; + scriptedit.IndicatorClearRange(0, scriptedit.TextLength); + + // Update indicator appearance + scriptedit.Indicators[HIGHLIGHT_INDICATOR].Style = IndicatorStyle.RoundBox; + scriptedit.Indicators[HIGHLIGHT_INDICATOR].Under = true; + scriptedit.Indicators[HIGHLIGHT_INDICATOR].ForeColor = indicatorcolor; + scriptedit.Indicators[HIGHLIGHT_INDICATOR].OutlineAlpha = 50; + scriptedit.Indicators[HIGHLIGHT_INDICATOR].Alpha = 30; + + // Search the document + scriptedit.TargetStart = 0; + scriptedit.TargetEnd = scriptedit.TextLength; + scriptedit.SearchFlags = SearchFlags.WholeWord; + + while(scriptedit.SearchInTarget(text) != -1) + { + //mxd. Don't mark currently selected word + if(scriptedit.SelectionStart != scriptedit.TargetStart && scriptedit.SelectionEnd != scriptedit.TargetEnd) + { + // Mark the search results with the current indicator + scriptedit.IndicatorFillRange(scriptedit.TargetStart, scriptedit.TargetEnd - scriptedit.TargetStart); + } + + // Search the remainder of the document + scriptedit.TargetStart = scriptedit.TargetEnd; + scriptedit.TargetEnd = scriptedit.TextLength; + } + } + + #endregion + + #region ================== Events + + private void scriptedit_UpdateUI(object sender, UpdateUIEventArgs e) + { + UpdateWordHighlight(); + + // Has the caret changed position? + int caretpos = scriptedit.CurrentPosition; + if(lastcaretpos != caretpos) + { + lastcaretpos = caretpos; + int bracepos1 = -1; + + // Is there a brace to the left or right? + if(caretpos > 0 && bracechars.Contains((char)scriptedit.GetCharAt(caretpos - 1))) + bracepos1 = (caretpos - 1); + else if(bracechars.Contains((char)(scriptedit.GetCharAt(caretpos)))) + bracepos1 = caretpos; + + if(bracepos1 > -1) + { + // Find the matching brace + int bracepos2 = scriptedit.BraceMatch(bracepos1); + if(bracepos2 == Scintilla.InvalidPosition) + scriptedit.BraceBadLight(bracepos1); + else + scriptedit.BraceHighlight(bracepos1, bracepos2); + } + else + { + // Turn off brace matching + scriptedit.BraceHighlight(Scintilla.InvalidPosition, Scintilla.InvalidPosition); + } + } + } + + #endregion + } +} diff --git a/Source/Core/Controls/ScriptEditorPreviewControl.resx b/Source/Core/Controls/ScriptEditorPreviewControl.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Source/Core/Controls/ScriptEditorPreviewControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Source/Core/Rendering/ColorCollection.cs b/Source/Core/Rendering/ColorCollection.cs index bfc8322..c6db4b3 100644 --- a/Source/Core/Rendering/ColorCollection.cs +++ b/Source/Core/Rendering/ColorCollection.cs @@ -37,7 +37,7 @@ namespace CodeImp.DoomBuilder.Rendering private const float DARK_ADDITION = -0.2f; // Palette size - private const int NUM_COLORS = 57; + private const int NUM_COLORS = 59; public const int NUM_THING_COLORS = 20; public const int THING_COLORS_OFFSET = 20; @@ -99,6 +99,8 @@ namespace CodeImp.DoomBuilder.Rendering public const int SCRIPTSELECTIONBACK = 54; public const int STRINGS = 55; public const int INCLUDES = 56; + public const int SCRIPTFOLDFORE = 57; + public const int SCRIPTFOLDBACK = 58; #endregion #region ================== Variables @@ -138,25 +140,29 @@ namespace CodeImp.DoomBuilder.Rendering public PixelColor Selection3D { get { return colors[SELECTION3D]; } internal set { colors[SELECTION3D] = value; } } public PixelColor ScriptBackground { get { return colors[SCRIPTBACKGROUND]; } internal set { colors[SCRIPTBACKGROUND] = value; } } - public PixelColor ScriptIndicator { get { return colors[SCRIPTINDICATOR]; } internal set { colors[SCRIPTINDICATOR] = value; } } - public PixelColor ScriptBraceHighlight { get { return colors[SCRIPTBRACEHIGHLIGHT]; } internal set { colors[SCRIPTBRACEHIGHLIGHT] = value; } } - public PixelColor ScriptBadBraceHighlight { get { return colors[SCRIPTBADBRACEHIGHLIGHT]; } internal set { colors[SCRIPTBADBRACEHIGHLIGHT] = value; } } - public PixelColor ScriptWhitespace { get { return colors[SCRIPTWHITESPACE]; } internal set { colors[SCRIPTWHITESPACE] = value; } } - public PixelColor ScriptSelectionForeColor { get { return colors[SCRIPTSELECTIONFORE]; } internal set { colors[SCRIPTSELECTIONFORE] = value; } } - public PixelColor ScriptSelectionBackColor { get { return colors[SCRIPTSELECTIONBACK]; } internal set { colors[SCRIPTSELECTIONBACK] = value; } } + public PixelColor ScriptIndicator { get { return colors[SCRIPTINDICATOR]; } internal set { colors[SCRIPTINDICATOR] = value; } } //mxd + public PixelColor ScriptBraceHighlight { get { return colors[SCRIPTBRACEHIGHLIGHT]; } internal set { colors[SCRIPTBRACEHIGHLIGHT] = value; } } //mxd + public PixelColor ScriptBadBraceHighlight { get { return colors[SCRIPTBADBRACEHIGHLIGHT]; } internal set { colors[SCRIPTBADBRACEHIGHLIGHT] = value; } } //mxd + public PixelColor ScriptWhitespace { get { return colors[SCRIPTWHITESPACE]; } internal set { colors[SCRIPTWHITESPACE] = value; } } //mxd + public PixelColor ScriptSelectionForeColor { get { return colors[SCRIPTSELECTIONFORE]; } internal set { colors[SCRIPTSELECTIONFORE] = value; } } //mxd + public PixelColor ScriptSelectionBackColor { get { return colors[SCRIPTSELECTIONBACK]; } internal set { colors[SCRIPTSELECTIONBACK] = value; } } //mxd public PixelColor LineNumbers { get { return colors[LINENUMBERS]; } internal set { colors[LINENUMBERS] = value; } } - public PixelColor PlainText { get { return colors[PLAINTEXT]; } internal set { colors[PLAINTEXT] = value; } } + public PixelColor PlainText { get { return colors[PLAINTEXT]; } internal set { colors[PLAINTEXT] = value; } } public PixelColor Comments { get { return colors[COMMENTS]; } internal set { colors[COMMENTS] = value; } } public PixelColor Keywords { get { return colors[KEYWORDS]; } internal set { colors[KEYWORDS] = value; } } public PixelColor Literals { get { return colors[LITERALS]; } internal set { colors[LITERALS] = value; } } public PixelColor Constants { get { return colors[CONSTANTS]; } internal set { colors[CONSTANTS] = value; } } - - #endregion + public PixelColor Strings { get { return colors[STRINGS]; } internal set { colors[STRINGS] = value; } } //mxd + public PixelColor Includes { get { return colors[INCLUDES]; } internal set { colors[INCLUDES] = value; } } //mxd + public PixelColor ScriptFoldForeColor { get { return colors[SCRIPTFOLDFORE]; } internal set { colors[SCRIPTFOLDFORE] = value; } } //mxd + public PixelColor ScriptFoldBackColor { get { return colors[SCRIPTFOLDBACK]; } internal set { colors[SCRIPTFOLDBACK] = value; } } //mxd - #region ================== Constructor / Disposer + #endregion - // Constructor for settings from configuration - internal ColorCollection(Configuration cfg) + #region ================== Constructor / Disposer + + // Constructor for settings from configuration + internal ColorCollection(Configuration cfg) { // Initialize colors = new PixelColor[NUM_COLORS]; @@ -191,9 +197,11 @@ namespace CodeImp.DoomBuilder.Rendering if(colors[THINGCOLOR17].ToInt() == 0) colors[THINGCOLOR17] = PixelColor.FromColor(Color.DarkOrange); if(colors[THINGCOLOR18].ToInt() == 0) colors[THINGCOLOR18] = PixelColor.FromColor(Color.DarkKhaki); if(colors[THINGCOLOR19].ToInt() == 0) colors[THINGCOLOR19] = PixelColor.FromColor(Color.Goldenrod); - - // Create assist colors - CreateAssistColors(); + if (colors[SCRIPTFOLDFORE].ToInt() == 0) colors[SCRIPTFOLDFORE] = PixelColor.FromColor(SystemColors.ControlLightLight); + if (colors[SCRIPTFOLDBACK].ToInt() == 0) colors[SCRIPTFOLDBACK] = PixelColor.FromColor(SystemColors.ControlDark); + + // Create assist colors + CreateAssistColors(); // Create color correction table CreateCorrectionTable(); diff --git a/Source/Core/Resources/Lexers.cfg b/Source/Core/Resources/Lexers.cfg index a260da7..cd5f035 100644 --- a/Source/Core/Resources/Lexers.cfg +++ b/Source/Core/Resources/Lexers.cfg @@ -23,13 +23,13 @@ lexer1 // None lexer3 // CPP-style, case-sensitive { - 0 = 0; // plain text + 10 = 0; // operator -> plain text + 11 = 0; // identifier -> plain text 33 = 5; // line numbers 1 = 3; // comments 2 = 3; // comments 5 = 1; // keywords 4 = 4; // literal - 6 = 4; // literal 7 = 4; // literal 16 = 2; // constants 37 = 5; // ident guides @@ -79,13 +79,13 @@ lexer18 // Pascal-style lexer35 // CPP-style, case-insensitive { - 0 = 0; // plain text + 10 = 0; // operator -> plain text + 11 = 0; // identifier -> plain text 33 = 5; // line numbers 1 = 3; // comments 2 = 3; // comments 5 = 1; // keywords 4 = 4; // literal - 6 = 4; // literal 7 = 4; // literal 16 = 2; // constants 37 = 5; // ident guides diff --git a/Source/Core/Windows/PreferencesForm.Designer.cs b/Source/Core/Windows/PreferencesForm.Designer.cs index 7f25c66..ba0e437 100644 --- a/Source/Core/Windows/PreferencesForm.Designer.cs +++ b/Source/Core/Windows/PreferencesForm.Designer.cs @@ -156,24 +156,42 @@ namespace CodeImp.DoomBuilder.Windows this.classicbilinear = new System.Windows.Forms.CheckBox(); this.imagebrightnesslabel = new System.Windows.Forms.Label(); this.imagebrightness = new System.Windows.Forms.TrackBar(); - this.colorsgroup3 = new System.Windows.Forms.GroupBox(); - this.snippetsallmanstyle = new System.Windows.Forms.CheckBox(); - this.scripttabwidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); - this.scriptautoindent = new System.Windows.Forms.CheckBox(); + this.tabscripteditor = new System.Windows.Forms.TabPage(); + this.groupBox9 = new System.Windows.Forms.GroupBox(); + this.scriptshowfolding = new System.Windows.Forms.CheckBox(); + this.scriptshowlinenumbers = new System.Windows.Forms.CheckBox(); + this.groupBox8 = new System.Windows.Forms.GroupBox(); + this.scriptautoshowautocompletion = new System.Windows.Forms.CheckBox(); + this.scriptautoclosebrackets = new System.Windows.Forms.CheckBox(); + this.scriptusetabs = new System.Windows.Forms.CheckBox(); + this.scriptallmanstyle = new System.Windows.Forms.CheckBox(); this.label10 = new System.Windows.Forms.Label(); - this.fontpreview = new System.Windows.Forms.RichTextBox(); - this.scriptfontsize = new System.Windows.Forms.ComboBox(); - this.label8 = new System.Windows.Forms.Label(); - this.scriptfontbold = new System.Windows.Forms.CheckBox(); - this.scriptfontname = new System.Windows.Forms.ComboBox(); + this.scriptautoindent = new System.Windows.Forms.CheckBox(); + this.scripttabwidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); this.label3 = new System.Windows.Forms.Label(); - this.colorconstants = new CodeImp.DoomBuilder.Controls.ColorControl(); - this.colorliterals = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.scriptfontname = new System.Windows.Forms.ComboBox(); + this.scriptfontbold = new System.Windows.Forms.CheckBox(); + this.label8 = new System.Windows.Forms.Label(); + this.scriptfontsize = new System.Windows.Forms.ComboBox(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.colorindicator = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorwhitespace = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorbracebad = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorbrace = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorselectionback = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorselectionfore = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorincludes = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorstrings = new CodeImp.DoomBuilder.Controls.ColorControl(); this.colorscriptbackground = new CodeImp.DoomBuilder.Controls.ColorControl(); - this.colorkeywords = new CodeImp.DoomBuilder.Controls.ColorControl(); - this.colorlinenumbers = new CodeImp.DoomBuilder.Controls.ColorControl(); - this.colorcomments = new CodeImp.DoomBuilder.Controls.ColorControl(); this.colorplaintext = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorcomments = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorlinenumbers = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorkeywords = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorliterals = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorconstants = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.previewgroup = new System.Windows.Forms.GroupBox(); + this.scriptedit = new CodeImp.DoomBuilder.Controls.ScriptEditorPreviewControl(); this.tabnights = new System.Windows.Forms.TabPage(); this.nightscolormare8 = new CodeImp.DoomBuilder.Controls.ColorControl(); this.nightscolormare7 = new CodeImp.DoomBuilder.Controls.ColorControl(); @@ -191,6 +209,8 @@ namespace CodeImp.DoomBuilder.Windows this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.browseScreenshotsFolderDialog = new System.Windows.Forms.FolderBrowserDialog(); + this.colorfoldfore = new CodeImp.DoomBuilder.Controls.ColorControl(); + this.colorfoldback = new CodeImp.DoomBuilder.Controls.ColorControl(); label7 = new System.Windows.Forms.Label(); label6 = new System.Windows.Forms.Label(); label5 = new System.Windows.Forms.Label(); @@ -227,7 +247,12 @@ namespace CodeImp.DoomBuilder.Windows ((System.ComponentModel.ISupportInitialize)(this.tbDynLightSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbDynLightCount)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).BeginInit(); - this.colorsgroup3.SuspendLayout(); + this.tabscripteditor.SuspendLayout(); + this.groupBox9.SuspendLayout(); + this.groupBox8.SuspendLayout(); + this.groupBox7.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.previewgroup.SuspendLayout(); this.tabnights.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nightscircleprecision)).BeginInit(); this.tabpasting.SuspendLayout(); @@ -852,6 +877,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabs.Controls.Add(this.tabinterface); this.tabs.Controls.Add(this.tabkeys); this.tabs.Controls.Add(this.tabcolors); + this.tabs.Controls.Add(this.tabscripteditor); this.tabs.Controls.Add(this.tabnights); this.tabs.Controls.Add(this.tabpasting); this.tabs.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -1465,7 +1491,6 @@ namespace CodeImp.DoomBuilder.Windows // tabcolors // this.tabcolors.Controls.Add(this.appearancegroup1); - this.tabcolors.Controls.Add(this.colorsgroup3); this.tabcolors.Controls.Add(this.colorsgroup1); this.tabcolors.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabcolors.Location = new System.Drawing.Point(4, 22); @@ -1503,9 +1528,9 @@ namespace CodeImp.DoomBuilder.Windows this.appearancegroup1.Controls.Add(this.classicbilinear); this.appearancegroup1.Controls.Add(this.imagebrightnesslabel); this.appearancegroup1.Controls.Add(this.imagebrightness); - this.appearancegroup1.Location = new System.Drawing.Point(217, 224); + this.appearancegroup1.Location = new System.Drawing.Point(217, 14); this.appearancegroup1.Name = "appearancegroup1"; - this.appearancegroup1.Size = new System.Drawing.Size(457, 300); + this.appearancegroup1.Size = new System.Drawing.Size(457, 487); this.appearancegroup1.TabIndex = 24; this.appearancegroup1.TabStop = false; this.appearancegroup1.Text = " Additional Options "; @@ -1687,45 +1712,131 @@ namespace CodeImp.DoomBuilder.Windows this.imagebrightness.TickStyle = System.Windows.Forms.TickStyle.TopLeft; this.imagebrightness.ValueChanged += new System.EventHandler(this.imagebrightness_ValueChanged); // - // colorsgroup3 + // tabscripteditor // - this.colorsgroup3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.colorsgroup3.Controls.Add(this.snippetsallmanstyle); - this.colorsgroup3.Controls.Add(this.scripttabwidth); - this.colorsgroup3.Controls.Add(this.scriptautoindent); - this.colorsgroup3.Controls.Add(this.label10); - this.colorsgroup3.Controls.Add(this.fontpreview); - this.colorsgroup3.Controls.Add(this.scriptfontsize); - this.colorsgroup3.Controls.Add(this.label8); - this.colorsgroup3.Controls.Add(this.scriptfontbold); - this.colorsgroup3.Controls.Add(this.scriptfontname); - this.colorsgroup3.Controls.Add(this.label3); - this.colorsgroup3.Controls.Add(this.colorconstants); - this.colorsgroup3.Controls.Add(this.colorliterals); - this.colorsgroup3.Controls.Add(this.colorscriptbackground); - this.colorsgroup3.Controls.Add(this.colorkeywords); - this.colorsgroup3.Controls.Add(this.colorlinenumbers); - this.colorsgroup3.Controls.Add(this.colorcomments); - this.colorsgroup3.Controls.Add(this.colorplaintext); - this.colorsgroup3.Location = new System.Drawing.Point(217, 8); - this.colorsgroup3.Name = "colorsgroup3"; - this.colorsgroup3.Size = new System.Drawing.Size(457, 212); - this.colorsgroup3.TabIndex = 1; - this.colorsgroup3.TabStop = false; - this.colorsgroup3.Text = " Script editor "; - this.colorsgroup3.Visible = false; + this.tabscripteditor.Controls.Add(this.groupBox9); + this.tabscripteditor.Controls.Add(this.groupBox8); + this.tabscripteditor.Controls.Add(this.groupBox7); + this.tabscripteditor.Controls.Add(this.groupBox6); + this.tabscripteditor.Controls.Add(this.previewgroup); + this.tabscripteditor.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tabscripteditor.Location = new System.Drawing.Point(4, 22); + this.tabscripteditor.Name = "tabscripteditor"; + this.tabscripteditor.Size = new System.Drawing.Size(682, 510); + this.tabscripteditor.TabIndex = 4; + this.tabscripteditor.Text = "Script Editor"; + this.tabscripteditor.UseVisualStyleBackColor = true; // - // snippetsallmanstyle + // groupBox9 // - this.snippetsallmanstyle.AutoSize = true; - this.snippetsallmanstyle.Location = new System.Drawing.Point(202, 187); - this.snippetsallmanstyle.Name = "snippetsallmanstyle"; - this.snippetsallmanstyle.Size = new System.Drawing.Size(172, 17); - this.snippetsallmanstyle.TabIndex = 34; - this.snippetsallmanstyle.Text = "Allman-style bracing in snippets"; - this.toolTip1.SetToolTip(this.snippetsallmanstyle, resources.GetString("snippetsallmanstyle.ToolTip")); - this.snippetsallmanstyle.UseVisualStyleBackColor = true; + this.groupBox9.Controls.Add(this.scriptshowfolding); + this.groupBox9.Controls.Add(this.scriptshowlinenumbers); + this.groupBox9.Location = new System.Drawing.Point(217, 260); + this.groupBox9.Name = "groupBox9"; + this.groupBox9.Size = new System.Drawing.Size(457, 78); + this.groupBox9.TabIndex = 6; + this.groupBox9.TabStop = false; + this.groupBox9.Text = " Appearance "; + // + // scriptshowfolding + // + this.scriptshowfolding.AutoSize = true; + this.scriptshowfolding.Location = new System.Drawing.Point(19, 49); + this.scriptshowfolding.Name = "scriptshowfolding"; + this.scriptshowfolding.Size = new System.Drawing.Size(120, 17); + this.scriptshowfolding.TabIndex = 38; + this.scriptshowfolding.Text = "Enable code folding"; + this.scriptshowfolding.UseVisualStyleBackColor = true; + this.scriptshowfolding.CheckedChanged += new System.EventHandler(this.scriptshowfolding_CheckedChanged); + // + // scriptshowlinenumbers + // + this.scriptshowlinenumbers.AutoSize = true; + this.scriptshowlinenumbers.Location = new System.Drawing.Point(19, 26); + this.scriptshowlinenumbers.Name = "scriptshowlinenumbers"; + this.scriptshowlinenumbers.Size = new System.Drawing.Size(115, 17); + this.scriptshowlinenumbers.TabIndex = 37; + this.scriptshowlinenumbers.Text = "Show line numbers"; + this.scriptshowlinenumbers.UseVisualStyleBackColor = true; + this.scriptshowlinenumbers.CheckedChanged += new System.EventHandler(this.scriptshowlinenumbers_CheckedChanged); + // + // groupBox8 + // + this.groupBox8.Controls.Add(this.scriptautoshowautocompletion); + this.groupBox8.Controls.Add(this.scriptautoclosebrackets); + this.groupBox8.Controls.Add(this.scriptusetabs); + this.groupBox8.Controls.Add(this.scriptallmanstyle); + this.groupBox8.Controls.Add(this.label10); + this.groupBox8.Controls.Add(this.scriptautoindent); + this.groupBox8.Controls.Add(this.scripttabwidth); + this.groupBox8.Location = new System.Drawing.Point(217, 104); + this.groupBox8.Name = "groupBox8"; + this.groupBox8.Size = new System.Drawing.Size(457, 148); + this.groupBox8.TabIndex = 5; + this.groupBox8.TabStop = false; + this.groupBox8.Text = " Formatting "; + // + // scriptautoshowautocompletion + // + this.scriptautoshowautocompletion.AutoSize = true; + this.scriptautoshowautocompletion.Location = new System.Drawing.Point(19, 118); + this.scriptautoshowautocompletion.Name = "scriptautoshowautocompletion"; + this.scriptautoshowautocompletion.Size = new System.Drawing.Size(169, 17); + this.scriptautoshowautocompletion.TabIndex = 37; + this.scriptautoshowautocompletion.Text = "Auto show auto-completion list"; + this.scriptautoshowautocompletion.UseVisualStyleBackColor = true; + // + // scriptautoclosebrackets + // + this.scriptautoclosebrackets.AutoSize = true; + this.scriptautoclosebrackets.Location = new System.Drawing.Point(19, 72); + this.scriptautoclosebrackets.Name = "scriptautoclosebrackets"; + this.scriptautoclosebrackets.Size = new System.Drawing.Size(120, 17); + this.scriptautoclosebrackets.TabIndex = 36; + this.scriptautoclosebrackets.Text = "Auto-close brackets"; + this.toolTip1.SetToolTip(this.scriptautoclosebrackets, "When enabled, the editor will automatically\r\ninsert closing bracket if opening br" + + "acket was typed."); + this.scriptautoclosebrackets.UseVisualStyleBackColor = true; + // + // scriptusetabs + // + this.scriptusetabs.AutoSize = true; + this.scriptusetabs.Location = new System.Drawing.Point(19, 26); + this.scriptusetabs.Name = "scriptusetabs"; + this.scriptusetabs.Size = new System.Drawing.Size(68, 17); + this.scriptusetabs.TabIndex = 35; + this.scriptusetabs.Text = "Use tabs"; + this.scriptusetabs.UseVisualStyleBackColor = true; + // + // scriptallmanstyle + // + this.scriptallmanstyle.AutoSize = true; + this.scriptallmanstyle.Location = new System.Drawing.Point(19, 95); + this.scriptallmanstyle.Name = "scriptallmanstyle"; + this.scriptallmanstyle.Size = new System.Drawing.Size(119, 17); + this.scriptallmanstyle.TabIndex = 34; + this.scriptallmanstyle.Text = "Allman-style bracing"; + this.toolTip1.SetToolTip(this.scriptallmanstyle, resources.GetString("scriptallmanstyle.ToolTip")); + this.scriptallmanstyle.UseVisualStyleBackColor = true; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(121, 27); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(57, 13); + this.label10.TabIndex = 30; + this.label10.Text = "Tab width:"; + // + // scriptautoindent + // + this.scriptautoindent.AutoSize = true; + this.scriptautoindent.Location = new System.Drawing.Point(19, 49); + this.scriptautoindent.Name = "scriptautoindent"; + this.scriptautoindent.Size = new System.Drawing.Size(80, 17); + this.scriptautoindent.TabIndex = 31; + this.scriptautoindent.Text = "Auto indent"; + this.scriptautoindent.UseVisualStyleBackColor = true; // // scripttabwidth // @@ -1738,44 +1849,68 @@ namespace CodeImp.DoomBuilder.Windows this.scripttabwidth.ButtonStepSmall = 0.1F; this.scripttabwidth.ButtonStepsUseModifierKeys = false; this.scripttabwidth.ButtonStepsWrapAround = false; - this.scripttabwidth.Location = new System.Drawing.Point(364, 157); + this.scripttabwidth.Location = new System.Drawing.Point(181, 22); this.scripttabwidth.Name = "scripttabwidth"; this.scripttabwidth.Size = new System.Drawing.Size(71, 24); this.scripttabwidth.StepValues = null; this.scripttabwidth.TabIndex = 32; + this.scripttabwidth.WhenTextChanged += new System.EventHandler(this.scripttabwidth_WhenTextChanged); // - // scriptautoindent + // groupBox7 // - this.scriptautoindent.AutoSize = true; - this.scriptautoindent.Location = new System.Drawing.Point(202, 161); - this.scriptautoindent.Name = "scriptautoindent"; - this.scriptautoindent.Size = new System.Drawing.Size(80, 17); - this.scriptautoindent.TabIndex = 31; - this.scriptautoindent.Text = "Auto indent"; - this.scriptautoindent.UseVisualStyleBackColor = true; + this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox7.Controls.Add(this.label3); + this.groupBox7.Controls.Add(this.scriptfontname); + this.groupBox7.Controls.Add(this.scriptfontbold); + this.groupBox7.Controls.Add(this.label8); + this.groupBox7.Controls.Add(this.scriptfontsize); + this.groupBox7.Location = new System.Drawing.Point(217, 8); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(457, 90); + this.groupBox7.TabIndex = 4; + this.groupBox7.TabStop = false; + this.groupBox7.Text = " Font "; // - // label10 + // label3 // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(304, 162); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(57, 13); - this.label10.TabIndex = 30; - this.label10.Text = "Tab width:"; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(16, 27); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 13); + this.label3.TabIndex = 24; + this.label3.Text = "Font:"; // - // fontpreview + // scriptfontname // - this.fontpreview.Cursor = System.Windows.Forms.Cursors.Arrow; - this.fontpreview.DetectUrls = false; - this.fontpreview.Location = new System.Drawing.Point(202, 70); - this.fontpreview.Name = "fontpreview"; - this.fontpreview.ReadOnly = true; - this.fontpreview.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; - this.fontpreview.Size = new System.Drawing.Size(233, 80); - this.fontpreview.TabIndex = 33; - this.fontpreview.Text = "1 #include \"zcommon.acs\"\n2 script 0 (void) { //a comment\n3 CONSTANT_VALUE;\n" + - "4 }"; - this.fontpreview.WordWrap = false; + this.scriptfontname.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.scriptfontname.FormattingEnabled = true; + this.scriptfontname.Location = new System.Drawing.Point(53, 24); + this.scriptfontname.Name = "scriptfontname"; + this.scriptfontname.Size = new System.Drawing.Size(199, 21); + this.scriptfontname.Sorted = true; + this.scriptfontname.TabIndex = 23; + this.scriptfontname.SelectedIndexChanged += new System.EventHandler(this.scriptfontname_SelectedIndexChanged); + // + // scriptfontbold + // + this.scriptfontbold.AutoSize = true; + this.scriptfontbold.Location = new System.Drawing.Point(165, 56); + this.scriptfontbold.Name = "scriptfontbold"; + this.scriptfontbold.Size = new System.Drawing.Size(47, 17); + this.scriptfontbold.TabIndex = 26; + this.scriptfontbold.Text = "Bold"; + this.scriptfontbold.UseVisualStyleBackColor = true; + this.scriptfontbold.CheckedChanged += new System.EventHandler(this.scriptfontbold_CheckedChanged); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(16, 56); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(30, 13); + this.label8.TabIndex = 28; + this.label8.Text = "Size:"; // // scriptfontsize // @@ -1799,75 +1934,135 @@ namespace CodeImp.DoomBuilder.Windows "36", "48", "72"}); - this.scriptfontsize.Location = new System.Drawing.Point(236, 43); + this.scriptfontsize.Location = new System.Drawing.Point(53, 53); this.scriptfontsize.Name = "scriptfontsize"; this.scriptfontsize.Size = new System.Drawing.Size(94, 21); this.scriptfontsize.TabIndex = 25; this.scriptfontsize.SelectedIndexChanged += new System.EventHandler(this.scriptfontsize_SelectedIndexChanged); // - // label8 + // groupBox6 // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(199, 46); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(30, 13); - this.label8.TabIndex = 28; - this.label8.Text = "Size:"; + this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.groupBox6.Controls.Add(this.colorfoldback); + this.groupBox6.Controls.Add(this.colorfoldfore); + this.groupBox6.Controls.Add(this.colorindicator); + this.groupBox6.Controls.Add(this.colorwhitespace); + this.groupBox6.Controls.Add(this.colorbracebad); + this.groupBox6.Controls.Add(this.colorbrace); + this.groupBox6.Controls.Add(this.colorselectionback); + this.groupBox6.Controls.Add(this.colorselectionfore); + this.groupBox6.Controls.Add(this.colorincludes); + this.groupBox6.Controls.Add(this.colorstrings); + this.groupBox6.Controls.Add(this.colorscriptbackground); + this.groupBox6.Controls.Add(this.colorplaintext); + this.groupBox6.Controls.Add(this.colorcomments); + this.groupBox6.Controls.Add(this.colorlinenumbers); + this.groupBox6.Controls.Add(this.colorkeywords); + this.groupBox6.Controls.Add(this.colorliterals); + this.groupBox6.Controls.Add(this.colorconstants); + this.groupBox6.Location = new System.Drawing.Point(8, 8); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(203, 493); + this.groupBox6.TabIndex = 3; + this.groupBox6.TabStop = false; + this.groupBox6.Text = " Colors "; // - // scriptfontbold + // colorindicator // - this.scriptfontbold.AutoSize = true; - this.scriptfontbold.Location = new System.Drawing.Point(354, 45); - this.scriptfontbold.Name = "scriptfontbold"; - this.scriptfontbold.Size = new System.Drawing.Size(47, 17); - this.scriptfontbold.TabIndex = 26; - this.scriptfontbold.Text = "Bold"; - this.scriptfontbold.UseVisualStyleBackColor = true; - this.scriptfontbold.CheckedChanged += new System.EventHandler(this.scriptfontbold_CheckedChanged); + this.colorindicator.BackColor = System.Drawing.Color.Transparent; + this.colorindicator.Label = "Matching word:"; + this.colorindicator.Location = new System.Drawing.Point(15, 325); + this.colorindicator.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorindicator.MinimumSize = new System.Drawing.Size(100, 23); + this.colorindicator.Name = "colorindicator"; + this.colorindicator.Size = new System.Drawing.Size(168, 23); + this.colorindicator.TabIndex = 14; + this.colorindicator.ColorChanged += new System.EventHandler(this.colorindicator_ColorChanged); // - // scriptfontname + // colorwhitespace // - this.scriptfontname.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.scriptfontname.FormattingEnabled = true; - this.scriptfontname.Location = new System.Drawing.Point(236, 17); - this.scriptfontname.Name = "scriptfontname"; - this.scriptfontname.Size = new System.Drawing.Size(199, 21); - this.scriptfontname.Sorted = true; - this.scriptfontname.TabIndex = 23; - this.scriptfontname.SelectedIndexChanged += new System.EventHandler(this.scriptfontname_SelectedIndexChanged); + this.colorwhitespace.BackColor = System.Drawing.Color.Transparent; + this.colorwhitespace.Label = "Whitespace:"; + this.colorwhitespace.Location = new System.Drawing.Point(15, 409); + this.colorwhitespace.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorwhitespace.MinimumSize = new System.Drawing.Size(100, 23); + this.colorwhitespace.Name = "colorwhitespace"; + this.colorwhitespace.Size = new System.Drawing.Size(168, 23); + this.colorwhitespace.TabIndex = 13; + this.colorwhitespace.ColorChanged += new System.EventHandler(this.colorwhitespace_ColorChanged); // - // label3 + // colorbracebad // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(199, 20); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(31, 13); - this.label3.TabIndex = 24; - this.label3.Text = "Font:"; + this.colorbracebad.BackColor = System.Drawing.Color.Transparent; + this.colorbracebad.Label = "Mismatching brace:"; + this.colorbracebad.Location = new System.Drawing.Point(15, 381); + this.colorbracebad.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorbracebad.MinimumSize = new System.Drawing.Size(100, 23); + this.colorbracebad.Name = "colorbracebad"; + this.colorbracebad.Size = new System.Drawing.Size(168, 23); + this.colorbracebad.TabIndex = 12; + this.colorbracebad.ColorChanged += new System.EventHandler(this.colorbracebad_ColorChanged); // - // colorconstants + // colorbrace // - this.colorconstants.BackColor = System.Drawing.Color.Transparent; - this.colorconstants.Label = "Constants:"; - this.colorconstants.Location = new System.Drawing.Point(15, 179); - this.colorconstants.MaximumSize = new System.Drawing.Size(10000, 23); - this.colorconstants.MinimumSize = new System.Drawing.Size(100, 23); - this.colorconstants.Name = "colorconstants"; - this.colorconstants.Size = new System.Drawing.Size(150, 23); - this.colorconstants.TabIndex = 6; - this.colorconstants.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); + this.colorbrace.BackColor = System.Drawing.Color.Transparent; + this.colorbrace.Label = "Matching brace:"; + this.colorbrace.Location = new System.Drawing.Point(15, 353); + this.colorbrace.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorbrace.MinimumSize = new System.Drawing.Size(100, 23); + this.colorbrace.Name = "colorbrace"; + this.colorbrace.Size = new System.Drawing.Size(168, 23); + this.colorbrace.TabIndex = 11; + this.colorbrace.ColorChanged += new System.EventHandler(this.colorbrace_ColorChanged); // - // colorliterals + // colorselectionback // - this.colorliterals.BackColor = System.Drawing.Color.Transparent; - this.colorliterals.Label = "Literals:"; - this.colorliterals.Location = new System.Drawing.Point(15, 152); - this.colorliterals.MaximumSize = new System.Drawing.Size(10000, 23); - this.colorliterals.MinimumSize = new System.Drawing.Size(100, 23); - this.colorliterals.Name = "colorliterals"; - this.colorliterals.Size = new System.Drawing.Size(150, 23); - this.colorliterals.TabIndex = 5; - this.colorliterals.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); + this.colorselectionback.BackColor = System.Drawing.Color.Transparent; + this.colorselectionback.Label = "Selection BG:"; + this.colorselectionback.Location = new System.Drawing.Point(15, 297); + this.colorselectionback.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorselectionback.MinimumSize = new System.Drawing.Size(100, 23); + this.colorselectionback.Name = "colorselectionback"; + this.colorselectionback.Size = new System.Drawing.Size(168, 23); + this.colorselectionback.TabIndex = 10; + this.colorselectionback.ColorChanged += new System.EventHandler(this.colorselectionback_ColorChanged); + // + // colorselectionfore + // + this.colorselectionfore.BackColor = System.Drawing.Color.Transparent; + this.colorselectionfore.Label = "Selection:"; + this.colorselectionfore.Location = new System.Drawing.Point(15, 269); + this.colorselectionfore.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorselectionfore.MinimumSize = new System.Drawing.Size(100, 23); + this.colorselectionfore.Name = "colorselectionfore"; + this.colorselectionfore.Size = new System.Drawing.Size(168, 23); + this.colorselectionfore.TabIndex = 9; + this.colorselectionfore.ColorChanged += new System.EventHandler(this.colorselectionfore_ColorChanged); + // + // colorincludes + // + this.colorincludes.BackColor = System.Drawing.Color.Transparent; + this.colorincludes.Label = "Includes:"; + this.colorincludes.Location = new System.Drawing.Point(15, 241); + this.colorincludes.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorincludes.MinimumSize = new System.Drawing.Size(100, 23); + this.colorincludes.Name = "colorincludes"; + this.colorincludes.Size = new System.Drawing.Size(168, 23); + this.colorincludes.TabIndex = 8; + this.colorincludes.ColorChanged += new System.EventHandler(this.colorincludes_ColorChanged); + // + // colorstrings + // + this.colorstrings.BackColor = System.Drawing.Color.Transparent; + this.colorstrings.Label = "Strings:"; + this.colorstrings.Location = new System.Drawing.Point(15, 157); + this.colorstrings.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorstrings.MinimumSize = new System.Drawing.Size(100, 23); + this.colorstrings.Name = "colorstrings"; + this.colorstrings.Size = new System.Drawing.Size(168, 23); + this.colorstrings.TabIndex = 7; + this.colorstrings.ColorChanged += new System.EventHandler(this.colorstrings_ColorChanged); // // colorscriptbackground // @@ -1877,57 +2072,100 @@ namespace CodeImp.DoomBuilder.Windows this.colorscriptbackground.MaximumSize = new System.Drawing.Size(10000, 23); this.colorscriptbackground.MinimumSize = new System.Drawing.Size(100, 23); this.colorscriptbackground.Name = "colorscriptbackground"; - this.colorscriptbackground.Size = new System.Drawing.Size(150, 23); + this.colorscriptbackground.Size = new System.Drawing.Size(168, 23); this.colorscriptbackground.TabIndex = 0; - this.colorscriptbackground.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); - // - // colorkeywords - // - this.colorkeywords.BackColor = System.Drawing.Color.Transparent; - this.colorkeywords.Label = "Keywords:"; - this.colorkeywords.Location = new System.Drawing.Point(15, 125); - this.colorkeywords.MaximumSize = new System.Drawing.Size(10000, 23); - this.colorkeywords.MinimumSize = new System.Drawing.Size(100, 23); - this.colorkeywords.Name = "colorkeywords"; - this.colorkeywords.Size = new System.Drawing.Size(150, 23); - this.colorkeywords.TabIndex = 4; - this.colorkeywords.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); - // - // colorlinenumbers - // - this.colorlinenumbers.BackColor = System.Drawing.Color.Transparent; - this.colorlinenumbers.Label = "Line numbers:"; - this.colorlinenumbers.Location = new System.Drawing.Point(15, 44); - this.colorlinenumbers.MaximumSize = new System.Drawing.Size(10000, 23); - this.colorlinenumbers.MinimumSize = new System.Drawing.Size(100, 23); - this.colorlinenumbers.Name = "colorlinenumbers"; - this.colorlinenumbers.Size = new System.Drawing.Size(150, 23); - this.colorlinenumbers.TabIndex = 1; - this.colorlinenumbers.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); - // - // colorcomments - // - this.colorcomments.BackColor = System.Drawing.Color.Transparent; - this.colorcomments.Label = "Comments:"; - this.colorcomments.Location = new System.Drawing.Point(15, 98); - this.colorcomments.MaximumSize = new System.Drawing.Size(10000, 23); - this.colorcomments.MinimumSize = new System.Drawing.Size(100, 23); - this.colorcomments.Name = "colorcomments"; - this.colorcomments.Size = new System.Drawing.Size(150, 23); - this.colorcomments.TabIndex = 3; - this.colorcomments.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); + this.colorscriptbackground.ColorChanged += new System.EventHandler(this.colorscriptbackground_ColorChanged); // // colorplaintext // this.colorplaintext.BackColor = System.Drawing.Color.Transparent; this.colorplaintext.Label = "Plain text:"; - this.colorplaintext.Location = new System.Drawing.Point(15, 71); + this.colorplaintext.Location = new System.Drawing.Point(15, 73); this.colorplaintext.MaximumSize = new System.Drawing.Size(10000, 23); this.colorplaintext.MinimumSize = new System.Drawing.Size(100, 23); this.colorplaintext.Name = "colorplaintext"; - this.colorplaintext.Size = new System.Drawing.Size(150, 23); + this.colorplaintext.Size = new System.Drawing.Size(168, 23); this.colorplaintext.TabIndex = 2; - this.colorplaintext.ColorChanged += new System.EventHandler(this.scriptcolor_ColorChanged); + this.colorplaintext.ColorChanged += new System.EventHandler(this.colorplaintext_ColorChanged); + // + // colorcomments + // + this.colorcomments.BackColor = System.Drawing.Color.Transparent; + this.colorcomments.Label = "Comments:"; + this.colorcomments.Location = new System.Drawing.Point(15, 101); + this.colorcomments.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorcomments.MinimumSize = new System.Drawing.Size(100, 23); + this.colorcomments.Name = "colorcomments"; + this.colorcomments.Size = new System.Drawing.Size(168, 23); + this.colorcomments.TabIndex = 3; + this.colorcomments.ColorChanged += new System.EventHandler(this.colorcomments_ColorChanged); + // + // colorlinenumbers + // + this.colorlinenumbers.BackColor = System.Drawing.Color.Transparent; + this.colorlinenumbers.Label = "Line numbers:"; + this.colorlinenumbers.Location = new System.Drawing.Point(15, 45); + this.colorlinenumbers.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorlinenumbers.MinimumSize = new System.Drawing.Size(100, 23); + this.colorlinenumbers.Name = "colorlinenumbers"; + this.colorlinenumbers.Size = new System.Drawing.Size(168, 23); + this.colorlinenumbers.TabIndex = 1; + this.colorlinenumbers.ColorChanged += new System.EventHandler(this.colorlinenumbers_ColorChanged); + // + // colorkeywords + // + this.colorkeywords.BackColor = System.Drawing.Color.Transparent; + this.colorkeywords.Label = "Keywords:"; + this.colorkeywords.Location = new System.Drawing.Point(15, 129); + this.colorkeywords.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorkeywords.MinimumSize = new System.Drawing.Size(100, 23); + this.colorkeywords.Name = "colorkeywords"; + this.colorkeywords.Size = new System.Drawing.Size(168, 23); + this.colorkeywords.TabIndex = 4; + this.colorkeywords.ColorChanged += new System.EventHandler(this.colorkeywords_ColorChanged); + // + // colorliterals + // + this.colorliterals.BackColor = System.Drawing.Color.Transparent; + this.colorliterals.Label = "Numbers:"; + this.colorliterals.Location = new System.Drawing.Point(15, 185); + this.colorliterals.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorliterals.MinimumSize = new System.Drawing.Size(100, 23); + this.colorliterals.Name = "colorliterals"; + this.colorliterals.Size = new System.Drawing.Size(168, 23); + this.colorliterals.TabIndex = 5; + this.colorliterals.ColorChanged += new System.EventHandler(this.colorliterals_ColorChanged); + // + // colorconstants + // + this.colorconstants.BackColor = System.Drawing.Color.Transparent; + this.colorconstants.Label = "Constants:"; + this.colorconstants.Location = new System.Drawing.Point(15, 213); + this.colorconstants.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorconstants.MinimumSize = new System.Drawing.Size(100, 23); + this.colorconstants.Name = "colorconstants"; + this.colorconstants.Size = new System.Drawing.Size(168, 23); + this.colorconstants.TabIndex = 6; + this.colorconstants.ColorChanged += new System.EventHandler(this.colorconstants_ColorChanged); + // + // previewgroup + // + this.previewgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.previewgroup.Controls.Add(this.scriptedit); + this.previewgroup.Location = new System.Drawing.Point(217, 344); + this.previewgroup.Name = "previewgroup"; + this.previewgroup.Size = new System.Drawing.Size(457, 157); + this.previewgroup.TabIndex = 2; + this.previewgroup.TabStop = false; + this.previewgroup.Text = " Preview "; + // + // scriptedit + // + this.scriptedit.Location = new System.Drawing.Point(6, 19); + this.scriptedit.Name = "scriptedit"; + this.scriptedit.Size = new System.Drawing.Size(445, 132); + this.scriptedit.TabIndex = 0; // // tabnights // @@ -2118,6 +2356,30 @@ namespace CodeImp.DoomBuilder.Windows // browseScreenshotsFolderDialog // this.browseScreenshotsFolderDialog.Description = "Select a Folder to Save Screenshots Into"; + // + // colorfoldfore + // + this.colorfoldfore.BackColor = System.Drawing.Color.Transparent; + this.colorfoldfore.Label = "Fold:"; + this.colorfoldfore.Location = new System.Drawing.Point(15, 437); + this.colorfoldfore.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorfoldfore.MinimumSize = new System.Drawing.Size(100, 23); + this.colorfoldfore.Name = "colorfoldfore"; + this.colorfoldfore.Size = new System.Drawing.Size(168, 23); + this.colorfoldfore.TabIndex = 15; + this.colorfoldfore.ColorChanged += new System.EventHandler(this.colorfoldfore_ColorChanged); + // + // colorfoldback + // + this.colorfoldback.BackColor = System.Drawing.Color.Transparent; + this.colorfoldback.Label = "Fold BG:"; + this.colorfoldback.Location = new System.Drawing.Point(15, 465); + this.colorfoldback.MaximumSize = new System.Drawing.Size(10000, 23); + this.colorfoldback.MinimumSize = new System.Drawing.Size(100, 23); + this.colorfoldback.Name = "colorfoldback"; + this.colorfoldback.Size = new System.Drawing.Size(168, 23); + this.colorfoldback.TabIndex = 16; + this.colorfoldback.ColorChanged += new System.EventHandler(this.colorfoldback_ColorChanged); // // PreferencesForm // @@ -2177,8 +2439,15 @@ namespace CodeImp.DoomBuilder.Windows ((System.ComponentModel.ISupportInitialize)(this.tbDynLightSize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tbDynLightCount)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imagebrightness)).EndInit(); - this.colorsgroup3.ResumeLayout(false); - this.colorsgroup3.PerformLayout(); + this.tabscripteditor.ResumeLayout(false); + this.groupBox9.ResumeLayout(false); + this.groupBox9.PerformLayout(); + this.groupBox8.ResumeLayout(false); + this.groupBox8.PerformLayout(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.previewgroup.ResumeLayout(false); this.tabnights.ResumeLayout(false); this.tabnights.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nightscircleprecision)).EndInit(); @@ -2208,14 +2477,6 @@ namespace CodeImp.DoomBuilder.Windows private CodeImp.DoomBuilder.Controls.ColorControl colorlinedefs; private CodeImp.DoomBuilder.Controls.ColorControl colorvertices; private CodeImp.DoomBuilder.Controls.ColorControl colorbackcolor; - private System.Windows.Forms.GroupBox colorsgroup3; - private CodeImp.DoomBuilder.Controls.ColorControl colorscriptbackground; - private CodeImp.DoomBuilder.Controls.ColorControl colorkeywords; - private CodeImp.DoomBuilder.Controls.ColorControl colorlinenumbers; - private CodeImp.DoomBuilder.Controls.ColorControl colorcomments; - private CodeImp.DoomBuilder.Controls.ColorControl colorplaintext; - private CodeImp.DoomBuilder.Controls.ColorControl colorliterals; - private CodeImp.DoomBuilder.Controls.ColorControl colorconstants; private CodeImp.DoomBuilder.Controls.ColorControl colorindication; private CodeImp.DoomBuilder.Controls.ColorControl colorgrid64; private CodeImp.DoomBuilder.Controls.ColorControl colorgrid; @@ -2267,14 +2528,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Label zoomfactorlabel; private System.Windows.Forms.Label label19; private System.Windows.Forms.GroupBox groupBox5; - private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox scripttabwidth; - private System.Windows.Forms.CheckBox scriptautoindent; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.ComboBox scriptfontsize; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.CheckBox scriptfontbold; - private System.Windows.Forms.ComboBox scriptfontname; - private System.Windows.Forms.Label label3; private System.Windows.Forms.CheckBox scriptontop; private System.Windows.Forms.CheckBox toolbar_script; private System.Windows.Forms.CheckBox toolbar_copy; @@ -2307,12 +2560,10 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Label label24; private CodeImp.DoomBuilder.Controls.ColorControl color3dFloors; private System.Windows.Forms.TextBox actiondescription; - private System.Windows.Forms.RichTextBox fontpreview; private System.Windows.Forms.CheckBox cbMarkExtraFloors; private System.Windows.Forms.TrackBar recentFiles; private System.Windows.Forms.Label labelRecentFiles; private System.Windows.Forms.Label label25; - private System.Windows.Forms.CheckBox snippetsallmanstyle; private System.Windows.Forms.CheckBox capitalizetexturenames; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.Button browsescreenshotsdir; @@ -2341,5 +2592,43 @@ namespace CodeImp.DoomBuilder.Windows private Controls.ColorControl nightscolormare5; private Controls.ColorControl nightscolormare4; private Controls.ColorControl nightscolormare3; + private System.Windows.Forms.TabPage tabscripteditor; + private System.Windows.Forms.GroupBox previewgroup; + private System.Windows.Forms.CheckBox scriptallmanstyle; + private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox scripttabwidth; + private System.Windows.Forms.CheckBox scriptautoindent; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.ComboBox scriptfontsize; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.CheckBox scriptfontbold; + private System.Windows.Forms.ComboBox scriptfontname; + private System.Windows.Forms.Label label3; + private CodeImp.DoomBuilder.Controls.ColorControl colorconstants; + private CodeImp.DoomBuilder.Controls.ColorControl colorliterals; + private CodeImp.DoomBuilder.Controls.ColorControl colorscriptbackground; + private CodeImp.DoomBuilder.Controls.ColorControl colorkeywords; + private CodeImp.DoomBuilder.Controls.ColorControl colorlinenumbers; + private CodeImp.DoomBuilder.Controls.ColorControl colorcomments; + private CodeImp.DoomBuilder.Controls.ColorControl colorplaintext; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.GroupBox groupBox6; + private CodeImp.DoomBuilder.Controls.ColorControl colorstrings; + private System.Windows.Forms.GroupBox groupBox8; + private System.Windows.Forms.CheckBox scriptusetabs; + private CodeImp.DoomBuilder.Controls.ColorControl colorwhitespace; + private CodeImp.DoomBuilder.Controls.ColorControl colorbracebad; + private CodeImp.DoomBuilder.Controls.ColorControl colorbrace; + private CodeImp.DoomBuilder.Controls.ColorControl colorselectionback; + private CodeImp.DoomBuilder.Controls.ColorControl colorselectionfore; + private CodeImp.DoomBuilder.Controls.ColorControl colorincludes; + private System.Windows.Forms.CheckBox scriptautoclosebrackets; + private System.Windows.Forms.GroupBox groupBox9; + private System.Windows.Forms.CheckBox scriptshowfolding; + private System.Windows.Forms.CheckBox scriptshowlinenumbers; + private System.Windows.Forms.CheckBox scriptautoshowautocompletion; + private CodeImp.DoomBuilder.Controls.ColorControl colorindicator; + private CodeImp.DoomBuilder.Controls.ScriptEditorPreviewControl scriptedit; + private CodeImp.DoomBuilder.Controls.ColorControl colorfoldback; + private CodeImp.DoomBuilder.Controls.ColorControl colorfoldfore; } } \ No newline at end of file diff --git a/Source/Core/Windows/PreferencesForm.cs b/Source/Core/Windows/PreferencesForm.cs index e4ede64..c74e6af 100644 --- a/Source/Core/Windows/PreferencesForm.cs +++ b/Source/Core/Windows/PreferencesForm.cs @@ -38,8 +38,8 @@ namespace CodeImp.DoomBuilder.Windows private bool allowapplycontrol; private bool disregardshift; private bool disregardcontrol; - private List actionListItems; //mxd - private List actionListItemsGroupIndices; //mxd + private readonly List actionListItems; //mxd + private readonly List actionListItemsGroupIndices; //mxd private bool reloadresources; @@ -70,11 +70,6 @@ namespace CodeImp.DoomBuilder.Windows vertexScale3D.Value = General.Clamp((int)(General.Settings.GZVertexScale3D * 10), vertexScale3D.Minimum, vertexScale3D.Maximum); //mxd viewdistance.Value = General.Clamp((int)(General.Settings.ViewDistance / 200.0f), viewdistance.Minimum, viewdistance.Maximum); invertyaxis.Checked = General.Settings.InvertYAxis; - scriptfontbold.Checked = General.Settings.ScriptFontBold; - scriptontop.Checked = General.Settings.ScriptOnTop; - scripttabwidth.Text = General.Settings.ScriptTabWidth.ToString(); - scriptautoindent.Checked = General.Settings.ScriptAutoIndent; - snippetsallmanstyle.Checked = General.Settings.SnippetsAllmanStyle; //mxd previewsize.Value = General.Clamp(General.Settings.PreviewImageSize, previewsize.Minimum, previewsize.Maximum); autoscrollspeed.Value = General.Clamp(General.Settings.AutoScrollSpeed, autoscrollspeed.Minimum, autoscrollspeed.Maximum); zoomfactor.Value = General.Clamp(General.Settings.ZoomFactor, zoomfactor.Minimum, zoomfactor.Maximum); @@ -91,6 +86,7 @@ namespace CodeImp.DoomBuilder.Windows toolbar_geometry.Checked = General.Settings.ToolbarGeometry; toolbar_testing.Checked = General.Settings.ToolbarTesting; showtexturesizes.Checked = General.Settings.ShowTextureSizes; + //mxd locatetexturegroup.Checked = General.Settings.LocateTextureGroup; cbStoreEditTab.Checked = General.Settings.StoreSelectedEditTab; @@ -114,10 +110,22 @@ namespace CodeImp.DoomBuilder.Windows screenshotsfolderpath.Text = General.Settings.ScreenshotsPath; if(Directory.Exists(General.Settings.ScreenshotsPath)) browseScreenshotsFolderDialog.SelectedPath = General.Settings.ScreenshotsPath; - - // Fill fonts list - scriptfontname.BeginUpdate(); - foreach(FontFamily ff in FontFamily.Families) + + //mxd. Script editor + scriptfontbold.Checked = General.Settings.ScriptFontBold; + scriptontop.Checked = General.Settings.ScriptOnTop; + scriptusetabs.Checked = General.Settings.ScriptUseTabs; + scripttabwidth.Text = General.Settings.ScriptTabWidth.ToString(); + scriptautoindent.Checked = General.Settings.ScriptAutoIndent; + scriptallmanstyle.Checked = General.Settings.ScriptAllmanStyle; //mxd + scriptautoclosebrackets.Checked = General.Settings.ScriptAutoCloseBrackets; //mxd + scriptshowfolding.Checked = General.Settings.ScriptShowFolding; //mxd + scriptshowlinenumbers.Checked = General.Settings.ScriptShowLineNumbers; //mxd + scriptautoshowautocompletion.Checked = General.Settings.ScriptAutoShowAutocompletion; //mxd + + // Fill script fonts list + scriptfontname.BeginUpdate(); + foreach (FontFamily ff in FontFamily.Families) scriptfontname.Items.Add(ff.Name); scriptfontname.EndUpdate(); @@ -180,6 +188,7 @@ namespace CodeImp.DoomBuilder.Windows colorInfo.Color = General.Colors.InfoLine; color3dFloors.Color = General.Colors.ThreeDFloor; + // Script editor colors colorscriptbackground.Color = General.Colors.ScriptBackground; colorlinenumbers.Color = General.Colors.LineNumbers; colorplaintext.Color = General.Colors.PlainText; @@ -187,7 +196,18 @@ namespace CodeImp.DoomBuilder.Windows colorkeywords.Color = General.Colors.Keywords; colorliterals.Color = General.Colors.Literals; colorconstants.Color = General.Colors.Constants; - blackbrowsers.Checked = General.Settings.BlackBrowsers; + colorstrings.Color = General.Colors.Strings; //mxd + colorincludes.Color = General.Colors.Includes; //mxd + colorselectionfore.Color = General.Colors.ScriptSelectionForeColor; //mxd + colorselectionback.Color = General.Colors.ScriptSelectionBackColor; //mxd + colorindicator.Color = General.Colors.ScriptIndicator; //mxd + colorbrace.Color = General.Colors.ScriptBraceHighlight; //mxd + colorbracebad.Color = General.Colors.ScriptBadBraceHighlight; //mxd + colorwhitespace.Color = General.Colors.ScriptWhitespace; //mxd + colorfoldfore.Color = General.Colors.ScriptFoldForeColor; //mxd + colorfoldback.Color = General.Colors.ScriptFoldBackColor; //mxd + + blackbrowsers.Checked = General.Settings.BlackBrowsers; capitalizetexturenames.Checked = General.Settings.CapitalizeTextureNames; //mxd classicbilinear.Checked = General.Settings.ClassicBilinear; visualbilinear.Checked = General.Settings.VisualBilinear; @@ -204,13 +224,11 @@ namespace CodeImp.DoomBuilder.Windows // Paste options pasteoptions.Setup(General.Settings.PasteOptions.Copy()); - UpdateScriptFontPreview(); //mxd // Allow plugins to add tabs this.SuspendLayout(); - controller = new PreferencesController(this); - controller.AllowAddTab = true; - General.Plugins.OnShowPreferences(controller); + controller = new PreferencesController(this) { AllowAddTab = true }; + General.Plugins.OnShowPreferences(controller); controller.AllowAddTab = false; this.ResumeLayout(true); @@ -250,12 +268,6 @@ namespace CodeImp.DoomBuilder.Windows General.Settings.GZVertexScale3D = vertexScale3D.Value * 0.1f; //mxd General.Settings.ViewDistance = viewdistance.Value * 200.0f; General.Settings.InvertYAxis = invertyaxis.Checked; - General.Settings.ScriptFontBold = scriptfontbold.Checked; - General.Settings.ScriptFontName = scriptfontname.Text; - General.Settings.ScriptOnTop = scriptontop.Checked; - General.Settings.ScriptTabWidth = scripttabwidth.GetResult(General.Settings.ScriptTabWidth); - General.Settings.ScriptAutoIndent = scriptautoindent.Checked; - General.Settings.SnippetsAllmanStyle = snippetsallmanstyle.Checked; //mxd General.Settings.PreviewImageSize = previewsize.Value; General.Settings.AutoScrollSpeed = autoscrollspeed.Value; General.Settings.ZoomFactor = zoomfactor.Value; @@ -279,9 +291,22 @@ namespace CodeImp.DoomBuilder.Windows General.Settings.MaxRecentFiles = recentFiles.Value; //mxd General.Settings.MaxBackups = maxBackups.Value; General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd - - // Script font size - int fontsize; + + // Script settings + General.Settings.ScriptFontBold = scriptfontbold.Checked; + General.Settings.ScriptFontName = scriptfontname.Text; + General.Settings.ScriptOnTop = scriptontop.Checked; + General.Settings.ScriptUseTabs = scriptusetabs.Checked; + General.Settings.ScriptTabWidth = scripttabwidth.GetResult(General.Settings.ScriptTabWidth); + General.Settings.ScriptAutoIndent = scriptautoindent.Checked; + General.Settings.ScriptAllmanStyle = scriptallmanstyle.Checked; //mxd + General.Settings.ScriptAutoCloseBrackets = scriptautoclosebrackets.Checked; //mxd + General.Settings.ScriptShowFolding = scriptshowfolding.Checked; //mxd + General.Settings.ScriptShowLineNumbers = scriptshowlinenumbers.Checked; //mxd + General.Settings.ScriptAutoShowAutocompletion = scriptautoshowautocompletion.Checked; //mxd + + // Script font size + int fontsize; if(!int.TryParse(scriptfontsize.Text, out fontsize)) fontsize = 10; General.Settings.ScriptFontSize = fontsize; @@ -300,15 +325,28 @@ namespace CodeImp.DoomBuilder.Windows General.Colors.Indication = colorindication.Color; General.Colors.Grid = colorgrid.Color; General.Colors.Grid64 = colorgrid64.Color; - General.Colors.ScriptBackground = colorscriptbackground.Color; + + // Script editor colors + General.Colors.ScriptBackground = colorscriptbackground.Color; General.Colors.LineNumbers = colorlinenumbers.Color; General.Colors.PlainText = colorplaintext.Color; General.Colors.Comments = colorcomments.Color; General.Colors.Keywords = colorkeywords.Color; General.Colors.Literals = colorliterals.Color; General.Colors.Constants = colorconstants.Color; - //mxd - General.Colors.ModelWireframe = colorMD3.Color; + General.Colors.Strings = colorstrings.Color; //mxd + General.Colors.Includes = colorincludes.Color; //mxd + General.Colors.ScriptSelectionForeColor = colorselectionfore.Color; //mxd + General.Colors.ScriptSelectionBackColor = colorselectionback.Color; //mxd + General.Colors.ScriptIndicator = colorindicator.Color; //mxd + General.Colors.ScriptBraceHighlight = colorbrace.Color; //mxd + General.Colors.ScriptBadBraceHighlight = colorbracebad.Color; //mxd + General.Colors.ScriptWhitespace = colorwhitespace.Color; //mxd + General.Colors.ScriptFoldForeColor = colorfoldfore.Color; //mxd + General.Colors.ScriptFoldBackColor = colorfoldback.Color; //mxd + + //mxd + General.Colors.ModelWireframe = colorMD3.Color; General.Colors.InfoLine = colorInfo.Color; General.Colors.ThreeDFloor = color3dFloors.Color; @@ -396,8 +434,8 @@ namespace CodeImp.DoomBuilder.Windows } colorsgroup1.Visible = (tabs.SelectedTab == tabcolors); - colorsgroup3.Visible = (tabs.SelectedTab == tabcolors); - } + previewgroup.Visible = (tabs.SelectedTab == tabscripteditor); + } #endregion @@ -469,89 +507,6 @@ namespace CodeImp.DoomBuilder.Windows labelBackups.Text = maxBackups.Value.ToString(); } - // This updates the script font preview label - private void UpdateScriptFontPreview() - { - if((scriptfontname.SelectedIndex > -1) && - (scriptfontsize.SelectedIndex > -1)) - { - FontFamily ff = new FontFamily(scriptfontname.Text); - FontStyle style = FontStyle.Regular; - if(scriptfontbold.Checked) - { - // Prefer bold over regular - if(ff.IsStyleAvailable(FontStyle.Bold)) - style = FontStyle.Bold; - else if(ff.IsStyleAvailable(FontStyle.Regular)) - style = FontStyle.Regular; - else if(ff.IsStyleAvailable(FontStyle.Italic)) - style = FontStyle.Italic; - else if(ff.IsStyleAvailable(FontStyle.Underline)) - style = FontStyle.Underline; - else if(ff.IsStyleAvailable(FontStyle.Strikeout)) - style = FontStyle.Strikeout; - } - else - { - // Prefer regular over bold - if(ff.IsStyleAvailable(FontStyle.Regular)) - style = FontStyle.Regular; - else if(ff.IsStyleAvailable(FontStyle.Bold)) - style = FontStyle.Bold; - else if(ff.IsStyleAvailable(FontStyle.Italic)) - style = FontStyle.Italic; - else if(ff.IsStyleAvailable(FontStyle.Underline)) - style = FontStyle.Underline; - else if(ff.IsStyleAvailable(FontStyle.Strikeout)) - style = FontStyle.Strikeout; - } - int fontsize; - if(!int.TryParse(scriptfontsize.Text, out fontsize)) fontsize = 8; - if(ff.IsStyleAvailable(style)) - fontpreview.Font = new Font(scriptfontname.Text, fontsize, style); //mxd - - //mxd. Update preview colors - fontpreview.BackColor = colorscriptbackground.Color.ToColor(); - fontpreview.ForeColor = colorplaintext.Color.ToColor(); - - //1 - fontpreview.Select(0, 1); - fontpreview.SelectionColor = colorlinenumbers.Color.ToColor(); - - //2 - fontpreview.Select(25, 1); - fontpreview.SelectionColor = colorlinenumbers.Color.ToColor(); - - //script - fontpreview.Select(27, 6); - fontpreview.SelectionColor = colorkeywords.Color.ToColor(); - - //0 - fontpreview.Select(34, 1); - fontpreview.SelectionColor = colorliterals.Color.ToColor(); - - //void - fontpreview.Select(37, 4); - fontpreview.SelectionColor = colorkeywords.Color.ToColor(); - - //a comment - fontpreview.Select(45, 11); - fontpreview.SelectionColor = colorcomments.Color.ToColor(); - - //3 - fontpreview.Select(57, 1); - fontpreview.SelectionColor = colorlinenumbers.Color.ToColor(); - - //CONSTANT_VALUE - fontpreview.Select(65, 14); - fontpreview.SelectionColor = colorconstants.Color.ToColor(); - - //4 - fontpreview.Select(81, 1); - fontpreview.SelectionColor = colorlinenumbers.Color.ToColor(); - } - } - #endregion #region ================== Controls Panel @@ -574,8 +529,8 @@ namespace CodeImp.DoomBuilder.Windows // Don't count the selected action if(item != listactions.SelectedItems[0]) { - Actions.Action a = General.Actions[item.Name]; - int akey = (int)item.SubItems[1].Tag; + Action a = General.Actions[item.Name]; + int akey = (int)item.SubItems[1].Tag; // Check if the key combination matches if((thiskey & a.ShortcutMask) == (akey & a.ShortcutMask)) @@ -600,10 +555,10 @@ namespace CodeImp.DoomBuilder.Windows keyusedlist.Visible = true; } } - - // This fills the list of available controls for the specified action - private void FillControlsList(Actions.Action a) - { + + // This fills the list of available controls for the specified action + private void FillControlsList(Action a) + { actioncontrol.Items.Clear(); // Fill combobox with special controls @@ -837,14 +792,14 @@ namespace CodeImp.DoomBuilder.Windows // Deselect anything from the combobox actioncontrol.SelectedIndex = -1; - - // Apply the key combination - listactions.SelectedItems[0].SubItems[1].Text = Actions.Action.GetShortcutKeyDesc(key); - listactions.SelectedItems[0].SubItems[1].Tag = key; - actionkey.Text = Actions.Action.GetShortcutKeyDesc(key); - - // Show actions with same key - UpdateKeyUsedActions(); + + // Apply the key combination + listactions.SelectedItems[0].SubItems[1].Text = Action.GetShortcutKeyDesc(key); + listactions.SelectedItems[0].SubItems[1].Tag = key; + actionkey.Text = Action.GetShortcutKeyDesc(key); + + // Show actions with same key + UpdateKeyUsedActions(); // Done allowapplycontrol = true; @@ -869,9 +824,9 @@ namespace CodeImp.DoomBuilder.Windows // Get the key control KeyControl key = (KeyControl)actioncontrol.SelectedItem; - // Apply the key combination - listactions.SelectedItems[0].SubItems[1].Text = Actions.Action.GetShortcutKeyDesc(key.key); - listactions.SelectedItems[0].SubItems[1].Tag = key.key; + // Apply the key combination + listactions.SelectedItems[0].SubItems[1].Text = Action.GetShortcutKeyDesc(key.key); + listactions.SelectedItems[0].SubItems[1].Tag = key.key; // Show actions with same key UpdateKeyUsedActions(); @@ -1001,35 +956,141 @@ namespace CodeImp.DoomBuilder.Windows labelDynLightIntensity.Text = ((float)tbDynLightIntensity.Value / 10).ToString(); } - //mxd - private void scriptfontbold_CheckedChanged(object sender, EventArgs e) - { - UpdateScriptFontPreview(); - } + #endregion + + #region ================== Script Editor Panel (mxd) + + private void scriptfontbold_CheckedChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.FontBold = scriptfontbold.Checked; + } //mxd private void scriptfontsize_SelectedIndexChanged(object sender, EventArgs e) { - UpdateScriptFontPreview(); - } + if (allowapplycontrol) + { + int fontsize; + if (int.TryParse(scriptfontsize.Text, out fontsize)) + scriptedit.FontSize = fontsize; + } + } + + private void scripttabwidth_WhenTextChanged(object sender, EventArgs e) + { + if (allowapplycontrol) + { + int tabwidth; + if (int.TryParse(scripttabwidth.Text, out tabwidth)) + scriptedit.TabWidth = tabwidth; + } + } - //mxd - private void scriptfontname_SelectedIndexChanged(object sender, EventArgs e) - { - UpdateScriptFontPreview(); - } + private void scriptfontname_SelectedIndexChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.FontName = scriptfontname.Text; + } - //mxd - private void scriptcolor_ColorChanged(object sender, EventArgs e) - { - UpdateScriptFontPreview(); - } + private void scriptshowlinenumbers_CheckedChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.ShowLineNumbers = scriptshowlinenumbers.Checked; + } - #endregion + private void scriptshowfolding_CheckedChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.ShowFolding = scriptshowfolding.Checked; + } - #region ================== Screenshots Stuff (mxd) + private void colorscriptbackground_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.ScriptBackground = colorscriptbackground.Color.ToColor(); + } - private void resetscreenshotsdir_Click(object sender, EventArgs e) + private void colorlinenumbers_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.LineNumbers = colorlinenumbers.Color.ToColor(); + } + + private void colorplaintext_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.PlainText = colorplaintext.Color.ToColor(); + } + + private void colorcomments_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.Comments = colorcomments.Color.ToColor(); + } + + private void colorkeywords_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.Keywords = colorkeywords.Color.ToColor(); + } + + private void colorstrings_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.Strings = colorstrings.Color.ToColor(); + } + + private void colorliterals_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.Literals = colorliterals.Color.ToColor(); + } + + private void colorconstants_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.Constants = colorconstants.Color.ToColor(); + } + + private void colorincludes_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.Includes = colorincludes.Color.ToColor(); + } + + private void colorselectionfore_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.SelectionForeColor = colorselectionfore.Color.ToColor(); + } + + private void colorselectionback_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.SelectionBackColor = colorselectionback.Color.ToColor(); + } + + private void colorindicator_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.ScriptIndicator = colorindicator.Color.ToColor(); + } + + private void colorbrace_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.BraceHighlight = colorbrace.Color.ToColor(); + } + + private void colorbracebad_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.BadBraceHighlight = colorbracebad.Color.ToColor(); + } + + private void colorwhitespace_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.WhitespaceColor = colorwhitespace.Color.ToColor(); + } + + private void colorfoldfore_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.FoldForeColor = colorfoldfore.Color.ToColor(); + } + + private void colorfoldback_ColorChanged(object sender, EventArgs e) + { + if (allowapplycontrol) scriptedit.FoldBackColor = colorfoldback.Color.ToColor(); + } + + #endregion + + #region ================== Screenshots Stuff (mxd) + + private void resetscreenshotsdir_Click(object sender, EventArgs e) { screenshotsfolderpath.Text = General.DefaultScreenshotsPath; browseScreenshotsFolderDialog.SelectedPath = General.DefaultScreenshotsPath; diff --git a/Source/Core/Windows/PreferencesForm.resx b/Source/Core/Windows/PreferencesForm.resx index 117f9d0..d255bf4 100644 --- a/Source/Core/Windows/PreferencesForm.resx +++ b/Source/Core/Windows/PreferencesForm.resx @@ -144,15 +144,19 @@ False - + + 17, 17 + + When enabled, the opening brace -will be placed on a new line. +will be placed on a new line when +inserting a snippet or reformatting +the text. Technical side: when enabled, $LB markers in snippets will be replaced with newline characters, otherwise -they will be replaced with spaces - +they will be replaced with tabs/spaces. 114, 17