If multiple Things/linedefs of different types are selected, show generic flag names

This commit is contained in:
MascaraSnake 2016-01-15 18:06:38 +01:00
parent 1e366ff36e
commit 984c021fe0
2 changed files with 20 additions and 11 deletions

View file

@ -177,7 +177,6 @@ namespace CodeImp.DoomBuilder.Windows
// Flags // Flags
LinedefActionInfo li = General.Map.Config.GetLinedefActionInfo(fl.Action); LinedefActionInfo li = General.Map.Config.GetLinedefActionInfo(fl.Action);
IDictionary<string, string> newFlags = (li == null || li.Flags.Count == 0) ? General.Map.Config.LinedefFlags : li.Flags; IDictionary<string, string> newFlags = (li == null || li.Flags.Count == 0) ? General.Map.Config.LinedefFlags : li.Flags;
flags.UpdateCheckboxes(newFlags);
foreach (CheckBox c in flags.Checkboxes) foreach (CheckBox c in flags.Checkboxes)
if(fl.Flags.ContainsKey(c.Tag.ToString())) c.Checked = fl.Flags[c.Tag.ToString()]; if(fl.Flags.ContainsKey(c.Tag.ToString())) c.Checked = fl.Flags[c.Tag.ToString()];
@ -232,11 +231,15 @@ namespace CodeImp.DoomBuilder.Windows
// 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 // Go for all lines
foreach(Linedef l in lines) foreach(Linedef l in lines)
{ {
if (l.Action != fl.Action) allsameaction = false;
// Flags // Flags
foreach(CheckBox c in flags.Checkboxes) foreach (CheckBox c in flags.Checkboxes)
{ {
if(c.CheckState == CheckState.Indeterminate) continue; //mxd if(c.CheckState == CheckState.Indeterminate) continue; //mxd
if(l.IsFlagSet(c.Tag.ToString()) != c.Checked) if(l.IsFlagSet(c.Tag.ToString()) != c.Checked)
@ -336,6 +339,8 @@ namespace CodeImp.DoomBuilder.Windows
linedefprops.Add(new LinedefProperties(l)); linedefprops.Add(new LinedefProperties(l));
} }
if (allsameaction) flags.UpdateCheckboxes(newFlags);
// Refresh controls so that they show their image // Refresh controls so that they show their image
backhigh.Refresh(); backhigh.Refresh();
backmid.Refresh(); backmid.Refresh();

View file

@ -192,7 +192,6 @@ namespace CodeImp.DoomBuilder.Windows
// Flags // Flags
ThingTypeInfo ti = General.Map.Data.GetThingInfoEx(ft.Type); ThingTypeInfo ti = General.Map.Data.GetThingInfoEx(ft.Type);
IDictionary<string, string> newFlags = (ti == null || ti.Flags.Count == 0) ? General.Map.Config.ThingFlags : ti.Flags; IDictionary<string, string> newFlags = (ti == null || ti.Flags.Count == 0) ? General.Map.Config.ThingFlags : ti.Flags;
flags.UpdateCheckboxes(newFlags);
foreach (CheckBox c in flags.Checkboxes) foreach (CheckBox c in flags.Checkboxes)
if(ft.Flags.ContainsKey(c.Tag.ToString())) c.Checked = ft.Flags[c.Tag.ToString()]; if(ft.Flags.ContainsKey(c.Tag.ToString())) c.Checked = ft.Flags[c.Tag.ToString()];
@ -229,6 +228,7 @@ namespace CodeImp.DoomBuilder.Windows
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
thingprops = new List<ThingProperties>(); thingprops = new List<ThingProperties>();
bool allsametype = true;
// Go for all things // Go for all things
foreach(Thing t in things) foreach(Thing t in things)
@ -236,6 +236,8 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Update sector info //mxd. Update sector info
t.DetermineSector(); t.DetermineSector();
if (t.Type != ft.Type) allsametype = false;
// Type does not match? // Type does not match?
ThingTypeInfo info = thingtype.GetSelectedInfo(); //mxd ThingTypeInfo info = thingtype.GetSelectedInfo(); //mxd
@ -280,6 +282,8 @@ namespace CodeImp.DoomBuilder.Windows
thingprops.Add(new ThingProperties(t)); thingprops.Add(new ThingProperties(t));
} }
if (allsametype) flags.UpdateCheckboxes(newFlags);
preventchanges = false; preventchanges = false;
//mxd. Trigger updates manually... //mxd. Trigger updates manually...