B2017-175 The steps were being displayed with High-level steps and sections overlapping an expanded high-level step. The fix assures that high level steps and sections will be located vertically so that they don't overlap other steps.

This commit is contained in:
Rich 2017-08-18 12:43:45 +00:00
parent 086adde4c6
commit 88383ec87f

View File

@ -303,7 +303,7 @@ namespace Volian.Controls.Library
//private string _LastMethod = "";
internal void LastMethodsPush(string str)
{
if(MyStepPanel != null)MyStepPanel._LastAdjust = str;
if (MyStepPanel != null) MyStepPanel._LastAdjust = str;
_LastMethods.Push(str);
}
internal string LastMethodsPop()
@ -331,7 +331,7 @@ namespace Volian.Controls.Library
// 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;
return (MySectionRTBItem == null) ? 0 : MySectionRTBItem.Bottom;
}
int b1 = prevOrParSupInfo.BottomMostEditItem.Bottom;
int b2 = b1;
@ -370,7 +370,7 @@ namespace Volian.Controls.Library
{
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();
if (prev.MyParentEditItem.MyPreviousEditItem != null) eitmp = prev.MyParentEditItem.MyPreviousEditItem.BottomMostEditItem.FindPreviousOrParentSupInfo();
return eitmp;
}
if (prev.MyParentEditItem.MySupInfoEditItems != null) return prev.MyParentEditItem.MySupInfoEditItems[0];
@ -438,7 +438,7 @@ namespace Volian.Controls.Library
{
if (MyItemInfo.IsSupInfoPart)
{
int? tmptop = FindTopSupInfo(test1);
int? tmptop = FindTopSupInfo(test1);
return tmptop == null ? bottom : Math.Max(bottom, (int)tmptop);
}
}
@ -722,16 +722,16 @@ namespace Volian.Controls.Library
{
EditItem prevChild = nextEditItem.MyPreviousEditItem;
EditItem parent = nextEditItem.MyParentEditItem;
if(siblingEditItems.Contains(nextEditItem))
siblingEditItems.Insert(siblingEditItems.IndexOf(nextEditItem), this);
if (siblingEditItems.Contains(nextEditItem))
siblingEditItems.Insert(siblingEditItems.IndexOf(nextEditItem), this);
else
siblingEditItems.Insert(0, this);
MyStepPanel.ItemMoving++;
_MyNextEditItem = nextEditItem;
if(!MyItemInfo.IsNote || !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || MyPreviousEditItem == null)
if (!MyItemInfo.IsNote || !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format || MyPreviousEditItem == null)
nextEditItem._MyPreviousEditItem = this;
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)
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))
{
@ -980,11 +980,11 @@ namespace Volian.Controls.Library
newFocus = MyNextEditItem;
}
// Adjust the vertical locations of all of the items below the item deleted
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && MyNextEditItem.MyPreviousEditItem == null &&
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.MyParentEditItem.Top = (MyNextEditItem.MyParentEditItem.MyPreviousEditItem != null ?
MyNextEditItem.MyParentEditItem.MyPreviousEditItem.FindBottomDevDoc : MyNextEditItem.MyParentEditItem.MyParentEditItem.Bottom);
MyNextEditItem.Top = MyNextEditItem.MyParentEditItem.Top;
MyNextEditItem.AdjustLocation();
}
@ -1223,7 +1223,7 @@ namespace Volian.Controls.Library
child = new ImageItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem, FigInsType);
else if (MyItemInfo.IsRtfRaw)
child = new RtfRawItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
if(MyItemInfo.MyContent.MyGrid != null)
if (MyItemInfo.MyContent.MyGrid != null)
child = new GridItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
else
child = new RTBItem(MyItemInfo, MyStepPanel, this, ChildRelation.Before, true, nextEditItem);
@ -1357,7 +1357,7 @@ namespace Volian.Controls.Library
public void AddSiblingBefore(int? type, bool updateStatus)
{
SaveContents();
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore("", "",type);
ItemInfo newItemInfo = MyItemInfo.InsertSiblingBefore("", "", type);
AddGridIfNeeded(newItemInfo);
AddImageIfNeeded(newItemInfo);
DoAddSiblingBefore(newItemInfo, updateStatus);
@ -1594,9 +1594,9 @@ namespace Volian.Controls.Library
public void PasteSiblingBefore(int copyStartID)
{
ItemInfo newItemInfo = MyItemInfo.PasteSiblingBefore(copyStartID, GetChangeId(MyItemInfo));
if (newItemInfo.ItemID == MyItemInfo.ItemID) return;
EditItem newEditItem = null;
switch (_MyChildRelation)
{
@ -1759,7 +1759,7 @@ namespace Volian.Controls.Library
}
EditItem nextItem = GetNextItem(fromType, newItemInfo);
EditItem newEditItem;
switch (fromType)
{
case E_FromType.Caution:
@ -1801,7 +1801,7 @@ namespace Volian.Controls.Library
// To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field
// to simulate replacing an existing step - otherwise we will get null references.
if (MyStepPanel.SelectedEditItem.Empty)
MyStepPanel.SelectedEditItem.Empty=false;
MyStepPanel.SelectedEditItem.Empty = false;
MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted
ChildRelation childRelation = _MyChildRelation;
EditItem newFocus = null;
@ -1821,7 +1821,7 @@ namespace Volian.Controls.Library
//catch (System.Data.SqlClient.SqlException ex)
catch (Exception ex)
{
if (HandleSqlExceptionOnCopy(ex)) return this;
if (HandleSqlExceptionOnCopy(ex)) return this;
HandleSqlExceptionOnDelete(ex);
return this;
}
@ -1888,12 +1888,12 @@ namespace Volian.Controls.Library
MessageBox.Show("The step being pasted has been deleted", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return true;
}
if(ex.Message.Contains("This current step has been deleted in another session"))
{
MessageBox.Show("The highlighted step has been deleted by another user.", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return true;
}
return false;
if (ex.Message.Contains("This current step has been deleted in another session"))
{
MessageBox.Show("The highlighted step has been deleted by another user.", "Cannot Paste Step", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return true;
}
return false;
}
public void IdentifyChildren(bool highlight)
{
@ -2048,64 +2048,64 @@ namespace Volian.Controls.Library
//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 (MyStepPanel.ItemMoving == 0 && !TryAgainLater)
{
//vlnStackTrace.ScrollInStack();
return; // If 0 - Indicates scrolling which requires no action.
}
TryAgainLater = false;
//ShowMe("Move");
if (MyItemInfo == null)
return;
//if (_WatchThis > 0 && MyID > _StartingID)
//{
int watchThis = _WatchThis;
if (MyStepPanel.ItemMoving == 0 && !TryAgainLater)
{
//vlnStackTrace.ScrollInStack();
return; // If 0 - Indicates scrolling which requires no action.
}
TryAgainLater = false;
//ShowMe("Move");
if (MyItemInfo == null)
return;
//if (_WatchThis > 0 && MyID > _StartingID)
//{
// Console.WriteLine("{0}Start Move {1},{2}", WatchThisIndent, MyID, this);
// if (MyID == _LookForID)
// Console.WriteLine("{0}---------------", WatchThisIndent,MyID, this);
// _WatchThis++;
//}
if (MyExpandingStatus == ExpandingStatus.Expanding)
// Console.WriteLine("{0}Start Move {1},{2}", WatchThisIndent, MyID, this);
// if (MyID == _LookForID)
// Console.WriteLine("{0}---------------", WatchThisIndent,MyID, this);
// _WatchThis++;
//}
if (MyExpandingStatus == ExpandingStatus.Expanding)
{
_WatchThis = watchThis;
return;
}
Moving = true;
EditItem tmp = (EditItem)sender;
if (tmp.MyPreviousEditItem == null && tmp.MyParentEditItem == null)
{
_WatchThis = watchThis;
return;
}
if (RNOBelow) // Adjust substeps first
{
//Console.WriteLine("RNOBelow");
AdjustLocation();
MoveRNO();
}
else // Adjust RNO First
{
if (RNORight)
{
_WatchThis = watchThis;
return;
}
Moving = true;
EditItem tmp = (EditItem)sender;
if (tmp.MyPreviousEditItem == null && tmp.MyParentEditItem == null)
{
_WatchThis = watchThis;
return;
}
if (RNOBelow) // Adjust substeps first
{
//Console.WriteLine("RNOBelow");
AdjustLocation();
//Console.WriteLine("RNORight");
MoveRNO();
}
else // Adjust RNO First
{
if (RNORight)
{
//Console.WriteLine("RNORight");
MoveRNO();
}
AdjustLocation();
}
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)
//{
// Console.WriteLine("{0}Finish Move {1},{2}",WatchThisIndent, MyID, this);
//}
_WatchThis = watchThis;
AdjustLocation();
}
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)
//{
// Console.WriteLine("{0}Finish Move {1},{2}",WatchThisIndent, MyID, this);
//}
_WatchThis = watchThis;
}
/// <summary>
/// Adjust the locations when the EditItem is resized
/// </summary>
@ -2150,7 +2150,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 ) && !MyItemInfo.IsInSupInfo)
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);
@ -2164,7 +2164,7 @@ namespace Volian.Controls.Library
int x = center - width / 2;
if (x + width > rightLimit) x = rightLimit - width;
// B2017-043 account for Horizontal Scroll
int colT =MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay((int)myStepSectionLayoutData.ColT);
int colT = MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay((int)myStepSectionLayoutData.ColT);
if (x < colT) x = colT;
int y = FindTop(myParentEditItem.Bottom);
return new Point(x, y);
@ -2186,7 +2186,7 @@ namespace Volian.Controls.Library
if (!MyStepRTB.ContainsFocus)
MyStepRTB.Focus();
}
protected void ToggleContinuousActionSummary()
protected void ToggleContinuousActionSummary()
{
if (MyStepPropertiesPanel != null) // bug fix B2016-256 check for a null reference incase we are not on a step element
MyStepPropertiesPanel.ToggleContActSummary(); // update the checkbox on the Step Properties panel
@ -2249,7 +2249,7 @@ namespace Volian.Controls.Library
if (Top >= 0 && Bottom <= MyStepPanel.Height) return;// Don't move if within screen.
int scrollValue = MyStepPanel.VerticalScroll.Value + (Top - (MyStepPanel.Height / 2)); // calculate scroll center for the item
// Limit scroll location within allowable values
scrollValue = Math.Max(MyStepPanel.VerticalScroll.Minimum,Math.Min(MyStepPanel.VerticalScroll.Maximum,scrollValue));
scrollValue = Math.Max(MyStepPanel.VerticalScroll.Minimum, Math.Min(MyStepPanel.VerticalScroll.Maximum, scrollValue));
//Console.WriteLine("CenterScroll {0} Current {1} New {2} Min {3} Max {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, scrollValue, _Panel.VerticalScroll.Minimum, _Panel.VerticalScroll.Maximum);
//if (scrollValue >= MyStepPanel.VerticalScroll.Minimum && scrollValue <= MyStepPanel.VerticalScroll.Maximum) // If it is within range
MyStepPanel.VerticalScroll.Value = scrollValue; // Center the item
@ -2395,9 +2395,9 @@ namespace Volian.Controls.Library
return null;
}
}
/// <summary>
/// Adjust the Location of all items below the current item.
/// </summary>
/// <summary>
/// Adjust the Location of all items below the current item.
/// </summary>
internal void AdjustLocation()
{
if (MyStepPanel.ShuttingDown) return;
@ -2412,9 +2412,17 @@ namespace Volian.Controls.Library
// _NextDownEditItemPath);
if (nextEditItem != null)
{
if (MyStepPanel.ExpandingHLS != null && nextEditItem.MyItemInfo.IsSection) return; // without this, if next item is section, it crashes on null reference
if (MyStepPanel.ExpandingHLS != null && nextEditItem.MyItemInfo.IsSection)
{
AddAdjustItem(this);// B2017-175 Adjust Location after Expanding
return; // without this, if next item is section, it crashes on null reference
}
if (MyStepPanel.ExpandingHLS != null && nextEditItem.MyItemInfo.MyHLS.ItemID != MyStepPanel.ExpandingHLS.ItemID)
{
AddAdjustItem(this);// B2017-175 Adjust Location after Expanding
return;
}
if (AdjustItems.Contains(this)) AdjustItems.Remove(this);//B2017-175 If processed remove from list to do later
int bottom = nextEditItem.FindTop(Bottom);
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
@ -2466,12 +2474,27 @@ namespace Volian.Controls.Library
_MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'",
oldTop, nextEditItem.Top, newTop, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath);
nextEditItem.TryAgainLater = true;
}
}
nextEditItem.LastMethodsPop();
MyStepPanel.ItemMoving--;
}
}
}
private static List<EditItem> _AdjustItems=new List<EditItem>();// B2017-175 Keep a list of EditItems to adjust after expanding
public static List<EditItem> AdjustItems
{
get { return _AdjustItems; }
set { _AdjustItems = value; }
}
private static void AddAdjustItem(EditItem ei)// B2017-175 Add edit item to adjust after expanding
{
if(!AdjustItems.Contains(ei)) AdjustItems.Add(ei);
}
private static void ProcessAdjustItems() // B2017-175 adjust after expanding
{
while (AdjustItems.Count > 0)
AdjustItems[0].AdjustLocation();
}
private int _DevDocHeight = 0; // Deviation Document Step Height B2016-123, B2017-020, B2017-021
public int DevDocHeight
{
@ -2480,7 +2503,7 @@ namespace Volian.Controls.Library
}
public void TryAgainNow(int bottom)
{
TryToSetTop(bottom-10);
TryToSetTop(bottom - 10);
//TryToSetTop(bottom+10);
TryToSetTop(bottom);
}
@ -2488,7 +2511,7 @@ namespace Volian.Controls.Library
{
Top = offset;
if (Top != offset)
_MyLog.InfoFormat("Didn't work - Top {0} != offset {1} {2}", Top, offset,MyStepPanel.VerticalScroll.Value);
_MyLog.InfoFormat("Didn't work - Top {0} != offset {1} {2}", Top, offset, MyStepPanel.VerticalScroll.Value);
}
/// <summary>
/// Automatically expands Steps if not currently expanded
@ -2497,7 +2520,7 @@ namespace Volian.Controls.Library
{
if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections
{
if(MyStepPanel.AutoExpand)
if (MyStepPanel.AutoExpand)
Expand((_ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format);
else
Expand(false);
@ -2556,10 +2579,10 @@ namespace Volian.Controls.Library
// Only check the flag if the section has subsections because the
// default for the flag is not editable, and this would make non-metasections
// not editable.
bool hasMetaSubs = MyItemInfo.IsSection && MyItemInfo.Sections != null && MyItemInfo.Sections.Count>0;
bool hasMetaSubs = MyItemInfo.IsSection && MyItemInfo.Sections != null && MyItemInfo.Sections.Count > 0;
bool EditSteps = !hasMetaSubs || (MyItemInfo.MyConfig is SectionConfig && (MyItemInfo.MyConfig as SectionConfig).SubSection_Edit == "Y");
if (EditSteps) AddChildAfter(MyItemInfo.Steps, expand);
if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode &&
!((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds))
AddChildRNO(MyItemInfo.RNOs, expand);
@ -2569,6 +2592,8 @@ namespace Volian.Controls.Library
}
MyExpandingStatus = ExpandingStatus.Done;
BottomMostEditItem.AdjustLocation();
if (MyItemInfo.IsHigh)
ProcessAdjustItems(); // B2017-175 Adjust after expanding
MyExpandingStatus = ExpandingStatus.No;
//// TIMING: DisplayItem.TimeIt("Expand End");
}
@ -2715,7 +2740,7 @@ namespace Volian.Controls.Library
if (btmNext != null)
{
int bottom = btmNext.FindTop(btm.Bottom);
if (btmNext.MySupInfoEditItems != null && btmNext.MySupInfoEditItems.Count > 0)
if (btmNext.MySupInfoEditItems != null && btmNext.MySupInfoEditItems.Count > 0)
{
int btmSupInfo = btmNext.MySupInfoEditItems[0].FindTop(btm.Bottom);
if (btmSupInfo > bottom) bottom = btmSupInfo;
@ -2795,7 +2820,7 @@ namespace Volian.Controls.Library
public abstract bool FindText(string str, bool caseSensitive, bool matchWholeWord, bool reverse);
public abstract void PositionToEnd();
public abstract void PositionToStart();
public abstract string SelectedTextForFind { get;}
public abstract string SelectedTextForFind { get; }
public abstract bool SpellCheckNext();
public abstract void IdentifyMe(bool highlight);
public abstract void SetActive();
@ -2884,14 +2909,14 @@ namespace Volian.Controls.Library
if (MyPreviousEditItem != null)
{
EditItem ei = MyPreviousEditItem.BottomMostEditItem;
if (ei.MyItemInfo.IsHigh && (ei.MyItemInfo.Cautions !=null || ei.MyItemInfo.Notes!=null))
if (ei.MyItemInfo.IsHigh && (ei.MyItemInfo.Cautions != null || ei.MyItemInfo.Notes != null))
{
if (ei.MyItemInfo.Cautions!= null)// Look at cautions
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
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;
@ -2937,7 +2962,7 @@ namespace Volian.Controls.Library
// Paul Linn made the request on 6/4/12 to align the Component Description &
// Required Position under the Component Number.
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom);
// part of F2017-011, for enhanced backgrounds, always align the TitleWithTextRight and TitleWithTextBelow with the parent tab (on the screen)
// part of F2017-011, for enhanced backgrounds, always align the TitleWithTextRight and TitleWithTextBelow with the parent tab (on the screen)
else if ((MyItemInfo.FormatStepData.Type == "TitleWithTextRight" || MyItemInfo.FormatStepData.Type == "TitleWithTextBelow") && ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) // align with parent tab if in background document
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom);
else if (MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)) // this code is run for siblings within a HLS (but not last sibling).
@ -2956,7 +2981,7 @@ namespace Volian.Controls.Library
{
ItemLocation = new Point(_MyParentEditItem.ContentLeft, _MyParentEditItem.Bottom);
// if inserting a substep within supplemental information, then may have to adjust steps too:
if (MyItemInfo.IsInSupInfo)
if (MyItemInfo.IsInSupInfo)
{
AdjustLocation();
// find parent of supinfo & adjust its location:
@ -3004,12 +3029,12 @@ namespace Volian.Controls.Library
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
else if (MyItemInfo.MyTab != null && MyItemInfo.MyTab.Offset != 0)
{
// Farley - part of bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset)
ContentWidth = _MyParentEditItem.ContentWidth;
int xOffTabNew = (MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.Offset : MyItemInfo.MyParent.OffsetTab) + MyItemInfo.MyTab.Offset;
xOffTabNew += MyItemInfo.MyParent.MyTab == null ? 0 : MyItemInfo.MyParent.MyTab.Offset;
int xIncrement = xOffTabNew - MyItemInfo.MyTab.Offset;
MyStepRTB.Location = new Point(MyStepRTB.Location.X + xIncrement, MyStepRTB.Location.Y);
// Farley - part of bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset)
ContentWidth = _MyParentEditItem.ContentWidth;
int xOffTabNew = (MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.Offset : MyItemInfo.MyParent.OffsetTab) + MyItemInfo.MyTab.Offset;
xOffTabNew += MyItemInfo.MyParent.MyTab == null ? 0 : MyItemInfo.MyParent.MyTab.Offset;
int xIncrement = xOffTabNew - MyItemInfo.MyTab.Offset;
MyStepRTB.Location = new Point(MyStepRTB.Location.X + xIncrement, MyStepRTB.Location.Y);
}
else
ItemWidth = _MyParentEditItem.ContentWidth;
@ -3063,11 +3088,11 @@ namespace Volian.Controls.Library
// width for the screen (this does not affect the printout)
// If in single column, don't make this adjustment:
string[] splitRNOWidthAlt = MyStepSectionLayoutData.RNOWidthAlt.Split(',');
int ovrRNOWidth = (RNOLevel < splitRNOWidthAlt.Length)?MyStepPanel.ToDisplay(float.Parse(splitRNOWidthAlt[RNOLevel])+1) : 0;
int ovrRNOWidth = (RNOLevel < splitRNOWidthAlt.Length) ? MyStepPanel.ToDisplay(float.Parse(splitRNOWidthAlt[RNOLevel]) + 1) : 0;
if (MyStepSectionLayoutData.RNOWidthAlt != null && ovrRNOWidth > 1 && MyItemInfo.ColumnMode != 0)
ContentWidth = ovrRNOWidth;
else
ContentWidth = _MyParentEditItem.ContentWidth;
ContentWidth = _MyParentEditItem.ContentWidth;
_IgnoreResize = false;
if (RNOLevel <= MyItemInfo.ColumnMode)
{
@ -3127,23 +3152,23 @@ namespace Volian.Controls.Library
//}
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsCaution || MyItemInfo.IsNote))
{
// B2017-043 account for Horizontal Scroll
int x = MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
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
}
// B2017-043 account for Horizontal Scroll
int x = MyStepPanel.DisplayRectangle.X + MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
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
}
Location = new Point(x, y);
}
else
@ -3225,7 +3250,7 @@ namespace Volian.Controls.Library
else if (MyPreviousEditItem != null && MyPreviousEditItem.MyItemInfo.FormatStepData != null && MyPreviousEditItem.MyItemInfo.FormatStepData.ReadOnly)
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
// RHM The following lines were commented-out for Facing Pages (Supplemental Information) to test follow the instructions
//else if (MyItemInfo.MyTab.Offset != 0) // Farley - part of bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset)
//else if (MyItemInfo.MyTab.Offset != 0) // Farley - part of bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset)
// ContentWidth = (MyPreviousEditItem.MyItemInfo.MyTab.Offset != 0) ? MyPreviousEditItem.ContentWidth : MyPreviousEditItem.ContentWidth + 10;
else
Width = MyPreviousEditItem.Width;
@ -3310,7 +3335,7 @@ namespace Volian.Controls.Library
}
private EditItem AdjustForSupInfoHeight()
{
if (MyStepPanel._LookupEditItems.ContainsKey(MyID) && MyItemInfo.IsInSupInfo) // only do this if it is displayed (in LookupEditItems and in sup info column
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;
@ -3331,7 +3356,7 @@ namespace Volian.Controls.Library
EIWsupInfoBelow.Top = Math.Max(bottomOfAboveSupInfoColumn, bottomOfImmediatelyAbove);
EIWsupInfoBelow.AdjustLocation();
MyStepPanel.ItemMoving--;
return EIWsupInfoBelow.MySupInfoEditItems==null?null:EIWsupInfoBelow.MySupInfoEditItems[0];
return EIWsupInfoBelow.MySupInfoEditItems == null ? null : EIWsupInfoBelow.MySupInfoEditItems[0];
}
}
return null;
@ -3340,7 +3365,7 @@ namespace Volian.Controls.Library
{
ItemInfo hls = ei.MyItemInfo.MyHLS;
EditItem hlsEI = GetEditItemFromItemID(hls.ItemID);
if (hlsEI==null) return null;
if (hlsEI == null) return null;
return ei;
}
// FindSiblingOrParentSiblingWithSupInfo will find the next edititem below me on the screen that has a supinfo
@ -3353,7 +3378,7 @@ namespace Volian.Controls.Library
}
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.IsSection)
{
if (itm.NextItem.Steps == null || itm.NextItem.Steps.Count == 0) return null;
chldOfNext = FindFirstCautionOrNoteWithSupInfo(itm.NextItem);
@ -3373,7 +3398,7 @@ namespace Volian.Controls.Library
return GetEditItemFromItemID(itm.NextItem.ItemID);
}
// no longer looking at next, go to children.
chldOfNext = FindFirstChildWithSupInfo(itm.NextItem);
chldOfNext = FindFirstChildWithSupInfo(itm.NextItem);
if (chldOfNext != null) return CheckForExpanded(chldOfNext);
return FindSiblingOrParentSiblingWithSupInfo(itm.NextItem);
}
@ -3393,14 +3418,14 @@ namespace Volian.Controls.Library
}
}
// 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.ActiveParent as ItemInfo).SupInfos != null && (itm.ActiveParent as ItemInfo).SupInfos.Count > 0)
if ((itm.IsCaution || itm.IsNote) && itm.NextItem == null && (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)
if (ii.SupInfos != null && ii.SupInfos.Count > 0)
return GetEditItemFromItemID(ii.ItemID);
EditItem chld = FindFirstChildWithSupInfo(ii);
if (chld != null) return CheckForExpanded(chld);
@ -3467,7 +3492,7 @@ namespace Volian.Controls.Library
{
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) ei = ei.MyNextEditItem;// Get Next High Level Step
if (ei != null)
{
if (ei.MyItemInfo.IsHigh && (ei.MyItemInfo.Cautions != null || ei.MyItemInfo.Notes != null))
@ -3538,7 +3563,7 @@ namespace Volian.Controls.Library
vlntxt = null;
}
ContentFont = myStepPanel.StepFont;//lblTab.Font = myStepPanel.StepFont;
if (itemInfo.MyTab != null ) TabFont = itemInfo.MyTab.MyFont.WindowsFont;
if (itemInfo.MyTab != null) TabFont = itemInfo.MyTab.MyFont.WindowsFont;
MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[ContentType % 10000];
break;
}
@ -3612,7 +3637,7 @@ namespace Volian.Controls.Library
if (itemInfo.IsSupInfoPart)
{
EditItem high = MyStepPanel._LookupEditItems[itemInfo.MyHLS.ItemID];
ContentLocation = new Point(high.ContentLeft + high.Width + 36, (int)_MyParentEditItem.Top + SupInfoTopOffset);
ContentLocation = new Point(high.ContentLeft + high.Width + 36, (int)_MyParentEditItem.Top + SupInfoTopOffset);
}
//// TIMING: DisplayItem.TimeIt("CSLARTB SetText");
if (itemInfo != null)
@ -3710,7 +3735,7 @@ namespace Volian.Controls.Library
//g.DrawLine(Pens.DarkGreen, 18, 3, 21, 3);
//g.DrawLine(Pens.DarkGreen, 18, 6, 21, 6);
//g.DrawString("B", fnt, Brushes.Green, new RectangleF(new PointF(0,0), this.Size), StringFormat.GenericDefault);
g.DrawString(dved.PdfToken, fnt, Brushes.Green, new RectangleF(new PointF(x,y), this.Size), StringFormat.GenericDefault);
g.DrawString(dved.PdfToken, fnt, Brushes.Green, new RectangleF(new PointF(x, y), this.Size), StringFormat.GenericDefault);
if (y > 0)
{
x += 18;
@ -3757,7 +3782,7 @@ namespace Volian.Controls.Library
if (this is GridItem)
{
GridItem gi = this as GridItem;
X = gi.MyFlexGrid.Right+2;
X = gi.MyFlexGrid.Right + 2;
H = gi.MyFlexGrid.Height;
}
else if (this is RtfRawItem)
@ -3778,7 +3803,7 @@ namespace Volian.Controls.Library
X = ri.MyStepRTB.Right + 2;
H = ri.MyStepRTB.Height;
}
g.DrawLine(penCB, X, ContentTop, X, ContentTop+H); //Height);
g.DrawLine(penCB, X, ContentTop, X, ContentTop + H); //Height);
}
}
if (UserCheckOff)
@ -3807,7 +3832,7 @@ namespace Volian.Controls.Library
else
location = new PointF(ii.MyPictureBox.Left + ii.MyPictureBox.Width + 2, ii.MyPictureBox.Top);
}
else
else
{
RTBItem ri = this as RTBItem;
// SkipSpaces puts the checkoff macro (if specified in the format) next to the step tab
@ -3823,7 +3848,7 @@ namespace Volian.Controls.Library
// 'UserCheckOff' or 'UserCheckOffChar' properties to reflect that.
if (co != null && co.UIMark != null)
{
UserCheckOffChar = (char)co.UIMark;
UserCheckOffChar = (char)co.UIMark;
Font myFont = new Font("VolianDraw", MyItemInfo.MyTab.MyFont.WindowsFont.Size);
g.DrawString(UserCheckOffChar.ToString(), myFont, Brushes.DarkGreen, new RectangleF(location, MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault);
}