- ask to save map when closing application

- updated about dialog with version info and slimdx logo
This commit is contained in:
codeimp 2008-05-19 21:33:07 +00:00
parent c2a5ca1c8e
commit 91a5f8e41f
11 changed files with 136 additions and 38 deletions

BIN
Resources/SlimDX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
Resources/SlimDX_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -529,6 +529,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="Resources\DB2.ico" />
<None Include="Resources\SlimDX_small.png" />
<None Include="Resources\Splash3_trans.png" />
<None Include="Resources\Splash3_small.png" />
<EmbeddedResource Include="Interface\AngleControl.resx">

View file

@ -639,7 +639,8 @@ namespace CodeImp.DoomBuilder
// This closes the current map
[BeginAction("closemap")]
internal static void CloseMap()
internal static void ActionCloseMap() { CloseMap(); }
internal static bool CloseMap()
{
// Cancel volatile mode, if any
General.CancelVolatileMode();
@ -651,7 +652,7 @@ namespace CodeImp.DoomBuilder
mainwindow.DisplayStatus("Closing map...");
General.WriteLogLine("Unloading map...");
Cursor.Current = Cursors.WaitCursor;
// Trash the current map
if(map != null) map.Dispose();
map = null;
@ -665,6 +666,12 @@ namespace CodeImp.DoomBuilder
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
General.WriteLogLine("Map unload done");
return true;
}
else
{
// User cancelled
return false;
}
}

View file

@ -29,17 +29,23 @@ namespace CodeImp.DoomBuilder.Interface
private void InitializeComponent()
{
System.Windows.Forms.PictureBox pictureBox1;
this.label1 = new System.Windows.Forms.Label();
System.Windows.Forms.Label label1;
System.Windows.Forms.Label label2;
this.close = new System.Windows.Forms.Button();
this.builderlink = new System.Windows.Forms.LinkLabel();
this.version = new System.Windows.Forms.Label();
this.slimdxlogo = new System.Windows.Forms.PictureBox();
pictureBox1 = new System.Windows.Forms.PictureBox();
label1 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.slimdxlogo)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
pictureBox1.Image = global::CodeImp.DoomBuilder.Properties.Resources.Splash3_small;
pictureBox1.Location = new System.Drawing.Point(12, 12);
pictureBox1.Location = new System.Drawing.Point(10, 12);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new System.Drawing.Size(226, 80);
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -48,17 +54,28 @@ namespace CodeImp.DoomBuilder.Interface
//
// label1
//
this.label1.Location = new System.Drawing.Point(12, 93);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(318, 50);
this.label1.TabIndex = 2;
this.label1.Text = "Doom Builder is designed and programmed by Pascal vd Heiden.\r\nSeveral game config" +
"urations were written by various members of the Doom community.";
label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
label1.Location = new System.Drawing.Point(15, 119);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(335, 50);
label1.TabIndex = 2;
label1.Text = "Doom Builder is designed and programmed by Pascal vd Heiden.\r\nSeveral game config" +
"urations were written by various members of the Doom community. See the website " +
"for a complete list of credits.";
//
// label2
//
label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
label2.Location = new System.Drawing.Point(15, 233);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(213, 29);
label2.TabIndex = 8;
label2.Text = "Doom Builder is powered by SlimDX,\r\na DirectX API for Microsoft .NET 2.0";
//
// close
//
this.close.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.close.Location = new System.Drawing.Point(214, 139);
this.close.Location = new System.Drawing.Point(234, 237);
this.close.Name = "close";
this.close.Size = new System.Drawing.Size(116, 25);
this.close.TabIndex = 3;
@ -68,7 +85,7 @@ namespace CodeImp.DoomBuilder.Interface
// builderlink
//
this.builderlink.AutoSize = true;
this.builderlink.Location = new System.Drawing.Point(12, 144);
this.builderlink.Location = new System.Drawing.Point(12, 169);
this.builderlink.Name = "builderlink";
this.builderlink.Size = new System.Drawing.Size(121, 14);
this.builderlink.TabIndex = 5;
@ -76,15 +93,40 @@ namespace CodeImp.DoomBuilder.Interface
this.builderlink.Text = "www.doombuilder.com";
this.builderlink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.builderlink_LinkClicked);
//
// version
//
this.version.AutoSize = true;
this.version.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.version.Location = new System.Drawing.Point(15, 98);
this.version.Name = "version";
this.version.Size = new System.Drawing.Size(138, 14);
this.version.TabIndex = 6;
this.version.Text = "Doom Builder some version";
//
// slimdxlogo
//
this.slimdxlogo.Cursor = System.Windows.Forms.Cursors.Hand;
this.slimdxlogo.Image = global::CodeImp.DoomBuilder.Properties.Resources.SlimDX_small;
this.slimdxlogo.Location = new System.Drawing.Point(10, 210);
this.slimdxlogo.Name = "slimdxlogo";
this.slimdxlogo.Size = new System.Drawing.Size(80, 20);
this.slimdxlogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.slimdxlogo.TabIndex = 7;
this.slimdxlogo.TabStop = false;
this.slimdxlogo.Click += new System.EventHandler(this.slimdxlogo_Click);
//
// AboutForm
//
this.AcceptButton = this.close;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.CancelButton = this.close;
this.ClientSize = new System.Drawing.Size(337, 172);
this.ClientSize = new System.Drawing.Size(358, 270);
this.Controls.Add(label2);
this.Controls.Add(this.slimdxlogo);
this.Controls.Add(this.version);
this.Controls.Add(this.builderlink);
this.Controls.Add(this.close);
this.Controls.Add(this.label1);
this.Controls.Add(label1);
this.Controls.Add(pictureBox1);
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
@ -97,6 +139,7 @@ namespace CodeImp.DoomBuilder.Interface
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About Doom Builder";
((System.ComponentModel.ISupportInitialize)(pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.slimdxlogo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -104,8 +147,9 @@ namespace CodeImp.DoomBuilder.Interface
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button close;
private System.Windows.Forms.LinkLabel builderlink;
private System.Windows.Forms.Label version;
private System.Windows.Forms.PictureBox slimdxlogo;
}
}

