Support for SAMGS Supplemental Information
This commit is contained in:
@@ -18,7 +18,8 @@ namespace Volian.Controls.Library
|
||||
None = 0,
|
||||
After = 1,
|
||||
Before = 2,
|
||||
RNO = 3
|
||||
RNO = 3,
|
||||
SupInfo = 4
|
||||
}
|
||||
public enum E_ChangeBarPosition : int
|
||||
{
|
||||
@@ -59,7 +60,7 @@ namespace Volian.Controls.Library
|
||||
bool allow = (MyStepPanel.VwMode == E_ViewMode.Edit);
|
||||
StepTabRibbon str = MyStepPanel.MyStepTabPanel.MyStepTabRibbon;
|
||||
str.SiblingsButtonsEnabled = allow;
|
||||
str.InsertButtonsEnabled = allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection || MyItemInfo.IsRNOPart);
|
||||
str.InsertButtonsEnabled = allow && !(MyItemInfo.IsProcedure || MyItemInfo.IsSection || MyItemInfo.IsRNOPart || MyItemInfo.IsSupInfoPart);
|
||||
// do special case for cpystep button: cannot copy an enhanced step:
|
||||
if (MyItemInfo.IsEnhancedStep) str.SetCopyStepButton(false);
|
||||
}
|
||||
@@ -96,7 +97,7 @@ namespace Volian.Controls.Library
|
||||
get { return _MyBeforeEditItems != null || _MyRNOEditItems != null || _MyAfterEditItems != null; }
|
||||
}
|
||||
internal List<EditItem> _MyBeforeEditItems;
|
||||
public List<EditItem> MyBeforeEditItems
|
||||
public List<EditItem> MyBeforeEditItems // MyBeforeEditItems are Cautions & Notes
|
||||
{
|
||||
get { return _MyBeforeEditItems; }
|
||||
set { _MyBeforeEditItems = value; }
|
||||
@@ -113,6 +114,12 @@ namespace Volian.Controls.Library
|
||||
get { return _MyRNOEditItems; }
|
||||
set { _MyRNOEditItems = value; }
|
||||
}
|
||||
internal List<EditItem> _MySupInfoEditItems;
|
||||
public List<EditItem> MySupInfoEditItems
|
||||
{
|
||||
get { return _MySupInfoEditItems; }
|
||||
set { _MySupInfoEditItems = value; }
|
||||
}
|
||||
private StepSectionLayoutData _MyStepSectionLayoutData;
|
||||
public StepSectionLayoutData MyStepSectionLayoutData
|
||||
{
|
||||
@@ -180,7 +187,7 @@ namespace Volian.Controls.Library
|
||||
if (_MySectionRTBItem == null)
|
||||
{
|
||||
if (MyItemInfo.IsSection || MyItemInfo.IsProcedure) _MySectionRTBItem = (RTBItem)this;
|
||||
else _MySectionRTBItem = _MyParentEditItem.MySectionRTBItem;
|
||||
else _MySectionRTBItem = MyParent.MySectionRTBItem;
|
||||
}
|
||||
return _MySectionRTBItem;
|
||||
}
|
||||
@@ -307,13 +314,133 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get { return _LastMethods.Count == 0; }
|
||||
}
|
||||
// This should find the item that precedes the current item vertically in the supplemental information column
|
||||
// and then return the Bottom of that item.
|
||||
// It is used so that an edit item does not overlap in 'y-direction' any preceding items.
|
||||
internal int? FindTopSupInfo(bool useSuppInfoColBottom)
|
||||
{
|
||||
if (MyParentEditItem == null) return null;
|
||||
// on supplemental info item: parent is item in left column.
|
||||
// return null if parent does not have previous siblings or parents that have supp info. FindPreviousOrParentSupInfo looks above to
|
||||
// items that have supinfo.
|
||||
EditItem prevOrParSupInfo = MyParentEditItem.FindPreviousOrParentSupInfo();
|
||||
if (prevOrParSupInfo == null || !prevOrParSupInfo.Visible)
|
||||
{
|
||||
// Account for Expanded or collapsed. note that BottomMostEditItem already accounts for
|
||||
// whether it is expanded or collapsed.
|
||||
if (MyParentEditItem.MyPreviousEditItem != null) return MyParentEditItem.MyPreviousEditItem.BottomMostEditItem.Bottom;
|
||||
if (MyParentEditItem.MyBeforeEditItems != null) return MyParentEditItem.MyBeforeEditItems[MyParentEditItem.MyBeforeEditItems.Count - 1].BottomMostEditItem.Bottom;
|
||||
return (MySectionRTBItem==null)?0:MySectionRTBItem.Bottom;
|
||||
}
|
||||
int b1 = prevOrParSupInfo.BottomMostEditItem.Bottom;
|
||||
int b2 = b1;
|
||||
if (prevOrParSupInfo.MyParentEditItem.MyItemInfo.StepLevel > MyParentEditItem.MyItemInfo.StepLevel)
|
||||
b2 = prevOrParSupInfo.MyParentEditItem.LastSiblingEditItem.BottomMostEditItem.Bottom;
|
||||
|
||||
// if the current supinfo's parent (proc step) is same as the lastsibling bottom most, don't use its value - it puts the next step
|
||||
// down too far:
|
||||
if (this.MyParentEditItem.MyID == prevOrParSupInfo.MyParentEditItem.LastSiblingEditItem.BottomMostEditItem.MyID) b2 = b1;
|
||||
// if not in the same HLS, don't use the lastsibling either:
|
||||
if (this.MyParentEditItem.MyItemInfo.MyHLS.ItemID != prevOrParSupInfo.MyParentEditItem.LastSiblingEditItem.MyItemInfo.MyHLS.ItemID) b2 = b1;
|
||||
if (useSuppInfoColBottom)
|
||||
return b1;
|
||||
else
|
||||
return Math.Max(b1, b2); // look at both supinfo & parent column to determine bottom
|
||||
}
|
||||
// This goes up edititems, looking for the closest in 'y-direction' of any supplemental info items.
|
||||
EditItem FindPreviousOrParentSupInfo() // current edit item is parent of supplmental info item
|
||||
{
|
||||
EditItem prev = this;
|
||||
// First see if there are any Cautions or Notes before me that have supinfo:
|
||||
EditItem lastBefore = prev.FindLastBeforeWithSupInfo();
|
||||
if (lastBefore != null) return lastBefore.MySupInfoEditItems[0];
|
||||
|
||||
// There were no Cautions/Notes before me with supinfo, now see if there are previous items with supinfo:
|
||||
while (prev.MyPreviousEditItem != null)
|
||||
{
|
||||
prev = prev.MyPreviousEditItem;
|
||||
EditItem eiTmp = prev.FindLastSubstepWithSupInfo();
|
||||
// check for MySupInfoEditItems as null because the FindLastSubstepWithSupInfo checks for data, but the supinfo step may
|
||||
// not be displayed yet, i.e. the eiTmp.MySupInfoEditItems has an edititem defined only it if is displayed.
|
||||
if (eiTmp != null && eiTmp.MySupInfoEditItems != null) return eiTmp.MySupInfoEditItems[0];
|
||||
}
|
||||
// No previous items had supinfo, look up to the parent. But if on first before, i.e. first caution or note, there is nothing before (just the section)
|
||||
if (prev.MyParentEditItem.MyBeforeEditItems != null && prev.MyParentEditItem.MyBeforeEditItems.Count > 0 && prev.MyParentEditItem.MyBeforeEditItems[0] == prev)
|
||||
{
|
||||
EditItem eitmp = null;
|
||||
// if on a Note/Caution, need to be sure there isn't a step before me with supinfo (don't just assume going to Section)
|
||||
if (prev.MyParentEditItem.MyPreviousEditItem!=null)eitmp = prev.MyParentEditItem.MyPreviousEditItem.BottomMostEditItem.FindPreviousOrParentSupInfo();
|
||||
return eitmp;
|
||||
}
|
||||
if (prev.MyParentEditItem.MySupInfoEditItems != null) return prev.MyParentEditItem.MySupInfoEditItems[0];
|
||||
if (prev.MyItemInfo.IsSection) return null;
|
||||
return prev.MyParentEditItem.FindPreviousOrParentSupInfo();
|
||||
}
|
||||
private EditItem FindLastBeforeWithSupInfo()
|
||||
{
|
||||
if (MyBeforeEditItems == null || MyBeforeEditItems.Count == 0) return null;
|
||||
|
||||
for (int i = MyBeforeEditItems.Count - 1; i > -1; i--)
|
||||
{
|
||||
// Need to look at caution/note (mybeforeedititems) if they have substeps that have supinfo
|
||||
if (MyBeforeEditItems[i].MySupInfoEditItems != null && MyBeforeEditItems[i].MySupInfoEditItems.Count > 0) return MyBeforeEditItems[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// The next 2 methods, FindLastSubstepWithSupInfo, FindLastItemWithSupInfo:
|
||||
// for the current item, get to its bottommost supplemental info, if any steps/substeps have it.
|
||||
//
|
||||
private EditItem FindLastSubstepWithSupInfo()
|
||||
{
|
||||
ItemInfo ii = FindLastItemWithSupInfo(MyItemInfo);
|
||||
if (ii == null) return null;
|
||||
return GetEditItemFromItemID(ii.ItemID);
|
||||
}
|
||||
private ItemInfo FindLastItemWithSupInfo(ItemInfo stp)
|
||||
{
|
||||
// first check substeps (& their substeps) of item passed in.
|
||||
if (stp.Steps != null && stp.Steps.Count > 0)
|
||||
{
|
||||
for (int i = stp.Steps.Count - 1; i > -1; i--)
|
||||
{
|
||||
ItemInfo tmp = FindLastItemWithSupInfo(stp.Steps[i]);
|
||||
if (tmp != null) return tmp;
|
||||
}
|
||||
}
|
||||
//now check the step that was passed in.
|
||||
if (stp.SupInfos != null && stp.SupInfos.Count > 0) return stp;
|
||||
if (stp.Notes != null && stp.Notes.Count > 0)
|
||||
{
|
||||
for (int j = stp.Notes.Count - 1; j > -1; j--)
|
||||
{
|
||||
if (stp.Notes[j].SupInfos != null && stp.Notes[j].SupInfos.Count > 0) return stp.Notes[j];
|
||||
}
|
||||
}
|
||||
if (stp.Cautions != null && stp.Cautions.Count > 0)
|
||||
{
|
||||
for (int j = stp.Cautions.Count - 1; j > -1; j--)
|
||||
{
|
||||
if (stp.Cautions[j].SupInfos != null && stp.Cautions[j].SupInfos.Count > 0) return stp.Cautions[j];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// This should find the item that precedes the current item vertically
|
||||
/// and then return the Bottom of that item.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal int FindTop(int bottom)
|
||||
internal int FindTop(int bottom, bool test1)
|
||||
{
|
||||
// if on a supplemental info, use special code to find what steps are above the supplemental info
|
||||
if (MyItemInfo.MyDocStyle != null && MyItemInfo.MyDocStyle.SupplementalInformation)
|
||||
{
|
||||
if (MyItemInfo.IsSupInfoPart)
|
||||
{
|
||||
int? tmptop = FindTopSupInfo(test1);
|
||||
return tmptop == null ? bottom : Math.Max(bottom, (int)tmptop);
|
||||
}
|
||||
}
|
||||
int lastBottomPrev = bottom; // This is necessary if the value of bottom can be negative.
|
||||
if (_MyPreviousEditItem != null)
|
||||
lastBottomPrev = _MyPreviousEditItem.BottomMostEditItem.Bottom;
|
||||
@@ -324,6 +451,10 @@ namespace Volian.Controls.Library
|
||||
//if (bottomRNO == null) return bottom;
|
||||
return (int)max(bottomRNO, bottom);
|
||||
}
|
||||
internal int FindTop(int bottom)
|
||||
{
|
||||
return FindTop(bottom, true);
|
||||
}
|
||||
/// <summary>
|
||||
/// The Top of the EditItem
|
||||
/// </summary>
|
||||
@@ -630,6 +761,7 @@ namespace Volian.Controls.Library
|
||||
if (_MyNextEditItem != null) _MyNextEditItem.SetAllTabs();
|
||||
// Update the RNO tab if it exists - RHM 20100106
|
||||
if (_MyRNOEditItems != null) foreach (EditItem chld in _MyRNOEditItems) chld.SetAllTabs();
|
||||
if (_MySupInfoEditItems != null) foreach (EditItem chld in _MySupInfoEditItems) chld.SetAllTabs();
|
||||
}
|
||||
/// <summary>
|
||||
/// Add the next item to a list
|
||||
@@ -778,6 +910,16 @@ namespace Volian.Controls.Library
|
||||
if (!success)
|
||||
Item.DeleteItemAndChildren(ii);
|
||||
}
|
||||
if (MyItemInfo.MyDocStyle != null && MyItemInfo.MyDocStyle.SupplementalInformation)
|
||||
{
|
||||
if (newFocus.MyItemInfo.IsInSupInfo)
|
||||
newFocus.AdjustAllForSupInfoHeight();
|
||||
else
|
||||
{
|
||||
EditItem prvOrParSupInfo = newFocus.FindPreviousOrParentSupInfo();
|
||||
if (prvOrParSupInfo != null) prvOrParSupInfo.AdjustAllForSupInfoHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ForceEditItemRefresh(EditItem newFocus)
|
||||
@@ -955,6 +1097,12 @@ namespace Volian.Controls.Library
|
||||
if (parentEditItem.MyRNOEditItems.Count == 0)
|
||||
parentEditItem.MyRNOEditItems = null;
|
||||
}
|
||||
else if (parentEditItem.MySupInfoEditItems != null && parentEditItem.MySupInfoEditItems.Contains(this))
|
||||
{
|
||||
parentEditItem.MySupInfoEditItems.Remove(this);
|
||||
if (parentEditItem.MySupInfoEditItems.Count == 0)
|
||||
parentEditItem.MySupInfoEditItems = null;
|
||||
}
|
||||
if (parentEditItem.MyAfterEditItems == null && parentEditItem.MyBeforeEditItems == null && parentEditItem.MyRNOEditItems == null)
|
||||
parentEditItem.CanExpand = false;
|
||||
}
|
||||
@@ -1008,6 +1156,10 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
EditItem child = new RTBItem(myItemInfo, MyStepPanel, this, ChildRelation.RNO, expand);
|
||||
}
|
||||
public void AddChildSupInfo(ItemInfo myItemInfo, bool expand)
|
||||
{
|
||||
EditItem child = new RTBItem(myItemInfo, MyStepPanel, this, ChildRelation.SupInfo, expand);
|
||||
}
|
||||
/// <summary>
|
||||
/// Add a list of RNO (Contingency) children
|
||||
/// </summary>
|
||||
@@ -1019,6 +1171,12 @@ namespace Volian.Controls.Library
|
||||
foreach (ItemInfo item in myItemInfoList)
|
||||
AddChildRNO(item, expand);
|
||||
}
|
||||
public void AddChildSupInfo(ItemInfoList myItemInfoList, bool expand)
|
||||
{
|
||||
if (myItemInfoList != null)
|
||||
foreach (ItemInfo item in myItemInfoList)
|
||||
AddChildSupInfo(item, expand);
|
||||
}
|
||||
/// <summary>
|
||||
/// Add a child after
|
||||
/// </summary>
|
||||
@@ -1074,6 +1232,15 @@ namespace Volian.Controls.Library
|
||||
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.RNO, true, nextEditItem);
|
||||
return child;
|
||||
}
|
||||
public EditItem AddChildSupInfo(ItemInfo MyItemInfo, EditItem nextEditItem)
|
||||
{
|
||||
EditItem child = null;
|
||||
if (MyItemInfo.MyContent.MyGrid != null)
|
||||
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.SupInfo, true, nextEditItem);
|
||||
else
|
||||
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.SupInfo, true, nextEditItem);
|
||||
return child;
|
||||
}
|
||||
/// <summary>
|
||||
/// Adds a sibling after the current EditItem
|
||||
/// </summary>
|
||||
@@ -1164,6 +1331,9 @@ namespace Volian.Controls.Library
|
||||
case ChildRelation.RNO:
|
||||
newEditItem = ActiveParent.AddChildRNO(newItemInfo, MyNextEditItem);
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, MyNextEditItem);
|
||||
break;
|
||||
default: // Need debug
|
||||
break;
|
||||
}
|
||||
@@ -1224,6 +1394,9 @@ namespace Volian.Controls.Library
|
||||
case ChildRelation.RNO:
|
||||
newEditItem = ActiveParent.AddChildRNO(newItemInfo, this);
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, this);
|
||||
break;
|
||||
default: // Need debug
|
||||
break;
|
||||
}
|
||||
@@ -1323,6 +1496,9 @@ namespace Volian.Controls.Library
|
||||
case E_FromType.Table:
|
||||
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
|
||||
break;
|
||||
case E_FromType.SupInfo:
|
||||
newEditItem = this.AddChildSupInfo(newItemInfo, nextItem);
|
||||
break;
|
||||
default:
|
||||
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
|
||||
break;
|
||||
@@ -1425,6 +1601,9 @@ namespace Volian.Controls.Library
|
||||
case ChildRelation.RNO:
|
||||
newEditItem = ActiveParent.AddChildRNO(newItemInfo, this);
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, this);
|
||||
break;
|
||||
default: // Need debug
|
||||
break;
|
||||
}
|
||||
@@ -1539,6 +1718,9 @@ namespace Volian.Controls.Library
|
||||
case ChildRelation.RNO:
|
||||
newEditItem = ActiveParent.AddChildRNO(newItemInfo, MyNextEditItem);
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
newEditItem = ActiveParent.AddChildSupInfo(newItemInfo, MyNextEditItem);
|
||||
break;
|
||||
default: // Need debug
|
||||
break;
|
||||
}
|
||||
@@ -1565,6 +1747,7 @@ namespace Volian.Controls.Library
|
||||
else if (MyItemInfo.IsNote) fromType = E_FromType.Note;
|
||||
else if (MyItemInfo.IsTable) fromType = E_FromType.Table;
|
||||
else if (MyItemInfo.IsRNOPart) fromType = E_FromType.RNO;
|
||||
else if (MyItemInfo.IsSupInfoPart) fromType = E_FromType.SupInfo;
|
||||
}
|
||||
EditItem nextItem = GetNextItem(fromType, newItemInfo);
|
||||
EditItem newEditItem;
|
||||
@@ -1592,6 +1775,9 @@ namespace Volian.Controls.Library
|
||||
case E_FromType.Table:
|
||||
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
|
||||
break;
|
||||
case E_FromType.SupInfo:
|
||||
newEditItem = this.AddChildSupInfo(newItemInfo, nextItem);
|
||||
break;
|
||||
default:
|
||||
newEditItem = this.AddChildAfter(newItemInfo, nextItem);
|
||||
break;
|
||||
@@ -1674,6 +1860,9 @@ namespace Volian.Controls.Library
|
||||
case ChildRelation.RNO:
|
||||
newEditItem = parentEditItem.AddChildRNO(newItemInfo, nextEditItem);
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
newEditItem = parentEditItem.AddChildSupInfo(newItemInfo, nextEditItem);
|
||||
break;
|
||||
default: // Need debug
|
||||
break;
|
||||
}
|
||||
@@ -1725,6 +1914,14 @@ namespace Volian.Controls.Library
|
||||
sir.IdentifyChildren(highlight);
|
||||
}
|
||||
}
|
||||
if (MySupInfoEditItems != null)
|
||||
{
|
||||
foreach (EditItem sis in MySupInfoEditItems)
|
||||
{
|
||||
sis.IdentifyMe(highlight);
|
||||
sis.IdentifyChildren(highlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Event Handlers
|
||||
@@ -1788,6 +1985,21 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void MoveSupInfo() // If the current item has supplemental information, be sure its top location is that of the current item.
|
||||
{
|
||||
if (_MySupInfoEditItems != null && _MySupInfoEditItems.Count > 0)
|
||||
{
|
||||
EditItem supInfoTop = _MySupInfoEditItems[0].TopMostEditItem;
|
||||
if (supInfoTop.Top != Top + supInfoTop.SupInfoTopOffset)
|
||||
{
|
||||
MyStepPanel.ItemMoving++;
|
||||
supInfoTop.LastMethodsPush(string.Format("EditItem_Move SupInfo Right {0}", supInfoTop.MyID));
|
||||
supInfoTop.Top = Top + supInfoTop.SupInfoTopOffset;
|
||||
supInfoTop.LastMethodsPop();
|
||||
MyStepPanel.ItemMoving--;
|
||||
}
|
||||
}
|
||||
}
|
||||
private bool _TryAgainLater = false;
|
||||
public bool TryAgainLater
|
||||
{
|
||||
@@ -1813,37 +2025,22 @@ namespace Volian.Controls.Library
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
// use the following to debug if two steps are to be displayed one right after the other vertically, but they are getting separated, overwritten,
|
||||
// gaps. See code below at the beginning of EditItem_Move that uses these.
|
||||
//static EditItem ei_below;
|
||||
//static EditItem ei_above;
|
||||
private void EditItem_Move(object sender, EventArgs e)
|
||||
{
|
||||
//if (MyID == 205300) ei_above = this;
|
||||
//if (MyID == 205306) ei_below = this;
|
||||
//if (ei_below != null && ei_above != null && MyID == ei_below.MyID && ei_below.Top != ei_above.Bottom) Console.WriteLine("here");
|
||||
TurnOnSpellCheckIfVisible();
|
||||
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);
|
||||
//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);
|
||||
// //vlnStackTrace.ShowStack("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostRTBItem.MyPath);
|
||||
// //Console.WriteLine("{0} Move TO {1} - {2}, BottomMost {3}", MyID, Top, MyPath, BottomMostRTBItem.MyPath);
|
||||
//}
|
||||
//if (MyID > _StartingID)
|
||||
// Console.WriteLine("{0}--------------- {1} Top = {2} Bottom {3}", WatchThisIndent, MyID, Top, Bottom);
|
||||
if (MyStepPanel.ItemMoving == 0 && !TryAgainLater)
|
||||
{
|
||||
//vlnStackTrace.ScrollInStack();
|
||||
@@ -1890,6 +2087,9 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
Moving = false;
|
||||
EditItem btm = BottomMostEditItem;
|
||||
EditItem supinfo = null;
|
||||
if (MySupInfoEditItems != null && MySupInfoEditItems.Count > 0) supinfo = MySupInfoEditItems[0].BottomMostEditItem;
|
||||
if (supinfo != null && supinfo.Bottom > btm.Bottom) btm = supinfo;
|
||||
if (this != btm)
|
||||
btm.AdjustLocation();
|
||||
//if (_WatchThis > 0 && MyID > _StartingID)
|
||||
@@ -1909,7 +2109,7 @@ namespace Volian.Controls.Library
|
||||
if (_IgnoreResize) return;
|
||||
AdjustLocation();
|
||||
HandleResize();
|
||||
|
||||
AdjustAllForSupInfoHeight();
|
||||
}
|
||||
#endregion // Event Handlers
|
||||
#region Private and Protected Methods
|
||||
@@ -1942,7 +2142,7 @@ namespace Volian.Controls.Library
|
||||
int center = aboveForLocation.ContentLeft + aboveForLocation.ContentWidth / 2;
|
||||
int rightLimit = aboveForLocation.Right;
|
||||
// Then should center on the wid Limit
|
||||
if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0)
|
||||
if ((MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0 ) && !MyItemInfo.IsInSupInfo)
|
||||
{
|
||||
// B2017-043 COLR is used as a Width
|
||||
int colR = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
|
||||
@@ -2054,6 +2254,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
HideChildren(_MyBeforeEditItems);
|
||||
HideChildren(_MyRNOEditItems);
|
||||
HideChildren(_MySupInfoEditItems);
|
||||
HideChildren(_MyAfterEditItems);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -2079,6 +2280,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
UnhideChildren(_MyBeforeEditItems, expand);
|
||||
UnhideChildren(_MyRNOEditItems, expand);
|
||||
UnhideChildren(_MySupInfoEditItems, expand);
|
||||
UnhideChildren(_MyAfterEditItems, expand);
|
||||
MatchExpanded();
|
||||
|
||||
@@ -2109,6 +2311,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
AdjustChildren(_MyBeforeEditItems);
|
||||
AdjustChildren(_MyRNOEditItems);
|
||||
AdjustChildren(_MySupInfoEditItems);
|
||||
AdjustChildren(_MyAfterEditItems);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -2152,6 +2355,7 @@ namespace Volian.Controls.Library
|
||||
// Walk though Children performing Expand
|
||||
ExpandChildren(_MyBeforeEditItems);
|
||||
ExpandChildren(_MyRNOEditItems);
|
||||
ExpandChildren(_MySupInfoEditItems);
|
||||
ExpandChildren(_MyAfterEditItems);
|
||||
}
|
||||
private string MyPath
|
||||
@@ -2189,6 +2393,7 @@ namespace Volian.Controls.Library
|
||||
internal void AdjustLocation()
|
||||
{
|
||||
if (RNORight) MoveRNO(); // This is needed when an AER is Deleted that has an RNO.
|
||||
MoveSupInfo(); // If the current item has supplemental information, be sure its top location is that of the current item.
|
||||
if (RNOLevel > 0 && AEREditItem != null)
|
||||
AEREditItem.AdjustLocation();
|
||||
EditItem nextEditItem = NextDownEditItem;
|
||||
@@ -2226,6 +2431,7 @@ 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.IsSupInfoPart) newTop = Math.Max(bottom, nextEditItem.BottomOfStepImmediatelyAbove());
|
||||
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
|
||||
newTop = FindBottomDevDoc;// Use the bottom most caution or note
|
||||
@@ -2244,6 +2450,7 @@ namespace Volian.Controls.Library
|
||||
// it appears that setting the top doesn't always work. The logic below checks to see if it does
|
||||
// not work and trys some other things so that the EditItem will be moved to the correct place.
|
||||
// As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel.
|
||||
if (nextEditItem.MySupInfoEditItems != null && nextEditItem.MySupInfoEditItems.Count > 0) newTop = nextEditItem.MySupInfoEditItems[0].FindTop(newTop);
|
||||
nextEditItem.Top = newTop;
|
||||
if (nextEditItem.Top != newTop)
|
||||
{
|
||||
@@ -2332,6 +2539,7 @@ namespace Volian.Controls.Library
|
||||
AddChildRNO(MyItemInfo.RNOs, expand);
|
||||
if (MyItemInfo.RNOs != null && ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds))
|
||||
AddChildAfter(MyItemInfo.RNOs, expand);
|
||||
AddChildSupInfo(MyItemInfo.SupInfos, expand);
|
||||
AddChildAfter(MyItemInfo.Tables, expand);
|
||||
// get the config item for the steps section. there is an 'editable'
|
||||
// flag used in metasections to define whether the steps should print.
|
||||
@@ -2380,6 +2588,7 @@ namespace Volian.Controls.Library
|
||||
if (_MyPreviousEditItem != null) return _MyPreviousEditItem.BottomMostEditItem;
|
||||
if (_MyChildRelation == ChildRelation.After) return _MyParentEditItem;
|
||||
if (_MyChildRelation == ChildRelation.RNO) return _MyParentEditItem;
|
||||
if (_MyChildRelation == ChildRelation.SupInfo) return _MyParentEditItem;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2430,7 +2639,23 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return bottom;
|
||||
}
|
||||
public int? BottomOfParentSupInfo()
|
||||
{
|
||||
int? bottom = null;
|
||||
if (Colapsing) return null;
|
||||
EditItem parent = this;
|
||||
while (parent != null && parent.MyItemInfo.IsSection == false && parent._MyChildRelation != ChildRelation.Before)
|
||||
{
|
||||
if (parent._MySupInfoEditItems != null) return parent._MySupInfoEditItems[0].BottomMostEditItem.Bottom;
|
||||
parent = parent.UpOneEditItem;
|
||||
}
|
||||
return bottom;
|
||||
}
|
||||
private string _NextDownEditItemPath = "None";
|
||||
public string NextDownEditItemPath
|
||||
{
|
||||
get { return _NextDownEditItemPath; }
|
||||
}
|
||||
/// <summary>
|
||||
/// This finds the next EditItem down.
|
||||
/// </summary>
|
||||
@@ -2481,6 +2706,11 @@ namespace Volian.Controls.Library
|
||||
if (btmNext != null)
|
||||
{
|
||||
int bottom = btmNext.FindTop(btm.Bottom);
|
||||
if (btmNext.MySupInfoEditItems != null && btmNext.MySupInfoEditItems.Count > 0)
|
||||
{
|
||||
int btmSupInfo = btmNext.MySupInfoEditItems[0].FindTop(btm.Bottom);
|
||||
if (btmSupInfo > bottom) bottom = btmSupInfo;
|
||||
}
|
||||
if (btmNext.Top != bottom)
|
||||
{
|
||||
MyStepPanel.ItemMoving++;
|
||||
@@ -2524,7 +2754,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return _MyItemInfo == null ? base.ToString() : string.Format("{0},'{1}'", MyID, MyPath); // + "-" + MyItemInfo.MyContent.Text;
|
||||
return _MyItemInfo == null ? base.ToString() : string.Format("{0},'{1}',{2},{3}", MyID, MyPath, Top, Bottom); // + "-" + MyItemInfo.MyContent.Text;
|
||||
}
|
||||
#endregion
|
||||
#region Abstract Methods and Properties
|
||||
@@ -2577,6 +2807,13 @@ namespace Volian.Controls.Library
|
||||
public abstract void SetExpandAndExpander(ItemInfo itemInfo);
|
||||
public abstract void SaveCurrentAndContents();
|
||||
#endregion
|
||||
private int SupInfoTopOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return _MyParentEditItem.MyStepRTB.Location.Y - MyStepRTB.Location.Y;
|
||||
}
|
||||
}
|
||||
protected string _TabFormat;
|
||||
private static int _WidthAdjust = 5;
|
||||
protected bool _IgnoreResize = false;
|
||||
@@ -2707,7 +2944,19 @@ namespace Volian.Controls.Library
|
||||
if (_MyPreviousEditItem != null)
|
||||
ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyPreviousEditItem.BottomMostEditItem.Bottom);
|
||||
else
|
||||
{
|
||||
ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyParentEditItem.Bottom);
|
||||
// if inserting a substep within supplemental information, then may have to adjust steps too:
|
||||
if (MyItemInfo.IsInSupInfo)
|
||||
{
|
||||
AdjustLocation();
|
||||
// find parent of supinfo & adjust its location:
|
||||
ItemInfo supInfoPart = MyItemInfo;
|
||||
while (!supInfoPart.IsSupInfoPart) supInfoPart = supInfoPart.MyParent;
|
||||
EditItem eitmp = MyStepPanel._LookupEditItems[supInfoPart.ItemID];
|
||||
eitmp.MyParentEditItem.AdjustLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
bool specialTplSupport = ((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd) ||
|
||||
(MyItemInfo.MyDocStyle.LandscapePageList && MyItemInfo.MyDocStyle.ComponentList);
|
||||
@@ -2759,6 +3008,42 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ChildRelation.SupInfo: // on a supplemental info item
|
||||
EditItem high = MyStepPanel._LookupEditItems[MyItemInfo.MyHLS.ItemID];
|
||||
if (_MyParentEditItem.MyItemInfo.IsNote || _MyParentEditItem.MyItemInfo.IsCaution)
|
||||
{
|
||||
ContentWidth = high.ContentWidth - high.ContentLocation.X;
|
||||
}
|
||||
else
|
||||
ContentWidth = _MyParentEditItem.ContentWidth;
|
||||
// Currently on the supinfo, so MyParentEditItem is the step the supinfo is related to.
|
||||
// From this MyParentEditItem, need to find what is the bottom of the 'previous step' on the screen where 'previous step' can be:
|
||||
// 1) The bottom most EditItem from a caution/note, i.e. MyBeforeEditItems. This must be checked first.
|
||||
// 2) If there is a MyParentEditItem, use it (only MyParentEditItem or MyPreviousEditItem can be set), if going to parent don't use
|
||||
// BottomMostEditItem because that will take it onto this step or subsequent substeps. So just use its bottom. Note that there
|
||||
// are special cases if on a Note/Caution (see below for comments)
|
||||
// 3) If there is no MyBeforeEditItems & no MyParentEditItems, there must be a MyPreviousEditItems. Use its MyBottomMostEditItem's bottom
|
||||
// since this previous may have substeps.
|
||||
int btm = MyParentEditItem.BottomOfStepImmediatelyAbove();
|
||||
int topp = FindTop(btm, false);
|
||||
if (topp != 0)
|
||||
{
|
||||
MyStepPanel.ItemMoving++;
|
||||
_MyParentEditItem.Top = (int)topp;
|
||||
if (_MyParentEditItem.MyItemInfo.Steps != null && _MyParentEditItem.MyItemInfo.Steps.Count > 0)
|
||||
{
|
||||
EditItem chtmp = GetEditItemFromItemID(_MyParentEditItem.MyItemInfo.Steps[0].ItemID);
|
||||
if (chtmp != null && chtmp._MyParentEditItem != null)
|
||||
{
|
||||
chtmp.Top = chtmp._MyParentEditItem.Bottom;
|
||||
chtmp.AdjustLocation();
|
||||
}
|
||||
}
|
||||
_MyParentEditItem.AdjustLocation();
|
||||
MyStepPanel.ItemMoving--;
|
||||
}
|
||||
ContentLocation = new Point(high.ContentLeft + high.Width + 36, (int)_MyParentEditItem.Top + SupInfoTopOffset); // account for Caution/Note tab above caution/note
|
||||
break;
|
||||
case ChildRelation.RNO:
|
||||
// this is set so that TextWidth command below will be correct. TextWidth uses
|
||||
// the tab start & tab width to calculate the overall width.
|
||||
@@ -2820,7 +3105,12 @@ namespace Volian.Controls.Library
|
||||
_IgnoreResize = false;
|
||||
MyStepPanel.ItemMoving++;
|
||||
//Location = new Point(_MyParentRTBItem.Left + 20, FindTop(_MyParentRTBItem.Top));
|
||||
int myTop = MyNextEditItem == null ? _MyParentEditItem.Top : MyNextEditItem.Top;
|
||||
int myTop = 0;
|
||||
if (MyNextEditItem == null)
|
||||
myTop = _MyParentEditItem.Top;
|
||||
else
|
||||
myTop = MyNextEditItem.Top;
|
||||
|
||||
//if (MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2)
|
||||
//{
|
||||
// if (MyItemInfo.WidthOverride > 0)
|
||||
@@ -2864,6 +3154,31 @@ namespace Volian.Controls.Library
|
||||
LastMethodsPop();
|
||||
}
|
||||
}
|
||||
private int BottomOfStepImmediatelyAbove()
|
||||
{
|
||||
int btm = 0;
|
||||
if (MyBeforeEditItems != null && MyBeforeEditItems.Count > 0) // Notes & Cautions before
|
||||
btm = MyBeforeEditItems[MyBeforeEditItems.Count - 1].BottomMostEditItem.Bottom;
|
||||
else
|
||||
{
|
||||
// if on a caution or note, (the first one), need to go up to either previous step or the section to find its bottom
|
||||
// _MyParentEditItem is a way to find that the structure supports this, i.e. there can be a caution or note:
|
||||
if (_MyParentEditItem != null
|
||||
&& _MyParentEditItem.MyBeforeEditItems != null && _MyParentEditItem.MyBeforeEditItems.Count > 0 // this part checks that there are cautions/notes
|
||||
&& _MyParentEditItem.MyBeforeEditItems[0].MyID == MyID) // first caution or note, i.e. index of MyBeforeItems == 0
|
||||
{
|
||||
if (_MyParentEditItem._MyPreviousEditItem == null) // this part checks for first HLS
|
||||
btm = _MyParentEditItem._MyParentEditItem.Bottom; // bottom of the section
|
||||
else
|
||||
btm = _MyParentEditItem._MyPreviousEditItem.BottomMostEditItem.Bottom; // bottom of previous step
|
||||
}
|
||||
else
|
||||
{
|
||||
btm = MyParentEditItem != null ? MyParentEditItem.Bottom : MyPreviousEditItem.BottomMostEditItem.Bottom;
|
||||
}
|
||||
}
|
||||
return btm;
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the previous item and adjusts locations
|
||||
/// </summary>
|
||||
@@ -2936,6 +3251,7 @@ namespace Volian.Controls.Library
|
||||
Location = new Point(_MyPreviousEditItem.Left, top);
|
||||
// B2017-029 only do this if this is a the deviation document
|
||||
AdjustForDevDocStepHeight();
|
||||
AdjustAllForSupInfoHeight();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2959,6 +3275,8 @@ namespace Volian.Controls.Library
|
||||
break;
|
||||
case ChildRelation.RNO:
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
break;
|
||||
case ChildRelation.Before:
|
||||
//MyStepPanel.ItemMoving++;
|
||||
//UpOneRTBItem.Top = BottomMostRTBItem.Bottom;
|
||||
@@ -2969,7 +3287,147 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
LastMethodsPop();
|
||||
}
|
||||
}
|
||||
}
|
||||
// AdjustAllForSupInfoHeight & AdjustFOrSupInfoHeight go from current edit item down, adjusting any of the edit items' top
|
||||
// location to account for any supplemental informations that items may have so that either the step or its supplemental information
|
||||
// does not overwrite other steps on screen.
|
||||
private void AdjustAllForSupInfoHeight()
|
||||
{
|
||||
EditItem ei = this;
|
||||
while (ei != null)
|
||||
{
|
||||
ei = ei.AdjustForSupInfoHeight();
|
||||
}
|
||||
}
|
||||
private EditItem AdjustForSupInfoHeight()
|
||||
{
|
||||
if (MyStepPanel._LookupEditItems.ContainsKey(MyID) && MyItemInfo.IsInSupInfo) // only do this if it is displayed (in LookupEditItems and in sup info column
|
||||
{
|
||||
ItemInfo supInfoPart = MyItemInfo;
|
||||
while (!supInfoPart.IsSupInfoPart) supInfoPart = supInfoPart.MyParent;
|
||||
EditItem EIsupInfoPartAbove = MyStepPanel._LookupEditItems[supInfoPart.ItemID];
|
||||
|
||||
// find first edititem below this (EIWsupInfoBelow) or a sibling or child child that have sup info
|
||||
// if found, adjust top of this item to the bottommost edititem above this
|
||||
EditItem EIWsupInfoBelow = null;
|
||||
EIWsupInfoBelow = EIsupInfoPartAbove.MyParentEditItem.FindFirstChildWithSupInfo(EIsupInfoPartAbove.MyParentEditItem.MyItemInfo);
|
||||
if (EIWsupInfoBelow == null)
|
||||
EIWsupInfoBelow = EIsupInfoPartAbove.MyParentEditItem.FindSiblingOrParentSiblingWithSupInfo(EIsupInfoPartAbove.MyParentEditItem.MyItemInfo);
|
||||
|
||||
if (EIWsupInfoBelow != null) // for editiem below, find bottom of step & subinfo column and take the max of these:
|
||||
{
|
||||
int bottomOfAboveSupInfoColumn = EIsupInfoPartAbove.BottomMostEditItem.Bottom;
|
||||
int bottomOfImmediatelyAbove = EIWsupInfoBelow.BottomOfStepImmediatelyAbove();
|
||||
MyStepPanel.ItemMoving++;
|
||||
EIWsupInfoBelow.Top = Math.Max(bottomOfAboveSupInfoColumn, bottomOfImmediatelyAbove);
|
||||
EIWsupInfoBelow.AdjustLocation();
|
||||
MyStepPanel.ItemMoving--;
|
||||
return EIWsupInfoBelow.MySupInfoEditItems==null?null:EIWsupInfoBelow.MySupInfoEditItems[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private EditItem CheckForExpanded(EditItem ei)
|
||||
{
|
||||
ItemInfo hls = ei.MyItemInfo.MyHLS;
|
||||
EditItem hlsEI = GetEditItemFromItemID(hls.ItemID);
|
||||
if (hlsEI==null) return null;
|
||||
return ei;
|
||||
}
|
||||
// FindSiblingOrParentSiblingWithSupInfo will find the next edititem below me on the screen that has a supinfo
|
||||
private EditItem FindSiblingOrParentSiblingWithSupInfo(ItemInfo itm)
|
||||
{
|
||||
if (itm == null || itm.IsProcedure) return null;
|
||||
if (itm.NextItem == null)
|
||||
{
|
||||
return FindSiblingOrParentSiblingWithSupInfo(itm.ActiveParent as ItemInfo);
|
||||
}
|
||||
EditItem chldOfNext = null;
|
||||
// if section, handle notes/cautions on section and if none, look for hls (children of section)
|
||||
if (itm.NextItem.IsSection)
|
||||
{
|
||||
if (itm.NextItem.Steps == null || itm.NextItem.Steps.Count == 0) return null;
|
||||
chldOfNext = FindFirstCautionOrNoteWithSupInfo(itm.NextItem);
|
||||
if (chldOfNext != null) return CheckForExpanded(chldOfNext);
|
||||
chldOfNext = FindFirstChildWithSupInfo(itm.NextItem);
|
||||
if (chldOfNext != null) return CheckForExpanded(chldOfNext);
|
||||
return null;
|
||||
}
|
||||
// Handle caution/note off of itm.nextitem. See if any of those have supinfos.
|
||||
chldOfNext = FindFirstCautionOrNoteWithSupInfo(itm.NextItem);
|
||||
if (chldOfNext != null) return CheckForExpanded(chldOfNext);
|
||||
|
||||
// this is step side (parent) of supinfo part. This step does not have any children with supinfo.
|
||||
// See if any of my next siblings have supinfo
|
||||
if (itm.NextItem.SupInfos != null && itm.NextItem.SupInfos.Count > 0)
|
||||
{
|
||||
return GetEditItemFromItemID(itm.NextItem.ItemID);
|
||||
}
|
||||
// no longer looking at next, go to children.
|
||||
chldOfNext = FindFirstChildWithSupInfo(itm.NextItem);
|
||||
if (chldOfNext != null) return CheckForExpanded(chldOfNext);
|
||||
return FindSiblingOrParentSiblingWithSupInfo(itm.NextItem);
|
||||
}
|
||||
// FindFirstChildWithSupinfo finds the first child going down the screen that has a supinfo. It checks for cautions and
|
||||
// notes first.
|
||||
private EditItem FindFirstChildWithSupInfo(ItemInfo itm)
|
||||
{
|
||||
// If on a caution, see if there are any notes below me on the screen that have supinfo.
|
||||
if (itm.IsCaution && (itm.ActiveParent as ItemInfo).Notes != null && (itm.ActiveParent as ItemInfo).Notes.Count > 0)
|
||||
{
|
||||
foreach (ItemInfo inote in (itm.ActiveParent as ItemInfo).Notes)
|
||||
{
|
||||
if (inote.SupInfos != null && inote.SupInfos.Count > 0)
|
||||
return GetEditItemFromItemID(inote.ItemID);
|
||||
EditItem chld = FindFirstChildWithSupInfo(inote);
|
||||
if (chld != null) return CheckForExpanded(chld);
|
||||
}
|
||||
}
|
||||
// if on a caution or note check the step below me, which is really my activeparent (cautions/notes are above their respective parent)
|
||||
if ((itm.IsCaution || itm.IsNote) && (itm.NextItem == null || itm.NextItemCount == 0) && (itm.ActiveParent as ItemInfo).SupInfos != null && (itm.ActiveParent as ItemInfo).SupInfos.Count > 0)
|
||||
return GetEditItemFromItemID((itm.ActiveParent as ItemInfo).ItemID);
|
||||
|
||||
// Finally check substeps:
|
||||
if (itm.Steps == null || itm.Steps.Count == 0) return null;
|
||||
foreach (ItemInfo ii in itm.Steps)
|
||||
{
|
||||
if (ii.SupInfos != null && ii.SupInfos.Count > 0)
|
||||
return GetEditItemFromItemID(ii.ItemID);
|
||||
EditItem chld = FindFirstChildWithSupInfo(ii);
|
||||
if (chld != null) return CheckForExpanded(chld);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// FindFirstCautionOrNoteWithSupInfo looks for first caution or note going down the screen that has supInfo
|
||||
private EditItem FindFirstCautionOrNoteWithSupInfo(ItemInfo itm)
|
||||
{
|
||||
if (itm.Cautions != null && itm.Cautions.Count > 0)
|
||||
{
|
||||
foreach (ItemInfo ii in itm.Cautions)
|
||||
{
|
||||
if (ii.SupInfos != null && ii.SupInfos.Count > 0)
|
||||
return GetEditItemFromItemID(ii.ItemID);
|
||||
EditItem chld = FindFirstChildWithSupInfo(ii);
|
||||
if (chld != null) return CheckForExpanded(chld);
|
||||
}
|
||||
}
|
||||
if (itm.Notes != null && itm.Notes.Count > 0)
|
||||
{
|
||||
foreach (ItemInfo ii in itm.Notes)
|
||||
{
|
||||
if (ii.SupInfos != null && ii.SupInfos.Count > 0)
|
||||
return GetEditItemFromItemID(ii.ItemID);
|
||||
EditItem chld = FindFirstChildWithSupInfo(ii);
|
||||
if (chld != null) return CheckForExpanded(chld);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private EditItem GetEditItemFromItemID(int itemid)
|
||||
{
|
||||
if (!MyStepPanel._LookupEditItems.ContainsKey(itemid)) return null;
|
||||
return MyStepPanel._LookupEditItems[itemid];
|
||||
}
|
||||
/// <summary>
|
||||
/// Adjust the height of a Deviation Document Step Including the Cautions and Notes B2016-123, B2017-020, B2017-021
|
||||
/// </summary>
|
||||
@@ -3099,7 +3557,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
//// TIMING: DisplayItem.TimeIt("CSLARTB MyItem");
|
||||
myStepPanel.Controls.Add(this);
|
||||
|
||||
switch (myChildRelation)
|
||||
{
|
||||
case ChildRelation.After:
|
||||
@@ -3112,6 +3569,9 @@ namespace Volian.Controls.Library
|
||||
RNOLevel = myParentEditItem.RNOLevel + 1;
|
||||
AddItem(myParentEditItem, ref myParentEditItem._MyRNOEditItems, nextEditItem, addFirstChld);
|
||||
break;
|
||||
case ChildRelation.SupInfo:
|
||||
AddItem(myParentEditItem, ref myParentEditItem._MySupInfoEditItems, nextEditItem, addFirstChld);
|
||||
break;
|
||||
case ChildRelation.None:
|
||||
break;
|
||||
}
|
||||
@@ -3140,6 +3600,11 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
//// TIMING: DisplayItem.TimeIt("CSLARTB Parent");
|
||||
SetText();
|
||||
if (itemInfo.IsSupInfoPart)
|
||||
{
|
||||
EditItem high = MyStepPanel._LookupEditItems[itemInfo.MyHLS.ItemID];
|
||||
ContentLocation = new Point(high.ContentLeft + high.Width + 36, (int)_MyParentEditItem.Top + SupInfoTopOffset);
|
||||
}
|
||||
//// TIMING: DisplayItem.TimeIt("CSLARTB SetText");
|
||||
if (itemInfo != null)
|
||||
{
|
||||
@@ -3156,7 +3621,10 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
//// TIMING: DisplayItem.TimeIt("CSLARTB before Controls Add");
|
||||
//myStepPanel.Controls.Add(this);
|
||||
int top = FindTop(0);
|
||||
// If on the first Caution/Note and the parent has a previous, for example a caution off of 5th HLS, go to the
|
||||
// bottom on the previous parent. In the example, the bottom of the 4th HLS.
|
||||
int btm = myStepPanel.DisplayRectangle.Y;
|
||||
int top = FindTop(btm);
|
||||
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
|
||||
if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
|
||||
top = myParentEditItem.TopMostEditItem.Top;
|
||||
|
Reference in New Issue
Block a user