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);
|
EditItem lastChild = LastChild(siblingEditItems);
|
||||||
siblingEditItems.Add(this);
|
siblingEditItems.Add(this);
|
||||||
MyPreviousEditItem = lastChild;
|
MyPreviousEditItem = lastChild;
|
||||||
if (MyParentEditItem == null) MyParentEditItem = parentEditItem;
|
|
||||||
}
|
}
|
||||||
else // Add to the middle of the list before a particular item
|
else // Add to the middle of the list before a particular item
|
||||||
{
|
{
|
||||||
EditItem prevChild = nextEditItem.MyPreviousEditItem;
|
EditItem prevChild = nextEditItem.MyPreviousEditItem;
|
||||||
EditItem parent = nextEditItem.MyParentEditItem??parentEditItem;
|
EditItem parent = nextEditItem.MyParentEditItem;
|
||||||
if(siblingEditItems.Contains(nextEditItem))
|
if(siblingEditItems.Contains(nextEditItem))
|
||||||
siblingEditItems.Insert(siblingEditItems.IndexOf(nextEditItem), this);
|
siblingEditItems.Insert(siblingEditItems.IndexOf(nextEditItem), this);
|
||||||
else
|
else
|
||||||
@ -592,7 +591,7 @@ namespace Volian.Controls.Library
|
|||||||
_MyNextEditItem = nextEditItem;
|
_MyNextEditItem = nextEditItem;
|
||||||
nextEditItem._MyPreviousEditItem = this;
|
nextEditItem._MyPreviousEditItem = this;
|
||||||
MyPreviousEditItem = prevChild;// If a previous exists - this will adjust the location and width of the EditItem
|
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
|
MyParentEditItem = parent; // If a parent exists - this will adjust the location and width of the EditItem
|
||||||
//nextEditItem.MyPreviousEditItem = this;
|
//nextEditItem.MyPreviousEditItem = this;
|
||||||
MyStepPanel.ItemMoving--;
|
MyStepPanel.ItemMoving--;
|
||||||
@ -1829,8 +1828,17 @@ namespace Volian.Controls.Library
|
|||||||
/// <param name="myStepSectionLayoutData"></param>
|
/// <param name="myStepSectionLayoutData"></param>
|
||||||
/// <param name="width"></param>
|
/// <param name="width"></param>
|
||||||
/// <returns></returns>
|
/// <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
|
// Should center on parent unless it is a centered table in the AER column
|
||||||
int center = myParentEditItem.ContentLeft + myParentEditItem.ContentWidth / 2;
|
int center = myParentEditItem.ContentLeft + myParentEditItem.ContentWidth / 2;
|
||||||
int rightLimit = myParentEditItem.Right;
|
int rightLimit = myParentEditItem.Right;
|
||||||
|
@ -153,7 +153,7 @@ namespace Volian.Controls.Library
|
|||||||
if (wNew > ItemWidth)
|
if (wNew > ItemWidth)
|
||||||
{
|
{
|
||||||
ItemWidth = wNew;
|
ItemWidth = wNew;
|
||||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, wNew);
|
ItemLocation = TableLocation(MyStepSectionLayoutData, wNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -162,7 +162,7 @@ namespace Volian.Controls.Library
|
|||||||
if (ItemWidth != newwidth)
|
if (ItemWidth != newwidth)
|
||||||
{
|
{
|
||||||
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
|
// We had a table that was in a funky state. This allows it to appear in editor so
|
||||||
// that is could be deleted.
|
// that is could be deleted.
|
||||||
if (_MyParentEditItem == null) return;
|
if (_MyParentEditItem == null) return;
|
||||||
Point newLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
|
Point newLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
|
||||||
if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation;
|
if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation;
|
||||||
}
|
}
|
||||||
public override void SetToolTip(string tip)
|
public override void SetToolTip(string tip)
|
||||||
|
@ -124,7 +124,7 @@ namespace Volian.Controls.Library
|
|||||||
_MyStepRTB.Font = MyStepData.Font.WindowsFont;
|
_MyStepRTB.Font = MyStepData.Font.WindowsFont;
|
||||||
ItemWidth = (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
|
ItemWidth = (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
|
||||||
ItemLocation = new Point(50, _MyParentEditItem.Bottom);
|
ItemLocation = new Point(50, _MyParentEditItem.Bottom);
|
||||||
ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
|
ItemLocation = TableLocation(MyStepSectionLayoutData, ItemWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
override public void SetToolTip(string tip)
|
override public void SetToolTip(string tip)
|
||||||
@ -604,7 +604,7 @@ namespace Volian.Controls.Library
|
|||||||
if (wNew > ItemWidth)
|
if (wNew > ItemWidth)
|
||||||
{
|
{
|
||||||
ItemWidth = wNew;
|
ItemWidth = wNew;
|
||||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, wNew);
|
ItemLocation = TableLocation(MyStepSectionLayoutData, wNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -613,7 +613,7 @@ namespace Volian.Controls.Library
|
|||||||
if (ItemWidth != newwidth)
|
if (ItemWidth != newwidth)
|
||||||
{
|
{
|
||||||
ItemWidth = newwidth;
|
ItemWidth = newwidth;
|
||||||
ItemLocation = TableLocation(MyParentEditItem, MyStepSectionLayoutData, newwidth);
|
ItemLocation = TableLocation(MyStepSectionLayoutData, newwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user