From 984c021fe076b8fb0b862e563d9602ac7b61245b Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 15 Jan 2016 18:06:38 +0100 Subject: [PATCH] If multiple Things/linedefs of different types are selected, show generic flag names --- Source/Core/Windows/LinedefEditForm.cs | 23 ++++++++++++++--------- Source/Core/Windows/ThingEditForm.cs | 8 ++++++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Source/Core/Windows/LinedefEditForm.cs b/Source/Core/Windows/LinedefEditForm.cs index 1a476e4..4fdfc9c 100644 --- a/Source/Core/Windows/LinedefEditForm.cs +++ b/Source/Core/Windows/LinedefEditForm.cs @@ -177,7 +177,6 @@ namespace CodeImp.DoomBuilder.Windows // Flags LinedefActionInfo li = General.Map.Config.GetLinedefActionInfo(fl.Action); IDictionary newFlags = (li == null || li.Flags.Count == 0) ? General.Map.Config.LinedefFlags : li.Flags; - flags.UpdateCheckboxes(newFlags); foreach (CheckBox c in flags.Checkboxes) if(fl.Flags.ContainsKey(c.Tag.ToString())) c.Checked = fl.Flags[c.Tag.ToString()]; @@ -228,15 +227,19 @@ namespace CodeImp.DoomBuilder.Windows backTextureOffset.SetValues(fl.Back.OffsetX, fl.Back.OffsetY, true); //mxd } - //////////////////////////////////////////////////////////////////////// - // Now go for all lines and change the options when a setting is different - //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + // Now go for all lines and change the options when a setting is different + //////////////////////////////////////////////////////////////////////// + + bool allsameaction = true; // Go for all lines foreach(Linedef l in lines) { - // Flags - foreach(CheckBox c in flags.Checkboxes) + if (l.Action != fl.Action) allsameaction = false; + + // Flags + foreach (CheckBox c in flags.Checkboxes) { if(c.CheckState == CheckState.Indeterminate) continue; //mxd if(l.IsFlagSet(c.Tag.ToString()) != c.Checked) @@ -335,9 +338,11 @@ namespace CodeImp.DoomBuilder.Windows //mxd linedefprops.Add(new LinedefProperties(l)); } - - // Refresh controls so that they show their image - backhigh.Refresh(); + + if (allsameaction) flags.UpdateCheckboxes(newFlags); + + // Refresh controls so that they show their image + backhigh.Refresh(); backmid.Refresh(); backlow.Refresh(); fronthigh.Refresh(); diff --git a/Source/Core/Windows/ThingEditForm.cs b/Source/Core/Windows/ThingEditForm.cs index 79794bf..6ddd2a8 100644 --- a/Source/Core/Windows/ThingEditForm.cs +++ b/Source/Core/Windows/ThingEditForm.cs @@ -192,7 +192,6 @@ namespace CodeImp.DoomBuilder.Windows // Flags ThingTypeInfo ti = General.Map.Data.GetThingInfoEx(ft.Type); IDictionary newFlags = (ti == null || ti.Flags.Count == 0) ? General.Map.Config.ThingFlags : ti.Flags; - flags.UpdateCheckboxes(newFlags); foreach (CheckBox c in flags.Checkboxes) if(ft.Flags.ContainsKey(c.Tag.ToString())) c.Checked = ft.Flags[c.Tag.ToString()]; @@ -229,12 +228,15 @@ namespace CodeImp.DoomBuilder.Windows //////////////////////////////////////////////////////////////////////// thingprops = new List(); + bool allsametype = true; // Go for all things foreach(Thing t in things) { //mxd. Update sector info t.DetermineSector(); + + if (t.Type != ft.Type) allsametype = false; // Type does not match? ThingTypeInfo info = thingtype.GetSelectedInfo(); //mxd @@ -280,7 +282,9 @@ namespace CodeImp.DoomBuilder.Windows thingprops.Add(new ThingProperties(t)); } - preventchanges = false; + if (allsametype) flags.UpdateCheckboxes(newFlags); + + preventchanges = false; //mxd. Trigger updates manually... preventmapchange = true;