From a2016118584adc1faaa88c81b3a87d8f5cc7115f Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 31 Oct 2017 17:50:53 +0000 Subject: [PATCH] B2017-248 If a sibling Table, Figure or Equation has a sub-table or figure or equation, the code would crash when trying to display it. The code was changed to use the MyParent property which is never null rather than the MyParentEditItem property which can be null. --- PROMS/Volian.Controls.Library/EditItem.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 75369528..94085fc2 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -2165,21 +2165,11 @@ namespace Volian.Controls.Library 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; - } + EditItem myParentEditItem = MyParent; // Should center on parent unless it is a centered table type in the AER column or parent is another table type, then // walk up until finding a non-table type step'. (B2016-264: insert of centered eq off centered eq was not locating child equation correctly) EditItem aboveForLocation = myParentEditItem; - if (aboveForLocation.MyItemInfo.IsTable || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsFigure) - { - while (aboveForLocation.MyItemInfo.IsFigure || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsTable) aboveForLocation = aboveForLocation.MyParentEditItem; - } + while (aboveForLocation.MyItemInfo.IsFigure || aboveForLocation.MyItemInfo.IsRtfRaw || aboveForLocation.MyItemInfo.IsTable) aboveForLocation = aboveForLocation.MyParent;// B2017-248 int center = aboveForLocation.ContentLeft + aboveForLocation.ContentWidth / 2; int rightLimit = aboveForLocation.Right;