Added logic to support the indexed list version of ReplaceSymbolChars
This commit is contained in:
parent
dd4c099741
commit
c6608b8370
@ -805,7 +805,7 @@ namespace Volian.Print.Library
|
|||||||
//</ReplaceSymbolChars-->
|
//</ReplaceSymbolChars-->
|
||||||
//
|
//
|
||||||
// get the list of symbol replacements
|
// get the list of symbol replacements
|
||||||
FormatData fmtdata = (MyFlexGrid.MyDVI != null) ? MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
FormatData fmtdata = (MyFlexGrid.GetMyItemInfo().ActiveFormat != null) ? MyFlexGrid.GetMyItemInfo().ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
||||||
ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
|
ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
|
||||||
// Look at one character at a time
|
// Look at one character at a time
|
||||||
for (int i = 0; i < rtb.TextLength; i++)
|
for (int i = 0; i < rtb.TextLength; i++)
|
||||||
@ -827,10 +827,11 @@ namespace Volian.Print.Library
|
|||||||
rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style);
|
rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
if (rtb.SelectionFont.FontFamily.Name == "VESymbFix" && rtb.SelectedText.Length > 0)
|
if ((rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name.StartsWith("Arial Unicode")) && rtb.SelectedText.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (ReplaceChar rc in SymReplaceList)
|
for (int j=0; j<SymReplaceList.MaxIndex;j++)
|
||||||
{
|
{
|
||||||
|
ReplaceChar rc = SymReplaceList[j];
|
||||||
if (rc.Unicode != null)
|
if (rc.Unicode != null)
|
||||||
{
|
{
|
||||||
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
||||||
@ -840,7 +841,13 @@ namespace Volian.Print.Library
|
|||||||
System.Drawing.Font fnt = rtb.SelectionFont;
|
System.Drawing.Font fnt = rtb.SelectionFont;
|
||||||
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size, (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
|
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size, (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
|
||||||
rtb.SelectionFont = fntw;
|
rtb.SelectionFont = fntw;
|
||||||
|
if (rc.Replace != null)
|
||||||
|
{
|
||||||
|
char rc_RplChar = Convert.ToChar(Convert.ToInt32(rc.Replace));
|
||||||
|
rtb.SelectedText = rc_RplChar.ToString();
|
||||||
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
|
break; // break out of foreach loop since we changed the character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4332,7 +4332,7 @@ namespace Volian.Print.Library
|
|||||||
private string FixRTFToPrint(string rtf)
|
private string FixRTFToPrint(string rtf)
|
||||||
{
|
{
|
||||||
// Only do this if the text contains symbols.
|
// Only do this if the text contains symbols.
|
||||||
if (rtf.Contains("VESymbFix"))
|
if (rtf.Contains("VESymbFix") || rtf.Contains("Arial Unicode"))
|
||||||
{
|
{
|
||||||
System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
|
System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
|
||||||
rtb.Rtf = rtf.Replace(@"\\","<dblbs>"); // rename backslash character to avoid RTF confusion
|
rtb.Rtf = rtf.Replace(@"\\","<dblbs>"); // rename backslash character to avoid RTF confusion
|
||||||
@ -4357,16 +4357,17 @@ namespace Volian.Print.Library
|
|||||||
//</ReplaceSymbolChars-->
|
//</ReplaceSymbolChars-->
|
||||||
//
|
//
|
||||||
// get the list of symbol replacements
|
// get the list of symbol replacements
|
||||||
FormatData fmtdata = (MyItemInfo.MyDocVersion != null) ? MyItemInfo.MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
FormatData fmtdata = (MyItemInfo.ActiveFormat != null) ? MyItemInfo.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
||||||
ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
|
ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
|
||||||
// Look at one character at a time
|
// Look at one character at a time
|
||||||
for (int i = 0; i < rtb.TextLength; i++)
|
for (int i = 0; i < rtb.TextLength; i++)
|
||||||
{
|
{
|
||||||
rtb.Select(i, 1);
|
rtb.Select(i, 1);
|
||||||
if (rtb.SelectionFont.FontFamily.Name == "VESymbFix" && rtb.SelectedText.Length > 0)
|
if ((rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name.StartsWith("Arial Unicode")) && rtb.SelectedText.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (ReplaceChar rc in SymReplaceList)
|
for (int j=0; j<SymReplaceList.MaxIndex;j++)
|
||||||
{
|
{
|
||||||
|
ReplaceChar rc = SymReplaceList[j];
|
||||||
if (rc.Unicode != null)
|
if (rc.Unicode != null)
|
||||||
{
|
{
|
||||||
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
||||||
@ -4376,7 +4377,13 @@ namespace Volian.Print.Library
|
|||||||
System.Drawing.Font fnt = rtb.SelectionFont;
|
System.Drawing.Font fnt = rtb.SelectionFont;
|
||||||
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size, (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
|
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size, (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
|
||||||
rtb.SelectionFont = fntw;
|
rtb.SelectionFont = fntw;
|
||||||
|
if (rc.Replace != null)
|
||||||
|
{
|
||||||
|
char rc_RplChar = Convert.ToChar(Convert.ToInt32(rc.Replace));
|
||||||
|
rtb.SelectedText = rc_RplChar.ToString();
|
||||||
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
|
break; // break out of foreach loop since we changed the character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user