status indicator in statusbar

This commit is contained in:
codeimp 2007-10-26 19:06:59 +00:00
parent f970c82d3f
commit 65b4db3428
14 changed files with 159 additions and 79 deletions

BIN
Resources/Icons/Status0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

BIN
Resources/Icons/Status1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

BIN
Resources/Icons/Status2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

View file

@ -251,6 +251,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Builder.ico" />
<None Include="Resources\Status1.png" />
<None Include="Resources\Status2.png" />
<None Include="Resources\Status0.png" />
<None Include="Resources\UnknownImage.png" />
<None Include="Resources\ThingsMode.png" />
<None Include="Resources\VerticesMode.png" />

View file

@ -69,7 +69,8 @@ namespace CodeImp.DoomBuilder.Data
public Playpal Palette { get { return palette; } }
public bool IsDisposed { get { return isdisposed; } }
public bool IsLoading { get { return (backgroundloader != null) && backgroundloader.IsAlive; } }
#endregion
#region ================== Constructor / Disposer
@ -276,16 +277,15 @@ namespace CodeImp.DoomBuilder.Data
// The background loader
private void BackgroundLoad()
{
int loadedtextures, loadedflats, loadedsprites;
int starttime = General.Clock.GetCurrentTime();
int deltatime;
try
{
// Load all lists
loadedtextures = LoadImagesList(textures);
loadedflats = LoadImagesList(flats);
loadedsprites = LoadImagesList(sprites);
LoadImagesList(textures);
LoadImagesList(flats);
LoadImagesList(sprites);
}
catch(ThreadInterruptedException)
{
@ -295,16 +295,17 @@ namespace CodeImp.DoomBuilder.Data
// Done
deltatime = General.Clock.GetCurrentTime() - starttime;
General.WriteLogLine("Background resource loading completed in " + deltatime + "ms");
General.WriteLogLine("Loaded " + loadedtextures + " textures, " + loadedflats + " flats, " + loadedsprites + " sprites");
General.WriteLogLine("Loaded " + textures.Count + " textures, " + flats.Count + " flats, " + sprites.Count + " sprites");
backgroundloader = null;
General.MainWindow.UpdateStatusIcon();
}
// This loads a list of ImageData
private int LoadImagesList(Dictionary<long, ImageData> list)
private void LoadImagesList(Dictionary<long, ImageData> list)
{
Dictionary<long, ImageData>.Enumerator walker;
bool moveresult = false;
bool interrupted = false;
int numloaded;
do
{
@ -313,7 +314,6 @@ namespace CodeImp.DoomBuilder.Data
{
walker = list.GetEnumerator();
moveresult = walker.MoveNext();
numloaded = 0;
}
// Continue until at end of list
@ -324,7 +324,6 @@ namespace CodeImp.DoomBuilder.Data
// Load image
walker.Current.Value.LoadImage();
//walker.Current.Value.CreateTexture();
if(walker.Current.Value.IsLoaded) numloaded++;
}
// Wait a bit
@ -347,9 +346,6 @@ namespace CodeImp.DoomBuilder.Data
}
}
while(interrupted);
// Return result
return numloaded;
}
#endregion

View file

@ -85,12 +85,12 @@ namespace CodeImp.DoomBuilder.Interface
this.xposlabel = new System.Windows.Forms.ToolStripStatusLabel();
this.yposlabel = new System.Windows.Forms.ToolStripStatusLabel();
this.panelinfo = new System.Windows.Forms.Panel();
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl();
this.vertexinfo = new CodeImp.DoomBuilder.Interface.VertexInfoPanel();
this.thinginfo = new CodeImp.DoomBuilder.Interface.ThingInfoPanel();
this.sectorinfo = new CodeImp.DoomBuilder.Interface.SectorInfoPanel();
this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel();
this.thinginfo = new CodeImp.DoomBuilder.Interface.ThingInfoPanel();
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl();
toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
@ -484,9 +484,11 @@ namespace CodeImp.DoomBuilder.Interface
//
// statuslabel
//
this.statuslabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.statuslabel.Image = global::CodeImp.DoomBuilder.Properties.Resources.Status2;
this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.statuslabel.Name = "statuslabel";
this.statuslabel.Size = new System.Drawing.Size(628, 18);
this.statuslabel.Size = new System.Drawing.Size(597, 18);
this.statuslabel.Spring = true;
this.statuslabel.Text = "Initializing user interface...";
this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -607,6 +609,50 @@ namespace CodeImp.DoomBuilder.Interface
this.panelinfo.Size = new System.Drawing.Size(839, 106);
this.panelinfo.TabIndex = 4;
//
// vertexinfo
//
this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.vertexinfo.Location = new System.Drawing.Point(3, 3);
this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.vertexinfo.Name = "vertexinfo";
this.vertexinfo.Size = new System.Drawing.Size(180, 100);
this.vertexinfo.TabIndex = 1;
this.vertexinfo.Visible = false;
//
// thinginfo
//
this.thinginfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.thinginfo.Location = new System.Drawing.Point(3, 3);
this.thinginfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.thinginfo.MinimumSize = new System.Drawing.Size(100, 100);
this.thinginfo.Name = "thinginfo";
this.thinginfo.Size = new System.Drawing.Size(385, 100);
this.thinginfo.TabIndex = 3;
this.thinginfo.Visible = false;
//
// sectorinfo
//
this.sectorinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sectorinfo.Location = new System.Drawing.Point(3, 3);
this.sectorinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.sectorinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.sectorinfo.Name = "sectorinfo";
this.sectorinfo.Size = new System.Drawing.Size(447, 100);
this.sectorinfo.TabIndex = 2;
this.sectorinfo.Visible = false;
//
// linedefinfo
//
this.linedefinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.linedefinfo.Location = new System.Drawing.Point(3, 3);
this.linedefinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.linedefinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.linedefinfo.Name = "linedefinfo";
this.linedefinfo.Size = new System.Drawing.Size(783, 100);
this.linedefinfo.TabIndex = 0;
this.linedefinfo.Visible = false;
//
// redrawtimer
//
this.redrawtimer.Interval = 1;
@ -634,50 +680,6 @@ namespace CodeImp.DoomBuilder.Interface
this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter);
//
// vertexinfo
//
this.vertexinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.vertexinfo.Location = new System.Drawing.Point(3, 3);
this.vertexinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.vertexinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.vertexinfo.Name = "vertexinfo";
this.vertexinfo.Size = new System.Drawing.Size(180, 100);
this.vertexinfo.TabIndex = 1;
this.vertexinfo.Visible = false;
//
// sectorinfo
//
this.sectorinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sectorinfo.Location = new System.Drawing.Point(3, 3);
this.sectorinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.sectorinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.sectorinfo.Name = "sectorinfo";
this.sectorinfo.Size = new System.Drawing.Size(447, 100);
this.sectorinfo.TabIndex = 2;
this.sectorinfo.Visible = false;
//
// linedefinfo
//
this.linedefinfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.linedefinfo.Location = new System.Drawing.Point(3, 3);
this.linedefinfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.linedefinfo.MinimumSize = new System.Drawing.Size(100, 100);
this.linedefinfo.Name = "linedefinfo";
this.linedefinfo.Size = new System.Drawing.Size(783, 100);
this.linedefinfo.TabIndex = 0;
this.linedefinfo.Visible = false;
//
// thinginfo
//
this.thinginfo.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.thinginfo.Location = new System.Drawing.Point(3, 3);
this.thinginfo.MaximumSize = new System.Drawing.Size(10000, 100);
this.thinginfo.MinimumSize = new System.Drawing.Size(100, 100);
this.thinginfo.Name = "thinginfo";
this.thinginfo.Size = new System.Drawing.Size(385, 100);
this.thinginfo.TabIndex = 3;
this.thinginfo.Visible = false;
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;

