For IP2 backgrounds, adjust starting location & width of various steps

Made RTBMargin public
This commit is contained in:
Kathy Ruffing 2014-10-07 12:25:12 +00:00
parent f9d0c363f7
commit add1510f84
2 changed files with 43 additions and 9 deletions

View File

@ -1752,8 +1752,10 @@ namespace Volian.Controls.Library
//if (MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) //if (MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2)
// bottom = Top; // bottom = Top;
// If this is a "TitleWithTextRight", don't move down on the screen:
if (nextEditItem.Top != bottom) int newTop = bottom;
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Type == "TitleWithTextRight") newTop = Top;
if (nextEditItem.Top != newTop)
{ {
MyStepPanel.ItemMoving++; MyStepPanel.ItemMoving++;
nextEditItem.LastMethodsPush(string.Format("AdjustLocation {0}", MyID)); nextEditItem.LastMethodsPush(string.Format("AdjustLocation {0}", MyID));
@ -1763,11 +1765,11 @@ namespace Volian.Controls.Library
// it appears that setting the top doesn't always work. The logic below checks to see if it does // it appears that setting the top doesn't always work. The logic below checks to see if it does
// not work and trys some other things so that the EditItem will be moved to the correct place. // not work and trys some other things so that the EditItem will be moved to the correct place.
// As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel. // As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel.
nextEditItem.Top = bottom; nextEditItem.Top = newTop;
if (nextEditItem.Top != bottom) if (nextEditItem.Top != newTop)
{ {
_MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'", _MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'",
oldTop, nextEditItem.Top, bottom, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath); oldTop, nextEditItem.Top, newTop, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath);
nextEditItem.TryAgainLater = true; nextEditItem.TryAgainLater = true;
} }
nextEditItem.LastMethodsPop(); nextEditItem.LastMethodsPop();
@ -2164,6 +2166,28 @@ namespace Volian.Controls.Library
SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont);
ItemWidth = (int)sz.Width; ItemWidth = (int)sz.Width;
} }
else if (MyItemInfo.FormatStepData.Type == "TitleWithTextRight" &&
((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
{
Graphics g = CreateGraphics();
SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont);
ItemWidth = (int)sz.Width + 5;
}
else if (MyItemInfo.FormatStepData.Type == "TitleWithTextBelow" &&
((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
{
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
}
else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow" &&
((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
{
ItemWidth = MyParentEditItem.ItemWidth - RTBItem.RTBMargin;
}
else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight" &&
((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
{
ItemWidth = MyParentEditItem.MyParentEditItem.ContentWidth - MyParentEditItem.ItemWidth;
}
else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight") else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight")
{ {
ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0); ItemWidth = MyStepPanel.ToDisplay(MyStepSectionLayoutData.ColT) + MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidSTableEdit, 0);
@ -2237,7 +2261,6 @@ namespace Volian.Controls.Library
//Location = new Point(_MyParentRTBItem.Left + 20, max(_MyParentRTBItem.Top, (_MyNextRTBItem == null ? 0 : _MyNextRTBItem.Top )) ?? 0); //Location = new Point(_MyParentRTBItem.Left + 20, max(_MyParentRTBItem.Top, (_MyNextRTBItem == null ? 0 : _MyNextRTBItem.Top )) ?? 0);
_IgnoreResize = true; _IgnoreResize = true;
int spaceToRTB = 23; int spaceToRTB = 23;
Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB;
_IgnoreResize = false; _IgnoreResize = false;
MyStepPanel.ItemMoving++; MyStepPanel.ItemMoving++;
//Location = new Point(_MyParentRTBItem.Left + 20, FindTop(_MyParentRTBItem.Top)); //Location = new Point(_MyParentRTBItem.Left + 20, FindTop(_MyParentRTBItem.Top));
@ -2266,6 +2289,12 @@ namespace Volian.Controls.Library
} }
else else
Location = new Point(_MyParentEditItem.Left + 20, FindTop(myTop)); Location = new Point(_MyParentEditItem.Left + 20, FindTop(myTop));
// ip2bck's needed the width to be set slightly differently to get the correct width.
int widthtpl = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB;
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.UseOldTemplate &&
((MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
widthtpl = MyParentEditItem.Width + MyParentEditItem.Left - Left;
Width = widthtpl; // MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB;
MyStepPanel.ItemMoving--; MyStepPanel.ItemMoving--;
//_MyParentRTBItem.Top = Bottom; //_MyParentRTBItem.Top = Bottom;
// Could be a Caution or Note - Need to get WidT // Could be a Caution or Note - Need to get WidT
@ -2446,6 +2475,11 @@ namespace Volian.Controls.Library
} }
if (itemInfo != null) if (itemInfo != null)
{ {
// ip2bck's needed the ContentWidth set to get the edit windows to size correctly.
if (itemInfo.IsStep && itemInfo.FormatStepData.Type == "TitleWithTextBelow" &&
((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) == E_DocStructStyle.DSS_PageListSpBckgrnd))
ContentWidth = myParentEditItem.ContentWidth;
if (myChildRelation == ChildRelation.None) if (myChildRelation == ChildRelation.None)
{ {
if (ContentType == 0 && MyStepSectionLayoutData != null) if (ContentType == 0 && MyStepSectionLayoutData != null)

View File

@ -177,12 +177,12 @@ namespace Volian.Controls.Library
#endregion #endregion
#region Properties #region Properties
private int _RTBMargin = 3; private static int _RTBMargin = 3;
/// <summary> /// <summary>
/// Margin between the EditItem and the StepRTB. Appears on the Right. /// Margin between the EditItem and the StepRTB. Appears on the Right.
/// Will allow space to draw a Change Bar on the right side of the EditItem. /// Will allow space to draw a Change Bar on the right side of the EditItem.
/// </summary> /// </summary>
public int RTBMargin public static int RTBMargin
{ {
get { return _RTBMargin; } get { return _RTBMargin; }
set { _RTBMargin = value; } set { _RTBMargin = value; }