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,
Done = 16
}
#endregion
#endregion
public partial class RTBItem : EditItem
{
#region Private Fields
public Label MyLabel
{ get { return lblTab; } }
/// <summary>
@ -35,7 +35,7 @@ namespace Volian.Controls.Library
get { return _MyStepRTB; }
}
public override int TableWidth { get { return (int)GetTableWidth(_MyStepRTB.Font, MyItemInfo.MyContent.Text, true); } }
/// <summary>
/// The left edge of the Tab
/// </summary>
@ -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>
@ -107,7 +107,7 @@ namespace Volian.Controls.Library
_MyvlnExpander.Expanded = value;
}
}
#endregion
#region IEditItem
override public void AdjustTableWidthAndLocation()
@ -117,7 +117,7 @@ namespace Volian.Controls.Library
ItemLocation = new Point(50, _MyParentEditItem.Bottom);
ItemLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
}
override public void SetToolTip(string tip)
{
DevComponents.DotNetBar.SuperTooltipInfo tpi = new DevComponents.DotNetBar.SuperTooltipInfo("", "", tip, null, null, DevComponents.DotNetBar.eTooltipColor.Lemon);
@ -138,7 +138,7 @@ namespace Volian.Controls.Library
/// <summary>
/// Tab Format used for outputing the Tab
/// </summary>
public override string TabFormat
{
get
@ -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;
@ -170,7 +170,7 @@ namespace Volian.Controls.Library
}
}
}
#endregion
#region Properties
private int _RTBMargin = 3;
@ -190,11 +190,11 @@ namespace Volian.Controls.Library
/// </summary>
public int CheckOffMargin
{
get
get
{
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,10 +450,10 @@ 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;
}
/// <summary>
/// Raises an ItemClick event when the user clicks on the Tab
/// </summary>
@ -689,7 +691,7 @@ namespace Volian.Controls.Library
public override void MatchExpanded()
{
if (!_MyvlnExpander.Expanded)
_MyvlnExpander.ShowExpanded();
_MyvlnExpander.ShowExpanded();
}
/// <summary>
/// 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;
}
public override string SelectedTextForFind
public override string SelectedTextForFind
{
get
{
@ -758,14 +760,14 @@ namespace Volian.Controls.Library
}
public override bool Empty
{
get
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 == "";
return MyStepRTB.Text == "";
}
set { MyStepRTB.Text = value ? "" : " "; }
}
@ -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;