// This shows the info public void ShowInfo(Linedef l, Sidedef highlightside) { 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; } //mxd. Hide activation or tag and rearrange labels if (!General.Map.FormatInterface.HasBuiltInActivations && General.Map.FormatInterface.HasNumericLinedefActivations) //Hexen map format? { activation.Visible = true; activationlabel.Text = "Activation:"; activationlabel.Visible = true; taglabel.Visible = false; tag.Visible = false; //set activation foreach (LinedefActivateInfo ai in General.Map.Config.LinedefActivates) { if (l.Activate == ai.Index) { activation.Text = ai.Title; break; } } activation.Enabled = (l.Activate != 0 || l.Action != 0); //mxd activationlabel.Enabled = (l.Activate != 0 || l.Action != 0); //mxd } else { if (General.Map.UDMF) { // Hijack activation labels to show lock numer... activationlabel.Text = "Lock:"; activationlabel.Visible = true; activation.Visible = true; int locknum = l.Fields.GetValue("locknumber", 0); if (locknum != 0) { activationlabel.Enabled = true; activation.Enabled = true; if (General.Map.Config.Enums.ContainsKey("keys")) { foreach (EnumItem item in General.Map.Config.Enums["keys"]) { if (item.GetIntValue() == locknum) { activation.Text = locknum + " - " + item.Title; break; } } } else { activation.Text = locknum.ToString(); } } else { activationlabel.Enabled = false; activation.Enabled = false; activation.Text = "None"; } } else { // Should be Doom map format activationlabel.Visible = false; activation.Visible = false; } taglabel.Visible = true; tag.Visible = true; //mxd. Set tag(s) if (l.Tags.Count > 1) { string[] tags = new string[l.Tags.Count]; for (int i = 0; i < l.Tags.Count; i++) { tags[i] = l.Tags[i].ToString(); } tag.Text = string.Join(", ", tags); tag.Enabled = true; taglabel.Enabled = true; taglabel.Text = "Tags:"; } else { tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " - " + General.Map.Options.TagLabels[l.Tag] : string.Empty); tag.Enabled = (l.Tag != 0); taglabel.Enabled = (l.Tag != 0); taglabel.Text = "Tag:"; } } // Get line action information LinedefActionInfo act = General.Map.Config.GetLinedefActionInfo(l.Action); // Determine peggedness bool upperunpegged = l.IsFlagSet(General.Map.Config.UpperUnpeggedFlag); bool 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 #if DEBUG infopanel.Text = " Linedef " + l.Index + " (vert. " + l.Start.Index + " - vert. " + l.End.Index + ") "; #else infopanel.Text = " Linedef " + l.Index + " "; #endif action.Text = act.ToString(); length.Text = l.Length.ToString("0.##"); angle.Text = l.AngleDeg + "\u00B0"; unpegged.Text = peggedness; unpegged.Enabled = (peggedness != "None"); //mxd peglabel.Enabled = (peggedness != "None"); //mxd action.Enabled = (act.Index != 0); actionlabel.Enabled = (act.Index != 0); //mxd. ACS script argument names bool isacsscript = (Array.IndexOf(GZGeneral.ACS_SPECIALS, l.Action) != -1); bool isarg0str = (General.Map.UDMF && l.Fields.ContainsKey("arg0str")); string arg0str = isarg0str ? l.Fields.GetValue("arg0str", string.Empty) : string.Empty; ScriptItem scriptitem = null; //mxd. Set default label colors arg1.ForeColor = SystemColors.ControlText; arglbl1.ForeColor = SystemColors.ControlText; // Named script? if (isacsscript && isarg0str && General.Map.NamedScripts.ContainsKey(arg0str.ToLowerInvariant())) { scriptitem = General.Map.NamedScripts[arg0str.ToLowerInvariant()]; } // Script number? else if (isacsscript && General.Map.NumberedScripts.ContainsKey(l.Args[0])) { scriptitem = General.Map.NumberedScripts[l.Args[0]]; arg0str = (scriptitem.HasCustomName ? scriptitem.Name : scriptitem.Index.ToString()); } // Apply script args? Label[] arglabels = { arglbl1, arglbl2, arglbl3, arglbl4, arglbl5 }; Label[] args = { arg1, arg2, arg3, arg4, arg5 }; if (scriptitem != null) { int first; string[] argnames = scriptitem.GetArgumentsDescriptions(l.Action, out first); for (int i = 0; i < first; i++) { arglabels[i].Text = (isarg0str ? act.Args[i].TitleStr : act.Args[i].Title) + ":"; arglabels[i].Enabled = act.Args[i].Used; args[i].Enabled = act.Args[i].Used; } for (int i = first; i < argnames.Length; i++) { if (!string.IsNullOrEmpty(argnames[i])) { arglabels[i].Text = argnames[i] + ":"; arglabels[i].Enabled = true; args[i].Enabled = true; } else { arglabels[i].Text = (isarg0str ? act.Args[i].TitleStr : act.Args[i].Title) + ":"; arglabels[i].Enabled = act.Args[i].Used; args[i].Enabled = act.Args[i].Used; } } } else { for (int i = 0; i < act.Args.Length; i++) { arglabels[i].Text = (isarg0str ? act.Args[i].TitleStr : act.Args[i].Title) + ":"; arglabels[i].Enabled = act.Args[i].Used; args[i].Enabled = act.Args[i].Used; } // Special cases: unknown script name/index if (isacsscript) { arglbl1.Text = "Unknown script " + (isarg0str ? "name" : "number") + ":"; arg1.ForeColor = Color.DarkRed; arglbl1.ForeColor = Color.DarkRed; } } //mxd. Set argument value and label if (isarg0str) { arg1.Text = arg0str; } else { 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]); // Front side available? if (l.Front != null) { //mxd. Extended info shown? bool hasTopFields = false; bool hasMiddleFields = false; bool hasBottomFields = false; //mxd. Highlight this side? bool highlight = (l.Front == highlightside); frontpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd // Show sidedef info frontpanel.Visible = true; //mxd frontpanel.Text = " Front Sidedef " + l.Front.Index; //mxd if (General.Map.UDMF) { //light frontoffsetlabel.Text = "Front light:"; SetUDMFLight(l.Front, frontoffsetlabel, frontoffset, highlight); //global offset, sector index frontpanel.Text += ". Offset " + l.Front.OffsetX + ", " + l.Front.OffsetY + ". Sector " + l.Front.Sector.Index + " "; //sidedef top hasTopFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_top", "offsety_top", 0.0, frontTopUDMFOffsetLabel, frontTopUDMFOffset, highlight); hasTopFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_top", "scaley_top", 1.0, frontTopUDMFScaleLabel, frontTopUDMFScale, highlight); //sidedef middle hasMiddleFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_mid", "offsety_mid", 0.0, frontMidUDMFOffsetLabel, frontMidUDMFOffset, highlight); hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_mid", "scaley_mid", 1.0, frontMidUDMFScaleLabel, frontMidUDMFScale, highlight); //sidedef bottom hasBottomFields = SetPairedUDMFFieldsLabel(l.Front.Fields, "offsetx_bottom", "offsety_bottom", 0.0, frontBottomUDMFOffsetLabel, frontBottomUDMFOffset, highlight); hasBottomFields |= SetPairedUDMFFieldsLabel(l.Front.Fields, "scalex_bottom", "scaley_bottom", 1.0, frontBottomUDMFScaleLabel, frontBottomUDMFScale, highlight); //visibility 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; } else { frontoffsetlabel.Text = "Front offset:"; if (l.Front.OffsetX != 0 || l.Front.OffsetY != 0) { frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY; frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); frontoffsetlabel.ForeColor = frontoffset.ForeColor; } else { frontoffset.Text = "--, --"; frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; } //mxd. Sector index frontpanel.Text += ". Sector " + l.Front.Sector.Index + " "; //visibility frontTopUDMFOffsetLabel.Visible = false; frontTopUDMFScaleLabel.Visible = false; frontMidUDMFOffsetLabel.Visible = false; frontMidUDMFScaleLabel.Visible = false; frontBottomUDMFOffsetLabel.Visible = false; frontBottomUDMFScaleLabel.Visible = false; } //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()); UpdateTexturePanel(panelFrontMid, l.Front.MiddleTexture, frontmidname, labelTextureFrontMid, Math.Max(frontMidUDMFOffset.Right, frontMidUDMFScale.Right) + 4, frontmidtex, frontMidUDMFOffsetLabel.Left, hasMiddleFields, l.Front.MiddleRequired()); 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; } else { // Show no info if (General.Map.UDMF) //mxd { frontoffsetlabel.Text = "Front light:"; frontoffset.Text = "--"; } else { frontoffsetlabel.Text = "Front offset:"; frontoffset.Text = "--, --"; } frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; fronthightex.BackgroundImage = null; frontmidtex.BackgroundImage = null; frontlowtex.BackgroundImage = null; frontpanel.Visible = false; //mxd } // Back size available? if (l.Back != null) { //mxd. Extended info shown? bool hasTopFields = false; bool hasMiddleFields = false; bool hasBottomFields = false; //mxd. Highlight this side? bool highlight = l.Back == highlightside; backpanel.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); //mxd // Show sidedef info backpanel.Visible = true; //mxd backpanel.Text = " Back Sidedef " + l.Back.Index; //mxd if (General.Map.UDMF) { //light backoffsetlabel.Text = "Back light:"; SetUDMFLight(l.Back, backoffsetlabel, backoffset, highlight); //global offset, sector index backpanel.Text += ". Offset " + l.Back.OffsetX + ", " + l.Back.OffsetY + ". Sector " + l.Back.Sector.Index + " "; //sidedef top hasTopFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_top", "offsety_top", 0.0, backTopUDMFOffsetLabel, backTopUDMFOffset, highlight); hasTopFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_top", "scaley_top", 1.0, backTopUDMFScaleLabel, backTopUDMFScale, highlight); //sidedef middle hasMiddleFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_mid", "offsety_mid", 0.0, backMidUDMFOffsetLabel, backMidUDMFOffset, highlight); hasMiddleFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_mid", "scaley_mid", 1.0, backMidUDMFScaleLabel, backMidUDMFScale, highlight); //sidedef bottom hasBottomFields = SetPairedUDMFFieldsLabel(l.Back.Fields, "offsetx_bottom", "offsety_bottom", 0.0, backBottomUDMFOffsetLabel, backBottomUDMFOffset, highlight); hasBottomFields |= SetPairedUDMFFieldsLabel(l.Back.Fields, "scalex_bottom", "scaley_bottom", 1.0, backBottomUDMFScaleLabel, backBottomUDMFScale, highlight); //visibility 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 { backoffsetlabel.Text = "Back offset:"; if (l.Back.OffsetX != 0 || l.Back.OffsetY != 0) { backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY; backoffsetlabel.Enabled = true; backoffset.Enabled = true; backoffset.ForeColor = (highlight ? SystemColors.HotTrack : SystemColors.WindowText); backoffsetlabel.ForeColor = backoffset.ForeColor; } else { backoffset.Text = "--, --"; backoffsetlabel.Enabled = false; backoffset.Enabled = false; } // Sector index backpanel.Text += ". Sector " + l.Back.Sector.Index + " "; } //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()); UpdateTexturePanel(panelBackMid, l.Back.MiddleTexture, backmidname, labelTextureBackMid, Math.Max(backMidUDMFOffset.Right, backMidUDMFScale.Right) + 4, backmidtex, backMidUDMFOffsetLabel.Left, hasMiddleFields, l.Back.MiddleRequired()); 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; } else { // Show no info if (General.Map.UDMF) //mxd { backoffsetlabel.Text = "Back light:"; backoffset.Text = "--"; } else { backoffsetlabel.Text = "Back offset:"; backoffset.Text = "--, --"; } backoffsetlabel.Enabled = false; backoffset.Enabled = false; backhightex.BackgroundImage = null; backmidtex.BackgroundImage = null; backlowtex.BackgroundImage = null; backpanel.Visible = false; //mxd } //mxd. Flags and activations flags.Items.Clear(); // Add activations foreach (LinedefActivateInfo ai in General.Map.Config.LinedefActivates) { if (l.Flags.ContainsKey(ai.Key) && l.Flags[ai.Key]) { flags.Items.Add(new ListViewItem(ai.Title) { Checked = true, ForeColor = SystemColors.HotTrack }); } } // And flags foreach (KeyValuePair <string, string> group in General.Map.Config.LinedefFlags) { if (l.Flags.ContainsKey(group.Key) && l.Flags[group.Key]) { flags.Items.Add(new ListViewItem(group.Value) { Checked = true }); } } // And front flags if (l.Front != null) { foreach (KeyValuePair <string, string> group in General.Map.Config.SidedefFlags) { if (l.Front.Flags.ContainsKey(group.Key) && l.Front.Flags[group.Key]) { flags.Items.Add(new ListViewItem("Front: " + group.Value) { Checked = true }); } } } // And back flags if (l.Back != null) { foreach (KeyValuePair <string, string> group in General.Map.Config.SidedefFlags) { if (l.Back.Flags.ContainsKey(group.Key) && l.Back.Flags[group.Key]) { flags.Items.Add(new ListViewItem("Back: " + group.Value) { Checked = true }); } } } //mxd. Flags panel visibility and size flagsPanel.Visible = (flags.Items.Count > 0); if (flags.Items.Count > 0) { Rectangle rect = flags.GetItemRect(0); int itemspercolumn = 1; // Check how many items per column we have... for (int i = 1; i < flags.Items.Count; i++) { if (flags.GetItemRect(i).X != rect.X) { break; } itemspercolumn++; } flags.Width = rect.Width * (int)Math.Ceiling(flags.Items.Count / (float)itemspercolumn); flagsPanel.Width = flags.Width + flags.Left * 2; } // Show the whole thing this.Show(); //this.Update(); // ano - don't think this is needed, and is slow }
// This shows the info public void ShowInfo(Linedef l) { TypeHandler th; bool upperunpegged, lowerunpegged; 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; } // Move panels frontpanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + frontpanel.Margin.Left; backpanel.Left = frontpanel.Left + frontpanel.Width + frontpanel.Margin.Right + backpanel.Margin.Left; // 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 infopanel.Text = " Linedef " + l.Index + " "; action.Text = act.ToString(); length.Text = l.Length.ToString("0.##"); angle.Text = l.AngleDeg.ToString() + "\u00B0"; tag.Text = l.Tag.ToString(); unpegged.Text = peggedness; // Arguments arglbl1.Text = act.Args[0].Title + ":"; 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; th = General.Types.GetArgumentHandler(act.Args[0]); th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue(); 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) { // Show sidedef info frontpanel.Text = " Front Sidedef " + l.Front.Index + " "; frontsector.Text = " Sector " + l.Front.Sector.Index; frontsector.Visible = true; frontoffset.Text = l.Front.OffsetX + ", " + l.Front.OffsetY; fronthighname.Text = l.Front.HighTexture; frontmidname.Text = l.Front.MiddleTexture; frontlowname.Text = l.Front.LowTexture; DisplaySidedefTexture(fronthightex, l.Front.HighTexture, l.Front.HighRequired()); DisplaySidedefTexture(frontmidtex, l.Front.MiddleTexture, l.Front.MiddleRequired()); DisplaySidedefTexture(frontlowtex, l.Front.LowTexture, l.Front.LowRequired()); frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontpanel.Enabled = true; } else { // Show no info frontpanel.Text = " Front Sidedef "; frontsector.Text = ""; frontsector.Visible = false; frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; frontpanel.Enabled = false; frontoffset.Text = "--, --"; fronthighname.Text = ""; frontmidname.Text = ""; frontlowname.Text = ""; fronthightex.BackgroundImage = null; frontmidtex.BackgroundImage = null; frontlowtex.BackgroundImage = null; } // Back size available? if (l.Back != null) { // Show sidedef info backpanel.Text = " Back Sidedef " + l.Back.Index + " "; backsector.Text = " Sector " + l.Back.Sector.Index; backsector.Visible = true; backoffset.Text = l.Back.OffsetX + ", " + l.Back.OffsetY; backhighname.Text = l.Back.HighTexture; backmidname.Text = l.Back.MiddleTexture; backlowname.Text = l.Back.LowTexture; DisplaySidedefTexture(backhightex, l.Back.HighTexture, l.Back.HighRequired()); DisplaySidedefTexture(backmidtex, l.Back.MiddleTexture, l.Back.MiddleRequired()); DisplaySidedefTexture(backlowtex, l.Back.LowTexture, l.Back.LowRequired()); backoffsetlabel.Enabled = true; backoffset.Enabled = true; backpanel.Enabled = true; } else { // Show no info backpanel.Text = " Back Sidedef "; backsector.Text = ""; backsector.Visible = false; backoffsetlabel.Enabled = false; backoffset.Enabled = false; backpanel.Enabled = false; backoffset.Text = "--, --"; backhighname.Text = ""; backmidname.Text = ""; backlowname.Text = ""; backhightex.BackgroundImage = null; backmidtex.BackgroundImage = null; backlowtex.BackgroundImage = null; } // Position labels frontsector.Left = frontlowtex.Right - frontsector.Width; backsector.Left = backlowtex.Right - backsector.Width; // Show the whole thing this.Show(); this.Update(); }
// This shows the info public void ShowInfo(Thing t) { ThingTypeInfo ti; LinedefActionInfo act = null; TypeHandler th; string actioninfo = ""; string zinfo; float zvalue; // 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; } // Move panel spritepanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + spritepanel.Margin.Left; // Lookup thing info ti = General.Map.Data.GetThingInfo(t.Type); // Get thing action information if (General.Map.Config.LinedefActions.ContainsKey(t.Action)) { act = General.Map.Config.LinedefActions[t.Action]; actioninfo = act.ToString(); } else if (t.Action == 0) { actioninfo = t.Action.ToString() + " - None"; } else { actioninfo = t.Action.ToString() + " - Unknown"; } // Determine z info to show t.DetermineSector(); if (ti.AbsoluteZ) { zvalue = t.Position.z; zinfo = zvalue.ToString(); } else { if (t.Sector != null) { // Hangs from ceiling? if (ti.Hangs) { zvalue = (float)t.Sector.CeilHeight + t.Position.z; zinfo = zvalue.ToString(); } else { zvalue = (float)t.Sector.FloorHeight + t.Position.z; zinfo = zvalue.ToString(); } } else { zvalue = t.Position.z; if (zvalue >= 0.0f) { zinfo = "+" + zvalue.ToString(); } else { zinfo = zvalue.ToString(); } } } // Thing info infopanel.Text = " Thing " + t.Index + " "; type.Text = t.Type + " - " + ti.Title; action.Text = actioninfo; position.Text = t.Position.x.ToString() + ", " + t.Position.y.ToString() + ", " + zinfo; tag.Text = t.Tag.ToString(); angle.Text = t.AngleDoom.ToString() + "\u00B0"; // Sprite if (ti.Sprite.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX) && (ti.Sprite.Length > DataManager.INTERNAL_PREFIX.Length)) { spritename.Text = ""; General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(ti.Sprite).GetBitmap()); } else if (ti.Sprite.Length > 0) { spritename.Text = ti.Sprite; General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(ti.Sprite).GetPreview()); } else { spritename.Text = ""; spritetex.BackgroundImage = null; } // Arguments if (act != null) { arglbl1.Text = act.Args[0].Title + ":"; 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; th = General.Types.GetArgumentHandler(act.Args[0]); th.SetValue(t.Args[0]); arg1.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[1]); th.SetValue(t.Args[1]); arg2.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[2]); th.SetValue(t.Args[2]); arg3.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[3]); th.SetValue(t.Args[3]); arg4.Text = th.GetStringValue(); th = General.Types.GetArgumentHandler(act.Args[4]); th.SetValue(t.Args[4]); arg5.Text = th.GetStringValue(); } else { arglbl1.Text = "Argument 1:"; arglbl2.Text = "Argument 2:"; arglbl3.Text = "Argument 3:"; arglbl4.Text = "Argument 4:"; arglbl5.Text = "Argument 5:"; arglbl1.Enabled = false; arglbl2.Enabled = false; arglbl3.Enabled = false; arglbl4.Enabled = false; arglbl5.Enabled = false; arg1.Enabled = false; arg2.Enabled = false; arg3.Enabled = false; arg4.Enabled = false; arg5.Enabled = false; arg1.Text = "-"; arg2.Text = "-"; arg3.Text = "-"; arg4.Text = "-"; arg5.Text = "-"; } // Show the whole thing this.Show(); //this.Update(); // ano - don't think this is needed, and is slow }
// This shows the info public void ShowInfo(Linedef l) { TypeHandler th; bool upperunpegged, lowerunpegged; string peggedness; //double starttime = General.stopwatch.Elapsed.TotalMilliseconds; SuspendLayout(); // Show/hide stuff depending on format if (!General.Map.FormatInterface.HasActionArgs) { if (bUsingArgsAlready || bNeedSetup) { 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; tableLayoutPanel1.ColumnStyles[1].Width = 0f; infopanel.Width = doomformatwidth; bUsingArgsAlready = false; } } else { if (!bUsingArgsAlready || bNeedSetup) { 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; tableLayoutPanel1.ColumnStyles[1].Width = 37.5f; infopanel.Width = hexenformatwidth; bUsingArgsAlready = true; } } // Move panels frontpanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + frontpanel.Margin.Left; backpanel.Left = frontpanel.Left + frontpanel.Width + frontpanel.Margin.Right + backpanel.Margin.Left; // 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 sb.Length = 0; sb.Append(" Linedef "); sb.Append(l.Index); sb.Append(" "); infopanel.Text = sb.ToString(); sb.Length = 0; action.Text = act.ToString(); length.Text = l.Length.ToString("0.##"); sb.Append(l.AngleDeg.ToString()); sb.Append("\u00B0"); angle.Text = sb.ToString(); sb.Length = 0; tag.Text = l.Tag.ToString(); unpegged.Text = peggedness; if (bUsingArgsAlready) { // Arguments sb.Append(act.Args[0].Title); sb.Append(':'); arglbl1.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[1].Title); sb.Append(':'); arglbl2.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[2].Title); sb.Append(':'); arglbl3.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[3].Title); sb.Append(':'); arglbl4.Text = sb.ToString(); sb.Length = 0; sb.Append(act.Args[4].Title); sb.Append(':'); arglbl5.Text = sb.ToString(); sb.Length = 0; 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; th = General.Types.GetArgumentHandler(act.Args[0]); th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue(); 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) { // Show sidedef info sb.Append(" Front Sidedef "); sb.Append(l.Front.Index); sb.Append(' '); frontpanel.Text = sb.ToString(); sb.Length = 0; sb.Append(" Sector "); sb.Append(l.Front.Sector.Index); frontsector.Text = sb.ToString(); sb.Length = 0; frontsector.Visible = true; sb.Append(l.Front.OffsetX); sb.Append(", "); sb.Append(l.Front.OffsetY); frontoffset.Text = sb.ToString(); sb.Length = 0; fronthighname.Text = l.Front.HighTexture; frontmidname.Text = l.Front.MiddleTexture; frontlowname.Text = l.Front.LowTexture; DisplaySidedefTexture(fronthightex, l.Front.HighTexture, l.Front.HighRequired()); DisplaySidedefTexture(frontmidtex, l.Front.MiddleTexture, l.Front.MiddleRequired()); DisplaySidedefTexture(frontlowtex, l.Front.LowTexture, l.Front.LowRequired()); frontoffsetlabel.Enabled = true; frontoffset.Enabled = true; frontpanel.Enabled = true; } else { // Show no info frontpanel.Text = " Front Sidedef "; frontsector.Text = ""; frontsector.Visible = false; frontoffsetlabel.Enabled = false; frontoffset.Enabled = false; frontpanel.Enabled = false; frontoffset.Text = "--, --"; fronthighname.Text = ""; frontmidname.Text = ""; frontlowname.Text = ""; fronthightex.BackgroundImage = null; frontmidtex.BackgroundImage = null; frontlowtex.BackgroundImage = null; } // Back size available? if (l.Back != null) { // Show sidedef info sb.Append(" Back Sidedef "); sb.Append(l.Back.Index); sb.Append(' '); backpanel.Text = sb.ToString(); sb.Length = 0; sb.Append(" Sector "); sb.Append(l.Back.Sector.Index); backsector.Text = sb.ToString(); sb.Length = 0; backsector.Visible = true; sb.Append(l.Back.OffsetX); sb.Append(", "); sb.Append(l.Back.OffsetY); backoffset.Text = sb.ToString(); sb.Length = 0; backhighname.Text = l.Back.HighTexture; backmidname.Text = l.Back.MiddleTexture; backlowname.Text = l.Back.LowTexture; DisplaySidedefTexture(backhightex, l.Back.HighTexture, l.Back.HighRequired()); DisplaySidedefTexture(backmidtex, l.Back.MiddleTexture, l.Back.MiddleRequired()); DisplaySidedefTexture(backlowtex, l.Back.LowTexture, l.Back.LowRequired()); backoffsetlabel.Enabled = true; backoffset.Enabled = true; backpanel.Enabled = true; } else { // Show no info backpanel.Text = " Back Sidedef "; backsector.Text = ""; backsector.Visible = false; backoffsetlabel.Enabled = false; backoffset.Enabled = false; backpanel.Enabled = false; backoffset.Text = "--, --"; backhighname.Text = ""; backmidname.Text = ""; backlowname.Text = ""; backhightex.BackgroundImage = null; backmidtex.BackgroundImage = null; backlowtex.BackgroundImage = null; } // Position labels frontsector.Left = frontlowtex.Right - frontsector.Width; backsector.Left = backlowtex.Right - backsector.Width; ResumeLayout(); // Show the whole thing this.Show(); this.Invalidate(); //this.Update(); // ano - don't think this is needed, and is slow bNeedSetup = false; //Logger.WriteLogLine((General.stopwatch.Elapsed.TotalMilliseconds - starttime) + " milliseconds for linedefinfopanel.showinfo"); }