Fixed logic to support adding a Caution when a Caution or adding a note when a note exists in Deviation Document Format

This commit is contained in:
Rich
2017-02-20 16:08:23 +00:00
parent e1019e3454
commit 4932c7d28c

View File

@@ -590,13 +590,17 @@ namespace Volian.Controls.Library
siblingEditItems.Insert(0, this); siblingEditItems.Insert(0, this);
MyStepPanel.ItemMoving++; MyStepPanel.ItemMoving++;
_MyNextEditItem = nextEditItem; _MyNextEditItem = nextEditItem;
if(!MyItemInfo.IsNote || !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || MyPreviousEditItem == null)
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
if (MyItemInfo.IsNote && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyPreviousEditItem != null)
nextEditItem.MyPreviousEditItem = this;//Position First Note in Dev Doc Format
if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || !(nextEditItem.MyItemInfo.IsNote && MyItemInfo.IsCaution)) if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || !(nextEditItem.MyItemInfo.IsNote && MyItemInfo.IsCaution))
{ {
// RHM 20170216 For Deviation Document don't set MyParentEditItem to null when Type Changes from Caution to Note // RHM 20170216 For Deviation Document don't set MyParentEditItem to null when Type Changes from Caution to Note
nextEditItem.MyParentEditItem = null; 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
AdjustForDevDocStepHeight();
} }
//nextEditItem.MyPreviousEditItem = this; //nextEditItem.MyPreviousEditItem = this;
MyStepPanel.ItemMoving--; MyStepPanel.ItemMoving--;
@@ -820,7 +824,18 @@ namespace Volian.Controls.Library
newFocus = MyNextEditItem; newFocus = MyNextEditItem;
} }
// Adjust the vertical locations of all of the items below the item deleted // Adjust the vertical locations of all of the items below the item deleted
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyNextEditItem.MyPreviousEditItem == null &&
(MyNextEditItem.MyItemInfo.IsNote || MyNextEditItem.MyItemInfo.IsCaution))
{
MyNextEditItem.MyParentEditItem.Top = (MyNextEditItem.MyParentEditItem.MyPreviousEditItem != null ?
MyNextEditItem.MyParentEditItem.MyPreviousEditItem.FindBottomDevDoc: MyNextEditItem.MyParentEditItem.MyParentEditItem.Bottom);
MyNextEditItem.Top = MyNextEditItem.MyParentEditItem.Top;
MyNextEditItem.AdjustLocation();
}
else
{
MyNextEditItem.TopMostEditItem.AdjustLocation(); MyNextEditItem.TopMostEditItem.AdjustLocation();
}
MyNextEditItem = null; MyNextEditItem = null;
} }
else if (MyPreviousEditItem != null) else if (MyPreviousEditItem != null)
@@ -829,6 +844,13 @@ namespace Volian.Controls.Library
//newFocus = MyPreviousEditItem.BottomMostEditItem; //newFocus = MyPreviousEditItem.BottomMostEditItem;
// bug fix - when deleting an edit window in the AER, position to the bottom most in the AER - was jumping to RNO // bug fix - when deleting an edit window in the AER, position to the bottom most in the AER - was jumping to RNO
newFocus = MyPreviousEditItem.BottomMostEditItemNoRNOs; newFocus = MyPreviousEditItem.BottomMostEditItemNoRNOs;
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyPreviousEditItem.MyNextEditItem == null &&
(MyPreviousEditItem.MyItemInfo.IsNote || MyPreviousEditItem.MyItemInfo.IsCaution))
{
MyPreviousEditItem.MyParent.Top = MyPreviousEditItem.MyParent.MyPreviousEditItem.FindBottomDevDoc;
MyPreviousEditItem.Top = MyPreviousEditItem.MyParent.Top;
MyPreviousEditItem.MyParent.AdjustLocation();
}
MyPreviousEditItem = null; MyPreviousEditItem = null;
//Console.Write(",\"Previous\","); //Console.Write(",\"Previous\",");
} }
@@ -2163,25 +2185,14 @@ namespace Volian.Controls.Library
{ {
if (MyItemInfo.IsCaution || MyItemInfo.IsNote) if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
{ {
if (nextEditItem.MyItemInfo.IsHigh || nextEditItem.MyItemInfo.IsFirstNotePart) if (nextEditItem.MyItemInfo.IsHigh || (nextEditItem.MyItemInfo.IsNote && MyItemInfo.IsCaution))
{ {
bottom = FirstSiblingEditItem.Top; bottom = FirstSiblingEditItem.Top;
} }
// RHM 20170216 // RHM 20170216
// MyParent will walk back MyPrevious to find Parent // MyParent will walk back MyPrevious to find Parent
// NextDevDocStep will find the first part of a Dev Doc HLS // NextDevDocStep will find the first part of a Dev Doc HLS
if (MyParent == nextEditItem && MyParent.NextDevDocStep != null) AdjustForDevDocStepHeight();
{
int bot = MyParent.FindBottomDevDoc;
int DDHeight = bot - FirstSiblingEditItem.Top;//Determine the height of the step including cautions and notes
if (_DevDocHeight != DDHeight)
{
_DevDocHeight = DDHeight;// If the height has changed adjust the top of the next item down
EditItem ei = MyParent.NextDevDocStep;
ei.Top = bot;
ei.AdjustLocation();
}
}
} }
} }
// SameRowAsParent - Comanche Peak Step Designator // SameRowAsParent - Comanche Peak Step Designator
@@ -2224,7 +2235,12 @@ namespace Volian.Controls.Library
} }
} }
} }
public int _DevDocHeight = 0; // Deviation Document Step Height private int _DevDocHeight = 0; // Deviation Document Step Height B2016-123, B2017-020, B2017-021
public int DevDocHeight
{
get { return _DevDocHeight; }
set { _DevDocHeight = value; }
}
public void TryAgainNow(int bottom) public void TryAgainNow(int bottom)
{ {
TryToSetTop(bottom-10); TryToSetTop(bottom-10);
@@ -2893,21 +2909,7 @@ namespace Volian.Controls.Library
} }
Location = new Point(_MyPreviousEditItem.Left, top); Location = new Point(_MyPreviousEditItem.Left, top);
// B2017-029 only do this if this is a the deviation document // B2017-029 only do this if this is a the deviation document
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyParent.MyItemInfo.IsHigh) AdjustForDevDocStepHeight();
{
int bot = MyParent.FindBottomDevDoc;
int DDHeight = bot - FirstSiblingEditItem.Top;//Determine the height of the step including cautions and notes
if (MyParent._DevDocHeight != DDHeight)
{
MyParent._DevDocHeight = DDHeight;// If the height has changed adjust the top of the next item down
EditItem ei = NextDevDocStep;// RHM 20170216 Locate Next Dev Doc Step
if(ei != null)
{
ei.Top = bot;
ei.AdjustLocation();
}
}
}
} }
} }
else else
@@ -2941,6 +2943,27 @@ namespace Volian.Controls.Library
} }
LastMethodsPop(); LastMethodsPop();
} }
}
/// <summary>
/// Adjust the height of a Deviation Document Step Including the Cautions and Notes B2016-123, B2017-020, B2017-021
/// </summary>
private void AdjustForDevDocStepHeight()
{
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyParent.MyItemInfo.IsHigh)
{
int bot = MyParent.FindBottomDevDoc;
int DDHeight = bot - FirstSiblingEditItem.Top;//Determine the height of the step including cautions and notes
if (MyParent.DevDocHeight != DDHeight)
{
MyParent.DevDocHeight = DDHeight;// If the height has changed adjust the top of the next item down
EditItem ei = NextDevDocStep;// RHM 20170216 Locate Next Dev Doc Step
if (ei != null)
{
ei.Top = bot;
ei.AdjustLocation();
}
}
}
} }
// RHM 20170216 - Find Next Dev Doc High Level Step // RHM 20170216 - Find Next Dev Doc High Level Step
// If caution Exists return caution // If caution Exists return caution