mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
- script editor now remembers window position/size
- fixed re-opening of opened script documents after script editor was closed
This commit is contained in:
parent
746fe86aea
commit
83ae7e4880
7 changed files with 129 additions and 30 deletions
7
Source/Controls/ScriptEditorPanel.Designer.cs
generated
7
Source/Controls/ScriptEditorPanel.Designer.cs
generated
|
@ -72,7 +72,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.tabs.Name = "tabs";
|
||||
this.tabs.Padding = new System.Drawing.Point(12, 3);
|
||||
this.tabs.SelectedIndex = 0;
|
||||
this.tabs.Size = new System.Drawing.Size(720, 386);
|
||||
this.tabs.Size = new System.Drawing.Size(720, 401);
|
||||
this.tabs.TabIndex = 0;
|
||||
this.tabs.TabStop = false;
|
||||
this.tabs.Selecting += new System.Windows.Forms.TabControlCancelEventHandler(this.tabs_Selecting);
|
||||
|
@ -261,6 +261,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
//
|
||||
this.splitter.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitter.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitter.IsSplitterFixed = true;
|
||||
this.splitter.Location = new System.Drawing.Point(0, 25);
|
||||
this.splitter.Name = "splitter";
|
||||
this.splitter.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
|
@ -274,7 +275,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.splitter.Panel2.Controls.Add(this.label1);
|
||||
this.splitter.Panel2.Controls.Add(this.errorlist);
|
||||
this.splitter.Size = new System.Drawing.Size(726, 538);
|
||||
this.splitter.SplitterDistance = 397;
|
||||
this.splitter.SplitterDistance = 412;
|
||||
this.splitter.TabIndex = 2;
|
||||
this.splitter.TabStop = false;
|
||||
//
|
||||
|
@ -309,7 +310,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.errorlist.MultiSelect = false;
|
||||
this.errorlist.Name = "errorlist";
|
||||
this.errorlist.ShowGroups = false;
|
||||
this.errorlist.Size = new System.Drawing.Size(720, 115);
|
||||
this.errorlist.Size = new System.Drawing.Size(720, 100);
|
||||
this.errorlist.SmallImageList = this.errorimages;
|
||||
this.errorlist.TabIndex = 0;
|
||||
this.errorlist.TabStop = false;
|
||||
|
|
|
@ -134,11 +134,31 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// If the map has remembered any compile errors, then show them
|
||||
ShowErrors(General.Map.Errors);
|
||||
|
||||
|
||||
// Done
|
||||
UpdateToolbar();
|
||||
}
|
||||
|
||||
// This applies user preferences
|
||||
public void ApplySettings()
|
||||
{
|
||||
// Apply settings
|
||||
//int panel2size = General.Settings.ReadSetting("scriptspanel.splitter", splitter.ClientRectangle.Height - splitter.SplitterDistance);
|
||||
//splitter.SplitterDistance = splitter.ClientRectangle.Height - panel2size;
|
||||
errorlist.Columns[0].Width = General.Settings.ReadSetting("scriptspanel.errorscolumn0width", errorlist.Columns[0].Width);
|
||||
errorlist.Columns[1].Width = General.Settings.ReadSetting("scriptspanel.errorscolumn1width", errorlist.Columns[1].Width);
|
||||
errorlist.Columns[2].Width = General.Settings.ReadSetting("scriptspanel.errorscolumn2width", errorlist.Columns[2].Width);
|
||||
}
|
||||
|
||||
// This saves user preferences
|
||||
public void SaveSettings()
|
||||
{
|
||||
//General.Settings.WriteSetting("scriptspanel.splitter", splitter.ClientRectangle.Height - splitter.SplitterDistance);
|
||||
General.Settings.WriteSetting("scriptspanel.errorscolumn0width", errorlist.Columns[0].Width);
|
||||
General.Settings.WriteSetting("scriptspanel.errorscolumn1width", errorlist.Columns[1].Width);
|
||||
General.Settings.WriteSetting("scriptspanel.errorscolumn2width", errorlist.Columns[2].Width);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
@ -493,6 +513,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Compile now
|
||||
General.MainWindow.DisplayStatus("Compiling script " + t.Text + "...");
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
t.Compile();
|
||||
|
||||
// Show warning
|
||||
|
@ -500,7 +521,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
General.MainWindow.DisplayWarning(compilererrors.Count.ToString() + " errors while compiling " + t.Text + "!");
|
||||
else
|
||||
General.MainWindow.DisplayReady();
|
||||
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
UpdateToolbar();
|
||||
}
|
||||
|
||||
|
|
|
@ -150,28 +150,28 @@
|
|||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADI
|
||||
BQAAAk1TRnQBSQFMAwEBAAEEAQABBAEAARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMA
|
||||
ARADAAEBAQABIAYAARD/ACMAAc8B2AHyAf8BWwFzAbkB/wEkAT8BkwH/ARwBMgF4Af8BFQErAW8B/wEV
|
||||
AS8BgAH/AUoBYAGkAf8BzwHYAfIB/9wAAYABlAHUAf8BLwFOAawB/wEdAUIBuAH/AQ0BPQHQAf8BBAE6
|
||||
AeIB/wEDATcB3AH/AQcBNAG9Af8BCgErAZYB/wELASYBfQH/AWgBegGyAf/UAAGJAZ0B3AH/ATwBWwG7
|
||||
Af8BHQFNAd0B/wEKAUUB+gH/AQgBQgH5Af8BSAFzAfgB/wFIAXMB+AH/AQEBOgHqAf8BAQE3AeQB/wEG
|
||||
ATABtgH/AQsBJgF9Af8BaAF6AbIB/8wAAc8B2AHyAf8BUQFsAcYB/wEvAVsB4wH/ARwBUwH9Af8BHAFT
|
||||
Af0B/wFXAYAB/gH/A/4B/wP+Af8BWgGBAfoB/wEBATsB7gH/AQEBNwHkAf8BBgEwAbYB/wELASYBfQH/
|
||||
Ac8B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AcwB2AH+Af8BnQGtAeAB/wGJAZ0B3AH/AYoBmwHUAf8BgQGU
|
||||
AdEB/wFyAYkB1QH/AYEBlAHRAf8BzAHYAf4B//8A0QABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEA
|
||||
AQEFAAGAFwAD/wEAAv8GAAHwAQ8GAAHgAQcGAAHAAQMGAAGAAQEGAAGAAQEGAAGAAQEGAAGAAQEGAAGA
|
||||
AQEGAAGAAQEGAAGAAQEGAAGAAQEGAAHAAQMGAAHgAQcGAAHwAQ8GAAL/BgAL
|
||||
</value>
|
||||
|
|
|
@ -1089,6 +1089,8 @@ namespace CodeImp.DoomBuilder
|
|||
[BeginAction("openscripteditor")]
|
||||
internal void ShowScriptEditor()
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
if(scriptwindow == null)
|
||||
{
|
||||
// Load the window
|
||||
|
@ -1098,6 +1100,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Show the window
|
||||
scriptwindow.Show();
|
||||
scriptwindow.Focus();
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
// This asks the user to save changes in script files
|
||||
|
|
|
@ -158,6 +158,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
resources.WriteToConfig(mapconfig, "resources");
|
||||
|
||||
// Write scripts to config
|
||||
mapconfig.DeleteSetting("scripts");
|
||||
for(int i = 0; i < scriptfiles.Count; i++)
|
||||
mapconfig.WriteSetting("scripts." + "file" + i.ToString(CultureInfo.InvariantCulture), scriptfiles[i]);
|
||||
|
||||
|
|
6
Source/Windows/ScriptEditorForm.Designer.cs
generated
6
Source/Windows/ScriptEditorForm.Designer.cs
generated
|
@ -46,12 +46,16 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(729, 578);
|
||||
this.Controls.Add(this.editor);
|
||||
this.DoubleBuffered = true;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "ScriptEditorForm";
|
||||
this.Opacity = 0;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "Doom Builder Script Editor";
|
||||
this.Load += new System.EventHandler(this.ScriptEditorForm_Load);
|
||||
this.Shown += new System.EventHandler(this.ScriptEditorForm_Shown);
|
||||
this.Move += new System.EventHandler(this.ScriptEditorForm_Move);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptEditorForm_FormClosing);
|
||||
this.ResizeEnd += new System.EventHandler(this.ScriptEditorForm_ResizeEnd);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -31,10 +31,15 @@ using CodeImp.DoomBuilder.Controls;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Windows
|
||||
{
|
||||
internal partial class ScriptEditorForm : DelayedForm
|
||||
internal partial class ScriptEditorForm : Form
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
||||
// Position/size
|
||||
private Point lastposition;
|
||||
private Size lastsize;
|
||||
|
||||
// Closing?
|
||||
private bool appclose;
|
||||
|
||||
#endregion
|
||||
|
@ -80,6 +85,29 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
||||
// Window is loaded
|
||||
private void ScriptEditorForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
this.Location = new Point(General.Settings.ReadSetting("scriptswindow.positionx", this.Location.X),
|
||||
General.Settings.ReadSetting("scriptswindow.positiony", this.Location.Y));
|
||||
this.Size = new Size(General.Settings.ReadSetting("scriptswindow.sizewidth", this.Size.Width),
|
||||
General.Settings.ReadSetting("scriptswindow.sizeheight", this.Size.Height));
|
||||
this.WindowState = (FormWindowState)General.Settings.ReadSetting("scriptswindow.windowstate", (int)FormWindowState.Normal);
|
||||
this.ResumeLayout(true);
|
||||
|
||||
// Normal windowstate?
|
||||
if(this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
|
||||
// Apply panel settings
|
||||
editor.ApplySettings();
|
||||
}
|
||||
|
||||
// Window is shown
|
||||
private void ScriptEditorForm_Shown(object sender, EventArgs e)
|
||||
|
@ -91,6 +119,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Window is closing
|
||||
private void ScriptEditorForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
int windowstate;
|
||||
|
||||
// Determine window state to save
|
||||
if(this.WindowState != FormWindowState.Minimized)
|
||||
windowstate = (int)this.WindowState;
|
||||
else
|
||||
windowstate = (int)FormWindowState.Normal;
|
||||
|
||||
// Save window settings
|
||||
General.Settings.WriteSetting("scriptswindow.positionx", lastposition.X);
|
||||
General.Settings.WriteSetting("scriptswindow.positiony", lastposition.Y);
|
||||
General.Settings.WriteSetting("scriptswindow.sizewidth", lastsize.Width);
|
||||
General.Settings.WriteSetting("scriptswindow.sizeheight", lastsize.Height);
|
||||
General.Settings.WriteSetting("scriptswindow.windowstate", windowstate);
|
||||
editor.SaveSettings();
|
||||
|
||||
// Only when closed by the user
|
||||
if(!appclose)
|
||||
{
|
||||
|
@ -107,6 +151,30 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window resized
|
||||
private void ScriptEditorForm_ResizeEnd(object sender, EventArgs e)
|
||||
{
|
||||
// Normal windowstate?
|
||||
if(this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
}
|
||||
|
||||
// Window moved
|
||||
private void ScriptEditorForm_Move(object sender, EventArgs e)
|
||||
{
|
||||
// Normal windowstate?
|
||||
if(this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue