working on script editor

This commit is contained in:
codeimp 2008-10-30 23:03:49 +00:00
parent 4f7aaeaa53
commit 665cfb52dc
5 changed files with 160 additions and 85 deletions

View file

@ -28,17 +28,131 @@ namespace CodeImp.DoomBuilder.Controls
/// </summary>
private void InitializeComponent()
{
this.functionslist = new System.Windows.Forms.ComboBox();
this.scriptedit = new CodeImp.DoomBuilder.Controls.ScriptEditControl();
this.scriptpanel = new System.Windows.Forms.Panel();
this.scriptpanel.SuspendLayout();
this.SuspendLayout();
//
// functionslist
//
this.functionslist.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.functionslist.FormattingEnabled = true;
this.functionslist.Items.AddRange(new object[] {
"Function1",
"Function2",
"Function3"});
this.functionslist.Location = new System.Drawing.Point(0, 0);
this.functionslist.Name = "functionslist";
this.functionslist.Size = new System.Drawing.Size(474, 21);
this.functionslist.TabIndex = 1;
//
// scriptedit
//
this.scriptedit.AnchorPosition = 0;
this.scriptedit.AutoCSeparator = 0;
this.scriptedit.AutoCTypeSeparator = 0;
this.scriptedit.BackColor = System.Drawing.SystemColors.Window;
this.scriptedit.CaretFore = 0;
this.scriptedit.CaretLineBack = 0;
this.scriptedit.CaretPeriod = 0;
this.scriptedit.CaretWidth = 0;
this.scriptedit.CodePage = 0;
this.scriptedit.ControlCharSymbol = 0;
this.scriptedit.CurrentPos = 0;
this.scriptedit.CursorType = 0;
this.scriptedit.Dock = System.Windows.Forms.DockStyle.Fill;
this.scriptedit.DocPointer = 0;
this.scriptedit.EdgeColour = 0;
this.scriptedit.EdgeColumn = 0;
this.scriptedit.EdgeMode = 0;
this.scriptedit.EndAtLastLine = 0;
this.scriptedit.EndOfLineMode = CodeImp.DoomBuilder.Controls.ScriptEndOfLine.CRLF;
this.scriptedit.EOLMode = 0;
this.scriptedit.HighlightGuide = 0;
this.scriptedit.Indent = 0;
this.scriptedit.IsAutoCGetAutoHide = false;
this.scriptedit.IsAutoCGetCancelAtStart = false;
this.scriptedit.IsAutoCGetChooseSingle = false;
this.scriptedit.IsAutoCGetDropRestOfWord = false;
this.scriptedit.IsAutoCGetIgnoreCase = false;
this.scriptedit.IsBackSpaceUnIndents = false;
this.scriptedit.IsBufferedDraw = false;
this.scriptedit.IsCaretLineVisible = false;
this.scriptedit.IsFocus = false;
this.scriptedit.IsHScrollBar = false;
this.scriptedit.IsIndentationGuides = false;
this.scriptedit.IsMouseDownCaptures = false;
this.scriptedit.IsOvertype = false;
this.scriptedit.IsReadOnly = false;
this.scriptedit.IsTabIndents = false;
this.scriptedit.IsTwoPhaseDraw = false;
this.scriptedit.IsUndoCollection = false;
this.scriptedit.IsUsePalette = false;
this.scriptedit.IsUseTabs = false;
this.scriptedit.IsViewEOL = false;
this.scriptedit.IsVScrollBar = false;
this.scriptedit.LayoutCache = 0;
this.scriptedit.Lexer = 0;
this.scriptedit.Location = new System.Drawing.Point(0, 0);
this.scriptedit.MarginLeft = 0;
this.scriptedit.MarginRight = 0;
this.scriptedit.ModEventMask = 0;
this.scriptedit.MouseDwellTime = 0;
this.scriptedit.Name = "scriptedit";
this.scriptedit.PrintColourMode = 0;
this.scriptedit.PrintMagnification = 0;
this.scriptedit.PrintWrapMode = 0;
this.scriptedit.ScrollWidth = 0;
this.scriptedit.SearchFlags = 0;
this.scriptedit.SelectionEnd = 0;
this.scriptedit.SelectionMode = 0;
this.scriptedit.SelectionStart = 0;
this.scriptedit.Size = new System.Drawing.Size(470, 377);
this.scriptedit.Status = 0;
this.scriptedit.StyleBits = 0;
this.scriptedit.TabIndex = 0;
this.scriptedit.TabWidth = 0;
this.scriptedit.TargetEnd = 0;
this.scriptedit.TargetStart = 0;
this.scriptedit.ViewWhitespace = CodeImp.DoomBuilder.Controls.ScriptWhiteSpace.Invisible;
this.scriptedit.ViewWS = 0;
this.scriptedit.WrapMode = 0;
this.scriptedit.WrapStartIndent = 0;
this.scriptedit.WrapVisualFlags = 0;
this.scriptedit.WrapVisualFlagsLocation = 0;
this.scriptedit.XOffset = 0;
this.scriptedit.ZoomLevel = 0;
//
// scriptpanel
//
this.scriptpanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.scriptpanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.scriptpanel.Controls.Add(this.scriptedit);
this.scriptpanel.Location = new System.Drawing.Point(0, 27);
this.scriptpanel.Name = "scriptpanel";
this.scriptpanel.Size = new System.Drawing.Size(474, 381);
this.scriptpanel.TabIndex = 2;
//
// BuilderScriptControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.scriptpanel);
this.Controls.Add(this.functionslist);
this.Name = "BuilderScriptControl";
this.Size = new System.Drawing.Size(327, 234);
this.Size = new System.Drawing.Size(474, 408);
this.scriptpanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private ScriptEditControl scriptedit;
private System.Windows.Forms.ComboBox functionslist;
private System.Windows.Forms.Panel scriptpanel;
}
}

