Deviation Documents now display properly in the Step Editor.

Cautions and Notes position properly when added
This commit is contained in:
Rich 2017-02-15 14:26:26 +00:00
parent dea491a3d9
commit fef4b2ba8b

View File

@ -1739,7 +1739,7 @@ namespace Volian.Controls.Library
MyStepPanel.ItemMoving++;
rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Right {0}", rnoTop.MyID));
//rnoTop.Top = tmpBottom.Bottom;
if(rnoTop.Top != Top)
if (rnoTop.Top != Top)
rnoTop.Top = Top;
rnoTop.LastMethodsPop();
MyStepPanel.ItemMoving--;
@ -1748,7 +1748,7 @@ namespace Volian.Controls.Library
{
MyStepPanel.ItemMoving++;
rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Below {0} {1} {2}", rnoTop.MyID, BottomMostEditItemNoRNOs.MyID, BottomMostEditItemNoRNOs.Bottom));
if(rnoTop.Top != BottomMostEditItemNoRNOs.Bottom)
if (rnoTop.Top != BottomMostEditItemNoRNOs.Bottom)
rnoTop.Top = BottomMostEditItemNoRNOs.Bottom;
rnoTop.LastMethodsPop();
MyStepPanel.ItemMoving--;
@ -2139,9 +2139,27 @@ namespace Volian.Controls.Library
return;
int bottom = nextEditItem.FindTop(Bottom);
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
bottom = Top;
{
if (nextEditItem.MyItemInfo.IsHigh || nextEditItem.MyItemInfo.IsFirstNotePart)
{
bottom = FirstSiblingEditItem.Top;
}
if (MyParentEditItem == nextEditItem && MyParentEditItem.NextDownEditItem != null)
{
int bot = 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 = MyParentEditItem.NextDownEditItem;
ei.Top = bot;
ei.AdjustLocation();
}
}
}
}
// SameRowAsParent - Comanche Peak Step Designator
//FormatData fmtdata = MyItemInfo.ActiveFormat.PlantFormat.FormatData;
//int formatSteptype = MyItemInfo.FormatStepType;
@ -2152,7 +2170,14 @@ namespace Volian.Controls.Library
// If this is a "TitleWithTextRight", don't move down on the screen but only if it has a
// child, i.e. want the child to be positioned on line, but if no child, move down on screen:
int newTop = bottom;
if (MyItemInfo.IsStep &&nextEditItem.MyItemInfo.MyHLS.ItemID != MyItemInfo.MyHLS.ItemID)// Move from one step to another
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) // Deviation Document Format
newTop = FindBottomDevDoc;// Use the bottom most caution or note
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && MyItemInfo.HasChildren) newTop = Top;
//This was useful to find the code that was positioning the Deviationn Document steps
//if (MyItemInfo.InList(134782, 134783) || nextEditItem.MyItemInfo.InList(134782, 134783))
// Console.WriteLine("\"AdjustLocation\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}\t{4}\t{5}", MyItemInfo.ShortPath, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyID, newTop, FindBottom, FindBottom - Top);
if (nextEditItem.Top != newTop)
{
MyStepPanel.ItemMoving++;
@ -2175,6 +2200,7 @@ namespace Volian.Controls.Library
}
}
}
public int _DevDocHeight = 0; // Deviation Document Step Height
public void TryAgainNow(int bottom)
{
TryToSetTop(bottom-10);
@ -2220,7 +2246,7 @@ namespace Volian.Controls.Library
if (ExpandPrefix != 0)
{
MyStepPanel.ItemMoving++;
if(TopMostEditItem.Top != Top)
if (TopMostEditItem.Top != Top)
TopMostEditItem.Top = Top;
MyStepPanel.ItemMoving--;
}
@ -2399,7 +2425,7 @@ namespace Volian.Controls.Library
//Console.WriteLine("{0}***Move in NextDownEditItem {1},{2} From {3} To {4}",WatchThisIndent, btmNext.MyID, btmNext, btmNext.Top, btm.Bottom);
btmNext.LastMethodsPush(string.Format("NextDownEditItem {0} {1}", MyID, EditItem.MyID));
//ShowMe(string.Format("FindTop = {0}", btmNext.FindTop(btm.Bottom)));
if(btmNext.Top != bottom)
if (btmNext.Top != bottom)
btmNext.Top = bottom;
btmNext.LastMethodsPop();
MyStepPanel.ItemMoving--;
@ -2491,6 +2517,27 @@ namespace Volian.Controls.Library
protected string _TabFormat;
private static int _WidthAdjust = 5;
protected bool _IgnoreResize = false;
private int FindBottomDevDoc // Find Bottom of a Deviation Document Step
{
get
{
int y = Bottom;
if (MyParentEditItem == null || MyParentEditItem.MyItemInfo.IsSection)
{
EditItem eitm2 = this;
if (eitm2 != null && eitm2.MyBeforeEditItems != null)
foreach (EditItem eitm2Tmp in eitm2.MyBeforeEditItems)
y = Math.Max(y, eitm2Tmp.Bottom);
return y;
}
y = Math.Max(y, MyParentEditItem.Bottom);
EditItem eitm = MyParentEditItem;
if (eitm != null && eitm.MyBeforeEditItems != null)
foreach (EditItem eitmTmp in eitm.MyBeforeEditItems)
y = Math.Max(y, eitmTmp.Bottom);
return y;
}
}
/// <summary>
/// Sets the parent and postions the item with respect to the parent
/// </summary>
@ -2522,8 +2569,29 @@ namespace Volian.Controls.Library
case 1: // Section
if (this == TopMostEditItem)
{
if(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
ItemLocation = new Point(MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColS)+50, _MyParentEditItem.Bottom);
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
if (MyPreviousEditItem != null)
{
EditItem ei = MyPreviousEditItem.BottomMostEditItem;
if (ei.MyItemInfo.IsHigh && (ei.MyItemInfo.Cautions !=null || ei.MyItemInfo.Notes!=null))
{
if (ei.MyItemInfo.Cautions!= null)// Look at cautions
{
EditItem eic = MyStepPanel._LookupEditItems[ei.MyItemInfo.Cautions[0].ItemID].BottomMostEditItem;
if (eic.Bottom > ei.Bottom) ei = eic;
}
if (ei.MyItemInfo.Notes!= null)//Look at notes
{
EditItem ein = MyStepPanel._LookupEditItems[ei.MyItemInfo.Notes[0].ItemID].BottomMostEditItem;
if (ein.Bottom > ei.Bottom) ei = ein;
}
}
ItemLocation = new Point(MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColS) + 50, ei.Bottom);
}
else
ItemLocation = new Point(MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColS) + 50, _MyParentEditItem.Bottom);
}
else
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + 20, _MyParentEditItem.Bottom);
}
@ -2655,7 +2723,7 @@ namespace Volian.Controls.Library
if (top != _MyParentEditItem.Top)
{
_MyParentEditItem.LastMethodsPush(string.Format("set_MyParentRTBItem RNO Right {0}", MyID));
if(_MyParentEditItem.Top != top)
if (_MyParentEditItem.Top != top)
_MyParentEditItem.Top = top;
_MyParentEditItem.LastMethodsPop();
Top = top;
@ -2695,18 +2763,21 @@ namespace Volian.Controls.Library
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsCaution || MyItemInfo.IsNote))
{
int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
int y = FindTop(myTop);
int y = Top;
if (MyPreviousEditItem == null || !MyPreviousEditItem.MyItemInfo.IsCaution || !MyItemInfo.IsNote)
y = FindTop(myTop);
// Get the "bottom" number of the longest Caution/Note on the step/substep above so that
// we can position properly on the screen.
// EX. Catawba Deviations E-1 step deviation for step 10
EditItem eitm = (MyParentEditItem.MyPreviousEditItem != null) ? MyParentEditItem.MyPreviousEditItem : MyParentEditItem.MyParentEditItem;
if (eitm != null && eitm.MyBeforeEditItems != null)
{
foreach (EditItem eitmTmp in eitm.MyBeforeEditItems)
y = Math.Max(y, eitmTmp.Bottom);
if (MyItemInfo.IsNote) // Move to the right based upon the Width of the Caution which is the same as the width of the note.
{ // AdjustChildren width BeforeItem setting Left offset
int width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB;
x += width + 6;//Account for the width of the Caution in the Deviation Document
}
if(MyItemInfo.IsNote)
x += Width + 6;
Location = new Point(x, y);
}
else
@ -2775,7 +2846,11 @@ namespace Volian.Controls.Library
int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
if (MyItemInfo.IsNote)
x += Width + 6;
Location = new Point(x, _MyPreviousEditItem.Top);
//Find first sibling
EditItem prev = _MyPreviousEditItem;
while (prev._MyPreviousEditItem != null)
prev = prev._MyPreviousEditItem;
Location = new Point(x, prev.Top);// Use the top of the first sibling
}
else
{