2009-04-19 18:07:22 +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.Windows.Forms;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
|
|
|
using CodeImp.DoomBuilder.Types;
|
2012-07-10 10:20:45 +00:00
|
|
|
using CodeImp.DoomBuilder.GZBuilder;
|
2013-06-17 13:17:53 +00:00
|
|
|
using CodeImp.DoomBuilder.Data;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
{
|
|
|
|
internal partial class LinedefInfoPanel : UserControl
|
|
|
|
{
|
|
|
|
private int hexenformatwidth;
|
|
|
|
private int doomformatwidth;
|
2012-10-05 13:16:38 +00:00
|
|
|
private List<UniversalFieldInfo> fieldInfos;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public LinedefInfoPanel()
|
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
// Hide stuff when in Doom format
|
|
|
|
hexenformatwidth = infopanel.Width;
|
|
|
|
doomformatwidth = infopanel.Width - 190;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This shows the info
|
|
|
|
public void ShowInfo(Linedef l)
|
|
|
|
{
|
|
|
|
TypeHandler th;
|
|
|
|
bool upperunpegged, lowerunpegged;
|
|
|
|
string peggedness;
|
2012-10-03 18:46:13 +00:00
|
|
|
int defaultPanelWidth = 270; //mxd
|
2012-10-05 13:16:38 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
if (General.Map.UDMF && fieldInfos == null) {
|
|
|
|
fieldInfos = General.Map.Config.SidedefFields;
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Show/hide stuff depending on format
|
|
|
|
if(!General.Map.FormatInterface.HasActionArgs)
|
|
|
|
{
|
|
|
|
arglbl1.Visible = false;
|
|
|
|
arglbl2.Visible = false;
|
|
|
|
arglbl3.Visible = false;
|
|
|
|
arglbl4.Visible = false;
|
|
|
|
arglbl5.Visible = false;
|
|
|
|
arg1.Visible = false;
|
|
|
|
arg2.Visible = false;
|
|
|
|
arg3.Visible = false;
|
|
|
|
arg4.Visible = false;
|
|
|
|
arg5.Visible = false;
|
|
|
|
infopanel.Width = doomformatwidth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arglbl1.Visible = true;
|
|
|
|
arglbl2.Visible = true;
|
|
|
|
arglbl3.Visible = true;
|
|
|
|
arglbl4.Visible = true;
|
|
|
|
arglbl5.Visible = true;
|
|
|
|
arg1.Visible = true;
|
|
|
|
arg2.Visible = true;
|
|
|
|
arg3.Visible = true;
|
|
|
|
arg4.Visible = true;
|
|
|
|
arg5.Visible = true;
|
|
|
|
infopanel.Width = hexenformatwidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get line action information
|
|
|
|
LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action);
|
|
|
|
|
|
|
|
// Determine peggedness
|
|
|
|
upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag);
|
|
|
|
lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag);
|
|
|
|
if(upperunpegged && lowerunpegged)
|
|
|
|
peggedness = "Upper & Lower";
|
|
|
|
else if(upperunpegged)
|
|
|
|
peggedness = "Upper";
|
|
|
|
else if(lowerunpegged)
|
|
|
|
peggedness = "Lower";
|
|
|
|
else
|
|
|
|
peggedness = "None";
|
|
|
|
|
|
|
|
// Linedef info
|
2009-06-05 19:03:56 +00:00
|
|
|
infopanel.Text = " Linedef " + l.Index + " ";
|
2009-04-19 18:07:22 +00:00
|
|
|
action.Text = act.ToString();
|
|
|
|
length.Text = l.Length.ToString("0.##");
|
|
|
|
angle.Text = l.AngleDeg.ToString() + "\u00B0";
|
|
|
|
tag.Text = l.Tag.ToString();
|
|
|
|
unpegged.Text = peggedness;
|
2012-07-10 10:20:45 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
bool hasArg0Str = General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, l.Action) != -1 && l.Fields.ContainsKey("arg0str");
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Arguments
|
2012-07-10 10:20:45 +00:00
|
|
|
arglbl1.Text = hasArg0Str ? "Script name:" : act.Args[0].Title + ":"; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
arglbl2.Text = act.Args[1].Title + ":";
|
|
|
|
arglbl3.Text = act.Args[2].Title + ":";
|
|
|
|
arglbl4.Text = act.Args[3].Title + ":";
|
|
|
|
arglbl5.Text = act.Args[4].Title + ":";
|
|
|
|
arglbl1.Enabled = act.Args[0].Used;
|
|
|
|
arglbl2.Enabled = act.Args[1].Used;
|
|
|
|
arglbl3.Enabled = act.Args[2].Used;
|
|
|
|
arglbl4.Enabled = act.Args[3].Used;
|
|
|
|
arglbl5.Enabled = act.Args[4].Used;
|
|
|
|
arg1.Enabled = act.Args[0].Used;
|
|
|
|
arg2.Enabled = act.Args[1].Used;
|
|
|
|
arg3.Enabled = act.Args[2].Used;
|
|
|
|
arg4.Enabled = act.Args[3].Used;
|
|
|
|
arg5.Enabled = act.Args[4].Used;
|
2012-07-10 10:20:45 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
if (hasArg0Str) {
|
|
|
|
arg1.Text = '"' + l.Fields["arg0str"].Value.ToString() + '"';
|
|
|
|
} else {
|
|
|
|
th = General.Types.GetArgumentHandler(act.Args[0]);
|
|
|
|
th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue();
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
th = General.Types.GetArgumentHandler(act.Args[1]);
|
|
|
|
th.SetValue(l.Args[1]); arg2.Text = th.GetStringValue();
|
|
|
|
th = General.Types.GetArgumentHandler(act.Args[2]);
|
|
|
|
th.SetValue(l.Args[2]); arg3.Text = th.GetStringValue();
|
|
|
|
th = General.Types.GetArgumentHandler(act.Args[3]);
|
|
|
|
th.SetValue(l.Args[3]); arg4.Text = th.GetStringValue();
|
|
|
|
th = General.Types.GetArgumentHandler(act.Args[4]);
|
|
|
|
th.SetValue(l.Args[4]); arg5.Text = th.GetStringValue();
|
|
|
|
|
|
|
|
// Front side available?
|
|
|
|
if(l.Front != null)
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
int addedWidth = 0; //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Show sidedef info
|
2012-10-03 18:46:13 +00:00
|
|
|
frontpanel.Visible = true; //mxd
|
|
|
|
|
2012-11-05 21:53:45 +00:00
|
|
|
frontpanel.Text = " Front Sidedef " + l.Front.Index;
|
2009-06-12 09:22:09 +00:00
|
|
|
frontsector.Text = " Sector " + l.Front.Sector.Index;
|
|
|
|
frontsector.Visible = true;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
//light
|
|
|
|
frontoffsetlabel.Text = "Front light:";
|
2012-11-02 23:11:38 +00:00
|
|
|
setUDMFLight(l.Front, frontoffsetlabel, frontoffset);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2012-11-05 21:53:45 +00:00
|
|
|
//global offset
|
|
|
|
frontpanel.Text += ". Offset: " + l.Front.OffsetX + ", " + l.Front.OffsetY;
|
|
|
|
|
2012-10-03 18:46:13 +00:00
|
|
|
bool hasTopFields = false;
|
|
|
|
bool hasMiddleFields = false;
|
|
|
|
bool hasBottomFields = false;
|
|
|
|
|
|
|
|
//sidedef top
|
|
|
|
if(checkPairedUDMFFields(l.Front.Fields, "offsetx_top", "offsety_top", frontTopUDMFOffsetLabel, frontTopUDMFOffset))
|
|
|
|
hasTopFields = true;
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Front.Fields, "scalex_top", "scaley_top", frontTopUDMFScaleLabel, frontTopUDMFScale))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasTopFields = true;
|
|
|
|
|
|
|
|
//sidedef middle
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Front.Fields, "offsetx_mid", "offsety_mid", frontMidUDMFOffsetLabel, frontMidUDMFOffset))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasMiddleFields = true;
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Front.Fields, "scalex_mid", "scaley_mid", frontMidUDMFScaleLabel, frontMidUDMFScale))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasMiddleFields = true;
|
|
|
|
|
|
|
|
//sidedef bottom
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Front.Fields, "offsetx_bottom", "offsety_bottom", frontBottomUDMFOffsetLabel, frontBottomUDMFOffset))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasBottomFields = true;
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Front.Fields, "scalex_bottom", "scaley_bottom", frontBottomUDMFScaleLabel, frontBottomUDMFScale))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasBottomFields = true;
|
|
|
|
|
|
|
|
//visibility
|
|
|
|
panelUDMFFrontTop.Visible = hasTopFields;
|
|
|
|
panelUDMFFrontMid.Visible = hasMiddleFields;
|
|
|
|
panelUDMFFrontBottom.Visible = hasBottomFields;
|
|
|
|
|
|
|
|
//size
|
|
|
|
if(hasTopFields) addedWidth = 64;
|
|
|
|
if(hasMiddleFields) addedWidth += 64;
|
|
|
|
if(hasBottomFields) addedWidth += 64;
|
|
|
|
} else {
|
|
|
|
frontoffsetlabel.Text = "Front offset:";
|
|
|
|
frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
|
|
|
|
frontoffsetlabel.Enabled = true;
|
|
|
|
frontoffset.Enabled = true;
|
|
|
|
|
|
|
|
panelUDMFFrontTop.Visible = false;
|
|
|
|
panelUDMFFrontMid.Visible = false;
|
|
|
|
panelUDMFFrontBottom.Visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Resize panel
|
|
|
|
frontpanel.Width = defaultPanelWidth + addedWidth + 12;
|
|
|
|
flowLayoutPanelFront.Width = defaultPanelWidth + addedWidth;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
fronthighname.Text = l.Front.HighTexture;
|
|
|
|
frontmidname.Text = l.Front.MiddleTexture;
|
|
|
|
frontlowname.Text = l.Front.LowTexture;
|
2013-06-17 13:17:53 +00:00
|
|
|
DisplaySidedefTexture(fronthightex, labelTextureFrontTop, l.Front.HighTexture, l.Front.HighRequired());
|
|
|
|
DisplaySidedefTexture(frontmidtex, labelTextureFrontMid, l.Front.MiddleTexture, l.Front.MiddleRequired());
|
|
|
|
DisplaySidedefTexture(frontlowtex, labelTextureFrontBottom, l.Front.LowTexture, l.Front.LowRequired());
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//mxd. Position panel
|
|
|
|
frontpanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + frontpanel.Margin.Left;
|
|
|
|
|
|
|
|
//mxd. Position label
|
|
|
|
frontsector.Left = frontpanel.Width - frontsector.Width - 12;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Show no info
|
2012-10-03 18:46:13 +00:00
|
|
|
//mxd
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
frontoffsetlabel.Text = "Front light:";
|
|
|
|
frontoffset.Text = "--";
|
|
|
|
} else {
|
|
|
|
frontoffsetlabel.Text = "Front offset:";
|
|
|
|
frontoffset.Text = "--, --";
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
frontoffsetlabel.Enabled = false;
|
|
|
|
frontoffset.Enabled = false;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
fronthightex.BackgroundImage = null;
|
|
|
|
frontmidtex.BackgroundImage = null;
|
|
|
|
frontlowtex.BackgroundImage = null;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
frontpanel.Visible = false; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Back size available?
|
|
|
|
if(l.Back != null)
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
int addedWidth = 0; //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Show sidedef info
|
2012-10-03 18:46:13 +00:00
|
|
|
backpanel.Visible = true; //mxd
|
2012-11-05 21:53:45 +00:00
|
|
|
backpanel.Text = " Back Sidedef " + l.Back.Index;
|
2009-06-12 09:22:09 +00:00
|
|
|
backsector.Text = " Sector " + l.Back.Sector.Index;
|
|
|
|
backsector.Visible = true;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
//light
|
|
|
|
backoffsetlabel.Text = "Back light:";
|
2012-11-02 23:11:38 +00:00
|
|
|
setUDMFLight(l.Back, backoffsetlabel, backoffset);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2012-11-05 21:53:45 +00:00
|
|
|
//global offset
|
|
|
|
backpanel.Text += ". Offset: " + l.Back.OffsetX + ", " + l.Back.OffsetY;
|
|
|
|
|
2012-10-03 18:46:13 +00:00
|
|
|
bool hasTopFields = false;
|
|
|
|
bool hasMiddleFields = false;
|
|
|
|
bool hasBottomFields = false;
|
|
|
|
|
|
|
|
//sidedef top
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Back.Fields, "offsetx_top", "offsety_top", backTopUDMFOffsetLabel, backTopUDMFOffset))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasTopFields = true;
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Back.Fields, "scalex_top", "scaley_top", backTopUDMFScaleLabel, backTopUDMFScale))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasTopFields = true;
|
|
|
|
|
|
|
|
//sidedef middle
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Back.Fields, "offsetx_mid", "offsety_mid", backMidUDMFOffsetLabel, backMidUDMFOffset))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasMiddleFields = true;
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Back.Fields, "scalex_mid", "scaley_mid", backMidUDMFScaleLabel, backMidUDMFScale))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasMiddleFields = true;
|
|
|
|
|
|
|
|
//sidedef bottom
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Back.Fields, "offsetx_bottom", "offsety_bottom", backBottomUDMFOffsetLabel, backBottomUDMFOffset))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasBottomFields = true;
|
2012-10-05 13:16:38 +00:00
|
|
|
if (checkPairedUDMFFields(l.Back.Fields, "scalex_bottom", "scaley_bottom", backBottomUDMFScaleLabel, backBottomUDMFScale))
|
2012-10-03 18:46:13 +00:00
|
|
|
hasBottomFields = true;
|
|
|
|
|
|
|
|
//visibility
|
|
|
|
panelUDMFBackTop.Visible = hasTopFields;
|
|
|
|
panelUDMFBackMid.Visible = hasMiddleFields;
|
|
|
|
panelUDMFBackBottom.Visible = hasBottomFields;
|
|
|
|
|
|
|
|
//size
|
|
|
|
if(hasTopFields) addedWidth = 64;
|
|
|
|
if(hasMiddleFields) addedWidth += 64;
|
|
|
|
if(hasBottomFields) addedWidth += 64;
|
|
|
|
} else {
|
|
|
|
backoffsetlabel.Text = "Back offset:";
|
|
|
|
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
|
|
|
|
backoffsetlabel.Enabled = true;
|
|
|
|
backoffset.Enabled = true;
|
|
|
|
|
|
|
|
panelUDMFBackTop.Visible = false;
|
|
|
|
panelUDMFBackMid.Visible = false;
|
|
|
|
panelUDMFBackBottom.Visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Resize panel
|
|
|
|
backpanel.Width = defaultPanelWidth + addedWidth + 12;
|
|
|
|
flowLayoutPanelBack.Width = defaultPanelWidth + addedWidth;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
backhighname.Text = l.Back.HighTexture;
|
|
|
|
backmidname.Text = l.Back.MiddleTexture;
|
|
|
|
backlowname.Text = l.Back.LowTexture;
|
2013-06-17 13:17:53 +00:00
|
|
|
DisplaySidedefTexture(backhightex, labelTextureBackTop, l.Back.HighTexture, l.Back.HighRequired());
|
|
|
|
DisplaySidedefTexture(backmidtex, labelTextureBackMid, l.Back.MiddleTexture, l.Back.MiddleRequired());
|
|
|
|
DisplaySidedefTexture(backlowtex, labelTextureBackBottom, l.Back.LowTexture, l.Back.LowRequired());
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//mxd. Position panel
|
|
|
|
backpanel.Left = (l.Front != null ? frontpanel.Right : infopanel.Right) + 3;
|
|
|
|
|
|
|
|
//mxd. Position label
|
|
|
|
backsector.Left = backpanel.Width - backsector.Width - 12;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Show no info
|
2012-10-03 18:46:13 +00:00
|
|
|
//mxd
|
|
|
|
if(General.Map.UDMF) {
|
|
|
|
backoffsetlabel.Text = "Back light:";
|
|
|
|
backoffset.Text = "--";
|
|
|
|
} else {
|
|
|
|
backoffsetlabel.Text = "Back offset:";
|
|
|
|
backoffset.Text = "--, --";
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
backoffsetlabel.Enabled = false;
|
|
|
|
backoffset.Enabled = false;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
backhightex.BackgroundImage = null;
|
|
|
|
backmidtex.BackgroundImage = null;
|
|
|
|
backlowtex.BackgroundImage = null;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
backpanel.Visible = false; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Show the whole thing
|
|
|
|
this.Show();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
|
2012-10-03 18:46:13 +00:00
|
|
|
//mxd
|
|
|
|
private bool checkPairedUDMFFields(UniFields fields, string paramX, string paramY, Label label, Label value) {
|
2012-10-05 13:16:38 +00:00
|
|
|
float dx = getDefaultUDMFValue(paramX);
|
|
|
|
float dy = getDefaultUDMFValue(paramY);
|
|
|
|
float x = dx;
|
|
|
|
float y = dy;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
if(fields.ContainsKey(paramX))
|
|
|
|
x = (float)fields[paramX].Value;
|
|
|
|
if(fields.ContainsKey(paramY))
|
|
|
|
y = (float)fields[paramY].Value;
|
|
|
|
|
2012-10-05 13:16:38 +00:00
|
|
|
if(x != dx || y != dy) {
|
|
|
|
value.Text = String.Format("{0:0.##}", x) + ", " + String.Format("{0:0.##}", y);
|
2012-10-03 18:46:13 +00:00
|
|
|
value.Enabled = true;
|
|
|
|
label.Enabled = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
value.Text = "--, --";
|
|
|
|
value.Enabled = false;
|
|
|
|
label.Enabled = false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
2012-11-02 23:11:38 +00:00
|
|
|
private void setUDMFLight(Sidedef sd, Label label, Label value) {
|
|
|
|
if(sd.Fields.ContainsKey("light")) {
|
|
|
|
int light = (int)sd.Fields["light"].Value;
|
|
|
|
|
|
|
|
if (sd.Fields.ContainsKey("lightabsolute") && Boolean.Parse(sd.Fields["lightabsolute"].Value.ToString()))
|
|
|
|
value.Text = light + " (abs.)";
|
|
|
|
else
|
|
|
|
value.Text = light + " (" + Math.Min(255, Math.Max(0, (light + sd.Sector.Brightness))) + ")";
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
value.Enabled = true;
|
|
|
|
label.Enabled = true;
|
|
|
|
} else {
|
|
|
|
value.Text = "--";
|
|
|
|
label.Enabled = false;
|
|
|
|
value.Enabled = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 13:16:38 +00:00
|
|
|
//mxd
|
|
|
|
private float getDefaultUDMFValue(string valueName) {
|
|
|
|
foreach (UniversalFieldInfo fi in fieldInfos) {
|
|
|
|
if (fi.Name == valueName)
|
|
|
|
return (float)fi.Default;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// When visible changed
|
|
|
|
protected override void OnVisibleChanged(EventArgs e)
|
|
|
|
{
|
|
|
|
// Hiding panels
|
|
|
|
if(!this.Visible)
|
|
|
|
{
|
|
|
|
fronthightex.BackgroundImage = null;
|
|
|
|
frontmidtex.BackgroundImage = null;
|
|
|
|
frontlowtex.BackgroundImage = null;
|
|
|
|
backhightex.BackgroundImage = null;
|
|
|
|
backmidtex.BackgroundImage = null;
|
|
|
|
backlowtex.BackgroundImage = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call base
|
|
|
|
base.OnVisibleChanged(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This shows a sidedef texture in a panel
|
2013-06-17 13:17:53 +00:00
|
|
|
private void DisplaySidedefTexture(Panel panel, Label label, string name, bool required)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Check if name is a "none" texture
|
2013-07-31 12:38:47 +00:00
|
|
|
if((name.Length < 1) || (name == "-"))
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2013-06-17 13:17:53 +00:00
|
|
|
label.Visible = false; //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Determine image to show
|
2013-07-31 12:38:47 +00:00
|
|
|
if(required)
|
|
|
|
General.DisplayZoomedImage(panel, Properties.Resources.MissingTexture);
|
2013-08-05 13:46:43 +00:00
|
|
|
else
|
|
|
|
panel.BackgroundImage = null;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-17 13:17:53 +00:00
|
|
|
//mxd
|
|
|
|
ImageData texture = General.Map.Data.GetTextureImage(name);
|
2013-07-29 08:50:50 +00:00
|
|
|
if(General.Settings.ShowTextureSizes && texture.ImageState == ImageLoadState.Ready && !(texture is UnknownImage)) {
|
2013-06-17 13:17:53 +00:00
|
|
|
label.Visible = true;
|
2013-06-17 14:09:29 +00:00
|
|
|
label.Text = texture.ScaledWidth + "x" + texture.ScaledHeight;
|
2013-06-17 13:17:53 +00:00
|
|
|
} else {
|
|
|
|
label.Visible = false;
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Set the image
|
2013-07-31 12:38:47 +00:00
|
|
|
General.DisplayZoomedImage(panel, texture.GetPreview());
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|