Fixed code to correctly position Tables
Fixed code that inserts a table to point to existing substeps
This commit is contained in:
parent
a62793b1d5
commit
c9ab8919f0
@ -318,57 +318,17 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get { return _LastMethods.Count == 0; }
|
||||
}
|
||||
private void ShowMe(string method)
|
||||
{
|
||||
//if (MyID < _StartingID) return;
|
||||
//if (MyID == 2129)
|
||||
// Console.WriteLine("2129");
|
||||
if ((LastMethodsEmpty || _LookForID.Contains(MyID)) && _MyStepPanel != null) // jsj added check for null _MyStepPanel
|
||||
{
|
||||
Console.WriteLine("{0}{1}\t\"{2}\"\t{3}\t{4}\t{5}\t{6}\t\"{7}\"\t\"{8}\"\t\"{9}\""
|
||||
, "", MyID, method, Top, Bottom
|
||||
, FindTop(0), FindRight()
|
||||
, LastMethodsEmpty ? _MyStepPanel._LastAdjust : _LastMethods.Peek(), this
|
||||
, _NextDownStepItemPath);
|
||||
//vlnStackTrace.ShowStackLocal(string.Format("ShowMe {0}",MyID),3, 8);
|
||||
//vlnStackTrace.ShowStack();
|
||||
//vlnStackTrace.ScrollInStack();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// This should find the item that precedes the current item vertically
|
||||
/// and then return the Bottom of that item.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int FindTop()
|
||||
{
|
||||
//if (MyStepPanel._LookupStepItems.ContainsKey(2118))
|
||||
//{
|
||||
// StepItem MyPrevious = MyStepPanel._LookupStepItems[2118];
|
||||
// if (MyID >= 2120) return MyPrevious.Bottom;
|
||||
//}
|
||||
int? bottomRNO = BottomOfParentRNO();
|
||||
if (bottomRNO != null) return (int)bottomRNO;
|
||||
if(_MyNextStepItem == null)return _MyParentStepItem.Top;
|
||||
return min(MyParentStepItem.Top,_MyNextStepItem.Top);
|
||||
}
|
||||
private int FindTop(int bottom)
|
||||
{
|
||||
int lastBottomPrev = bottom; // This is necessary if the value of bottom can be negative.
|
||||
//int lastBottomPrev = 0;
|
||||
//int lastBottomParent = 0;
|
||||
if (_MyPreviousStepItem != null)
|
||||
lastBottomPrev = _MyPreviousStepItem.BottomMostStepItem.Bottom;
|
||||
//else if(_MyParentStepItem != null)
|
||||
// lastBottomParent = MyParentStepItem.BottomMostStepItem.Bottom;
|
||||
int? bottomRNO = BottomOfParentRNO();
|
||||
//if (MyID == 2123)
|
||||
// Console.WriteLine("Oops! {0},{1}", bottomRNO, bottom);
|
||||
//if (lastBottom != bottom)
|
||||
//if(MyID > _StartingID)
|
||||
// Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", MyID, lastBottomPrev,lastBottomParent, bottom, bottomRNO);
|
||||
//if (MyID == 2125)
|
||||
// Console.WriteLine("Oops!");
|
||||
int? bottomRNO = BottomOfParentRNO();
|
||||
if (lastBottomPrev > bottom) bottom = (int)(lastBottomPrev); // RHM 20090615 ES02 Step8
|
||||
// Moving from Step 8 to the Note preceeding step 8 caused the step 9 to be positioned in the wrong place.
|
||||
//if (lastBottomParent > bottom) bottom = lastBottomParent;
|
||||
@ -1322,10 +1282,12 @@ namespace Volian.Controls.Library
|
||||
ItemInfo newItemInfo = MyItemInfo.InsertChild(fromType, type, text);
|
||||
// TODO: We need to determine where this will go in the stack of children
|
||||
StepItem nextItem = null;
|
||||
if(newItemInfo.NextItem != null)
|
||||
if (newItemInfo.NextItem != null)
|
||||
nextItem = MyStepPanel.FindItem(newItemInfo.NextItem);
|
||||
else if (fromType == E_FromType.Table && MyAfterStepItems != null)
|
||||
nextItem = MyAfterStepItems[0];
|
||||
// Cautions come before notes, so if this is a Caution and there are Notes, put this first
|
||||
else if(fromType == E_FromType.Caution && ((ItemInfo)newItemInfo.ActiveParent).Notes != null
|
||||
else if (fromType == E_FromType.Caution && ((ItemInfo)newItemInfo.ActiveParent).Notes != null
|
||||
&& ((ItemInfo)newItemInfo.ActiveParent).Notes.Count > 0)
|
||||
nextItem = MyStepPanel.FindItem(((ItemInfo)newItemInfo.ActiveParent).Notes[0]);
|
||||
// TODO: May need similar logic if a Table is being added to a step that has substeps
|
||||
@ -1628,10 +1590,6 @@ namespace Volian.Controls.Library
|
||||
/// <param name="e"></param>
|
||||
private void StepItem_Resize(object sender, EventArgs e)
|
||||
{
|
||||
//ShowMe("Resize");
|
||||
if (MyStepRTB.Text.EndsWith("\n"))
|
||||
if (!_LookForID.Contains(MyID))
|
||||
_LookForID.Add(MyID);
|
||||
if (_MyItemInfo == null) return;
|
||||
if (_IgnoreResize) return;
|
||||
AdjustLocation();
|
||||
@ -1902,10 +1860,10 @@ namespace Volian.Controls.Library
|
||||
// Calulate the x location
|
||||
//int x = myParentStepItem.TextLeft;
|
||||
int x = center - width / 2;
|
||||
int y = FindTop(myParentStepItem.Bottom);
|
||||
if (x + width > rightLimit) x = rightLimit - width;
|
||||
int colT = _MyStepPanel.ToDisplay(myStepSectionLayoutData.ColT);
|
||||
if (x < colT) x = colT;
|
||||
int y = FindTop(myParentStepItem.Bottom);
|
||||
return new Point(x, y);
|
||||
}
|
||||
/// <summary>
|
||||
@ -2255,8 +2213,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public int? BottomOfParentRNO()
|
||||
{
|
||||
//if (MyID > 2124) return null;
|
||||
// Console.WriteLine("Ooops!!!");
|
||||
int? bottom = null;
|
||||
StepItem stepItem = this;
|
||||
if (!MyItemInfo.IsTablePart)
|
||||
@ -2271,15 +2227,13 @@ namespace Volian.Controls.Library
|
||||
if (stepItem == null || stepItem._MyChildRelation == ChildRelation.None)
|
||||
return null;
|
||||
StepItem parent = stepItem.UpOneStepItem;
|
||||
//if (parent != null) parent = parent.UpOneStepItem;
|
||||
//if (_WatchThis > 0)
|
||||
// Console.WriteLine("watch this");
|
||||
int right = FindRight();
|
||||
bool centeredTable = (MyItemInfo.IsTablePart && MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0);
|
||||
while (parent != null && parent.MyItemInfo.IsSection == false)
|
||||
{
|
||||
if (parent._MyRNOStepItems != null)
|
||||
{
|
||||
if (right > parent._MyRNOStepItems[0].Left)
|
||||
if (centeredTable || right > parent._MyRNOStepItems[0].Left)
|
||||
{
|
||||
if(parent._MyRNOStepItems[0].BottomMostStepItem.RNOLevel > RNOLevel && RNOLevel < _MyItemInfo.ColumnMode)
|
||||
bottom = max(bottom, parent._MyRNOStepItems[0].BottomMostStepItem.Bottom);
|
||||
@ -2289,8 +2243,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return bottom;
|
||||
}
|
||||
private static List<int> _LookForID = new List<int>();
|
||||
private static int _StartingID = 2114;
|
||||
private string _NextDownStepItemPath = "None";
|
||||
/// <summary>
|
||||
/// This finds the next StepItem down.
|
||||
@ -2299,8 +2251,6 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (_WatchThis > 0 && MyID == _LookForID)
|
||||
// Console.WriteLine("{0}NextDownStepID {1} {2}",WatchThisIndent, MyID, this);
|
||||
StepItem stepItem = this;
|
||||
_NextDownStepItemPath = "Path 1";
|
||||
// If this item appears before it's parent, and it doesn't have anything below it, return the parent
|
||||
|
Loading…
x
Reference in New Issue
Block a user