This commit is contained in:
Kathy Ruffing 2011-03-07 13:13:43 +00:00
parent c6203a6d6d
commit 47860da240

View File

@ -139,6 +139,22 @@ namespace Volian.Controls.Library
TextFont = vFont; TextFont = vFont;
StartText = CreateRtf(colorLinks, text, false, false, false, false, false); StartText = CreateRtf(colorLinks, text, false, false, false, false, false);
} }
public DisplayText(ItemInfo itemInfo, string text, bool colorLinks)
{
_FieldToEdit = E_FieldToEdit.Text;
_MyItemInfo = itemInfo;
OriginalText = text;
TextFont = itemInfo.GetItemFont();
_MyFormat = itemInfo.ActiveFormat;
bool wordsShouldBeReplaced = true;
bool numbersShouldBeFormated = !_MyFormat.PlantFormat.FormatData.SectData.StepSectionData.FortranFormatNumbers;
int typ = ((int)itemInfo.MyContent.Type) % 10000;
bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value
text = CreateRtf(colorLinks, text, false, wordsShouldBeReplaced, numbersShouldBeFormated, false, ROsShouldBeAdjusted);
StartText = text;
}
private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted) private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted)
{ {
// Adjust RO display // Adjust RO display
@ -170,12 +186,15 @@ namespace Volian.Controls.Library
// as a precaution, convert any \~ to \u160?. This is for Hard spaces. see the commentary in the // as a precaution, convert any \~ to \u160?. This is for Hard spaces. see the commentary in the
// save portion of this code for an explanation. // save portion of this code for an explanation.
if (!text.StartsWith(@"{\rtf"))
{
text = text.Replace(@"\~", @"\u160?"); text = text.Replace(@"\~", @"\u160?");
text = text.Replace("\r\n", @"\par "); text = text.Replace("\r\n", @"\par ");
//if (text.IndexOf(@"\line") > -1) //if (text.IndexOf(@"\line") > -1)
// MessageBox.Show("Found rtf line"); // MessageBox.Show("Found rtf line");
text = text.Replace(@"\line", @"\par"); text = text.Replace(@"\line", @"\par");
// Now put symbol (for fixed fonts) or unicode font (proportional) around symbols // Now put symbol (for fixed fonts) or unicode font (proportional) around symbols
// These fonts are VESymbFix & Arial Unicode MS respectively, and the font table // These fonts are VESymbFix & Arial Unicode MS respectively, and the font table
// is actually defined in the StepRTB code. // is actually defined in the StepRTB code.
@ -198,6 +217,7 @@ namespace Volian.Controls.Library
} }
indxsym = NextUnicode(text, indxsym + incrindx);//text.IndexOf(@"\u", indxsym + incrindx); indxsym = NextUnicode(text, indxsym + incrindx);//text.IndexOf(@"\u", indxsym + incrindx);
} }
}
return text; return text;
} }
private static string DoColorLinks(string text) private static string DoColorLinks(string text)