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

@ -75,7 +75,7 @@ namespace Volian.Controls.Library
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>
/// Location of the RichTextBox
/// </summary>
@ -151,7 +151,7 @@ namespace Volian.Controls.Library
if (MyItemInfo != null)
{
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;
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
// 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] *$");
lblTab.Width = ((lastDigitSingle?1:0) + tabString.Length) * MyStepPanel.DPI/cpi;
lblTab.Width = ((lastDigitSingle ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi;
Invalidate();
_MyStepRTB.Left = lblTab.Left + lblTab.Width;
_MyStepRTB.Width = Width - _MyStepRTB.Left - RTBMargin - CheckOffMargin;
@ -194,7 +194,7 @@ namespace Volian.Controls.Library
{
if (_CheckOffMargin == null)
{
if (MyItemInfo==null) _CheckOffMargin = 0;
if (MyItemInfo == null) _CheckOffMargin = 0;
else
{
if (!MyItemInfo.IsStep || !MyItemInfo.SectionHasCheckOffs()) _CheckOffMargin = 0;
@ -351,7 +351,7 @@ namespace Volian.Controls.Library
LastMethodsPop();
}
void _MyStepRTB_Resize(object sender, EventArgs e)
{
{
if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem)
MyStepPanel.ScrollControlIntoView(this);
}
@ -359,7 +359,7 @@ namespace Volian.Controls.Library
private Label lblFooter = null;
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.Location = new System.Drawing.Point(0, 0);
lbl.Name = name;
@ -418,17 +418,19 @@ namespace Volian.Controls.Library
Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
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;
// Hide Children
HideChildren();
// Adjust Positions
ExpandPrefix = Top - top;
ExpandSuffix = BottomMostEditItem.Bottom - Bottom;
if (Top != top)
int topOffsetAfter = TopMostEditItem.Top + MyStepPanel.VerticalScroll.Value;
ExpandPrefix = topOffset - topOffsetAfter;
//ExpandSuffix = BottomMostEditItem.Bottom - Bottom;
if (topOffsetAfter != topOffset)
{
LastMethodsPush(string.Format("Colapse {0}", MyID));
MyStepPanel.ItemMoving++;
Top = top;
Top += (topOffset - topOffsetAfter);
MyStepPanel.ItemMoving--;
LastMethodsPop();
}
@ -448,7 +450,7 @@ namespace Volian.Controls.Library
Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
if (!_Loading && MyExpandingStatus == ExpandingStatus.No)
Expand(ContentType >= 20000);
Expand((ContentType >= 20000) || MyItemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format);
Cursor.Current = tmp;
}
@ -760,10 +762,10 @@ namespace Volian.Controls.Library
{
get
{
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// string txt = MyStepRTB.Text;
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// return txt == "";
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// string txt = MyStepRTB.Text;
// Console.WriteLine("step rtb is dirty {0} and rtf is {1}", MyStepRTB.IsDirty, MyStepRTB.Rtf);
// return txt == "";
//return MyStepRTB.IsEmpty;
return MyStepRTB.Text == "";
}
@ -843,7 +845,7 @@ namespace Volian.Controls.Library
//OLD: _MyvlnExpander.Attachment = (itemInfo.MyContent.ContentPartCount == 0);
break;
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;
default://Procedures cannot expand, because they automatically expand
CanExpand = false;