Preferences: added 2 Script Editor color presets.

This commit is contained in:
MaxED 2016-01-29 14:54:55 +00:00
parent e29eef320c
commit 0bb521cc67
4 changed files with 167 additions and 40 deletions

View file

@ -75,7 +75,14 @@ namespace CodeImp.DoomBuilder.Controls
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 WhitespaceColor
{
set
{
scriptedit.SetWhitespaceForeColor(true, value);
scriptedit.SetWhitespaceBackColor(false, value); // Otherwise selection back color won't be applied correctly...
}
}
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(); } }

View file

@ -189,7 +189,7 @@ namespace CodeImp.DoomBuilder.Rendering
if(colors[COMMENTS].ToInt() == 0) colors[COMMENTS] = PixelColor.FromInt(-16744448);
if(colors[KEYWORDS].ToInt() == 0) colors[KEYWORDS] = PixelColor.FromInt(-16741493);
if(colors[LITERALS].ToInt() == 0) colors[LITERALS] = PixelColor.FromInt(-16776961);
if(colors[CONSTANTS].ToInt() == 0) colors[CONSTANTS] = PixelColor.FromInt(-12566273);
if(colors[CONSTANTS].ToInt() == 0) colors[CONSTANTS] = PixelColor.FromInt(-16744256);
// Set new thing colors
if(colors[THINGCOLOR00].ToInt() == 0) colors[THINGCOLOR00] = PixelColor.FromColor(Color.DimGray);
@ -223,8 +223,8 @@ namespace CodeImp.DoomBuilder.Rendering
if(colors[SCRIPTSELECTIONBACK].ToInt() == 0) colors[SCRIPTSELECTIONBACK] = PixelColor.FromInt(-13395457);
if(colors[STRINGS].ToInt() == 0) colors[STRINGS] = PixelColor.FromInt(-6089451);
if(colors[INCLUDES].ToInt() == 0) colors[INCLUDES] = PixelColor.FromInt(-9868951);
if(colors[SCRIPTFOLDFORE].ToInt() == 0) colors[SCRIPTFOLDFORE] = PixelColor.FromColor(SystemColors.ControlLightLight);
if(colors[SCRIPTFOLDBACK].ToInt() == 0) colors[SCRIPTFOLDBACK] = PixelColor.FromColor(SystemColors.ControlDark);
if(colors[SCRIPTFOLDFORE].ToInt() == 0) colors[SCRIPTFOLDFORE] = PixelColor.FromColor(SystemColors.ControlDark);
if(colors[SCRIPTFOLDBACK].ToInt() == 0) colors[SCRIPTFOLDBACK] = PixelColor.FromColor(SystemColors.ControlLightLight);
// Create assist colors
CreateAssistColors();

View file

