Changed Deviation Document Layout:

* account for Cautions and Notes
* find the first item on a High Level Step (Cautions or Notes)
* account for RNOs and Substeps when calculating step height
This commit is contained in:
Rich 2017-02-16 18:24:48 +00:00
parent 4686cb0f6e
commit be1a86b43a

View File

@ -592,8 +592,12 @@ 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
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
nextEditItem.MyParentEditItem = null;
MyParentEditItem = parent; // If a parent exists - this will adjust the location and width of the EditItem
}
//nextEditItem.MyPreviousEditItem = this;
MyStepPanel.ItemMoving--;
}
@ -1762,6 +1766,7 @@ namespace Volian.Controls.Library
get { return _TryAgainLater; }
set { _TryAgainLater = value; }
}
//static bool _ShowChanges=false;
int _LastTop = 0;
/// <summary>
/// Handles movement of the EditItems
@ -1771,9 +1776,25 @@ namespace Volian.Controls.Library
private void EditItem_Move(object sender, EventArgs e)
{
int newTop = Top - MyStepPanel.TopMostEditItem.Top;
//if(_ShowChanges && _LastTop != newTop && MyItemInfo.InList(134786))
// Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,"\"EditItem_Move\"\t\"\"\t\"{0}\"\t{1}\t{2}\t{3}",MyItemInfo.ShortPath, MyID, Top, _LastTop);
if (_LastTop == newTop) return;
_LastTop = newTop;
int watchThis = _WatchThis;
//if ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyPreviousEditItem != null)
//{
// if (Top != MyPreviousEditItem.Bottom && MyPreviousEditItem.MyItemInfo.MyContent.Type == MyItemInfo.MyContent.Type)
// {
// if(Top != MyPreviousEditItem.Bottom || Left != MyPreviousEditItem.Left)
// {
// Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,
// //Console.WriteLine(
// "\"EditItem_Move\"\t\"\"\t\"{0}\"\t{1}\t{2}\t{3}\t{4}\t\"{5}\"\t{6}\t{7}\t{8}",
// MyItemInfo.ShortPath, MyID, Top, Left,
// MyPreviousEditItem.Bottom, MyPreviousEditItem.MyItemInfo.ShortPath, MyPreviousEditItem.MyID, MyPreviousEditItem.Top, MyPreviousEditItem.Left);
// }
// }
//}
//if (MyID == 136)
//{
// vlnStackTrace.ShowStack("{0} Move TO {1}", MyID, Top);
@ -2146,14 +2167,17 @@ namespace Volian.Controls.Library
{
bottom = FirstSiblingEditItem.Top;
}
if (MyParentEditItem == nextEditItem && MyParentEditItem.NextDownEditItem != null)
// RHM 20170216
// MyParent will walk back MyPrevious to find Parent
// NextDevDocStep will find the first part of a Dev Doc HLS
if (MyParent == nextEditItem && MyParent.NextDevDocStep != null)
{
int bot = FindBottomDevDoc;
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 = MyParentEditItem.NextDownEditItem;
EditItem ei = MyParent.NextDevDocStep;
ei.Top = bot;
ei.AdjustLocation();
}
@ -2252,7 +2276,9 @@ namespace Volian.Controls.Library
}
else
TopMostEditItem.AdjustLocation();
//_ShowChanges = true;
AdjustChildren();
//_ShowChanges = false;
//if(_Before != null )
// Top = _Before[_Before.Count - 1].BottomMost.Bottom;
}
@ -2521,7 +2547,7 @@ namespace Volian.Controls.Library
{
get
{
int y = Bottom;
int y = BottomMostEditItem.Bottom;// RHM 20170216 Get the bottom most step of a High Level step (RNOs and Substeps)
if (MyParentEditItem == null || MyParentEditItem.MyItemInfo.IsSection)
{
EditItem eitm2 = this;
@ -2532,6 +2558,7 @@ namespace Volian.Controls.Library
}
y = Math.Max(y, MyParentEditItem.Bottom);
EditItem eitm = MyParentEditItem;
while (eitm != null && !eitm.MyItemInfo.IsHigh) eitm = eitm.MyParent;
if (eitm != null && eitm.MyBeforeEditItems != null)
foreach (EditItem eitmTmp in eitm.MyBeforeEditItems)
y = Math.Max(y, eitmTmp.Bottom);
@ -2840,7 +2867,9 @@ namespace Volian.Controls.Library
if (TopMostEditItem == this)
{
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsNote || MyItemInfo.IsCaution))
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format &&
(MyItemInfo.IsNote || MyItemInfo.IsCaution) &&
(MyPreviousEditItem == null || (MyPreviousEditItem.MyItemInfo.IsCaution && MyItemInfo.IsNote)))
//if ((MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) || (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsNote || MyItemInfo.IsCaution)))
{
int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
@ -2863,6 +2892,21 @@ namespace Volian.Controls.Library
top=Math.Max(top, ei.Bottom);
}
Location = new Point(_MyPreviousEditItem.Left, top);
if (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();
}
}
}
}
}
else
@ -2897,6 +2941,44 @@ namespace Volian.Controls.Library
LastMethodsPop();
}
}
// RHM 20170216 - Find Next Dev Doc High Level Step
// If caution Exists return caution
// If note exists return note
private EditItem NextDevDocStep
{
get
{
EditItem ei = this;
while (ei != null && !ei.MyItemInfo.IsHigh) ei = ei.MyParent;// Get High Level Step
if(ei != null) ei=ei.MyNextEditItem;// Get Next High Level Step
if (ei != null)
{
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;
ei = eic;
}
else if (ei.MyItemInfo.Notes != null)//Look at notes
{
EditItem ein = MyStepPanel._LookupEditItems[ei.MyItemInfo.Notes[0].ItemID].BottomMostEditItem;
ei = ein;
}
}
}
return ei;
}
}
// RHM 20170216 Find Parent by walking up MyPrevious
private EditItem MyParent
{
get
{
if (MyParentEditItem != null) return MyParentEditItem;
return MyPreviousEditItem.MyParent;
}
}
protected void SetupEditItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, bool addFirstChld)
{
if (myStepPanel.TopMostEditItem == null) myStepPanel.TopMostEditItem = this;