View file

@ -54,6 +54,26 @@ namespace CodeImp.DoomBuilder.Controls
{
// Initialize
InitializeComponent();
// Script editor properties
scriptedit.IsBackSpaceUnIndents = true;
scriptedit.IsBufferedDraw = true;
scriptedit.SetFoldFlags((int)ScriptFoldFlag.Box);
scriptedit.IsUseTabs = true;
scriptedit.IsViewEOL = false;
scriptedit.IsVScrollBar = true;
scriptedit.IsHScrollBar = true;
scriptedit.IsCaretLineVisible = false;
scriptedit.IsIndentationGuides = true;
scriptedit.IsMouseDownCaptures = true;
scriptedit.IsTabIndents = true;
scriptedit.IsUndoCollection = true;
scriptedit.EndOfLineMode = ScriptEndOfLine.CRLF;
scriptedit.EndAtLastLine = 1;
scriptedit.SetMarginWidthN(0, 16);
scriptedit.SetMarginTypeN(0, (int)ScriptMarginType.Symbol);
scriptedit.SetMarginWidthN(1, 42);
scriptedit.SetMarginTypeN(1, (int)ScriptMarginType.Number);
}
#endregion

View file

@ -2201,7 +2201,8 @@ namespace CodeImp.DoomBuilder.Controls
base.OnResize(e);
// Resize control
General.SetWindowPos(controlptr, 0, base.Location.X, base.Location.Y, base.Width, base.Height, 0);
//General.SetWindowPos(controlptr, 0, base.Location.X, base.Location.Y, base.Width, base.Height, 0);
General.SetWindowPos(controlptr, 0, 0, 0, base.Width, base.Height, 0);
}
#endregion

View file

