This commit is contained in:
parent
c6203a6d6d
commit
47860da240
@ -139,6 +139,22 @@ namespace Volian.Controls.Library
|
||||
TextFont = vFont;
|
||||
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)
|
||||
{
|
||||
// Adjust RO display
|
||||
@ -170,33 +186,37 @@ namespace Volian.Controls.Library
|
||||
|
||||
// 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.
|
||||
text = text.Replace(@"\~", @"\u160?");
|
||||
text = text.Replace("\r\n", @"\par ");
|
||||
//if (text.IndexOf(@"\line") > -1)
|
||||
// MessageBox.Show("Found rtf line");
|
||||
text = text.Replace(@"\line", @"\par");
|
||||
|
||||
// Now put symbol (for fixed fonts) or unicode font (proportional) around symbols
|
||||
// These fonts are VESymbFix & Arial Unicode MS respectively, and the font table
|
||||
// is actually defined in the StepRTB code.
|
||||
int indxsym = NextUnicode(text,0);//text.IndexOf(@"\u");
|
||||
while (indxsym != -1)
|
||||
if (!text.StartsWith(@"{\rtf"))
|
||||
{
|
||||
int incrindx = 3;
|
||||
if (text[indxsym + 2] != 'l')
|
||||
text = text.Replace(@"\~", @"\u160?");
|
||||
text = text.Replace("\r\n", @"\par ");
|
||||
//if (text.IndexOf(@"\line") > -1)
|
||||
// MessageBox.Show("Found rtf line");
|
||||
text = text.Replace(@"\line", @"\par");
|
||||
|
||||
|
||||
// Now put symbol (for fixed fonts) or unicode font (proportional) around symbols
|
||||
// These fonts are VESymbFix & Arial Unicode MS respectively, and the font table
|
||||
// is actually defined in the StepRTB code.
|
||||
int indxsym = NextUnicode(text, 0);//text.IndexOf(@"\u");
|
||||
while (indxsym != -1)
|
||||
{
|
||||
text = text.Insert(indxsym, @"\f1 ");
|
||||
int indxendsym = text.IndexOfAny(@"\ ?".ToCharArray(), indxsym + 5);
|
||||
if (indxendsym == -1) // must be end of line:
|
||||
text = text.Insert(text.Length - 1, @"\f0 ");
|
||||
else
|
||||
int incrindx = 3;
|
||||
if (text[indxsym + 2] != 'l')
|
||||
{
|
||||
if (text[indxendsym] == '?') indxendsym++;
|
||||
text = text.Insert(indxendsym, @"\f0 "); // TODO: do I need a space??
|
||||
text = text.Insert(indxsym, @"\f1 ");
|
||||
int indxendsym = text.IndexOfAny(@"\ ?".ToCharArray(), indxsym + 5);
|
||||
if (indxendsym == -1) // must be end of line:
|
||||
text = text.Insert(text.Length - 1, @"\f0 ");
|
||||
else
|
||||
{
|
||||
if (text[indxendsym] == '?') indxendsym++;
|
||||
text = text.Insert(indxendsym, @"\f0 "); // TODO: do I need a space??
|
||||
}
|
||||
incrindx = 5;
|
||||
}
|
||||
incrindx = 5;
|
||||
indxsym = NextUnicode(text, indxsym + incrindx);//text.IndexOf(@"\u", indxsym + incrindx);
|
||||
}
|
||||
indxsym = NextUnicode(text, indxsym + incrindx);//text.IndexOf(@"\u", indxsym + incrindx);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user