diff --git a/Source/Config/ProgramConfiguration.cs b/Source/Config/ProgramConfiguration.cs index 48a35440..a662f096 100644 --- a/Source/Config/ProgramConfiguration.cs +++ b/Source/Config/ProgramConfiguration.cs @@ -69,6 +69,7 @@ namespace CodeImp.DoomBuilder.Config private string scriptfontname; private int scriptfontsize; private bool scriptfontbold; + private bool scriptontop; // These are not stored in the configuration, only used at runtime private string defaulttexture; @@ -106,6 +107,7 @@ namespace CodeImp.DoomBuilder.Config 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 string DefaultTexture { get { return defaulttexture; } set { defaulttexture = value; } } public string DefaultFloorTexture { get { return defaultfloortexture; } set { defaultfloortexture = value; } } @@ -159,6 +161,7 @@ namespace CodeImp.DoomBuilder.Config scriptfontname = cfg.ReadSetting("scriptfontname", "Lucida Console"); scriptfontsize = cfg.ReadSetting("scriptfontsize", 10); scriptfontbold = cfg.ReadSetting("scriptfontbold", false); + scriptontop = cfg.ReadSetting("scriptontop", true); // Success return true; @@ -195,6 +198,7 @@ namespace CodeImp.DoomBuilder.Config cfg.WriteSetting("scriptfontname", scriptfontname); cfg.WriteSetting("scriptfontsize", scriptfontsize); cfg.WriteSetting("scriptfontbold", scriptfontbold); + cfg.WriteSetting("scriptontop", scriptontop); // Save settings configuration General.WriteLogLine("Saving program configuration..."); diff --git a/Source/Controls/ScriptDocumentTab.cs b/Source/Controls/ScriptDocumentTab.cs index 357cffbc..b72416cb 100644 --- a/Source/Controls/ScriptDocumentTab.cs +++ b/Source/Controls/ScriptDocumentTab.cs @@ -90,11 +90,19 @@ namespace CodeImp.DoomBuilder.Controls editor.TabStop = true; editor.TabIndex = 0; this.Controls.Add(editor); + + // Bind events + editor.OnExplicitSaveTab += panel.ExplicitSaveCurrentTab; + editor.OnOpenScriptBrowser += panel.OpenBrowseScript; } // Disposer protected override void Dispose(bool disposing) { + // Remove events + editor.OnExplicitSaveTab -= panel.ExplicitSaveCurrentTab; + editor.OnOpenScriptBrowser -= panel.OpenBrowseScript; + base.Dispose(disposing); } diff --git a/Source/Controls/ScriptEditorControl.cs b/Source/Controls/ScriptEditorControl.cs index 4709d426..abaafa30 100644 --- a/Source/Controls/ScriptEditorControl.cs +++ b/Source/Controls/ScriptEditorControl.cs @@ -57,6 +57,12 @@ namespace CodeImp.DoomBuilder.Controls #region ================== Delegates / Events + public delegate void ExplicitSaveTabDelegate(); + public delegate void OpenScriptBrowserDelegate(); + + public event ExplicitSaveTabDelegate OnExplicitSaveTab; + public event OpenScriptBrowserDelegate OnOpenScriptBrowser; + #endregion #region ================== Properties @@ -548,6 +554,45 @@ namespace CodeImp.DoomBuilder.Controls // Key pressed down private void scriptedit_KeyDown(object sender, KeyEventArgs e) { + // These key combinations put odd characters in the script, so I disabled them + if((e.KeyCode == Keys.Q) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.W) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.E) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.R) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.Y) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.U) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.I) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.P) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.A) && ((e.Modifiers & Keys.Control) == Keys.Control) && ((e.Modifiers & Keys.Shift) == Keys.Shift)) e.Handled = true; + if((e.KeyCode == Keys.D) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.F) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.G) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.H) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.J) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.K) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.L) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.Z) && ((e.Modifiers & Keys.Control) == Keys.Control) && ((e.Modifiers & Keys.Shift) == Keys.Shift)) e.Handled = true; + if((e.KeyCode == Keys.X) && ((e.Modifiers & Keys.Control) == Keys.Control) && ((e.Modifiers & Keys.Shift) == Keys.Shift)) e.Handled = true; + if((e.KeyCode == Keys.C) && ((e.Modifiers & Keys.Control) == Keys.Control) && ((e.Modifiers & Keys.Shift) == Keys.Shift)) e.Handled = true; + if((e.KeyCode == Keys.V) && ((e.Modifiers & Keys.Control) == Keys.Control) && ((e.Modifiers & Keys.Shift) == Keys.Shift)) e.Handled = true; + if((e.KeyCode == Keys.B) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.N) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + if((e.KeyCode == Keys.M) && ((e.Modifiers & Keys.Control) == Keys.Control)) e.Handled = true; + + // CTRL+S for save + if((e.KeyCode == Keys.S) && ((e.Modifiers & Keys.Control) == Keys.Control)) + { + if(OnExplicitSaveTab != null) OnExplicitSaveTab(); + e.Handled = true; + } + + // CTRL+O for open + if((e.KeyCode == Keys.O) && ((e.Modifiers & Keys.Control) == Keys.Control)) + { + if(OnOpenScriptBrowser != null) OnOpenScriptBrowser(); + e.Handled = true; + } + // CTRL+Space to autocomplete if((e.KeyCode == Keys.Space) && (e.Modifiers == Keys.Control)) { diff --git a/Source/Controls/ScriptEditorPanel.cs b/Source/Controls/ScriptEditorPanel.cs index ffde44d4..2a9af484 100644 --- a/Source/Controls/ScriptEditorPanel.cs +++ b/Source/Controls/ScriptEditorPanel.cs @@ -22,6 +22,7 @@ using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; +using CodeImp.DoomBuilder.Windows; using Microsoft.Win32; using System.Diagnostics; using CodeImp.DoomBuilder.Data; @@ -136,7 +137,7 @@ namespace CodeImp.DoomBuilder.Controls ShowErrors(General.Map.Errors); // Done - UpdateToolbar(); + UpdateToolbar(true); } // This applies user preferences @@ -307,11 +308,11 @@ namespace CodeImp.DoomBuilder.Controls if(!t.ExplicitSave) t.Save(); } - UpdateToolbar(); + UpdateToolbar(false); } // This updates the toolbar for the current status - private void UpdateToolbar() + private void UpdateToolbar(bool focuseditor) { int numscriptsopen = tabs.TabPages.Count; int explicitsavescripts = 0; @@ -347,7 +348,7 @@ namespace CodeImp.DoomBuilder.Controls } // Focus to script editor - ForceFocus(); + if(focuseditor) ForceFocus(); } } @@ -383,7 +384,7 @@ namespace CodeImp.DoomBuilder.Controls tabs.SelectedTab = t; // Done - UpdateToolbar(); + UpdateToolbar(true); return t; } else @@ -392,6 +393,26 @@ namespace CodeImp.DoomBuilder.Controls return null; } } + + // This saves the current open script + public void ExplicitSaveCurrentTab() + { + ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); + if((t != null) && t.ExplicitSave) + { + buttonsave_Click(this, EventArgs.Empty); + } + else + { + General.MessageBeep(MessageBeepType.Default); + } + } + + // This opens a script + public void OpenBrowseScript() + { + buttonopen_Click(this, EventArgs.Empty); + } #endregion @@ -408,7 +429,7 @@ namespace CodeImp.DoomBuilder.Controls t.ChangeScriptConfig(scriptconfig); // Done - UpdateToolbar(); + UpdateToolbar(true); } // When new script is clicked @@ -423,7 +444,7 @@ namespace CodeImp.DoomBuilder.Controls tabs.SelectedTab = t; // Done - UpdateToolbar(); + UpdateToolbar(true); } // Open script clicked @@ -443,7 +464,7 @@ namespace CodeImp.DoomBuilder.Controls // Save the current script ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); SaveScript(t); - UpdateToolbar(); + UpdateToolbar(true); } // Save All clicked @@ -459,7 +480,7 @@ namespace CodeImp.DoomBuilder.Controls } } - UpdateToolbar(); + UpdateToolbar(true); } // This is called by Save and Save All to save a script @@ -495,7 +516,7 @@ namespace CodeImp.DoomBuilder.Controls // A tab is selected private void tabs_Selecting(object sender, TabControlCancelEventArgs e) { - UpdateToolbar(); + UpdateToolbar(true); } // This closes the current file @@ -503,7 +524,7 @@ namespace CodeImp.DoomBuilder.Controls { ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); CloseScript(t, false); - UpdateToolbar(); + UpdateToolbar(true); } // Compile Script clicked @@ -532,7 +553,7 @@ namespace CodeImp.DoomBuilder.Controls General.MainWindow.DisplayReady(); Cursor.Current = Cursors.Default; - UpdateToolbar(); + UpdateToolbar(true); } // Undo clicked @@ -540,7 +561,7 @@ namespace CodeImp.DoomBuilder.Controls { ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); t.Undo(); - UpdateToolbar(); + UpdateToolbar(true); } // Redo clicked @@ -548,7 +569,7 @@ namespace CodeImp.DoomBuilder.Controls { ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); t.Redo(); - UpdateToolbar(); + UpdateToolbar(true); } // Cut clicked @@ -556,7 +577,7 @@ namespace CodeImp.DoomBuilder.Controls { ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); t.Cut(); - UpdateToolbar(); + UpdateToolbar(true); } // Copy clicked @@ -564,7 +585,7 @@ namespace CodeImp.DoomBuilder.Controls { ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); t.Copy(); - UpdateToolbar(); + UpdateToolbar(true); } // Paste clicked @@ -572,7 +593,7 @@ namespace CodeImp.DoomBuilder.Controls { ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab); t.Paste(); - UpdateToolbar(); + UpdateToolbar(true); } // Mouse released on tabs diff --git a/Source/Controls/ScriptLumpDocumentTab.cs b/Source/Controls/ScriptLumpDocumentTab.cs index 8367bac5..e92e04e7 100644 --- a/Source/Controls/ScriptLumpDocumentTab.cs +++ b/Source/Controls/ScriptLumpDocumentTab.cs @@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.Controls #region ================== Variables private string lumpname; + private bool ismapheader; #endregion @@ -63,12 +64,22 @@ namespace CodeImp.DoomBuilder.Controls public ScriptLumpDocumentTab(ScriptEditorPanel panel, string lumpname, ScriptConfiguration config) : base(panel) { // Initialize - this.lumpname = lumpname; + if(lumpname == MapManager.CONFIG_MAP_HEADER) + { + this.lumpname = MapManager.TEMP_MAP_HEADER; + this.ismapheader = true; + } + else + { + this.lumpname = lumpname; + this.ismapheader = false; + } + this.config = config; editor.SetupStyles(config); // Load the lump data - MemoryStream stream = General.Map.GetLumpData(lumpname); + MemoryStream stream = General.Map.GetLumpData(this.lumpname); if(stream != null) { StreamReader reader = new StreamReader(stream); @@ -78,7 +89,10 @@ namespace CodeImp.DoomBuilder.Controls } // Done - SetTitle(lumpname.ToUpper()); + if(ismapheader) + SetTitle(General.Map.Options.CurrentName); + else + SetTitle(this.lumpname.ToUpper()); } // Disposer @@ -95,7 +109,10 @@ namespace CodeImp.DoomBuilder.Controls public override void Compile() { // Compile - General.Map.CompileLump(lumpname, true); + if(ismapheader) + General.Map.CompileLump(MapManager.CONFIG_MAP_HEADER, true); + else + General.Map.CompileLump(lumpname, true); // Feed errors to panel panel.ShowErrors(General.Map.Errors); @@ -108,6 +125,7 @@ namespace CodeImp.DoomBuilder.Controls byte[] data = Encoding.ASCII.GetBytes(editor.Text); MemoryStream stream = new MemoryStream(data); General.Map.SetLumpData(lumpname, stream); + editor.ClearUndoRedo(); return true; } diff --git a/Source/General/MapManager.cs b/Source/General/MapManager.cs index 269bcfab..28370fb3 100644 --- a/Source/General/MapManager.cs +++ b/Source/General/MapManager.cs @@ -1090,7 +1090,10 @@ namespace CodeImp.DoomBuilder } // Show the window - scriptwindow.Show(); + if(General.Settings.ScriptOnTop) + scriptwindow.Show(General.MainWindow); + else + scriptwindow.Show(); scriptwindow.Focus(); Cursor.Current = Cursors.Default; } @@ -1179,111 +1182,121 @@ namespace CodeImp.DoomBuilder string inputfile, outputfile; Compiler compiler; byte[] filedata; + string reallumpname = lumpname; // Find the lump - Lump lump = tempwad.FindLump(lumpname); - if(lump == null) throw new Exception("No such lump in temporary wad file '" + lumpname + "'."); + if(lumpname == CONFIG_MAP_HEADER) reallumpname = TEMP_MAP_HEADER; + Lump lump = tempwad.FindLump(reallumpname); + if(lump == null) throw new Exception("No such lump in temporary wad file '" + reallumpname + "'."); // New list of errors if(clearerrors || (errors == null)) errors = new List(); // Determine the script configuration to use - ScriptConfiguration scriptconfig = config.MapLumps[lump.Name].script; - - try + ScriptConfiguration scriptconfig = config.MapLumps[lumpname].script; + if(scriptconfig.Compiler != null) { - // Initialize compiler - compiler = scriptconfig.Compiler.Create(); - } - catch(Exception e) - { - // Fail - errors.Add(new CompilerError("Unable to initialize compiler. " + e.GetType().Name + ": " + e.Message)); - return false; - } - - try - { - // Write lump data to temp script file in compiler's temp directory - inputfile = General.MakeTempFilename(compiler.Location, "tmp"); - lump.Stream.Seek(0, SeekOrigin.Begin); - BinaryReader reader = new BinaryReader(lump.Stream); - File.WriteAllBytes(inputfile, reader.ReadBytes((int)lump.Stream.Length)); - } - catch(Exception e) - { - // Fail - compiler.Dispose(); - errors.Add(new CompilerError("Unable to write script to working file. " + e.GetType().Name + ": " + e.Message)); - return false; - } - - // Make random output filename - outputfile = General.MakeTempFilename(compiler.Location, "tmp"); - - // Run compiler - compiler.Parameters = scriptconfig.Parameters; - compiler.InputFile = Path.GetFileName(inputfile); - compiler.OutputFile = Path.GetFileName(outputfile); - compiler.WorkingDirectory = Path.GetDirectoryName(inputfile); - if(compiler.Run()) - { - // Process errors - foreach(CompilerError e in compiler.Errors) + try { - CompilerError newerror = e; - - // If the error's filename equals our temporary file, - // use the lump name instead and prefix it with ? - if(string.Compare(e.filename, inputfile, true) == 0) - newerror.filename = "?" + lumpname; - - errors.Add(newerror); + // Initialize compiler + compiler = scriptconfig.Compiler.Create(); + } + catch(Exception e) + { + // Fail + errors.Add(new CompilerError("Unable to initialize compiler. " + e.GetType().Name + ": " + e.Message)); + return false; } - // No errors? - if(compiler.Errors.Length == 0) + try { - // Output file exists? - if(File.Exists(outputfile)) - { - // Copy output file data into a lump? - if((scriptconfig.ResultLump != null) && (scriptconfig.ResultLump.Length > 0)) - { - // Do that now then - try - { - filedata = File.ReadAllBytes(outputfile); - } - catch(Exception e) - { - // Fail - compiler.Dispose(); - errors.Add(new CompilerError("Unable to read compiler output file. " + e.GetType().Name + ": " + e.Message)); - return false; - } + // Write lump data to temp script file in compiler's temp directory + inputfile = General.MakeTempFilename(compiler.Location, "tmp"); + lump.Stream.Seek(0, SeekOrigin.Begin); + BinaryReader reader = new BinaryReader(lump.Stream); + File.WriteAllBytes(inputfile, reader.ReadBytes((int)lump.Stream.Length)); + } + catch(Exception e) + { + // Fail + compiler.Dispose(); + errors.Add(new CompilerError("Unable to write script to working file. " + e.GetType().Name + ": " + e.Message)); + return false; + } - // Store data - MemoryStream stream = new MemoryStream(filedata); - SetLumpData(scriptconfig.ResultLump, stream); + // Make random output filename + outputfile = General.MakeTempFilename(compiler.Location, "tmp"); + + // Run compiler + compiler.Parameters = scriptconfig.Parameters; + compiler.InputFile = Path.GetFileName(inputfile); + compiler.OutputFile = Path.GetFileName(outputfile); + compiler.WorkingDirectory = Path.GetDirectoryName(inputfile); + if(compiler.Run()) + { + // Process errors + foreach(CompilerError e in compiler.Errors) + { + CompilerError newerror = e; + + // If the error's filename equals our temporary file, + // use the lump name instead and prefix it with ? + if(string.Compare(e.filename, inputfile, true) == 0) + newerror.filename = "?" + reallumpname; + + errors.Add(newerror); + } + + // No errors? + if(compiler.Errors.Length == 0) + { + // Output file exists? + if(File.Exists(outputfile)) + { + // Copy output file data into a lump? + if((scriptconfig.ResultLump != null) && (scriptconfig.ResultLump.Length > 0)) + { + // Do that now then + try + { + filedata = File.ReadAllBytes(outputfile); + } + catch(Exception e) + { + // Fail + compiler.Dispose(); + errors.Add(new CompilerError("Unable to read compiler output file. " + e.GetType().Name + ": " + e.Message)); + return false; + } + + // Store data + MemoryStream stream = new MemoryStream(filedata); + SetLumpData(scriptconfig.ResultLump, stream); + } } } + + // Clean up + compiler.Dispose(); + if(errors.Count == 0) errors = null; + + // Done + return true; + } + else + { + // Fail + compiler.Dispose(); + errors = null; + return false; } - - // Clean up - compiler.Dispose(); - if(errors.Count == 0) errors = null; - - // Done - return true; } else { - // Fail - compiler.Dispose(); - errors = null; - return false; + // No compiler to run for this script type + if(errors.Count == 0) errors = null; + return true; } } diff --git a/Source/Windows/MainForm.cs b/Source/Windows/MainForm.cs index f2decec9..41155140 100644 --- a/Source/Windows/MainForm.cs +++ b/Source/Windows/MainForm.cs @@ -274,8 +274,8 @@ namespace CodeImp.DoomBuilder.Windows if(sender is ToolStripItem) General.Actions.InvokeAction((sender as ToolStripItem).Tag.ToString()); - else if(sender is Button) - General.Actions.InvokeAction((sender as Button).Tag.ToString()); + else if(sender is Control) + General.Actions.InvokeAction((sender as Control).Tag.ToString()); else General.Fail("InvokeTaggedAction used on an unexpected control."); diff --git a/Source/Windows/PreferencesForm.Designer.cs b/Source/Windows/PreferencesForm.Designer.cs index 68e1dbd9..1097afcd 100644 --- a/Source/Windows/PreferencesForm.Designer.cs +++ b/Source/Windows/PreferencesForm.Designer.cs @@ -55,6 +55,7 @@ namespace CodeImp.DoomBuilder.Windows this.tabs = new System.Windows.Forms.TabControl(); this.tabinterface = new System.Windows.Forms.TabPage(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.scriptontop = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.scriptfontlabel = new System.Windows.Forms.Label(); this.scriptfontsize = new System.Windows.Forms.ComboBox(); @@ -164,7 +165,7 @@ namespace CodeImp.DoomBuilder.Windows groupBox1.Controls.Add(this.qualitydisplay); groupBox1.Location = new System.Drawing.Point(8, 8); groupBox1.Name = "groupBox1"; - groupBox1.Size = new System.Drawing.Size(248, 189); + groupBox1.Size = new System.Drawing.Size(248, 160); groupBox1.TabIndex = 6; groupBox1.TabStop = false; groupBox1.Text = " Classic Modes "; @@ -195,7 +196,7 @@ namespace CodeImp.DoomBuilder.Windows // classicbilinear // this.classicbilinear.AutoSize = true; - this.classicbilinear.Location = new System.Drawing.Point(25, 151); + this.classicbilinear.Location = new System.Drawing.Point(25, 124); this.classicbilinear.Name = "classicbilinear"; this.classicbilinear.Size = new System.Drawing.Size(136, 18); this.classicbilinear.TabIndex = 12; @@ -205,7 +206,7 @@ namespace CodeImp.DoomBuilder.Windows // squarethings // this.squarethings.AutoSize = true; - this.squarethings.Location = new System.Drawing.Point(25, 87); + this.squarethings.Location = new System.Drawing.Point(25, 76); this.squarethings.Name = "squarethings"; this.squarethings.Size = new System.Drawing.Size(93, 18); this.squarethings.TabIndex = 11; @@ -215,7 +216,7 @@ namespace CodeImp.DoomBuilder.Windows // qualitydisplay // this.qualitydisplay.AutoSize = true; - this.qualitydisplay.Location = new System.Drawing.Point(25, 119); + this.qualitydisplay.Location = new System.Drawing.Point(25, 100); this.qualitydisplay.Name = "qualitydisplay"; this.qualitydisplay.Size = new System.Drawing.Size(118, 18); this.qualitydisplay.TabIndex = 10; @@ -434,19 +435,30 @@ namespace CodeImp.DoomBuilder.Windows // // groupBox3 // + this.groupBox3.Controls.Add(this.scriptontop); this.groupBox3.Controls.Add(this.panel1); this.groupBox3.Controls.Add(this.scriptfontsize); this.groupBox3.Controls.Add(this.label8); this.groupBox3.Controls.Add(this.scriptfontbold); this.groupBox3.Controls.Add(this.scriptfontname); this.groupBox3.Controls.Add(this.label3); - this.groupBox3.Location = new System.Drawing.Point(8, 203); + this.groupBox3.Location = new System.Drawing.Point(8, 174); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(248, 168); + this.groupBox3.Size = new System.Drawing.Size(248, 197); this.groupBox3.TabIndex = 8; this.groupBox3.TabStop = false; this.groupBox3.Text = " Script Editor "; // + // scriptontop + // + this.scriptontop.AutoSize = true; + this.scriptontop.Location = new System.Drawing.Point(25, 160); + this.scriptontop.Name = "scriptontop"; + this.scriptontop.Size = new System.Drawing.Size(178, 18); + this.scriptontop.TabIndex = 19; + this.scriptontop.Text = "Always on top of main window"; + this.scriptontop.UseVisualStyleBackColor = true; + // // panel1 // this.panel1.BackColor = System.Drawing.SystemColors.Window; @@ -454,7 +466,7 @@ namespace CodeImp.DoomBuilder.Windows this.panel1.Controls.Add(this.scriptfontlabel); this.panel1.Location = new System.Drawing.Point(25, 109); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(203, 41); + this.panel1.Size = new System.Drawing.Size(203, 38); this.panel1.TabIndex = 18; // // scriptfontlabel @@ -463,7 +475,7 @@ namespace CodeImp.DoomBuilder.Windows this.scriptfontlabel.Dock = System.Windows.Forms.DockStyle.Fill; this.scriptfontlabel.Location = new System.Drawing.Point(0, 0); this.scriptfontlabel.Name = "scriptfontlabel"; - this.scriptfontlabel.Size = new System.Drawing.Size(199, 37); + this.scriptfontlabel.Size = new System.Drawing.Size(199, 34); this.scriptfontlabel.TabIndex = 0; this.scriptfontlabel.Text = "Font"; this.scriptfontlabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -630,7 +642,7 @@ namespace CodeImp.DoomBuilder.Windows // invertyaxis // this.invertyaxis.AutoSize = true; - this.invertyaxis.Location = new System.Drawing.Point(31, 296); + this.invertyaxis.Location = new System.Drawing.Point(31, 288); this.invertyaxis.Name = "invertyaxis"; this.invertyaxis.Size = new System.Drawing.Size(122, 18); this.invertyaxis.TabIndex = 26; @@ -1147,5 +1159,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Label disregardshiftlabel; private System.Windows.Forms.ListBox keyusedlist; private System.Windows.Forms.Label keyusedlabel; + private System.Windows.Forms.CheckBox scriptontop; } } \ No newline at end of file diff --git a/Source/Windows/PreferencesForm.cs b/Source/Windows/PreferencesForm.cs index 3450e3b3..4a8926bc 100644 --- a/Source/Windows/PreferencesForm.cs +++ b/Source/Windows/PreferencesForm.cs @@ -66,6 +66,7 @@ namespace CodeImp.DoomBuilder.Windows 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; // Fill fonts list scriptfontname.BeginUpdate(); @@ -152,6 +153,7 @@ namespace CodeImp.DoomBuilder.Windows General.Settings.InvertYAxis = invertyaxis.Checked; General.Settings.ScriptFontBold = scriptfontbold.Checked; General.Settings.ScriptFontName = scriptfontname.Text; + General.Settings.ScriptOnTop = scriptontop.Checked; // Script font size int fontsize = 8; diff --git a/Source/Windows/PreferencesForm.resx b/Source/Windows/PreferencesForm.resx index 459426e0..607b84a6 100644 --- a/Source/Windows/PreferencesForm.resx +++ b/Source/Windows/PreferencesForm.resx @@ -213,6 +213,9 @@ True + + True + True diff --git a/Source/Windows/ScriptEditorForm.Designer.cs b/Source/Windows/ScriptEditorForm.Designer.cs index ca0784e9..ea9488fe 100644 --- a/Source/Windows/ScriptEditorForm.Designer.cs +++ b/Source/Windows/ScriptEditorForm.Designer.cs @@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.Windows this.Controls.Add(this.editor); this.DoubleBuffered = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.KeyPreview = true; this.Name = "ScriptEditorForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "Doom Builder Script Editor";