Fixed null reference error when inserting a figure off of a figure
This commit is contained in:
parent
0166b06209
commit
6ed306e8b9
@ -578,12 +578,11 @@ namespace Volian.Controls.Library
|
||||
EditItem lastChild = LastChild(siblingEditItems);
|
||||
siblingEditItems.Add(this);
|
||||
MyPreviousEditItem = lastChild;
|
||||
if (MyParentEditItem == null) MyParentEditItem = parentEditItem;
|
||||
}
|
||||
else // Add to the middle of the list before a particular item
|
||||
{
|
||||
EditItem prevChild = nextEditItem.MyPreviousEditItem;
|
||||
EditItem parent = nextEditItem.MyParentEditItem??parentEditItem;
|
||||
EditItem parent = nextEditItem.MyParentEditItem;
|
||||
if(siblingEditItems.Contains(nextEditItem))
|
||||
siblingEditItems.Insert(siblingEditItems.IndexOf(nextEditItem), this);
|
||||
else
|
||||
@ -592,7 +591,7 @@ namespace Volian.Controls.Library
|
||||
_MyNextEditItem = nextEditItem;
|
||||
nextEditItem._MyPreviousEditItem = this;
|
||||
MyPreviousEditItem = prevChild;// If a previous exists - this will adjust the location and width of the EditItem
|
||||
//nextEditItem.MyParentEditItem = null; // jsj 5-13-2016 commented out got null referenced error when deleting an empty figure type substep
|
||||
nextEditItem.MyParentEditItem = null;
|
||||
MyParentEditItem = parent; // If a parent exists - this will adjust the location and width of the EditItem
|
||||
//nextEditItem.MyPreviousEditItem = this;
|
||||
MyStepPanel.ItemMoving--;
|
||||
@ -1829,8 +1828,17 @@ namespace Volian.Controls.Library
|
||||
/// <param name="myStepSectionLayoutData"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <returns></returns>
|
||||
protected Point TableLocation(EditItem myParentEditItem, StepSectionLayoutData myStepSectionLayoutData, int width)
|
||||
protected Point TableLocation(StepSectionLayoutData myStepSectionLayoutData, int width)
|
||||
{
|
||||
// bug fix: B2016-111 - myParentEditItem was getting a null reference error when inserting a figure before/after a figure
|
||||
EditItem myParentEditItem = _MyParentEditItem;
|
||||
if (myParentEditItem == null)
|
||||
{
|
||||
EditItem parentEI = _MyPreviousEditItem;
|
||||
while (parentEI._MyPreviousEditItem != null)
|
||||
parentEI = parentEI._MyPreviousEditItem;
|
||||
myParentEditItem = parentEI._MyParentEditItem;
|
||||
}
|
||||
// Should center on parent unless it is a centered table in the AER column
|
||||
int center = myParentEditItem.ContentLeft + myParentEditItem.ContentWidth / 2;
|
||||
int rightLimit = myParentEditItem.Right;
|
||||
|
@ -153,7 +153,7 @@ namespace Volian.Controls.Library
|
||||
if (wNew > ItemWidth)
|
||||
{
|
||||
ItemWidth = wNew;
|
||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, wNew);
|
||||
ItemLocation = TableLocation(MyStepSectionLayoutData, wNew);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -162,7 +162,7 @@ namespace Volian.Controls.Library
|
||||
if (ItemWidth != newwidth)
|
||||
{
|
||||
ItemWidth = newwidth;
|
||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, newwidth);
|
||||
ItemLocation = TableLocation( MyStepSectionLayoutData, newwidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -452,7 +452,7 @@ namespace Volian.Controls.Library
|
||||
// We had a table that was in a funky state. This allows it to appear in editor so
|
||||
// that is could be deleted.
|
||||
if (_MyParentEditItem == null) return;
|
||||
Point newLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
|
||||
Point newLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
|
||||
if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation;
|
||||
}
|
||||
public override void SetToolTip(string tip)
|
||||
|
@ -124,7 +124,7 @@ namespace Volian.Controls.Library
|
||||
_MyStepRTB.Font = MyStepData.Font.WindowsFont;
|
||||
ItemWidth = (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
|
||||
ItemLocation = new Point(50, _MyParentEditItem.Bottom);
|
||||
ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
|
||||
ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
|
||||
}
|
||||
|
||||
override public void SetToolTip(string tip)
|
||||
@ -604,7 +604,7 @@ namespace Volian.Controls.Library
|
||||
if (wNew > ItemWidth)
|
||||
{
|
||||
ItemWidth = wNew;
|
||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, wNew);
|
||||
ItemLocation = TableLocation(MyStepSectionLayoutData, wNew);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -613,7 +613,7 @@ namespace Volian.Controls.Library
|
||||
if (ItemWidth != newwidth)
|
||||
{
|
||||
ItemWidth = newwidth;
|
||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, newwidth);
|
||||
ItemLocation = TableLocation(MyStepSectionLayoutData, newwidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user