Added logic to support ConvertUnderscoreToUnderline flag

This commit is contained in:
Rich 2017-09-21 17:37:18 +00:00
parent 9b3e2ea0f7
commit 48df3eeee8

View File

@ -913,7 +913,8 @@ namespace VEPROMS.CSLA.Library
val = val.Replace("\x7F", "\x394"); //delta
// An X/Y Plot RO type might have text preceding the Plot Commands
int pstart = val.IndexOf("<<G"); // find the starting Plot Command
AddPrecedingText(sel, val.Substring(0, pstart),0.0F);// replace the RO token with what's in front of the X/Y Plot
// B2017-217 Added logic so that underscores are not converted to underline
AddPrecedingText(sel, val.Substring(0, pstart), 0.0F, sect.MyActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertUnderscoreToUnderline);// replace the RO token with what's in front of the X/Y Plot
val = val.Substring(pstart); // set val to the start of the plot commands
pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
RectangleF plotRect = CreatePlot(pngFile, val, 600F, FormForPlotGraphics);
@ -966,7 +967,8 @@ namespace VEPROMS.CSLA.Library
//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
// if val is null, then InsertROValue will put in "RO Not Found" for the value
float indent = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToTextBoundary);
InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper, indent);
// B2017-217 Added logic so that underscores are not converted to underline
InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper, indent, sect.MyActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertUnderscoreToUnderline);
}
sel = FindRO();
if (sel != null && sel.Start == lastStart)
@ -1127,9 +1129,10 @@ namespace VEPROMS.CSLA.Library
}
return indxClose;
}
public static void AddPrecedingText(LBSelection sel, string val, float indent)
public static void AddPrecedingText(LBSelection sel, string val, float indent, bool convertUnderline)
{
if (val.IndexOf("_") == -1) // Is some of the text underlined?
// B2017-217 Added logic so that underscores are not converted to underline
if (!convertUnderline || val.IndexOf("_") == -1) // Is some of the text underlined?
{
if (val.Contains("\r\n"))
{
@ -1399,7 +1402,7 @@ namespace VEPROMS.CSLA.Library
myFile.Delete();
return retval;
}
private static void InsertROValue(LBSelection sel, string roValue, bool upRoIfPrevUpper, float indent)
private static void InsertROValue(LBSelection sel, string roValue, bool upRoIfPrevUpper, float indent, bool convertUnderline)
{
if (roValue == null)
{
@ -1449,7 +1452,7 @@ namespace VEPROMS.CSLA.Library
roValue = roValue.Replace(@"[XB3]", "\xB3");
sel.Text = roValue;
// look for toggling of '_' to turn underlining on/off:
AddPrecedingText(sel, roValue, indent); // parse underlining
AddPrecedingText(sel, roValue, indent,convertUnderline); // parse underlining
// B2017-177 Don't print text RO in red
//sel.Font.Color = LBWdColor.wdColorRed;
}