diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs
index 2a508d90..861b12e6 100644
--- a/PROMS/Volian.Controls.Library/StepItem.cs
+++ b/PROMS/Volian.Controls.Library/StepItem.cs
@@ -73,7 +73,7 @@ namespace Volian.Controls.Library
private StepData _MyStepData;
private ItemInfo _MyItemInfo;
private static int _WidthAdjust = 3;
- private string _TabFormat;
+
private int _ExpandPrefix = 0;
private int _ExpandSuffix = 0;
private ExpandingStatus _MyExpandingStatus = ExpandingStatus.No;
@@ -120,13 +120,6 @@ namespace Volian.Controls.Library
int stepType = typ % 10000;
_MyStepData = value.ActiveFormat.PlantFormat.FormatData.StepDataList[stepType];
}
-#if(DEBUG)
- // TODO: This formatting should come from the format file
- if (value.MyContent.Type == 20002)
- Circle = true;
- if (_TabFormat == "o ")
- CheckOff = true;
-#endif
ChangeBar = _MyItemInfo.HasChangeBar();
value.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
}
@@ -210,7 +203,9 @@ namespace Volian.Controls.Library
}
break;
case ChildRelation.RNO:
- TabFormat = "";
+ // this is set so that TextWidth command below will be correct. TextWidth uses
+ // the tab start & tab width to calculate the overall width.
+ TabFormat = ""; // this is set so that TextWidth command below will be correct
_IgnoreResize = true;
TextWidth = _MyParentStepItem.TextWidth;
_IgnoreResize = false;
@@ -257,7 +252,9 @@ namespace Volian.Controls.Library
Width = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidT);
_IgnoreResize = false;
_MyStepPanel.ItemMoving++;
- Location = new Point(_MyParentStepItem.Left + 20, FindTop(_MyParentStepItem.Top));
+ //Location = new Point(_MyParentStepItem.Left + 20, FindTop(_MyParentStepItem.Top));
+ int myTop = MyNextStepItem == null ? _MyParentStepItem.Top : MyNextStepItem.Top;
+ Location = new Point(_MyParentStepItem.Left + 20, FindTop(myTop));
_MyStepPanel.ItemMoving--;
//_MyParentStepItem.Top = Bottom;
// Could be a Caution or Note - Need to get WidT
@@ -409,49 +406,27 @@ namespace Volian.Controls.Library
///
/// Tab Format used for outputing the Tab
///
+ private string _TabFormat;
public string TabFormat
{
- get { return _TabFormat; }
+ get
+ {
+ if (_TabFormat == null) TabFormat = null; // execute 'set' code.
+ return _TabFormat;
+ }
set
{
- _TabFormat = value;
- if (_MyItemInfo != null)
- {
- string tabString = _TabFormat;
- switch (_Type / 10000)
- {
- case 0: // Procedure
- //// TIMING: DisplayItem.TimeIt("TabFormat Start");
- tabString = _MyItemInfo.MyContent.Number.PadRight(20);
- //// TIMING: DisplayItem.TimeIt("TabFormat End");
- break;
- case 1: // Section
- //// TIMING: DisplayItem.TimeIt("TabFormat Start");
- tabString = _MyItemInfo.MyContent.Number.PadRight(20);
- //// TIMING: DisplayItem.TimeIt("TabFormat End");
- break;
- case 2: // Step
- //// TIMING: DisplayItem.TimeIt("TabFormat Start");
- //int ordinal = _MyItem.Ordinal;
- int ordinal = Ordinal;
- //// TIMING: DisplayItem.TimeIt("TabFormat End");
- string alpha = AlphabeticalNumbering.Convert(ordinal);
- tabString = tabString.Replace("", alpha.ToLower());
- tabString = tabString.Replace("", alpha);
- string roman = RomanNumeral.Convert(ordinal);
- tabString = tabString.Replace("", roman.ToLower());
- tabString = tabString.Replace("", roman);
- tabString = tabString.Replace("", ordinal.ToString().PadLeft(2));
- tabString = tabString.Replace("", MyID.ToString());
- break;
- }
+ if (_MyItemInfo != null)
+ {
+ ItemInfo.ResetTabString(MyID);
+ string tabString = _MyItemInfo.MyTab.CleanText;
lblTab.Text = tabString;
lblTab.Width = tabString.Length * 8;
Invalidate();
_MyStepRTB.Left = lblTab.Left + lblTab.Width;// +2;
_MyStepRTB.Width = Width - _MyStepRTB.Left;
- // TODO: Performance - SetToolTip();
- }
+ _TabFormat = value; // tabString;
+ }
}
}
///
@@ -741,14 +716,16 @@ namespace Volian.Controls.Library
}
private void SetupStepItem(ItemInfo itemInfo, StepPanel myStepPanel, StepItem myParentStepItem, ChildRelation myChildRelation, bool expand, StepItem nextStepItem)
{
+ if (itemInfo.ItemID==225)_MyStepRTB.Resize += new EventHandler(_MyStepRTB_Resize);
_MyStepRTB.MyStepItem = this;
//// TIMING: DisplayItem.TimeIt("CSLARTB InitComp");
BackColor = myStepPanel.PanelColor;
_MyStepRTB.BackColor = myStepPanel.InactiveColor;
// TODO: Adjust top based upon format
// TODO: Remove Label and just output ident on the paint event
- lblTab.Top = 3;
- _MyStepRTB.Top = 3;
+ lblTab.Left = 20;
+ SetupHeader(itemInfo);
+
this.Paint += new PaintEventHandler(StepItem_Paint);
this.BackColorChanged += new EventHandler(StepItem_BackColorChanged);
if (itemInfo != null)
@@ -757,13 +734,16 @@ namespace Volian.Controls.Library
switch (_Type / 10000)
{
case 0: // Procedure
- _MyStepRTB.Font = lblTab.Font = myStepPanel.ProcFont;
+ _MyStepRTB.Font = myStepPanel.ProcFont;// lblTab.Font = myStepPanel.ProcFont;
+ lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
break;
case 1: // Section
- _MyStepRTB.Font = lblTab.Font = myStepPanel.SectFont;
+ _MyStepRTB.Font = myStepPanel.SectFont;// lblTab.Font = myStepPanel.SectFont;
+ lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
break;
case 2: // Steps
- _MyStepRTB.Font = lblTab.Font = myStepPanel.StepFont;
+ _MyStepRTB.Font = myStepPanel.StepFont;//lblTab.Font = myStepPanel.StepFont;
+ lblTab.Font = itemInfo.MyTab.MyFont.WindowsFont;
_MyStepData = itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[_Type % 10000];
break;
}
@@ -790,6 +770,7 @@ namespace Volian.Controls.Library
}
//// TIMING: DisplayItem.TimeIt("CSLARTB MyItem");
myStepPanel.Controls.Add(this);
+
switch (myChildRelation)
{
case ChildRelation.After:
@@ -860,6 +841,48 @@ namespace Volian.Controls.Library
_Loading = false;
//// TIMING: DisplayItem.TimeIt("CSLARTB Controls Add");
}
+
+ private void SetupHeader(ItemInfo itemInfo)
+ {
+ lblTab.Top = 3 + ((itemInfo.HasHeader) ? 23 : 0);
+ _MyStepRTB.Top = lblTab.Top; // 3 + ((itemInfo.HasHeader) ? 23 : 0);
+ //lblTab.Move += new EventHandler(lblTab_Move);
+ if (itemInfo.HasHeader)
+ SetupHeaderFooter(ref lblHeader, "Header", itemInfo.MyHeader);
+ else
+ {
+ // remove header from screen if it exists:
+ this.Controls.Remove(lblHeader);
+ lblHeader = null;
+ }
+ }
+ private void SetupHeader()
+ {
+ SetupHeader(MyItemInfo);
+ LastMethodsPush("SetupHeader");
+ Height = _MyStepRTB.Height + _MyStepRTB.Top + 7;
+ LastMethodsPop();
+ }
+ void _MyStepRTB_Resize(object sender, EventArgs e)
+ {
+ Console.WriteLine("Left {0} Width {1}", Left, Width);
+ }
+
+ private Label lblHeader = null;
+ private Label lblFooter = null;
+ private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag)
+ {
+ if (lbl==null)lbl = new Label();
+ lbl.BackColor = System.Drawing.Color.Transparent;
+ lbl.Location = new System.Drawing.Point(0, 0);
+ lbl.Name = name;
+ lbl.Size = new System.Drawing.Size(this.Width, 23);
+ lbl.Visible = true;
+ lbl.Font = mTag.MyFont.WindowsFont;
+ lbl.Text = mTag.CleanText;
+ lbl.TextAlign = mTag.Justify;
+ this.Controls.Add(lbl);
+ }
#endregion
#region AddItem
///
@@ -898,14 +921,23 @@ namespace Volian.Controls.Library
MyStepPanel.ItemMoving--;
}
}
- SetAllTabs();
+ if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
+ {
+ StepItem prev = this;
+ while (prev.MyPreviousStepItem != null) prev = prev.MyPreviousStepItem;
+ prev.SetAllTabs();
+ }
+ else
+ SetAllTabs();
}
-
+ // clear tabs, clears then all so that next 'get' will calculate new.
private void SetAllTabs()
{
- TabFormat = TemporaryFormat.TabFormat(this);
- //Console.WriteLine("TabFormat {0},{1},{2},{3}", MyID, MyPath, lblTab.Text,MyItemInfo.Ordinal);
+ TabFormat = null; // reset TabFormat
+ SetupHeader();
+ if (_MyAfterStepItems != null) foreach (StepItem chld in _MyAfterStepItems) chld.SetAllTabs();
if (_MyNextStepItem != null) _MyNextStepItem.SetAllTabs();
+
}
///
/// Add the next item to a list
@@ -988,6 +1020,7 @@ namespace Volian.Controls.Library
newFocus.TopMostStepItem.Top = TopMostYBefore;
newFocus.AdjustLocation();
newFocus.ShowTops("");
+ return;
}
private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex)
@@ -1261,12 +1294,12 @@ namespace Volian.Controls.Library
///
private void _StepRTB_HeightChanged(object sender, EventArgs args)
{
- if (this.Height != _MyStepRTB.Height + 10)
+ if (this.Height != _MyStepRTB.Height+_MyStepRTB.Top+7) // add in 7 to make it look good // + 10)
{
//if (MyID == 2131 || MyID == 2132)
// Console.WriteLine("oops!");
LastMethodsPush(string.Format("_StepRTB_HeightChanged {0}", _MyStepRTB.Height));
- this.Height = _MyStepRTB.Height + 10;
+ this.Height = _MyStepRTB.Height + _MyStepRTB.Top + 7;
LastMethodsPop();
}
}
@@ -1340,6 +1373,7 @@ namespace Volian.Controls.Library
// _lookForID = MyID;
if (_IgnoreResize) return;
AdjustLocation();
+ if (lblHeader != null) lblHeader.Width = this.Width;
}
private string WatchThisIndent
{
@@ -1620,7 +1654,14 @@ namespace Volian.Controls.Library
{
Graphics g = e.Graphics;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
- g.DrawString(lblTab.Text, _MyStepRTB.Font, Brushes.Black, new RectangleF(new PointF(_MyStepPanel.MyStepPanelSettings.NumberLocationX, _MyStepPanel.MyStepPanelSettings.NumberLocationY), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault);
+ //g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Red, new RectangleF(new PointF(_MyStepPanel.MyStepPanelSettings.NumberLocationX, _MyStepPanel.MyStepPanelSettings.NumberLocationY), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault);
+ // adjust x location of label by 7, to position correctly.
+ //g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Blue, new RectangleF(new PointF(Convert.ToSingle(lblTab.Location.X-7), Convert.ToSingle(lblTab.Location.Y)), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault);
+ //g.DrawLine(Pens.DarkGreen, lblTab.Location.X-7, 0, lblTab.Location.X-7, this.Height);
+ //g.DrawLine(Pens.DarkGreen, MyStepRTB.Location.X - 7, 0, MyStepRTB.Location.X - 7, this.Height);
+ g.DrawString(lblTab.Text, MyItemInfo.MyTab.MyFont.WindowsFont, Brushes.Black, new RectangleF(new PointF(Convert.ToSingle(lblTab.Location.X), Convert.ToSingle(lblTab.Location.Y)), _MyStepPanel.MyStepPanelSettings.NumberSize), StringFormat.GenericDefault);
+ //g.DrawLine(Pens.DarkGreen, lblTab.Location.X, 0, lblTab.Location.X, this.Height);
+ //g.DrawLine(Pens.DarkGreen, MyStepRTB.Location.X, 0, MyStepRTB.Location.X, this.Height);
if (Circle)
{
Pen penC = new Pen(_MyStepPanel.MyStepPanelSettings.CircleColor, _MyStepPanel.MyStepPanelSettings.CircleWeight);
@@ -1634,7 +1675,7 @@ namespace Volian.Controls.Library
if (ChangeBar)
{
Pen penCB = new Pen(_MyStepPanel.MyStepPanelSettings.ChangeBarColor, _MyStepPanel.MyStepPanelSettings.ChangeBarWeight);
- g.DrawLine(penCB, 0, 0, 0, Height);
+ g.DrawLine(penCB, 0, _MyStepRTB.Top, 0, Height);
}
}
///