From add1510f84fee1c597d654a38c36c06ba6c9766d Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 7 Oct 2014 12:25:12 +0000 Subject: [PATCH] For IP2 backgrounds, adjust starting location & width of various steps Made RTBMargin public --- PROMS/Volian.Controls.Library/EditItem.cs | 48 +++++++++++++++++++---- PROMS/Volian.Controls.Library/RTBItem.cs | 4 +- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index ec3b5f63..7e966c81 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1506,7 +1506,7 @@ namespace Volian.Controls.Library if (_IgnoreResize) return; AdjustLocation(); HandleResize(); - + } #endregion // Event Handlers #region Private and Protected Methods @@ -1752,8 +1752,10 @@ namespace Volian.Controls.Library //if (MyItemInfo.SameRowAsParent && MyItemInfo.IsCaution2) // bottom = Top; - - if (nextEditItem.Top != bottom) + // If this is a "TitleWithTextRight", don't move down on the screen: + int newTop = bottom; + if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Type == "TitleWithTextRight") newTop = Top; + if (nextEditItem.Top != newTop) { MyStepPanel.ItemMoving++; 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 // 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. - nextEditItem.Top = bottom; - if (nextEditItem.Top != bottom) + nextEditItem.Top = newTop; + if (nextEditItem.Top != newTop) { _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.LastMethodsPop(); @@ -2164,6 +2166,28 @@ namespace Volian.Controls.Library SizeF sz = g.MeasureString(MyItemInfo.MyContent.Text, MyItemInfo.FormatStepData.Font.WindowsFont); 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") { 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); _IgnoreResize = true; int spaceToRTB = 23; - Width = MyStepPanel.ToDisplay(MyStepSectionLayoutData.WidT) + spaceToRTB; _IgnoreResize = false; MyStepPanel.ItemMoving++; //Location = new Point(_MyParentRTBItem.Left + 20, FindTop(_MyParentRTBItem.Top)); @@ -2266,6 +2289,12 @@ namespace Volian.Controls.Library } else 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--; //_MyParentRTBItem.Top = Bottom; // Could be a Caution or Note - Need to get WidT @@ -2446,6 +2475,11 @@ namespace Volian.Controls.Library } 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 (ContentType == 0 && MyStepSectionLayoutData != null) diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs index 1ec23b1d..df2b22e5 100644 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ b/PROMS/Volian.Controls.Library/RTBItem.cs @@ -177,12 +177,12 @@ namespace Volian.Controls.Library #endregion #region Properties - private int _RTBMargin = 3; + private static int _RTBMargin = 3; /// /// 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. /// - public int RTBMargin + public static int RTBMargin { get { return _RTBMargin; } set { _RTBMargin = value; }