View file

@ -24,6 +24,7 @@ using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Diagnostics;
using System.Reflection;
#endregion
@ -36,6 +37,11 @@ namespace CodeImp.DoomBuilder.Interface
{
// Initialize
InitializeComponent();
// Show version
string postfix = "";
if(General.DebugBuild) postfix = "(debug)";
version.Text = Application.ProductName + " version " + Application.ProductVersion + " " + postfix;
}
// Launch Doom Builder website
@ -44,6 +50,12 @@ namespace CodeImp.DoomBuilder.Interface
OpenWebsite("http://" + builderlink.Text);
}
// Clicking SlimDX logo
private void slimdxlogo_Click(object sender, EventArgs e)
{
OpenWebsite("http://slimdx.mdxinfo.com/");
}
// This opens a URL in the default browser
private void OpenWebsite(string url)
{

View file

@ -126,12 +126,27 @@
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="close.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="builderlink.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="version.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="slimdxlogo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -247,33 +247,42 @@ namespace CodeImp.DoomBuilder.Interface
if(e.CloseReason != CloseReason.ApplicationExitCall)
{
General.WriteLogLine("Closing main interface window...");
// Close the map
if(General.CloseMap())
{
General.WriteLogLine("Closing main interface window...");
// Stop exclusive mode, if any is active
StopExclusiveMouseInput();
SetProcessorState(false);
// Stop exclusive mode, if any is active
StopExclusiveMouseInput();
SetProcessorState(false);
// Unbind methods
General.Actions.UnbindMethods(this);
// Unbind methods
General.Actions.UnbindMethods(this);
// Determine window state to save
if(this.WindowState != FormWindowState.Minimized)
windowstate = (int)this.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("mainwindow.positionx", lastposition.X);
General.Settings.WriteSetting("mainwindow.positiony", lastposition.Y);
General.Settings.WriteSetting("mainwindow.sizewidth", lastsize.Width);
General.Settings.WriteSetting("mainwindow.sizeheight", lastsize.Height);
General.Settings.WriteSetting("mainwindow.windowstate", windowstate);
// Save recent files
SaveRecentFiles();
// Terminate the program
General.Terminate(true);
}
else
windowstate = (int)FormWindowState.Normal;
// Save window settings
General.Settings.WriteSetting("mainwindow.positionx", lastposition.X);
General.Settings.WriteSetting("mainwindow.positiony", lastposition.Y);
General.Settings.WriteSetting("mainwindow.sizewidth", lastsize.Width);
General.Settings.WriteSetting("mainwindow.sizeheight", lastsize.Height);
General.Settings.WriteSetting("mainwindow.windowstate", windowstate);
// Save recent files
SaveRecentFiles();
// Terminate the program
General.Terminate(true);
{
// Cancel the close
e.Cancel = true;
}
}
}

View file

@ -165,6 +165,13 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap SlimDX_small {
get {
object obj = ResourceManager.GetObject("SlimDX_small", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Splash3_small {
get {
object obj = ResourceManager.GetObject("Splash3_small", resourceCulture);

View file

@ -190,4 +190,7 @@
<data name="Splash3_trans" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash3_trans.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SlimDX_small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SlimDX_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB