diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index ee83dd14..067e3cc3 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -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; /// /// 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,7 +1326,8 @@ namespace Volian.Controls.Library MyStepPanel.ItemMoving++; rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Right {0}", rnoTop.MyID)); //rnoTop.Top = tmpBottom.Bottom; - rnoTop.Top = Top; + if(rnoTop.Top != Top) + rnoTop.Top = Top; rnoTop.LastMethodsPop(); MyStepPanel.ItemMoving--; } @@ -1340,7 +1335,8 @@ namespace Volian.Controls.Library { MyStepPanel.ItemMoving++; rnoTop.LastMethodsPush(string.Format("EditItem_Move RNO Below {0} {1} {2}", rnoTop.MyID, BottomMostEditItemNoRNOs.MyID, BottomMostEditItemNoRNOs.Bottom)); - rnoTop.Top = 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; /// /// Handles movement of the EditItems /// @@ -1360,6 +1357,9 @@ namespace Volian.Controls.Library /// 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) //{ @@ -1648,12 +1648,11 @@ namespace Volian.Controls.Library return null; } } - /// - /// Adjust the Location of all items below the current item. - /// + /// + /// Adjust the Location of all items below the current item. + /// 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++; @@ -1678,31 +1682,13 @@ namespace Volian.Controls.Library 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); - } + _MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'", + oldTop, nextEditItem.Top, bottom, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath); + nextEditItem.TryAgainLater = true; } 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); } /// /// 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(" 1) ContentWidth = ovrRNOWidth; else - ContentWidth =_MyParentEditItem.ContentWidth; + ContentWidth = _MyParentEditItem.ContentWidth; _IgnoreResize = false; if (RNOLevel <= MyItemInfo.ColumnMode) { @@ -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,12 +2118,23 @@ 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; - Location = new Point(_MyParentEditItem.Left + 20, FindTop(myTop)); + 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; // Could be a Caution or Note - Need to get WidT @@ -2160,10 +2170,29 @@ namespace Volian.Controls.Library else { Width = MyPreviousEditItem.Width; - if (TopMostEditItem == this) - Location = new Point(_MyPreviousEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom)); - else - TopMostEditItem.Location = new Point(TopMostEditItem.Left, FindTop(_MyPreviousEditItem.BottomMostEditItem.Bottom)); + if (TopMostEditItem == this) + { + 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)); } _IgnoreResize = false; //ShowMe(""); @@ -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");