@ -171,6 +171,8 @@ namespace CodeImp.DoomBuilder.Windows
this.label8 = new System.Windows.Forms.Label();
this.scriptfontsize = new System.Windows.Forms.ComboBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.colorfoldback = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorfoldfore = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorindicator = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorwhitespace = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorbracebad = new CodeImp.DoomBuilder.Controls.ColorControl();
@ -193,8 +195,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();
this.scriptcolorpresets = new System.Windows.Forms.ComboBox();
this.label23 = new System.Windows.Forms.Label();
label7 = new System.Windows.Forms.Label();
label6 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
@ -1875,6 +1877,8 @@ namespace CodeImp.DoomBuilder.Windows
//
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.label23);
this.groupBox6.Controls.Add(this.scriptcolorpresets);
this.groupBox6.Controls.Add(this.colorfoldback);
this.groupBox6.Controls.Add(this.colorfoldfore);
this.groupBox6.Controls.Add(this.colorindicator);
@ -1899,11 +1903,35 @@ namespace CodeImp.DoomBuilder.Windows
this.groupBox6.TabStop = false;
this.groupBox6.Text = " Colors ";
//
// colorfoldback
//
this.colorfoldback.BackColor = System.Drawing.Color.Transparent;
this.colorfoldback.Label = "Fold BG:";
this.colorfoldback.Location = new System.Drawing.Point(15, 461);
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);
//
// colorfoldfore
//
this.colorfoldfore.BackColor = System.Drawing.Color.Transparent;
this.colorfoldfore.Label = "Fold:";
this.colorfoldfore.Location = new System.Drawing.Point(15, 435);
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);
//
// colorindicator
//
this.colorindicator.BackColor = System.Drawing.Color.Transparent;
this.colorindicator.Label = "Matching word:";
this.colorindicator.Location = new System.Drawing.Point(15, 325);
this.colorindicator.Location = new System.Drawing.Point(15, 331);
this.colorindicator.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorindicator.MinimumSize = new System.Drawing.Size(100, 23);
this.colorindicator.Name = "colorindicator";
@ -1927,7 +1955,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorbracebad.BackColor = System.Drawing.Color.Transparent;
this.colorbracebad.Label = "Mismatching brace:";
this.colorbracebad.Location = new System.Drawing.Point(15, 381);
this.colorbracebad.Location = new System.Drawing.Point(15, 383);
this.colorbracebad.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorbracebad.MinimumSize = new System.Drawing.Size(100, 23);
this.colorbracebad.Name = "colorbracebad";
@ -1939,7 +1967,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorbrace.BackColor = System.Drawing.Color.Transparent;
this.colorbrace.Label = "Matching brace:";
this.colorbrace.Location = new System.Drawing.Point(15, 353);
this.colorbrace.Location = new System.Drawing.Point(15, 357);
this.colorbrace.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorbrace.MinimumSize = new System.Drawing.Size(100, 23);
this.colorbrace.Name = "colorbrace";
@ -1951,7 +1979,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorselectionback.BackColor = System.Drawing.Color.Transparent;
this.colorselectionback.Label = "Selection BG:";
this.colorselectionback.Location = new System.Drawing.Point(15, 297);
this.colorselectionback.Location = new System.Drawing.Point(15, 305);
this.colorselectionback.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorselectionback.MinimumSize = new System.Drawing.Size(100, 23);
this.colorselectionback.Name = "colorselectionback";
@ -1963,7 +1991,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorselectionfore.BackColor = System.Drawing.Color.Transparent;
this.colorselectionfore.Label = "Selection:";
this.colorselectionfore.Location = new System.Drawing.Point(15, 269);
this.colorselectionfore.Location = new System.Drawing.Point(15, 279);
this.colorselectionfore.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorselectionfore.MinimumSize = new System.Drawing.Size(100, 23);
this.colorselectionfore.Name = "colorselectionfore";
@ -1975,7 +2003,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorincludes.BackColor = System.Drawing.Color.Transparent;
this.colorincludes.Label = "Includes:";
this.colorincludes.Location = new System.Drawing.Point(15, 241);
this.colorincludes.Location = new System.Drawing.Point(15, 253);
this.colorincludes.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorincludes.MinimumSize = new System.Drawing.Size(100, 23);
this.colorincludes.Name = "colorincludes";
@ -1987,7 +2015,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorstrings.BackColor = System.Drawing.Color.Transparent;
this.colorstrings.Label = "Strings:";
this.colorstrings.Location = new System.Drawing.Point(15, 157);
this.colorstrings.Location = new System.Drawing.Point(15, 175);
this.colorstrings.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorstrings.MinimumSize = new System.Drawing.Size(100, 23);
this.colorstrings.Name = "colorstrings";
@ -1999,7 +2027,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorscriptbackground.BackColor = System.Drawing.Color.Transparent;
this.colorscriptbackground.Label = "Background:";
this.colorscriptbackground.Location = new System.Drawing.Point(15, 17);
this.colorscriptbackground.Location = new System.Drawing.Point(15, 45);
this.colorscriptbackground.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorscriptbackground.MinimumSize = new System.Drawing.Size(100, 23);
this.colorscriptbackground.Name = "colorscriptbackground";
@ -2011,7 +2039,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorplaintext.BackColor = System.Drawing.Color.Transparent;
this.colorplaintext.Label = "Plain text:";
this.colorplaintext.Location = new System.Drawing.Point(15, 73);
this.colorplaintext.Location = new System.Drawing.Point(15, 97);
this.colorplaintext.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorplaintext.MinimumSize = new System.Drawing.Size(100, 23);
this.colorplaintext.Name = "colorplaintext";
@ -2023,7 +2051,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorcomments.BackColor = System.Drawing.Color.Transparent;
this.colorcomments.Label = "Comments:";
this.colorcomments.Location = new System.Drawing.Point(15, 101);
this.colorcomments.Location = new System.Drawing.Point(15, 123);
this.colorcomments.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorcomments.MinimumSize = new System.Drawing.Size(100, 23);
this.colorcomments.Name = "colorcomments";
@ -2035,7 +2063,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorlinenumbers.BackColor = System.Drawing.Color.Transparent;
this.colorlinenumbers.Label = "Line numbers:";
this.colorlinenumbers.Location = new System.Drawing.Point(15, 45);
this.colorlinenumbers.Location = new System.Drawing.Point(15, 71);
this.colorlinenumbers.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorlinenumbers.MinimumSize = new System.Drawing.Size(100, 23);
this.colorlinenumbers.Name = "colorlinenumbers";
@ -2047,7 +2075,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorkeywords.BackColor = System.Drawing.Color.Transparent;
this.colorkeywords.Label = "Keywords:";
this.colorkeywords.Location = new System.Drawing.Point(15, 129);
this.colorkeywords.Location = new System.Drawing.Point(15, 149);
this.colorkeywords.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorkeywords.MinimumSize = new System.Drawing.Size(100, 23);
this.colorkeywords.Name = "colorkeywords";
@ -2059,7 +2087,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorliterals.BackColor = System.Drawing.Color.Transparent;
this.colorliterals.Label = "Numbers:";
this.colorliterals.Location = new System.Drawing.Point(15, 185);
this.colorliterals.Location = new System.Drawing.Point(15, 201);
this.colorliterals.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorliterals.MinimumSize = new System.Drawing.Size(100, 23);
this.colorliterals.Name = "colorliterals";
@ -2071,7 +2099,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.colorconstants.BackColor = System.Drawing.Color.Transparent;
this.colorconstants.Label = "Constants:";
this.colorconstants.Location = new System.Drawing.Point(15, 213);
this.colorconstants.Location = new System.Drawing.Point(15, 227);
this.colorconstants.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorconstants.MinimumSize = new System.Drawing.Size(100, 23);
this.colorconstants.Name = "colorconstants";
@ -2137,29 +2165,28 @@ namespace CodeImp.DoomBuilder.Windows
//
this.browseScreenshotsFolderDialog.Description = "Select a Folder to Save Screenshots Into";
//
// colorfoldfore
// scriptcolorpresets
//
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);
this.scriptcolorpresets.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.scriptcolorpresets.FormattingEnabled = true;
this.scriptcolorpresets.Items.AddRange(new object[] {
"Use current settings",
"Light theme",
"Dark theme"});
this.scriptcolorpresets.Location = new System.Drawing.Point(61, 18);
this.scriptcolorpresets.Name = "scriptcolorpresets";
this.scriptcolorpresets.Size = new System.Drawing.Size(122, 21);
this.scriptcolorpresets.TabIndex = 39;
this.scriptcolorpresets.SelectedIndexChanged += new System.EventHandler(this.scriptcolorpresets_SelectedIndexChanged);
//
// colorfoldback
// label23
//
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);
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(15, 22);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(40, 13);
this.label23.TabIndex = 40;
this.label23.Text = "Preset:";
//
// PreferencesForm
//
@ -2226,6 +2253,7 @@ namespace CodeImp.DoomBuilder.Windows
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.previewgroup.ResumeLayout(false);
this.tabpasting.ResumeLayout(false);
this.ResumeLayout(false);
@ -2390,5 +2418,7 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.Controls.ScriptEditorPreviewControl scriptedit;
private CodeImp.DoomBuilder.Controls.ColorControl colorfoldback;
private CodeImp.DoomBuilder.Controls.ColorControl colorfoldfore;
private System.Windows.Forms.ComboBox scriptcolorpresets;
private System.Windows.Forms.Label label23;
}
}

