UltimateZoneBuilder/Source/Controls/ThingInfoPanel.cs

106 lines
2.4 KiB
C#
Raw Normal View History

2007-10-24 17:25:03 +00:00
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Diagnostics;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
#endregion
namespace CodeImp.DoomBuilder.Controls
2007-10-24 17:25:03 +00:00
{
2008-01-02 21:49:43 +00:00
internal partial class ThingInfoPanel : UserControl
2007-10-24 17:25:03 +00:00
{
// Constructor
public ThingInfoPanel()
{
// Initialize
InitializeComponent();
}
// This shows the info
public void ShowInfo(Thing t)
{
ThingTypeInfo ti;
int zvalue;
string zinfo;
2007-10-24 17:25:03 +00:00
// Lookup thing info
ti = General.Map.Config.GetThingInfo(t.Type);
// TODO: Lookup action description from config
// Determine z info to show
t.DetermineSector();
2007-10-24 17:25:03 +00:00
if(t.Sector != null)
{
// Hangs from ceiling?
if(ti.Hangs)
{
zvalue = t.Sector.CeilHeight + t.ZOffset;
zinfo = zvalue.ToString();
}
else
{
zvalue = t.Sector.FloorHeight + t.ZOffset;
zinfo = zvalue.ToString();
}
}
else
{
zvalue = t.ZOffset;
if(zvalue >= 0) zinfo = "+" + zvalue.ToString(); else zinfo = zvalue.ToString();
2007-10-24 17:25:03 +00:00
}
// Thing info
type.Text = t.Type + " - " + ti.Title;
action.Text = ""; // TODO
position.Text = t.X.ToString() + ", " + t.Y.ToString() + ", " + zinfo;
tag.Text = ""; // TODO
angle.Text = t.AngleDeg.ToString() + "\u00B0";
spritename.Text = ti.Sprite;
2007-11-04 22:19:30 +00:00
General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteBitmap(ti.Sprite));
2007-10-24 17:25:03 +00:00
// Show the whole thing
this.Show();
this.Update();
}
// When visible changed
protected override void OnVisibleChanged(EventArgs e)
2007-10-24 17:25:03 +00:00
{
// Hiding panels
if(!this.Visible)
{
spritetex.BackgroundImage = null;
}
2007-10-24 17:25:03 +00:00
// Call base
base.OnVisibleChanged(e);
2007-10-24 17:25:03 +00:00
}
}
}