diff --git a/PROMS/Volian.Controls.Library/StepItem.cs b/PROMS/Volian.Controls.Library/StepItem.cs
index 0d396993..854540d7 100644
--- a/PROMS/Volian.Controls.Library/StepItem.cs
+++ b/PROMS/Volian.Controls.Library/StepItem.cs
@@ -1607,7 +1607,7 @@ namespace Volian.Controls.Library
///
///
///
- private float TableWidth(Font myFont, string txt)
+ public float TableWidth(Font myFont, string txt)
{
string[] lines = txt.Split("\n".ToCharArray());
float max = 0;
diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs
index 18904a8f..ec18a5cb 100644
--- a/PROMS/Volian.Controls.Library/StepRTB.cs
+++ b/PROMS/Volian.Controls.Library/StepRTB.cs
@@ -168,12 +168,12 @@ namespace Volian.Controls.Library
_SelectedRtfSB.Remove(0, _SelectedRtfSB.Length);
DisplayText vlntxt = new DisplayText(_MyItemInfo, EpMode, VwMode, !edit, FieldToEdit);
- if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
- {
- ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
- if (!ReadOnly && !edit) ReadOnly = true;
- return;
- }
+ //if (_origDisplayText != null && vlntxt.StartText == _origDisplayText.StartText)
+ //{
+ // ReadOnly = !(EpMode == E_EditPrintMode.Edit && VwMode == E_ViewMode.Edit);
+ // if (!ReadOnly && !edit) ReadOnly = true;
+ // return;
+ //}
_origDisplayText = vlntxt;
#if(DEBUG)
// Use Times New Roman for Debugging
@@ -207,7 +207,6 @@ namespace Volian.Controls.Library
int typ = ((int)_MyItemInfo.MyContent.Type) % 10000;
OutlineTable(_MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless")<0);
FindAllLinks();
- AdjustSizeForContents(); // TODO: this is not quite right yet.
}
SelectAll();
SelectionHangingIndent = 0;
@@ -222,9 +221,18 @@ namespace Volian.Controls.Library
}
AddEventHandlers();
}
+ else
+ {
+ if (_MyStepItem != null && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
+ {
+ //AdjustWidthForContent();
+ _MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text);
+ }
+ }
_origRTF = Rtf;
_InitializingRTB = false;
_MyItemInfo.MyConfig.PropertyChanged += new PropertyChangedEventHandler(MyConfig_PropertyChanged);
+ AdjustSizeForContents(); // TODO: this is not quite right yet.
}
private bool _ProcessKeystrokes = true;
public bool ProcessKeystrokes
@@ -776,7 +784,7 @@ namespace Volian.Controls.Library
int widthNew = ContentsSize.Width + offset.Width + AdjustSize.Width;
int heightNew = ContentsSize.Height + offset.Height + AdjustSize.Height;
Size szNew = new Size(widthNew,heightNew);
- if (this.Size != szNew)
+ if (this.Size != szNew && !_InitializingRTB)
{
this.Size = szNew;
OnHeightChanged(this, new EventArgs());
@@ -2080,13 +2088,20 @@ namespace Volian.Controls.Library
SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}";
}
// Add the top line
+ if (_MyStepItem != null)
+ {
+ //AdjustWidthForContent();
+ _MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text);
+ }
Select(0, 0);
SelectedRtf = RtfPrefix + (withBorder ? @"\u9484?" : " ") + horzLine + (withBorder ? @"\u9488?\par " : @" \par ") + "}";
// Add the bottom line
Select(TextLength, 0);
+ ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized);
SelectedRtf = RtfPrefix + (withBorder ? @"\par\u9492?" : @"\par ") + horzLine + (withBorder ? @"\u9496?" : @" ") + "}";
-
+ ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized);
ReplaceLinesInTable(withBorder);
+
}
private int MaxCharacterWidth()
{