View file

@ -45,6 +45,12 @@ namespace CodeImp.DoomBuilder.Interface
#endregion
#region ================== Delegates
private delegate void CallUpdateStatusIcon();
#endregion
#region ================== Variables
// Position/size
@ -126,7 +132,9 @@ namespace CodeImp.DoomBuilder.Interface
// Generic event that invokes the tagged action
private void InvokeTaggedAction(object sender, EventArgs e)
{
this.Update();
General.Actions[(sender as ToolStripItem).Tag.ToString()].Invoke();
this.Update();
}
#endregion
@ -233,6 +241,9 @@ namespace CodeImp.DoomBuilder.Interface
if(statuslabel.Text != status)
statuslabel.Text = status;
// Update icon as well
UpdateStatusIcon();
// Refresh if needed
statusbar.Invalidate();
this.Update();
@ -245,6 +256,50 @@ namespace CodeImp.DoomBuilder.Interface
DisplayStatus(STATUS_READY_TEXT);
}
// This updates the status icon
public void UpdateStatusIcon()
{
// From another thread?
if(statusbar.InvokeRequired)
{
// Call to form thread
CallUpdateStatusIcon call = new CallUpdateStatusIcon(UpdateStatusIcon);
this.Invoke(call);
}
else
{
// Ready status?
if(statuslabel.Text == STATUS_READY_TEXT)
{
// Map open?
if((General.Map != null) && (General.Map.Data != null))
{
// Check if loading in the background
if(General.Map.Data.IsLoading)
{
// Display semi-ready icon
statuslabel.Image = CodeImp.DoomBuilder.Properties.Resources.Status1;
}
else
{
// Display ready icon
statuslabel.Image = CodeImp.DoomBuilder.Properties.Resources.Status0;
}
}
else
{
// Display ready icon
statuslabel.Image = CodeImp.DoomBuilder.Properties.Resources.Status0;
}
}
else
{
// Display busy icon
statuslabel.Image = CodeImp.DoomBuilder.Properties.Resources.Status2;
}
}
}
// This changes coordinates display
public void UpdateCoordinates(Vector2D coords)
{

View file

@ -111,9 +111,6 @@ namespace CodeImp.DoomBuilder.Map
sidedefs = null;
sectors = null;
things = null;
// We may spend some time to clean things up here
GC.Collect();
// Done
isdisposed = true;

View file

@ -110,9 +110,6 @@ namespace CodeImp.DoomBuilder.Map
// Dispose the sidedefs that are attached to this sector
// because a sidedef cannot exist without reference to its sector.
foreach(Sidedef sd in sidedefs) sd.Dispose();
// Determine new sector references on things
foreach(Thing t in things) t.DetermineSector();
// Clean up
mainlistitem = null;

View file

@ -130,6 +130,27 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap Status0 {
get {
object obj = ResourceManager.GetObject("Status0", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Status1 {
get {
object obj = ResourceManager.GetObject("Status1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Status2 {
get {
object obj = ResourceManager.GetObject("Status2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap ThingsMode {
get {
object obj = ResourceManager.GetObject("ThingsMode", resourceCulture);

View file

@ -121,11 +121,14 @@
<data name="ColorPick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Properties" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Properties.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VerticesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VerticesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -136,17 +139,17 @@
<data name="Splash2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LinesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LinesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SectorsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SectorsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="UnknownImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -154,10 +157,16 @@
<data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="LinesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LinesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="UnknownImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Status0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Status0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Status1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Status1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Status2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Status2.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: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B