Use VerticalScroll.Value to determine absolute location of RTBItem on the Step Panel.

Deviation Document 3 Column Format (Dev_Format) support.
	Auto-expand HLS for Deviation Document format.
	B2012-265
This commit is contained in:
Rich 2012-10-25 00:41:39 +00:00
parent 762f1a9916
commit f685efbf5c

View File

@ -20,11 +20,11 @@ namespace Volian.Controls.Library
Showing = 8, Showing = 8,
Done = 16 Done = 16
} }
#endregion #endregion
public partial class RTBItem : EditItem public partial class RTBItem : EditItem
{ {
#region Private Fields #region Private Fields
public Label MyLabel public Label MyLabel
{ get { return lblTab; } } { get { return lblTab; } }
/// <summary> /// <summary>
@ -35,7 +35,7 @@ namespace Volian.Controls.Library
get { return _MyStepRTB; } get { return _MyStepRTB; }
} }
public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } } public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } }
/// <summary> /// <summary>
/// The left edge of the Tab /// The left edge of the Tab
/// </summary> /// </summary>
@ -75,7 +75,7 @@ namespace Volian.Controls.Library
Width = value + lblTab.Left + lblTab.Width + (this.Right - MyStepRTB.Right); Width = value + lblTab.Left + lblTab.Width + (this.Right - MyStepRTB.Right);
} }
} }
public override int BorderWidth { get {return (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width);} } public override int BorderWidth { get { return (_MyStepRTB.Width - _MyStepRTB.ClientRectangle.Width); } }
/// <summary> /// <summary>
/// Location of the RichTextBox /// Location of the RichTextBox
/// </summary> /// </summary>
@ -107,7 +107,7 @@ namespace Volian.Controls.Library
_MyvlnExpander.Expanded = value; _MyvlnExpander.Expanded = value;
} }
} }
#endregion #endregion
#region IEditItem #region IEditItem
override public void AdjustTableWidthAndLocation() override public void AdjustTableWidthAndLocation()
@ -117,7 +117,7 @@ namespace Volian.Controls.Library
ItemLocation = new Point(50, _MyParentEditItem.Bottom); ItemLocation = new Point(50, _MyParentEditItem.Bottom);
ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth); ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
} }
override public void SetToolTip(string tip) override public void SetToolTip(string tip)
{ {
DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon); DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon);
@ -138,7 +138,7 @@ namespace Volian.Controls.Library
/// <summary> /// <summary>
/// Tab Format used for outputing the Tab /// Tab Format used for outputing the Tab
/// </summary> /// </summary>
public override string TabFormat public override string TabFormat
{ {
get get
@ -151,7 +151,7 @@ namespace Volian.Controls.Library
if (MyItemInfo != null) if (MyItemInfo != null)
{ {
ItemInfo.ResetTabString(MyID); ItemInfo.ResetTabString(MyID);
string tabString = MyItemInfo.IsSection?MyItemInfo.DisplayNumber.PadRight(MyItemInfo.MyTab.CleanText.Length):MyItemInfo.MyTab.CleanText; string tabString = MyItemInfo.IsSection ? MyItemInfo.DisplayNumber.PadRight(MyItemInfo.MyTab.CleanText.Length) : MyItemInfo.MyTab.CleanText;
//string tabString = /*MyItemInfo.IsSection ? MyItemInfo.DisplayNumber : */ MyItemInfo.MyTab.CleanText; //string tabString = /*MyItemInfo.IsSection ? MyItemInfo.DisplayNumber : */ MyItemInfo.MyTab.CleanText;
lblTab.Text = tabString; lblTab.Text = tabString;
@ -162,7 +162,7 @@ namespace Volian.Controls.Library
// that the number can be two digits, for example... 8.1.9 goes to 8.1.10. We want // that the number can be two digits, for example... 8.1.9 goes to 8.1.10. We want
// the step windows to line up, so the 8.1.9 has one character more space (lastDigitSingle) // the step windows to line up, so the 8.1.9 has one character more space (lastDigitSingle)
bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$"); bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$");
lblTab.Width = ((lastDigitSingle?1:0) + tabString.Length) * MyStepPanel.DPI/cpi; lblTab.Width = ((lastDigitSingle ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi;
Invalidate(); Invalidate();
_MyStepRTB.Left = lblTab.Left + lblTab.Width; _MyStepRTB.Left = lblTab.Left + lblTab.Width;
_MyStepRTB.Width = Width - _MyStepRTB.Left - RTBMargin - CheckOffMargin; _MyStepRTB.Width = Width - _MyStepRTB.Left - RTBMargin - CheckOffMargin;
@ -170,7 +170,7 @@ namespace Volian.Controls.Library
} }
} }
} }
#endregion #endregion
#region Properties #region Properties
private int _RTBMargin = 3; private int _RTBMargin = 3;
@ -190,11 +190,11 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
public int CheckOffMargin public int CheckOffMargin
{ {
get get
{ {
if (_CheckOffMargin == null) if (_CheckOffMargin == null)
{ {
if (MyItemInfo==null) _CheckOffMargin = 0; if (MyItemInfo == null) _CheckOffMargin = 0;
else else
{ {
if (!MyItemInfo.IsStep || !MyItemInfo.SectionHasCheckOffs()) _CheckOffMargin = 0; if (!MyItemInfo.IsStep || !MyItemInfo.SectionHasCheckOffs()) _CheckOffMargin = 0;
@ -351,7 +351,7 @@ namespace Volian.Controls.Library
LastMethodsPop(); LastMethodsPop();
} }
void _MyStepRTB_Resize(object sender, EventArgs e) void _MyStepRTB_Resize(object sender, EventArgs e)
{ {
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
MyStepPanel.ScrollControlIntoView(this); MyStepPanel.ScrollControlIntoView(this);
} }
@ -359,7 +359,7 @@ namespace Volian.Controls.Library
private Label lblFooter = null; private Label lblFooter = null;
private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag) private void SetupHeaderFooter(ref Label lbl, string name, MetaTag mTag)
{ {
if (lbl==null)lbl = new Label(); if (lbl == null) lbl = new Label();
lbl.BackColor = System.Drawing.Color.Transparent; lbl.BackColor = System.Drawing.Color.Transparent;
lbl.Location = new System.Drawing.Point(0, 0); lbl.Location = new System.Drawing.Point(0, 0);
lbl.Name = name; lbl.Name = name;
@ -418,17 +418,19 @@ namespace Volian.Controls.Library
Cursor tmp = Cursor.Current; Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
int top = TopMostEditItem.Top;// This doesn't work - this is since the last time it was expanded. int top = TopMostEditItem.Top;// This doesn't work - this is since the last time it was expanded.
int topOffset = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
Colapsing = true; Colapsing = true;
// Hide Children // Hide Children
HideChildren(); HideChildren();
// Adjust Positions // Adjust Positions
ExpandPrefix = Top - top; int topOffsetAfter = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
ExpandSuffix = BottomMostEditItem.Bottom - Bottom; ExpandPrefix = topOffset - topOffsetAfter;
if (Top != top) //ExpandSuffix = BottomMostEditItem.Bottom - Bottom;
if (topOffsetAfter != topOffset)
{ {
LastMethodsPush(string.Format("Colapse {0}", MyID)); LastMethodsPush(string.Format("Colapse {0}", MyID));
MyStepPanel.ItemMoving++; MyStepPanel.ItemMoving++;
Top = top; Top += (topOffset - topOffsetAfter);
MyStepPanel.ItemMoving--; MyStepPanel.ItemMoving--;
LastMethodsPop(); LastMethodsPop();
} }
@ -448,10 +450,10 @@ namespace Volian.Controls.Library
Cursor tmp = Cursor.Current; Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
if (!_Loading && MyExpandingStatus == ExpandingStatus.No) if (!_Loading && MyExpandingStatus == ExpandingStatus.No)
Expand(ContentType >= 20000); Expand((ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format);
Cursor.Current = tmp; Cursor.Current = tmp;
} }
/// <summary> /// <summary>
/// Raises an ItemClick event when the user clicks on the Tab /// Raises an ItemClick event when the user clicks on the Tab
/// </summary> /// </summary>
@ -689,7 +691,7 @@ namespace Volian.Controls.Library
public override void MatchExpanded() public override void MatchExpanded()
{ {
if (!_MyvlnExpander.Expanded) if (!_MyvlnExpander.Expanded)
_MyvlnExpander.ShowExpanded(); _MyvlnExpander.ShowExpanded();
} }
/// <summary> /// <summary>
/// Sets the focus to this RTBItem and positions the cursor to the begining of the string /// Sets the focus to this RTBItem and positions the cursor to the begining of the string
@ -733,7 +735,7 @@ namespace Volian.Controls.Library
{ {
return; return;
} }
public override string SelectedTextForFind public override string SelectedTextForFind
{ {
get get
{ {
@ -758,14 +760,14 @@ namespace Volian.Controls.Library
} }
public override bool Empty public override bool Empty
{ {
get get
{ {
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf); // Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// string txt = MyStepRTB.Text; // string txt = MyStepRTB.Text;
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf); // Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// return txt == ""; // return txt == "";
//return MyStepRTB.IsEmpty; //return MyStepRTB.IsEmpty;
return MyStepRTB.Text == ""; return MyStepRTB.Text == "";
} }
set { MyStepRTB.Text = value ? "" : " "; } set { MyStepRTB.Text = value ? "" : " "; }
} }
@ -843,7 +845,7 @@ namespace Volian.Controls.Library
//OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0); //OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0);
break; break;
case 2: // High level steps with children can expand case 2: // High level steps with children can expand
CanExpand = itemInfo.IsHigh && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ; CanExpand = itemInfo.IsHigh && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format && itemInfo.HasChildren; // TemporaryFormat.IsHigh(item); ;
break; break;
default://Procedures cannot expand, because they automatically expand default://Procedures cannot expand, because they automatically expand
CanExpand = false; CanExpand = false;