fixed problem with editing UDMF fields on multiple selected elements

This commit is contained in:
codeimp 2009-01-23 13:30:25 +00:00
parent 4bbf14dde9
commit 1db48fd9e8
2 changed files with 20 additions and 23 deletions

View file

@ -141,6 +141,7 @@ namespace CodeImp.DoomBuilder.Controls
if(!frow.TypeHandler.GetValue().Equals(f.Value.Value))
{
// Clear the value in the row
frow.Define(f.Value.Value);
frow.Clear();
}
}
@ -231,11 +232,8 @@ namespace CodeImp.DoomBuilder.Controls
{
FieldsEditorRow frow = row as FieldsEditorRow;
// Field is defined?
if(frow.IsDefined)
{
// Only apply when not empty
if(!frow.IsEmpty)
// Field is defined and not empty?
if(frow.IsDefined && !frow.IsEmpty)
{
// Apply field
object oldvalue = null;
@ -252,7 +250,6 @@ namespace CodeImp.DoomBuilder.Controls
}
}
}
}
#endregion

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.Controls
public bool IsFixed { get { return isfixed; } }
public bool IsDefined { get { return isdefined; } }
public bool IsEmpty { get { return (this.Cells[2].Value.ToString().Length == 0); } }
public bool IsEmpty { get { return (this.Cells[2].Value == null) || (this.Cells[2].Value.ToString().Length == 0); } }
public string Name { get { return this.Cells[0].Value.ToString(); } }
public TypeHandler TypeHandler { get { return fieldtype; } }
public UniversalFieldInfo Info { get { return fieldinfo; } }
@ -193,7 +193,7 @@ namespace CodeImp.DoomBuilder.Controls
}
// Anything in the box?
if(this.Cells[2].Value.ToString().Length > 0)
if((this.Cells[2].Value != null) && (this.Cells[2].Value.ToString().Length > 0))
{
// Validate value
fieldtype.SetValue(this.Cells[2].Value);
@ -263,7 +263,7 @@ namespace CodeImp.DoomBuilder.Controls
public object GetResult(object value)
{
// Anything in the box?
if(this.Cells[2].Value.ToString().Length > 0)
if((this.Cells[2].Value != null) && (this.Cells[2].Value.ToString().Length > 0))
{
// Return validated value
fieldtype.SetValue(this.Cells[2].Value);