Deviation Document 3 Column Format (Dev_Format) support.

Auto-expand HLS for Deviation Document format.
	Corrected width of notes and cautions.
	B2012-265
Reduced updates to the location of an item that do not move the item.
This commit is contained in:
Rich 2012-10-25 00:40:46 +00:00
parent f63b9d3ace
commit 762f1a9916

View File

@ -118,12 +118,6 @@ namespace Volian.Controls.Library
get { return _ExpandPrefix; }
set { _ExpandPrefix = value; }
}
private int _ExpandSuffix = 0;
public int ExpandSuffix
{
get { return _ExpandSuffix; }
set { _ExpandSuffix = value; }
}
private bool _Colapsing = false;
/// <summary>
/// Gets or sets colapsing
@ -1033,7 +1027,7 @@ namespace Volian.Controls.Library
}
public void AddChild(string text, E_FromType fromType, int type, VlnFlexGrid vfGrid)
{
if (_MyItemInfo.IsHigh || _MyItemInfo.IsSection)
if ((_MyItemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) || _MyItemInfo.IsSection)
CanExpand = true;
this.Expanded = true;
_WatchThis = 1;
@ -1332,6 +1326,7 @@ namespace Volian.Controls.Library
MyStepPanel.ItemMoving++;
rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Right {0}", rnoTop.MyID));
//rnoTop.Top = tmpBottom.Bottom;
if(rnoTop.Top != Top)
rnoTop.Top = Top;
rnoTop.LastMethodsPop();
MyStepPanel.ItemMoving--;
@ -1340,6 +1335,7 @@ namespace Volian.Controls.Library
{
MyStepPanel.ItemMoving++;
rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Below {0} {1} {2}", rnoTop.MyID, BottomMostEditItemNoRNOs.MyID, BottomMostEditItemNoRNOs.Bottom));
if(rnoTop.Top != BottomMostEditItemNoRNOs.Bottom)
rnoTop.Top = BottomMostEditItemNoRNOs.Bottom;
rnoTop.LastMethodsPop();
MyStepPanel.ItemMoving--;
@ -1353,6 +1349,7 @@ namespace Volian.Controls.Library
get { return _TryAgainLater; }
set { _TryAgainLater = value; }
}
int _LastTop = 0;
/// <summary>
/// Handles movement of the EditItems
/// </summary>
@ -1360,6 +1357,9 @@ namespace Volian.Controls.Library
/// <param name="e"></param>
private void EditItem_Move(object sender, EventArgs e)
{
int newTop = Top - MyStepPanel.TopMostEditItem.Top;
if (_LastTop == newTop) return;
_LastTop = newTop;
int watchThis = _WatchThis;
//if (MyID == 136)
//{
@ -1653,7 +1653,6 @@ namespace Volian.Controls.Library
/// </summary>
internal void AdjustLocation()
{
//Console.WriteLine("'AdjustLocation',{0},{1},'{2}'", MyID, MyItemInfo.DBSequence, Volian.Base.Library.vlnStackTrace.CalledFrom4);
if (RNORight) MoveRNO(); // This is needed when an AER is Deleted that has an RNO.
if (RNOLevel > 0 && AEREditItem != null)
AEREditItem.AdjustLocation();
@ -1664,7 +1663,12 @@ namespace Volian.Controls.Library
// _NextDownEditItemPath);
if (nextEditItem != null)
{
if (MyStepPanel.ExpandingHLS != null && nextEditItem.MyItemInfo.MyHLS.ItemID != MyStepPanel.ExpandingHLS.ItemID)
return;
int bottom = nextEditItem.FindTop(Bottom);
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
bottom = Top;
if (nextEditItem.Top != bottom)
{
MyStepPanel.ItemMoving++;
@ -1677,32 +1681,14 @@ namespace Volian.Controls.Library
// As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel.
nextEditItem.Top = bottom;
if (nextEditItem.Top != bottom)
{
nextEditItem.TryAgainNow(bottom);
if (nextEditItem.Top != bottom)
{
_MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'",
oldTop, nextEditItem.Top, bottom, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath);
nextEditItem.TryAgainLater = true;
MyStepPanel.Height += 12;
}
}
else if ((nextEditItem.Bottom + MyStepPanel.VerticalScroll.Value + 1) > MyStepPanel.VerticalScroll.Maximum)
{
if (nextEditItem.Visible)
{
_MyLog.InfoFormat("Refresh Edit Item '{0}',{1},{2},{3},{4}", nextEditItem.MyItemInfo.ShortPath,
nextEditItem.Bottom, MyStepPanel.Height, MyStepPanel.VerticalScroll.Maximum, MyStepPanel.VerticalScroll.Value);
MyStepPanel.AddToRefreshList(nextEditItem);
}
}
nextEditItem.LastMethodsPop();
MyStepPanel.ItemMoving--;
}
else
{
Console.WriteLine("{0}** No Adjustment next = {1}, moving = {2}", WatchThisIndent, nextEditItem, nextEditItem == null ? false : nextEditItem.Moving);
}
}
}
public void TryAgainNow(int bottom)
@ -1715,7 +1701,7 @@ namespace Volian.Controls.Library
{
Top = offset;
if (Top != offset)
_MyLog.InfoFormat("Didn't work - Top {0} != offset {1}", Top, offset);
_MyLog.InfoFormat("Didn't work - Top {0} != offset {1} {2}", Top, offset,MyStepPanel.VerticalScroll.Value);
}
/// <summary>
/// Automatically expands Steps if not currently expanded
@ -1725,7 +1711,7 @@ namespace Volian.Controls.Library
if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections
{
//vlnStackTrace.ShowStack(">AutoExpand ID {0} - Can {1} Expanded {2}", _MyItem.ItemID, CanExpand, Expanded);
Expand(_ContentType >= 20000);
Expand((_ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format);
//Console.WriteLine("<AutoExpand ID {0} - Can {1} Expanded {2}",_MyItem.ItemID, CanExpand, Expanded);
}
}
@ -1748,6 +1734,7 @@ namespace Volian.Controls.Library
if (ExpandPrefix != 0)
{
MyStepPanel.ItemMoving++;
if(TopMostEditItem.Top != Top)
TopMostEditItem.Top = Top;
MyStepPanel.ItemMoving--;
}
@ -1759,6 +1746,7 @@ namespace Volian.Controls.Library
}
else
{
if (MyItemInfo.IsHigh) MyStepPanel.ExpandingHLS = MyItemInfo;
MyExpandingStatus = ExpandingStatus.Expanding;
_ChildrenLoaded = true;
//_Panel.SuspendLayout();
@ -1782,6 +1770,7 @@ namespace Volian.Controls.Library
AddChildRNO(MyItemInfo.RNOs, expand);
AddChildAfter(MyItemInfo.Sections, expand);
MatchExpanded();
if (MyItemInfo.IsHigh) MyStepPanel.ExpandingHLS = null;
}
MyExpandingStatus = ExpandingStatus.Done;
BottomMostEditItem.AdjustLocation();
@ -1921,6 +1910,7 @@ namespace Volian.Controls.Library
//Console.WriteLine("{0}***Move in NextDownEditItem {1},{2} From {3} To {4}",WatchThisIndent, btmNext.MyID, btmNext, btmNext.Top, btm.Bottom);
btmNext.LastMethodsPush(string.Format("NextDownEditItem {0} {1}", MyID, EditItem.MyID));
//ShowMe(string.Format("FindTop = {0}", btmNext.FindTop(btm.Bottom)));
if(btmNext.Top != bottom)
btmNext.Top = bottom;
btmNext.LastMethodsPop();
MyStepPanel.ItemMoving--;
@ -2035,11 +2025,19 @@ namespace Volian.Controls.Library
{
case 0: // Procedure
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + 20, _MyParentEditItem.Bottom);
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
int widt = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
int wids = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
int width = Math.Max(widt, wids);
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + width;
break;
case 1: // Section
if (this == TopMostEditItem)
{
if(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
ItemLocation = new Point(MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColS)+50, _MyParentEditItem.Bottom);
else
ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + 20, _MyParentEditItem.Bottom);
}
else
TopMostEditItem.ItemLocation = new Point(TopMostEditItem.ItemLocation.X, _MyParentEditItem.Bottom);
//TextWidth = _WidthAdjust + borderWidth + MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, Convert.ToInt32(_MyStepSectionLayoutData.PMode) - 1);
@ -2093,6 +2091,7 @@ namespace Volian.Controls.Library
if (top != _MyParentEditItem.Top)
{
_MyParentEditItem.LastMethodsPush(string.Format("set_MyParentRTBItem RNO Right {0}", MyID));
if(_MyParentEditItem.Top != top)
_MyParentEditItem.Top = top;
_MyParentEditItem.LastMethodsPop();
Top = top;
@ -2119,11 +2118,22 @@ namespace Volian.Controls.Library
//Location = new Point(_MyParentRTBItem.Left + 20, max(_MyParentRTBItem.Top, (_MyNextRTBItem == null ? 0 : _MyNextRTBItem.Top )) ?? 0);
_IgnoreResize = true;
Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
int spaceToRTB = 23;
Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB;
_IgnoreResize = false;
MyStepPanel.ItemMoving++;
//Location = new Point(_MyParentRTBItem.Left + 20, FindTop(_MyParentRTBItem.Top));
int myTop = MyNextEditItem == null ? _MyParentEditItem.Top : MyNextEditItem.Top;
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsCaution || MyItemInfo.IsNote ))
{
int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
if (MyItemInfo.ItemID == 1 || MyItemInfo.ItemID == 52)
Console.WriteLine("here");
if(MyItemInfo.IsNote)
x += Width + 6;
Location = new Point(x, FindTop(myTop));
}
else
Location = new Point(_MyParentEditItem.Left + 20, FindTop(myTop));
MyStepPanel.ItemMoving--;
//_MyParentRTBItem.Top = Bottom;
@ -2161,7 +2171,26 @@ namespace Volian.Controls.Library
{
Width = MyPreviousEditItem.Width;
if (TopMostEditItem == this)
Location = new Point(_MyPreviousEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom));
{
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && (MyItemInfo.IsNote || MyItemInfo.IsCaution))
{
int x = MyStepPanel.ToDisplay(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColT);
if (MyItemInfo.IsNote)
x += Width + 6;
Location = new Point(x, _MyPreviousEditItem.Top);
}
else
{
int top = FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom);
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && _MyPreviousEditItem.MyItemInfo.IsHigh)
{
if (_MyPreviousEditItem.MyBeforeEditItems != null)
foreach(EditItem ei in _MyPreviousEditItem.MyBeforeEditItems)
top=Math.Max(top, ei.Bottom);
}
Location = new Point(_MyPreviousEditItem.Left, top);
}
}
else
TopMostEditItem.Location = new Point(TopMostEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom));
}
@ -2196,6 +2225,7 @@ namespace Volian.Controls.Library
}
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 (itemInfo.ItemID == 10366) Console.WriteLine("Here");
//if (itemInfo.ItemID == 225) _MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize);
//_MyStepRTB.MyRTBItem = this;
@ -2276,7 +2306,9 @@ namespace Volian.Controls.Library
if (ContentType == 0 && MyStepSectionLayoutData != null)
{
LastMethodsPush(string.Format("SetupRTBItem {0}", MyID));
Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
int widt = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT);
int wids = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
ItemWidth = Math.Max(widt, wids);
}
}
}
@ -2299,6 +2331,9 @@ namespace Volian.Controls.Library
//// TIMING: DisplayItem.TimeIt("CSLARTB before Controls Add");
//myStepPanel.Controls.Add(this);
int top = FindTop(0);
if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
top = myParentEditItem.TopMostEditItem.Top;
if (Top < top)
{
LastMethodsPush("SetupRTBItem");