View file

@ -24,6 +24,7 @@ using CodeImp.DoomBuilder.Actions;
using System.Globalization;
using CodeImp.DoomBuilder.Data;
using System.IO;
using CodeImp.DoomBuilder.Rendering;
using Action = CodeImp.DoomBuilder.Actions.Action;
#endregion
@ -204,6 +205,9 @@ namespace CodeImp.DoomBuilder.Windows
colorfoldfore.Color = General.Colors.ScriptFoldForeColor; //mxd
colorfoldback.Color = General.Colors.ScriptFoldBackColor; //mxd
//mxd. Select "Current colors" preset
scriptcolorpresets.SelectedIndex = 0;
blackbrowsers.Checked = General.Settings.BlackBrowsers;
capitalizetexturenames.Checked = General.Settings.CapitalizeTextureNames; //mxd
classicbilinear.Checked = General.Settings.ClassicBilinear;
@ -1050,6 +1054,92 @@ namespace CodeImp.DoomBuilder.Windows
if(allowapplycontrol) scriptedit.FoldBackColor = colorfoldback.Color.ToColor();
}
private void scriptcolorpresets_SelectedIndexChanged(object sender, EventArgs e)
{
if(!allowapplycontrol) return;
switch(scriptcolorpresets.SelectedIndex)
{
case 0: // Restore current colors
colorscriptbackground.Color = General.Colors.ScriptBackground;
colorlinenumbers.Color = General.Colors.LineNumbers;
colorplaintext.Color = General.Colors.PlainText;
colorcomments.Color = General.Colors.Comments;
colorkeywords.Color = General.Colors.Keywords;
colorliterals.Color = General.Colors.Literals;
colorconstants.Color = General.Colors.Constants;
colorstrings.Color = General.Colors.Strings;
colorincludes.Color = General.Colors.Includes;
colorindicator.Color = General.Colors.ScriptIndicator;
colorbrace.Color = General.Colors.ScriptBraceHighlight;
colorbracebad.Color = General.Colors.ScriptBadBraceHighlight;
colorwhitespace.Color = General.Colors.ScriptWhitespace;
colorfoldfore.Color = General.Colors.ScriptFoldForeColor;
colorfoldback.Color = General.Colors.ScriptFoldBackColor;
colorselectionfore.Color = General.Colors.ScriptSelectionForeColor;
colorselectionback.Color = General.Colors.ScriptSelectionBackColor;
break;
case 1: // Light theme
colorlinenumbers.Color = PixelColor.FromInt(-13921873);
colorplaintext.Color = PixelColor.FromInt(-16777216);
colorcomments.Color = PixelColor.FromInt(-16744448);
colorkeywords.Color = PixelColor.FromInt(-16741493);
colorliterals.Color = PixelColor.FromInt(-16776961);
colorconstants.Color = PixelColor.FromInt(-16744256);
colorstrings.Color = PixelColor.FromInt(-6089451);
colorincludes.Color = PixelColor.FromInt(-9868951);
colorindicator.Color = PixelColor.FromInt(-16711936);
colorbrace.Color = PixelColor.FromInt(-16711681);
colorbracebad.Color = PixelColor.FromInt(-65536);
colorwhitespace.Color = PixelColor.FromInt(-8355712);
colorfoldfore.Color = PixelColor.FromColor(SystemColors.ControlDark);
colorfoldback.Color = PixelColor.FromColor(SystemColors.ControlLightLight);
colorselectionfore.Color = PixelColor.FromInt(-1);
colorselectionback.Color = PixelColor.FromInt(-13395457);
colorscriptbackground.Color = PixelColor.FromInt(-1);
break;
case 2: // Dark theme
colorscriptbackground.Color = new PixelColor(255, 34, 40, 42);
colorlinenumbers.Color = new PixelColor(255, 63, 78, 73);
colorplaintext.Color = new PixelColor(255, 241, 242, 243);
colorcomments.Color = new PixelColor(255, 102, 116, 123);
colorkeywords.Color = new PixelColor(255, 103, 140, 177);
colorliterals.Color = new PixelColor(255, 255, 205, 34);
colorconstants.Color = new PixelColor(255, 147, 199, 99);
colorstrings.Color = new PixelColor(255, 236, 118, 0);
colorincludes.Color = new PixelColor(255, 160, 130, 189);
colorindicator.Color = new PixelColor(255, 211, 209, 85);
colorbrace.Color = new PixelColor(255, 135, 211, 85);
colorbracebad.Color = new PixelColor(255, 150, 58, 70);
colorwhitespace.Color = new PixelColor(255, 241, 242, 243);
colorfoldfore.Color = new PixelColor(255, 37, 92, 111);
colorfoldback.Color = new PixelColor(255, 41, 49, 52);
colorselectionfore.Color = new PixelColor(255, 255, 255, 255);
colorselectionback.Color = new PixelColor(255, 71, 71, 71);
break;
}
// Apply changes
scriptedit.ScriptBackground = colorscriptbackground.Color.ToColor();
scriptedit.LineNumbers = colorlinenumbers.Color.ToColor();
scriptedit.PlainText = colorplaintext.Color.ToColor();
scriptedit.Comments = colorcomments.Color.ToColor();
scriptedit.Keywords = colorkeywords.Color.ToColor();
scriptedit.Strings = colorstrings.Color.ToColor();
scriptedit.Literals = colorliterals.Color.ToColor();
scriptedit.Constants = colorconstants.Color.ToColor();
scriptedit.Includes = colorincludes.Color.ToColor();
scriptedit.SelectionForeColor = colorselectionfore.Color.ToColor();
scriptedit.SelectionBackColor = colorselectionback.Color.ToColor();
scriptedit.ScriptIndicator = colorindicator.Color.ToColor();
scriptedit.BraceHighlight = colorbrace.Color.ToColor();
scriptedit.BadBraceHighlight = colorbracebad.Color.ToColor();
scriptedit.WhitespaceColor = colorwhitespace.Color.ToColor();
scriptedit.FoldForeColor = colorfoldfore.Color.ToColor();
scriptedit.FoldBackColor = colorfoldback.Color.ToColor();
}
#endregion
#region ================== Screenshots Stuff (mxd)