@ -72,7 +72,7 @@ namespace CodeImp.DoomBuilder.Rendering
#endregion
#region ================== Static Methods
#region ================== Methods
// Construct from color
public static PixelColor FromColor(Color c)
@ -86,6 +86,18 @@ namespace CodeImp.DoomBuilder.Rendering
return FromColor(Color.FromArgb(c));
}
// Return the inverse color
public PixelColor Inverse()
{
return new PixelColor((byte)(255 - a), (byte)(255 - r), (byte)(255 - g), (byte)(255 - b));
}
// Return the inverse color, but keep same alpha
public PixelColor InverseKeepAlpha()
{
return new PixelColor(a, (byte)(255 - r), (byte)(255 - g), (byte)(255 - b));
}
// To int
public int ToInt()
{
@ -107,10 +119,6 @@ namespace CodeImp.DoomBuilder.Rendering
(float)b * 0.00392156862745098f);
}
#endregion
#region ================== Methods
// This returns a new PixelColor with adjusted alpha
public PixelColor WithAlpha(byte a)
{

View file

@ -28,94 +28,25 @@ namespace CodeImp.DoomBuilder.Windows
/// </summary>
private void InitializeComponent()
{
this.scriptedit = new CodeImp.DoomBuilder.Controls.ScriptEditControl();
this.script = new CodeImp.DoomBuilder.Controls.BuilderScriptControl();
this.SuspendLayout();
//
// scriptedit
// script
//
this.scriptedit.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.script.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.scriptedit.AnchorPosition = 0;
this.scriptedit.AutoCSeparator = 0;
this.scriptedit.AutoCTypeSeparator = 0;
this.scriptedit.BackColor = System.Drawing.SystemColors.Window;
this.scriptedit.CaretFore = 0;
this.scriptedit.CaretLineBack = 0;
this.scriptedit.CaretPeriod = 0;
this.scriptedit.CaretWidth = 0;
this.scriptedit.CodePage = 0;
this.scriptedit.ControlCharSymbol = 0;
this.scriptedit.CurrentPos = 0;
this.scriptedit.CursorType = 0;
this.scriptedit.DocPointer = 0;
this.scriptedit.EdgeColour = 0;
this.scriptedit.EdgeColumn = 0;
this.scriptedit.EdgeMode = 0;
this.scriptedit.EndAtLastLine = 0;
this.scriptedit.EndOfLineMode = CodeImp.DoomBuilder.Controls.ScriptEndOfLine.CRLF;
this.scriptedit.EOLMode = 0;
this.scriptedit.HighlightGuide = 0;
this.scriptedit.Indent = 0;
this.scriptedit.IsAutoCGetAutoHide = false;
this.scriptedit.IsAutoCGetCancelAtStart = false;
this.scriptedit.IsAutoCGetChooseSingle = false;
this.scriptedit.IsAutoCGetDropRestOfWord = false;
this.scriptedit.IsAutoCGetIgnoreCase = false;
this.scriptedit.IsBackSpaceUnIndents = false;
this.scriptedit.IsBufferedDraw = false;
this.scriptedit.IsCaretLineVisible = false;
this.scriptedit.IsFocus = false;
this.scriptedit.IsHScrollBar = false;
this.scriptedit.IsIndentationGuides = false;
this.scriptedit.IsMouseDownCaptures = false;
this.scriptedit.IsOvertype = false;
this.scriptedit.IsReadOnly = false;
this.scriptedit.IsTabIndents = false;
this.scriptedit.IsTwoPhaseDraw = false;
this.scriptedit.IsUndoCollection = false;
this.scriptedit.IsUsePalette = false;
this.scriptedit.IsUseTabs = false;
this.scriptedit.IsViewEOL = false;
this.scriptedit.IsVScrollBar = false;
this.scriptedit.LayoutCache = 0;
this.scriptedit.Lexer = 0;
this.scriptedit.Location = new System.Drawing.Point(12, 12);
this.scriptedit.MarginLeft = 0;
this.scriptedit.MarginRight = 0;
this.scriptedit.ModEventMask = 0;
this.scriptedit.MouseDwellTime = 0;
this.scriptedit.Name = "scriptedit";
this.scriptedit.PrintColourMode = 0;
this.scriptedit.PrintMagnification = 0;
this.scriptedit.PrintWrapMode = 0;
this.scriptedit.ScrollWidth = 0;
this.scriptedit.SearchFlags = 0;
this.scriptedit.SelectionEnd = 0;
this.scriptedit.SelectionMode = 0;
this.scriptedit.SelectionStart = 0;
this.scriptedit.Size = new System.Drawing.Size(643, 487);
this.scriptedit.Status = 0;
this.scriptedit.StyleBits = 0;
this.scriptedit.TabIndex = 0;
this.scriptedit.TabWidth = 0;
this.scriptedit.TargetEnd = 0;
this.scriptedit.TargetStart = 0;
this.scriptedit.ViewWhitespace = CodeImp.DoomBuilder.Controls.ScriptWhiteSpace.Invisible;
this.scriptedit.ViewWS = 0;
this.scriptedit.WrapMode = 0;
this.scriptedit.WrapStartIndent = 0;
this.scriptedit.WrapVisualFlags = 0;
this.scriptedit.WrapVisualFlagsLocation = 0;
this.scriptedit.XOffset = 0;
this.scriptedit.ZoomLevel = 0;
this.script.Location = new System.Drawing.Point(12, 12);
this.script.Name = "script";
this.script.Size = new System.Drawing.Size(643, 487);
this.script.TabIndex = 0;
//
// ScriptEditTestForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(667, 511);
this.Controls.Add(this.scriptedit);
this.Controls.Add(this.script);
this.Name = "ScriptEditTestForm";
this.Text = "ScriptEditTestForm";
this.ResumeLayout(false);
@ -124,7 +55,8 @@ namespace CodeImp.DoomBuilder.Windows
#endregion
private CodeImp.DoomBuilder.Controls.ScriptEditControl scriptedit;
private CodeImp.DoomBuilder.Controls.BuilderScriptControl script;
}
}