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;
|
2014-12-03 09:06:05 +00:00
|
|
|
using System.Drawing;
|
2015-03-03 09:42:54 +00:00
|
|
|
using System.Globalization;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.Windows.Forms;
|
2014-12-03 09:06:05 +00:00
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Tools;
|
2009-04-19 18:07:22 +00:00
|
|
|
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
|
|
|
|
{
|
2014-12-03 09:06:05 +00:00
|
|
|
private readonly int hexenformatwidth;
|
|
|
|
private readonly int doomformatwidth;
|
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;
|
2014-12-03 09:06:05 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
labelTextureFrontTop.BackColor = Color.FromArgb(128, labelTextureFrontTop.BackColor);
|
|
|
|
labelTextureFrontMid.BackColor = Color.FromArgb(128, labelTextureFrontMid.BackColor);
|
|
|
|
labelTextureFrontBottom.BackColor = Color.FromArgb(128, labelTextureFrontBottom.BackColor);
|
|
|
|
|
|
|
|
labelTextureBackTop.BackColor = Color.FromArgb(128, labelTextureBackTop.BackColor);
|
|
|
|
labelTextureBackMid.BackColor = Color.FromArgb(128, labelTextureBackMid.BackColor);
|
|
|
|
labelTextureBackBottom.BackColor = Color.FromArgb(128, labelTextureBackBottom.BackColor);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This shows the info
|
2015-02-25 19:59:17 +00:00
|
|
|
public void ShowInfo(Linedef l, Sidedef highlightside)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
string peggedness;
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
2013-12-06 11:21:10 +00:00
|
|
|
|
2014-01-23 13:36:51 +00:00
|
|
|
//mxd. Hide activation or tag and rearrange labels
|
2014-11-25 11:52:01 +00:00
|
|
|
if(!General.Map.FormatInterface.HasBuiltInActivations && General.Map.FormatInterface.HasNumericLinedefActivations) //Hexen map format?
|
|
|
|
{
|
2014-01-23 13:36:51 +00:00
|
|
|
activation.Visible = true;
|
|
|
|
activationlabel.Visible = true;
|
|
|
|
taglabel.Visible = false;
|
|
|
|
tag.Visible = false;
|
|
|
|
|
2014-03-14 14:21:34 +00:00
|
|
|
//set activation
|
2014-11-25 11:52:01 +00:00
|
|
|
foreach(LinedefActivateInfo ai in General.Map.Config.LinedefActivates)
|
|
|
|
{
|
|
|
|
if(l.Activate == ai.Index)
|
|
|
|
{
|
2013-12-06 11:21:10 +00:00
|
|
|
activation.Text = ai.Title;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-01-23 13:36:51 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
activation.Enabled = (l.Activate != 0); //mxd
|
|
|
|
activationlabel.Enabled = (l.Activate != 0); //mxd
|
2014-11-25 11:52:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-06 11:21:10 +00:00
|
|
|
activation.Visible = false;
|
|
|
|
activationlabel.Visible = false;
|
2014-01-23 13:36:51 +00:00
|
|
|
taglabel.Visible = true;
|
|
|
|
tag.Visible = true;
|
2013-12-06 11:21:10 +00:00
|
|
|
|
2014-03-14 14:21:34 +00:00
|
|
|
//set tag
|
2014-12-08 21:06:08 +00:00
|
|
|
tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " - " + General.Map.Options.TagLabels[l.Tag] : string.Empty);
|
2014-12-03 09:06:05 +00:00
|
|
|
tag.Enabled = (l.Tag != 0);
|
|
|
|
taglabel.Enabled = (l.Tag != 0);
|
2013-12-06 11:21:10 +00:00
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Get line action information
|
|
|
|
LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action);
|
|
|
|
|
|
|
|
// Determine peggedness
|
2014-12-03 09:06:05 +00:00
|
|
|
bool upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag);
|
|
|
|
bool lowerunpegged = l.IsFlagSet(General.Map.Config.LowerUnpeggedFlag);
|
2009-04-19 18:07:22 +00:00
|
|
|
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.##");
|
2014-01-16 09:32:05 +00:00
|
|
|
angle.Text = l.AngleDeg + "\u00B0";
|
2009-04-19 18:07:22 +00:00
|
|
|
unpegged.Text = peggedness;
|
2014-12-08 21:06:08 +00:00
|
|
|
unpegged.Enabled = (peggedness != "None"); //mxd
|
|
|
|
peglabel.Enabled = (peggedness != "None"); //mxd
|
2014-12-03 09:06:05 +00:00
|
|
|
action.Enabled = (act.Index != 0);
|
|
|
|
actionlabel.Enabled = (act.Index != 0);
|
2012-07-10 10:20:45 +00:00
|
|
|
|
2013-09-11 09:47:53 +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
|
2013-09-11 09:47:53 +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
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-11-25 11:52:01 +00:00
|
|
|
if (hasArg0Str)
|
2013-09-11 09:47:53 +00:00
|
|
|
arg1.Text = '"' + l.Fields["arg0str"].Value.ToString() + '"';
|
2014-11-25 11:52:01 +00:00
|
|
|
else
|
2014-12-03 09:06:05 +00:00
|
|
|
SetArgumentText(act.Args[0], arg1, l.Args[0]);
|
|
|
|
SetArgumentText(act.Args[1], arg2, l.Args[1]);
|
|
|
|
SetArgumentText(act.Args[2], arg3, l.Args[2]);
|
|
|
|
SetArgumentText(act.Args[3], arg4, l.Args[3]);
|
|
|
|
SetArgumentText(act.Args[4], arg5, l.Args[4]);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Front side available?
|
|
|
|
if(l.Front != null)
|
|
|
|
{
|
2014-12-03 09:06:05 +00:00
|
|
|
//mxd. Extended info shown?
|
|
|
|
bool hasTopFields = false;
|
|
|
|
bool hasMiddleFields = false;
|
|
|
|
bool hasBottomFields = false;
|
2015-02-25 19:59:17 +00:00
|
|
|
|
|
|
|
//mxd. Highlight this side?
|
|
|
|
bool highlight = (l.Front == highlightside);
|
|
|
|
frontpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd
|
2012-10-03 18:46:13 +00:00
|
|
|
|
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;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-11-25 11:52:01 +00:00
|
|
|
if(General.Map.UDMF)
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
//light
|
|
|
|
frontoffsetlabel.Text = "Front light:";
|
2015-02-25 19:59:17 +00:00
|
|
|
SetUDMFLight(l.Front, frontoffsetlabel, frontoffset, highlight);
|
2012-11-05 21:53:45 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
//global offset, sector index
|
|
|
|
frontpanel.Text += ". Offset " + l.Front.OffsetX + ", " + l.Front.OffsetY + ". Sector " + l.Front.Sector.Index + " ";
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//sidedef top
|
2015-02-25 19:59:17 +00:00
|
|
|
hasTopFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_top", "offsety_top", 0.0f, frontTopUDMFOffsetLabel, frontTopUDMFOffset, highlight);
|
|
|
|
hasTopFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_top", "scaley_top", 1.0f, frontTopUDMFScaleLabel, frontTopUDMFScale, highlight);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//sidedef middle
|
2015-02-25 19:59:17 +00:00
|
|
|
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_mid", "offsety_mid", 0.0f, frontMidUDMFOffsetLabel, frontMidUDMFOffset, highlight);
|
|
|
|
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_mid", "scaley_mid", 1.0f, frontMidUDMFScaleLabel, frontMidUDMFScale, highlight);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//sidedef bottom
|
2015-02-25 19:59:17 +00:00
|
|
|
hasBottomFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_bottom", "offsety_bottom", 0.0f, frontBottomUDMFOffsetLabel, frontBottomUDMFOffset, highlight);
|
|
|
|
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_bottom", "scaley_bottom", 1.0f, frontBottomUDMFScaleLabel, frontBottomUDMFScale, highlight);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//visibility
|
2014-12-03 09:06:05 +00:00
|
|
|
frontTopUDMFOffset.Visible = hasTopFields;
|
|
|
|
frontTopUDMFOffsetLabel.Visible = hasTopFields;
|
|
|
|
frontTopUDMFScale.Visible = hasTopFields;
|
|
|
|
frontTopUDMFScaleLabel.Visible = hasTopFields;
|
|
|
|
|
|
|
|
frontMidUDMFOffset.Visible = hasMiddleFields;
|
|
|
|
frontMidUDMFOffsetLabel.Visible = hasMiddleFields;
|
|
|
|
frontMidUDMFScale.Visible = hasMiddleFields;
|
|
|
|
frontMidUDMFScaleLabel.Visible = hasMiddleFields;
|
|
|
|
|
|
|
|
frontBottomUDMFOffset.Visible = hasBottomFields;
|
|
|
|
frontBottomUDMFOffsetLabel.Visible = hasBottomFields;
|
|
|
|
frontBottomUDMFScale.Visible = hasBottomFields;
|
|
|
|
frontBottomUDMFScaleLabel.Visible = hasBottomFields;
|
2014-11-25 11:52:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
frontoffsetlabel.Text = "Front offset:";
|
2014-12-08 21:06:08 +00:00
|
|
|
if (l.Front.OffsetX != 0 || l.Front.OffsetY != 0)
|
|
|
|
{
|
|
|
|
frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY;
|
|
|
|
frontoffsetlabel.Enabled = true;
|
|
|
|
frontoffset.Enabled = true;
|
Fixed(?), Texture Browser: possibly fixed Texture Browser not showing up / locking edit forms when current map has a ton of textures (like 2000 or more) in a single texture group.
Changed, cosmetic, Sector Info panel, Visual mode: info about currently highlighted surface is now shown using different color.
Changed, cosmetic, Linedef Info panel, Visual mode, non-UDMF: texture offset labels for currently highlighted sidedef are now shown using different color.
Changed, cosmetic, Vertex Info panel, UDMF: floor and ceiling offset labels are now grayed out when they have default values.
2015-03-23 22:39:31 +00:00
|
|
|
|
|
|
|
frontoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText);
|
|
|
|
frontoffsetlabel.ForeColor = frontoffset.ForeColor;
|
2014-12-08 21:06:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frontoffset.Text = "--, --";
|
|
|
|
frontoffsetlabel.Enabled = false;
|
|
|
|
frontoffset.Enabled = false;
|
|
|
|
}
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
//mxd. Sector index
|
|
|
|
frontpanel.Text += ". Sector " + l.Front.Sector.Index + " ";
|
2012-10-03 18:46:13 +00:00
|
|
|
}
|
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
//mxd. Set texture names, update panel sizes
|
|
|
|
UpdateTexturePanel(panelFrontTop, l.Front.HighTexture, fronthighname, labelTextureFrontTop,
|
|
|
|
Math.Max(frontTopUDMFOffset.Right, frontTopUDMFScale.Right) + 4, fronthightex,
|
|
|
|
frontTopUDMFOffsetLabel.Left, hasTopFields, l.Front.HighRequired());
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
UpdateTexturePanel(panelFrontMid, l.Front.MiddleTexture, frontmidname, labelTextureFrontMid,
|
|
|
|
Math.Max(frontMidUDMFOffset.Right, frontMidUDMFScale.Right) + 4, frontmidtex,
|
|
|
|
frontMidUDMFOffsetLabel.Left, hasMiddleFields, l.Front.MiddleRequired());
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
UpdateTexturePanel(panelFrontLow, l.Front.LowTexture, frontlowname, labelTextureFrontBottom,
|
|
|
|
Math.Max(frontBottomUDMFOffset.Right, frontBottomUDMFScale.Right) + 4, frontlowtex,
|
|
|
|
frontBottomUDMFOffsetLabel.Left, hasBottomFields, l.Front.LowRequired());
|
|
|
|
|
|
|
|
//mxd. Resize panel
|
|
|
|
flowLayoutPanelFront.Width = panelFrontLow.Right;
|
|
|
|
frontpanel.Width = flowLayoutPanelFront.Width + flowLayoutPanelFront.Left * 2 - 4;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Show no info
|
2014-11-25 11:52:01 +00:00
|
|
|
if(General.Map.UDMF) //mxd
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
frontoffsetlabel.Text = "Front light:";
|
|
|
|
frontoffset.Text = "--";
|
2014-11-25 11:52:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
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)
|
|
|
|
{
|
2014-12-03 09:06:05 +00:00
|
|
|
//mxd. Extended info shown?
|
|
|
|
bool hasTopFields = false;
|
|
|
|
bool hasMiddleFields = false;
|
|
|
|
bool hasBottomFields = false;
|
2015-02-25 19:59:17 +00:00
|
|
|
|
|
|
|
//mxd. Highlight this side?
|
|
|
|
bool highlight = l.Back == highlightside;
|
|
|
|
backpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //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;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-12-03 09:06:05 +00:00
|
|
|
if(General.Map.UDMF)
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
//light
|
|
|
|
backoffsetlabel.Text = "Back light:";
|
2015-02-25 19:59:17 +00:00
|
|
|
SetUDMFLight(l.Back, backoffsetlabel, backoffset, highlight);
|
2012-11-05 21:53:45 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
//global offset, sector index
|
|
|
|
backpanel.Text += ". Offset " + l.Back.OffsetX + ", " + l.Back.OffsetY + ". Sector " + l.Back.Sector.Index + " ";
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//sidedef top
|
2015-02-25 19:59:17 +00:00
|
|
|
hasTopFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_top", "offsety_top", 0f, backTopUDMFOffsetLabel, backTopUDMFOffset, highlight);
|
|
|
|
hasTopFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_top", "scaley_top", 1.0f, backTopUDMFScaleLabel, backTopUDMFScale, highlight);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//sidedef middle
|
2015-02-25 19:59:17 +00:00
|
|
|
hasMiddleFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_mid", "offsety_mid", 0f, backMidUDMFOffsetLabel, backMidUDMFOffset, highlight);
|
|
|
|
hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_mid", "scaley_mid", 1.0f, backMidUDMFScaleLabel, backMidUDMFScale, highlight);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//sidedef bottom
|
2015-02-25 19:59:17 +00:00
|
|
|
hasBottomFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_bottom", "offsety_bottom", 0f, backBottomUDMFOffsetLabel, backBottomUDMFOffset, highlight);
|
|
|
|
hasBottomFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_bottom", "scaley_bottom", 1.0f, backBottomUDMFScaleLabel, backBottomUDMFScale, highlight);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
|
|
|
//visibility
|
2014-12-03 09:06:05 +00:00
|
|
|
backTopUDMFOffset.Visible = hasTopFields;
|
|
|
|
backTopUDMFOffsetLabel.Visible = hasTopFields;
|
|
|
|
backTopUDMFScale.Visible = hasTopFields;
|
|
|
|
backTopUDMFScaleLabel.Visible = hasTopFields;
|
|
|
|
|
|
|
|
backMidUDMFOffset.Visible = hasMiddleFields;
|
|
|
|
backMidUDMFOffsetLabel.Visible = hasMiddleFields;
|
|
|
|
backMidUDMFScale.Visible = hasMiddleFields;
|
|
|
|
backMidUDMFScaleLabel.Visible = hasMiddleFields;
|
|
|
|
|
|
|
|
backBottomUDMFOffset.Visible = hasBottomFields;
|
|
|
|
backBottomUDMFOffsetLabel.Visible = hasBottomFields;
|
|
|
|
backBottomUDMFScale.Visible = hasBottomFields;
|
|
|
|
backBottomUDMFScaleLabel.Visible = hasBottomFields;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
backoffsetlabel.Text = "Back offset:";
|
2014-12-08 21:06:08 +00:00
|
|
|
if (l.Back.OffsetX != 0 || l.Back.OffsetY != 0)
|
|
|
|
{
|
|
|
|
backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY;
|
|
|
|
backoffsetlabel.Enabled = true;
|
|
|
|
backoffset.Enabled = true;
|
Fixed(?), Texture Browser: possibly fixed Texture Browser not showing up / locking edit forms when current map has a ton of textures (like 2000 or more) in a single texture group.
Changed, cosmetic, Sector Info panel, Visual mode: info about currently highlighted surface is now shown using different color.
Changed, cosmetic, Linedef Info panel, Visual mode, non-UDMF: texture offset labels for currently highlighted sidedef are now shown using different color.
Changed, cosmetic, Vertex Info panel, UDMF: floor and ceiling offset labels are now grayed out when they have default values.
2015-03-23 22:39:31 +00:00
|
|
|
|
|
|
|
backoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText);
|
|
|
|
backoffsetlabel.ForeColor = backoffset.ForeColor;
|
2014-12-08 21:06:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
backoffset.Text = "--, --";
|
|
|
|
backoffsetlabel.Enabled = false;
|
|
|
|
backoffset.Enabled = false;
|
|
|
|
}
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
// Sector index
|
|
|
|
backpanel.Text += ". Sector " + l.Back.Sector.Index + " ";
|
2012-10-03 18:46:13 +00:00
|
|
|
}
|
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
//mxd. Set texture names, update panel sizes
|
|
|
|
UpdateTexturePanel(panelBackTop, l.Back.HighTexture, backhighname, labelTextureBackTop,
|
|
|
|
Math.Max(backTopUDMFOffset.Right, backTopUDMFScale.Right) + 4, backhightex,
|
|
|
|
backTopUDMFOffsetLabel.Left, hasTopFields, l.Back.HighRequired());
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
UpdateTexturePanel(panelBackMid, l.Back.MiddleTexture, backmidname, labelTextureBackMid,
|
|
|
|
Math.Max(backMidUDMFOffset.Right, backMidUDMFScale.Right) + 4, backmidtex,
|
|
|
|
backMidUDMFOffsetLabel.Left, hasMiddleFields, l.Back.MiddleRequired());
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
UpdateTexturePanel(panelBackLow, l.Back.LowTexture, backlowname, labelTextureBackBottom,
|
|
|
|
Math.Max(backBottomUDMFOffset.Right, backBottomUDMFScale.Right) + 4, backlowtex,
|
|
|
|
backBottomUDMFOffsetLabel.Left, hasBottomFields, l.Back.LowRequired());
|
|
|
|
|
|
|
|
//mxd. Resize panel
|
|
|
|
flowLayoutPanelBack.Width = panelBackLow.Right;
|
|
|
|
backpanel.Width = flowLayoutPanelBack.Width + flowLayoutPanelBack.Left * 2 - 4;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Show no info
|
2014-11-25 11:52:01 +00:00
|
|
|
if(General.Map.UDMF) //mxd
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
backoffsetlabel.Text = "Back light:";
|
|
|
|
backoffset.Text = "--";
|
2014-11-25 11:52:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-03 18:46:13 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-12-05 14:04:25 +00:00
|
|
|
//mxd. Flags
|
2014-02-26 14:11:06 +00:00
|
|
|
Dictionary<string, string> activations = new Dictionary<string, string>(StringComparer.Ordinal);
|
2014-11-25 11:52:01 +00:00
|
|
|
foreach(LinedefActivateInfo ai in General.Map.Config.LinedefActivates)
|
2013-12-06 11:21:10 +00:00
|
|
|
activations.Add(ai.Key, ai.Title);
|
|
|
|
|
2013-12-05 14:04:25 +00:00
|
|
|
flags.Items.Clear();
|
2014-11-25 11:52:01 +00:00
|
|
|
foreach(KeyValuePair<string, bool> group in l.Flags)
|
|
|
|
{
|
|
|
|
if(group.Value)
|
|
|
|
{
|
2013-12-06 11:21:10 +00:00
|
|
|
ListViewItem item;
|
2014-11-25 11:52:01 +00:00
|
|
|
if (General.Map.Config.LinedefFlags.ContainsKey(group.Key))
|
2013-12-06 11:21:10 +00:00
|
|
|
item = new ListViewItem(General.Map.Config.LinedefFlags[group.Key]);
|
2014-11-25 11:52:01 +00:00
|
|
|
else if (activations.ContainsKey(group.Key))
|
2013-12-06 11:21:10 +00:00
|
|
|
item = new ListViewItem(activations[group.Key]);
|
2014-11-25 11:52:01 +00:00
|
|
|
else
|
2013-12-06 11:21:10 +00:00
|
|
|
item = new ListViewItem(group.Key);
|
|
|
|
|
2013-12-05 14:04:25 +00:00
|
|
|
item.Checked = true;
|
|
|
|
flags.Items.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Flags panel visibility and size
|
|
|
|
flagsPanel.Visible = (flags.Items.Count > 0);
|
2014-11-25 11:52:01 +00:00
|
|
|
if(flags.Items.Count > 0)
|
|
|
|
{
|
2015-03-23 20:16:14 +00:00
|
|
|
flags.Width = flags.GetItemRect(0).Width * (int)Math.Ceiling(flags.Items.Count / 5.0f);
|
2013-12-05 14:04:25 +00:00
|
|
|
flagsPanel.Width = flags.Width + flags.Left * 2;
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Show the whole thing
|
|
|
|
this.Show();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required)
|
|
|
|
{
|
|
|
|
// Set texture name
|
|
|
|
texturenamelabel.Text = texturename;
|
|
|
|
|
|
|
|
// And image
|
|
|
|
DisplayTextureImage(image, sizelabel, texturename, required);
|
|
|
|
|
|
|
|
//Reposition texture name label?
|
|
|
|
if(texturenamelabel.Width < image.Width + 2)
|
|
|
|
texturenamelabel.Location = new Point(image.Location.X + (image.Width - texturenamelabel.Width) / 2, texturenamelabel.Location.Y);
|
|
|
|
else
|
|
|
|
texturenamelabel.Location = new Point(image.Location.X, texturenamelabel.Location.Y);
|
|
|
|
|
|
|
|
// Resize panel
|
|
|
|
if(!extendedinfoshown)
|
|
|
|
panel.Width = Math.Max(texturenamelabel.Right + image.Location.X + 1, sizeref);
|
|
|
|
else
|
|
|
|
panel.Width = Math.Max(texturenamelabel.Right, maxlabelright) + image.Location.X;
|
|
|
|
}
|
|
|
|
|
2012-10-03 18:46:13 +00:00
|
|
|
//mxd
|
2015-02-25 19:59:17 +00:00
|
|
|
private static bool SetPairedUDMFFieldsLabel(UniFields fields, string paramX, string paramY, float defaultvalue, Label namelabel, Label valuelabel, bool highlight)
|
2014-11-25 11:52:01 +00:00
|
|
|
{
|
2014-12-03 09:06:05 +00:00
|
|
|
float x = UDMFTools.GetFloat(fields, paramX, defaultvalue);
|
|
|
|
float y = UDMFTools.GetFloat(fields, paramY, defaultvalue);
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
if(fields.ContainsKey(paramX)) x = (float)fields[paramX].Value;
|
|
|
|
if(fields.ContainsKey(paramY)) y = (float)fields[paramY].Value;
|
2012-10-03 18:46:13 +00:00
|
|
|
|
2014-12-03 09:06:05 +00:00
|
|
|
if(x != defaultvalue || y != defaultvalue)
|
2014-11-25 11:52:01 +00:00
|
|
|
{
|
2015-03-03 09:42:54 +00:00
|
|
|
valuelabel.Text = x.ToString(CultureInfo.InvariantCulture) + ", " + y.ToString(CultureInfo.InvariantCulture);
|
2014-12-03 09:06:05 +00:00
|
|
|
valuelabel.Enabled = true;
|
|
|
|
namelabel.Enabled = true;
|
2015-02-25 19:59:17 +00:00
|
|
|
return true;
|
2014-12-03 09:06:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
valuelabel.Text = "--, --";
|
2015-02-25 19:59:17 +00:00
|
|
|
valuelabel.Enabled = highlight;
|
|
|
|
namelabel.Enabled = highlight;
|
|
|
|
return false;
|
2012-10-03 18:46:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
2015-02-25 19:59:17 +00:00
|
|
|
private static void SetUDMFLight(Sidedef sd, Label label, Label value, bool highlight)
|
2014-05-20 09:09:28 +00:00
|
|
|
{
|
2014-11-25 11:52:01 +00:00
|
|
|
if(sd.Fields.ContainsKey("light"))
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
int light = (int)sd.Fields["light"].Value;
|
|
|
|
|
2015-02-06 21:03:20 +00:00
|
|
|
if (sd.Fields.GetValue("lightabsolute", false))
|
2012-11-02 23:11:38 +00:00
|
|
|
value.Text = light + " (abs.)";
|
2013-09-11 09:47:53 +00:00
|
|
|
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;
|
2014-11-25 11:52:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-25 19:59:17 +00:00
|
|
|
value.Text = "-- (" + sd.Sector.Brightness + ")";
|
|
|
|
label.Enabled = highlight;
|
|
|
|
value.Enabled = highlight;
|
2012-10-03 18:46:13 +00:00
|
|
|
}
|
2015-02-25 19:59:17 +00:00
|
|
|
|
|
|
|
label.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText);
|
|
|
|
value.ForeColor = label.ForeColor;
|
2012-10-03 18:46:13 +00:00
|
|
|
}
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-03 09:06:05 +00:00
|
|
|
private static void SetArgumentText(ArgumentInfo info, Label label, int value)
|
2014-05-20 09:09:28 +00:00
|
|
|
{
|
2014-01-16 13:08:41 +00:00
|
|
|
TypeHandler th = General.Types.GetArgumentHandler(info);
|
|
|
|
th.SetValue(value);
|
|
|
|
label.Text = th.GetStringValue();
|
|
|
|
}
|
|
|
|
|
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
|
2014-12-03 09:06:05 +00:00
|
|
|
private static void DisplayTextureImage(Panel panel, Label sizelabel, 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
|
|
|
{
|
2014-11-25 11:52:01 +00:00
|
|
|
sizelabel.Visible = false; //mxd
|
2013-06-17 13:17:53 +00:00
|
|
|
|
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);
|
2014-12-03 09:06:05 +00:00
|
|
|
if(General.Settings.ShowTextureSizes && texture.ImageState == ImageLoadState.Ready && !(texture is UnknownImage))
|
2014-11-25 11:52:01 +00:00
|
|
|
{
|
|
|
|
sizelabel.Visible = true;
|
Fixed, Texture previews: texture size labels were displaying incorrect size or no size at all when showing TEXTURES textures with negative scale.
Fixed, Visual mode, UDMF: when several wall parts were selected, only one could be dragged with the mouse.
Fixed, Visual mode, Auto-align textures, UDMF: TEXTURES scale is now taken into account when aligning textures.
Fixed, Visual mode, Auto-align textures (Y), UDMF: nearest height matching is now applied to non-wrapped middle backsides.
Cosmetic changes in ZDoom_ACS.cfg.
2015-01-27 11:40:25 +00:00
|
|
|
sizelabel.Text = Math.Abs(texture.ScaledWidth) + "x" + Math.Abs(texture.ScaledHeight);
|
2014-11-25 11:52:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sizelabel.Visible = false;
|
2013-06-17 13:17:53 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|