Fixed Invalid message for DSOPanel (MSWord)
Comment-out unused varaible Calculate Table Width and Location Fixed Arrow-Up and Arrow-Down to account for Tables Adjust Table location based upon the width of the Table
This commit is contained in:
@@ -97,6 +97,11 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private bool _Loading = true;
|
||||
private StepData _MyStepData;
|
||||
public StepData MyStepData
|
||||
{
|
||||
get { return _MyStepData; }
|
||||
set { _MyStepData = value; }
|
||||
}
|
||||
private ItemInfo _MyItemInfo;
|
||||
private static int _WidthAdjust = 3;
|
||||
|
||||
@@ -224,7 +229,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MyStepRTB.Font = _MyStepData.Font.WindowsFont;
|
||||
ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text, true);
|
||||
ItemLocation = new Point(50, _MyParentStepItem.Bottom);
|
||||
ItemLocation = new Point(50, _MyParentStepItem.Bottom);
|
||||
ItemLocation = TableLocation(_MyParentStepItem, _MyStepSectionLayoutData, ItemWidth);
|
||||
}
|
||||
else
|
||||
@@ -487,12 +492,21 @@ namespace Volian.Controls.Library
|
||||
if (_MyPreviousStepItem != null)
|
||||
{
|
||||
_IgnoreResize=true;
|
||||
if (_MyStepData != null && (_MyStepData.Type == "Table" || _MyStepData.ParentType == "Table"))
|
||||
if (_MyStepData != null && (_MyStepData.Type.ToLower().Contains("table") || _MyStepData.ParentType.ToLower().Contains("table")))
|
||||
{
|
||||
ItemWidth = (int)TableWidth(_MyStepRTB.Font, _MyItemInfo.MyContent.Text, true);
|
||||
Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom));
|
||||
}
|
||||
else if (value.MyItemInfo.IsTablePart)
|
||||
{
|
||||
ItemLocation = new Point(value.MyParentStepItem.TextLeft, value.MyParentStepItem.Bottom);
|
||||
ItemWidth = value.MyParentStepItem.TextWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
Width = MyPreviousStepItem.Width;
|
||||
Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom));
|
||||
}
|
||||
_IgnoreResize=false;
|
||||
//ShowMe("");
|
||||
//if (MyID > _StartingID)
|
||||
@@ -503,7 +517,6 @@ namespace Volian.Controls.Library
|
||||
// , FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom)
|
||||
// , _MyPreviousStepItem.Bottom);
|
||||
//Location = new Point(_MyPreviousStepItem.Left, _MyPreviousStepItem.BottomMostStepItem.Bottom);
|
||||
Location = new Point(_MyPreviousStepItem.Left, FindTop(_MyPreviousStepItem.BottomMostStepItem.Bottom));
|
||||
switch (_MyChildRelation)
|
||||
{
|
||||
case ChildRelation.None:
|
||||
@@ -1615,28 +1628,11 @@ namespace Volian.Controls.Library
|
||||
/// <param name="e"></param>
|
||||
private void StepItem_Resize(object sender, EventArgs e)
|
||||
{
|
||||
//if (_MyItemInfo != null && _MyItemInfo.MyContent.Type == 20008)
|
||||
//{
|
||||
// vlnStackTrace.ShowStackLocal(string.Format("{0},{1}", _MyItemInfo.ItemID, _MyStepRTB.Width), 3);
|
||||
// Console.WriteLine("asd");
|
||||
//}
|
||||
//ShowMe("Resize");
|
||||
if (MyStepRTB.Text.EndsWith("\n"))
|
||||
if (!_LookForID.Contains(MyID))
|
||||
{
|
||||
//Console.WriteLine("{0} Added a CR",MyID);
|
||||
_LookForID.Add(MyID);
|
||||
}
|
||||
//if ((_WatchThis > 0 && MyID > 2100) || MyID == _LookForID)
|
||||
//{
|
||||
// Console.WriteLine("{0}Resize {1},{2}",WatchThisIndent, MyID, this);
|
||||
// if (MyID == _LookForID)
|
||||
// Console.WriteLine("{0}------------------------",WatchThisIndent);
|
||||
//}
|
||||
if (_MyItemInfo == null) return;
|
||||
//Console.WriteLine("{0} Resize - {1}, BottomMost {2}", MyID, MyPath,BottomMostStepItem.MyPath);
|
||||
//if (_lookForID == MyID)
|
||||
// _lookForID = MyID;
|
||||
if (_IgnoreResize) return;
|
||||
AdjustLocation();
|
||||
if (lblHeader != null) lblHeader.Width = this.Width;
|
||||
@@ -1848,7 +1844,7 @@ namespace Volian.Controls.Library
|
||||
return childStepItems[childStepItems.Count - 1];
|
||||
}
|
||||
/// <summary>
|
||||
/// Calculate the width of the table
|
||||
/// Calculate TableWidth based upon the the contents
|
||||
/// </summary>
|
||||
/// <param name="myFont"></param>
|
||||
/// <param name="txt"></param>
|
||||
@@ -1858,35 +1854,29 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
string[] lines = txt.Split("\n".ToCharArray());
|
||||
float max = 0;
|
||||
//string lineMax = "";
|
||||
SizeF siz10 = new SizeF();
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
PointF pnt = new PointF(0, 0);
|
||||
siz10 = g.MeasureString("MMMMMMMMMM", myFont, pnt, StringFormat.GenericTypographic);
|
||||
}
|
||||
foreach (string line in lines)
|
||||
{
|
||||
//string line2 = (addBorder ? "--" : "") + Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
|
||||
string line2 = Regex.Replace(line, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
|
||||
//line2 = line2.Replace(@"\u8209?", "-");
|
||||
//line2 = line2.Replace("<START]", "");
|
||||
//line2 = Regex.Replace(line2, @"#Link:.*?\[END>","");
|
||||
line2 = StepRTB.RemoveLinkComments(line2);
|
||||
// MeasureString doesn't work properly if the line include graphics characters.
|
||||
//SizeF siz = g.MeasureString(line2, myFont, pnt, StringFormat.GenericTypographic);
|
||||
float wid = line2.Length * siz10.Width / 10;
|
||||
//Console.WriteLine("'LineWidth'\t'{0}'\t{1}\t{2:0.}\t{3:0.}\t{4:0.}",
|
||||
// line2.Length, wid, max, _MyStepPanel.MyStepPanelSettings.TableWidthAdjust, line2);
|
||||
if (wid + _MyStepPanel.MyStepPanelSettings.TableWidthAdjust > max)
|
||||
foreach (string line in lines)
|
||||
{
|
||||
max = wid + _MyStepPanel.MyStepPanelSettings.TableWidthAdjust;
|
||||
//lineMax = line2;
|
||||
string lineAdj = Regex.Replace(line, @"\\u....\?", "X"); // Replace Special characters
|
||||
//line2 = Regex.Replace(line2, @"\\.*? ", ""); // Remove RTF Commands - Really should not be any
|
||||
lineAdj = StepRTB.RemoveLinkComments(lineAdj);
|
||||
// MeasureString doesn't work properly if the line include graphics characters.
|
||||
// So, Measure a string of the same length with 'M's.
|
||||
SizeF siz = g.MeasureString("".PadLeft(lineAdj.Length + (addBorder ? 2 : 0), 'M'), myFont, pnt, StringFormat.GenericTypographic);
|
||||
float wid = siz.Width;
|
||||
if (wid > max)
|
||||
{
|
||||
max = wid;
|
||||
}
|
||||
}
|
||||
}
|
||||
//vlnStackTrace.ShowStackLocal("TableWidth", 1, 10);
|
||||
//Console.WriteLine("TableWidth = {0}, lineMax = '{1}', myFont = {2}", max, lineMax, myFont);
|
||||
return max;
|
||||
float widLimit = (float) _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.WidSTableEdit, MyItemInfo.ColumnMode);
|
||||
widLimit += (float)_MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColS);
|
||||
widLimit += (float) _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
|
||||
max += _MyStepPanel.MyStepPanelSettings.TableWidthAdjust;
|
||||
return Math.Min(max,widLimit);
|
||||
}
|
||||
/// <summary>
|
||||
/// Calculates the table location
|
||||
@@ -1895,11 +1885,25 @@ namespace Volian.Controls.Library
|
||||
/// <param name="myStepSectionLayoutData"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <returns></returns>
|
||||
private Point TableLocation(StepItem myParentStepItem, StepSectionLayoutData myStepSectionLayoutData, int width)
|
||||
public Point TableLocation(StepItem myParentStepItem, StepSectionLayoutData myStepSectionLayoutData, int width)
|
||||
{
|
||||
int x = myParentStepItem.TextLeft;
|
||||
int y = myParentStepItem.Bottom;
|
||||
if (x + width > myParentStepItem.Right) x = myParentStepItem.Right - width;
|
||||
// Should center on parent unless it is a centered table in the AER column
|
||||
int center = myParentStepItem.TextLeft + myParentStepItem.TextWidth / 2;
|
||||
int rightLimit = myParentStepItem.Right;
|
||||
// Then should center on the wid Limit
|
||||
if (MyItemInfo.FormatStepData.Type.Contains("AER") == false && MyItemInfo.RNOLevel == 0)
|
||||
{
|
||||
int colR = _MyStepPanel.ToDisplay(_MyStepSectionLayoutData.ColRTable, MyItemInfo.ColumnMode);
|
||||
rightLimit += colR * MyItemInfo.ColumnMode;
|
||||
center += (colR * MyItemInfo.ColumnMode) / 2;
|
||||
center -= (myParentStepItem.TextLeft - (int)MyItemInfo.MyDocStyle.Layout.LeftMargin) / 2;
|
||||
}
|
||||
|
||||
// Calulate the x location
|
||||
//int x = myParentStepItem.TextLeft;
|
||||
int x = center - width / 2;
|
||||
int y = FindTop(myParentStepItem.Bottom);
|
||||
if (x + width > rightLimit) x = rightLimit - width;
|
||||
int colT = _MyStepPanel.ToDisplay(myStepSectionLayoutData.ColT);
|
||||
if (x < colT) x = colT;
|
||||
return new Point(x, y);
|
||||
@@ -2194,8 +2198,8 @@ namespace Volian.Controls.Library
|
||||
AddChildAfter(MyItemInfo.Sections, expand);
|
||||
if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel < MyItemInfo.ColumnMode)
|
||||
AddChildRNO(MyItemInfo.RNOs, expand);
|
||||
AddChildAfter(MyItemInfo.Steps, expand);
|
||||
AddChildAfter(MyItemInfo.Tables, expand);
|
||||
AddChildAfter(MyItemInfo.Steps, expand);
|
||||
if (MyItemInfo.RNOs != null && MyItemInfo.RNOLevel >= MyItemInfo.ColumnMode)
|
||||
AddChildRNO(MyItemInfo.RNOs, expand);
|
||||
if (!_MyvlnExpander.Expanded)
|
||||
@@ -2255,10 +2259,13 @@ namespace Volian.Controls.Library
|
||||
// Console.WriteLine("Ooops!!!");
|
||||
int? bottom = null;
|
||||
StepItem stepItem = this;
|
||||
if (stepItem._MyChildRelation == ChildRelation.None)
|
||||
return null;
|
||||
if (stepItem._MyChildRelation == ChildRelation.After && !RNORight)
|
||||
return null;
|
||||
if (!MyItemInfo.IsTablePart)
|
||||
{
|
||||
if (stepItem._MyChildRelation == ChildRelation.None)
|
||||
return null;
|
||||
if (stepItem._MyChildRelation == ChildRelation.After && !RNORight)
|
||||
return null;
|
||||
}
|
||||
while (stepItem != null && stepItem._MyChildRelation != ChildRelation.None && stepItem._MyChildRelation != ChildRelation.After)
|
||||
stepItem = stepItem.UpOneStepItem;
|
||||
if (stepItem == null || stepItem._MyChildRelation == ChildRelation.None)
|
||||
|
Reference in New Issue
Block a user