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; _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; if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || ( nextEditItem.MyItemInfo.IsNote && MyItemInfo.IsCaution))
MyParentEditItem = parent; // If a parent exists - this will adjust the location and width of the EditItem {
// 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; //nextEditItem.MyPreviousEditItem = this;
MyStepPanel.ItemMoving--; MyStepPanel.ItemMoving--;
} }
@ -1762,6 +1766,7 @@ namespace Volian.Controls.Library
get { return _TryAgainLater; } get { return _TryAgainLater; }
set { _TryAgainLater = value; } set { _TryAgainLater = value; }
} }
//static bool _ShowChanges=false;
int _LastTop = 0; int _LastTop = 0;
/// <summary> /// <summary>
/// Handles movement of the EditItems /// Handles movement of the EditItems
@ -1771,9 +1776,25 @@ namespace Volian.Controls.Library
private void EditItem_Move(object sender, EventArgs e) private void EditItem_Move(object sender, EventArgs e)
{ {
int newTop = Top - MyStepPanel.TopMostEditItem.Top; 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; if (_LastTop == newTop) return;
_LastTop = newTop; _LastTop = newTop;
int watchThis = _WatchThis; 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) //if (MyID == 136)
//{ //{
// vlnStackTrace.ShowStack("{0} Move TO {1}", MyID, Top); // vlnStackTrace.ShowStack("{0} Move TO {1}", MyID, Top);
@ -2146,14 +2167,17 @@ namespace Volian.Controls.Library
{ {
bottom = FirstSiblingEditItem.Top; 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 int DDHeight = bot - FirstSiblingEditItem.Top;//Determine the height of the step including cautions and notes
if (_DevDocHeight != DDHeight) if (_DevDocHeight != DDHeight)
{ {
_DevDocHeight = DDHeight;// If the height has changed adjust the top of the next item down _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.Top = bot;
ei.AdjustLocation(); ei.AdjustLocation();
} }
@ -2171,7 +2195,7 @@ namespace Volian.Controls.Library
// child, i.e. want the child to be positioned on line, but if no child, move down on screen: // child, i.e. want the child to be positioned on line, but if no child, move down on screen:
int newTop = bottom; int newTop = bottom;
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) // Deviation Document Format if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) // Deviation Document Format
if (MyItemInfo.IsStep && nextEditItem.MyItemInfo.IsStep && nextEditItem.MyItemInfo.MyHLS.ItemID != MyItemInfo.MyHLS.ItemID)// Move from one step to another if (MyItemInfo.IsStep && nextEditItem.MyItemInfo.IsStep && nextEditItem.MyItemInfo.MyHLS.ItemID != MyItemInfo.MyHLS.ItemID)// Move from one step to another
newTop = FindBottomDevDoc;// Use the bottom most caution or note newTop = FindBottomDevDoc;// Use the bottom most caution or note
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && MyItemInfo.HasChildren) newTop = Top; if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && MyItemInfo.HasChildren) newTop = Top;
@ -2252,7 +2276,9 @@ namespace Volian.Controls.Library
} }
else else
TopMostEditItem.AdjustLocation(); TopMostEditItem.AdjustLocation();
//_ShowChanges = true;
AdjustChildren(); AdjustChildren();
//_ShowChanges = false;
//if(_Before != null ) //if(_Before != null )
// Top = _Before[_Before.Count - 1].BottomMost.Bottom; // Top = _Before[_Before.Count - 1].BottomMost.Bottom;
} }
@ -2521,7 +2547,7 @@ namespace Volian.Controls.Library
{ {
get 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) if (MyParentEditItem == null || MyParentEditItem.MyItemInfo.IsSection)
{ {
EditItem eitm2 = this; EditItem eitm2 = this;
@ -2532,6 +2558,7 @@ namespace Volian.Controls.Library
} }
y = Math.Max(y, MyParentEditItem.Bottom); y = Math.Max(y, MyParentEditItem.Bottom);
EditItem eitm = MyParentEditItem; EditItem eitm = MyParentEditItem;
while (eitm != null && !eitm.MyItemInfo.IsHigh) eitm = eitm.MyParent;
if (eitm != null && eitm.MyBeforeEditItems != null) if (eitm != null && eitm.MyBeforeEditItems != null)
foreach (EditItem eitmTmp in eitm.MyBeforeEditItems) foreach (EditItem eitmTmp in eitm.MyBeforeEditItems)
y = Math.Max(y, eitmTmp.Bottom); y = Math.Max(y, eitmTmp.Bottom);
@ -2840,7 +2867,9 @@ namespace Volian.Controls.Library
if (TopMostEditItem == this) 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))) //if ((MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) || (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsNote || MyItemInfo.IsCaution)))
{ {
int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT); int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
@ -2849,9 +2878,9 @@ namespace Volian.Controls.Library
//Find first sibling //Find first sibling
EditItem prev = _MyPreviousEditItem; EditItem prev = _MyPreviousEditItem;
while (prev._MyPreviousEditItem != null) while (prev._MyPreviousEditItem != null)
prev = prev._MyPreviousEditItem; prev = prev._MyPreviousEditItem;
Location = new Point(x, prev.Top);// Use the top of the first sibling Location = new Point(x, prev.Top);// Use the top of the first sibling
} }
else else
{ {
int top = FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom); int top = FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom);
@ -2863,6 +2892,21 @@ namespace Volian.Controls.Library
top=Math.Max(top, ei.Bottom); top=Math.Max(top, ei.Bottom);
} }
Location = new Point(_MyPreviousEditItem.Left, top); 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 else
@ -2897,6 +2941,44 @@ namespace Volian.Controls.Library
LastMethodsPop(); 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) protected void SetupEditItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, bool addFirstChld)
{ {
if (myStepPanel.TopMostEditItem == null) myStepPanel.TopMostEditItem = this; if (myStepPanel.TopMostEditItem == null) myStepPanel.TopMostEditItem = this;