BGE: Handle {} around ro values
BGE: Added an x-Location of end message for a section Use x-location of end message for a section; tab format for sequential tabs at 4th level; hls tab spaces; indent in transition format 9 BGE: Use x-location of end message for a section BGE: support for top continue messages that contain tab for continued step resolve {Step Text} token in transition; modify code that processes transition format to use collection matches rather than search for ‘{‘ support AllUnits ro flag support ‘{‘ and ‘}’ around ro value top continue message with tab; location of top continue message in both AER/RNO columns for dual column; support indent in transition format during print support two top continue messages (aer/rno) that can have different text; fix bug in splitting procedure title text if it contains hard spaces
This commit is contained in:
@@ -410,11 +410,19 @@ namespace Volian.Controls.Library
|
||||
// if it turns out that if ro's have any embedded unicode characters this needs expanded, such as /u8209? (hard hyphen)
|
||||
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
|
||||
MatchCollection matches = Regex.Matches(text, lookFor);
|
||||
string prevValue = null;
|
||||
for (int i = matches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Match m = matches[i];
|
||||
if (m != null && m.Groups.Count > 6 && m.Groups[6].ToString() == "ReferencedObject")
|
||||
{
|
||||
// if previous processed (next ro) was found, then see if it has an 'and' between it and the previous
|
||||
if (prevValue != null)
|
||||
{
|
||||
int endIndx = m.Index + m.Length;
|
||||
string tr = text.Substring(endIndx).Replace(@"\v0","").TrimStart();
|
||||
if (!tr.ToUpper().StartsWith("AND")) prevValue = null;
|
||||
}
|
||||
System.Text.RegularExpressions.Group g = m.Groups[3];
|
||||
string beforeRO = StaticStripRtfCommands(text.Substring(0, g.Index));
|
||||
string afterRO = StaticStripRtfCommands(text.Substring(g.Index + g.Length));
|
||||
@@ -425,7 +433,8 @@ namespace Volian.Controls.Library
|
||||
int rodbid = int.Parse(myMatch.Groups[3].Value);
|
||||
ROFstInfo myROFst = _MyItemInfo.MyDocVersion.GetROFst(rodbid);
|
||||
bool isSetpoint=myROFst.IsSetpointDB(dbid, _MyItemInfo.MyDocVersion);
|
||||
string newvalue = DoROFormatFlags(g.ToString(), beforeRO, afterRO, isSetpoint);
|
||||
string newvalue = DoROFormatFlags(g.ToString(), beforeRO, afterRO, isSetpoint, prevValue);
|
||||
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits) prevValue = newvalue;
|
||||
newvalue = DoROReplaceWords(_MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList, newvalue, _MyItemInfo.IsHigh);
|
||||
if (isSetpoint) newvalue = ReplaceSpaceWithHardspace(newvalue);
|
||||
if (g.ToString() != newvalue)
|
||||
@@ -1240,13 +1249,14 @@ namespace Volian.Controls.Library
|
||||
// string spaces = @" \u160?";
|
||||
// return (spaces.IndexOf(ch) >= 0);
|
||||
//}
|
||||
private string DoROFormatFlags(string roText, string beforeRO, string afterRO, bool isSetpoint)
|
||||
private string DoROFormatFlags(string roText, string beforeRO, string afterRO, bool isSetpoint, string prevValue)
|
||||
{
|
||||
string rtnstr = roText;
|
||||
// The RO text is being changed to match it's context. Since it is changed in reverse order, the text before the RO
|
||||
// should ignore other RO text.
|
||||
beforeRO = Regex.Replace(beforeRO, @"\<START\].*?#Link:Refer.*?\[END\>", ""); // Remove any RO Values.
|
||||
beforeRO = Regex.Replace(beforeRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // Remove Comments
|
||||
string allUnitAfterRo = afterRO;
|
||||
afterRO = Regex.Replace(afterRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // Remove Comments
|
||||
|
||||
// Underline all ROs, values and Units
|
||||
@@ -1330,26 +1340,19 @@ namespace Volian.Controls.Library
|
||||
|
||||
//In a sequence of RO values, the unit appears with every value
|
||||
//(e.g., "25 gpm and 30 gpm" vs. "25 and 30 gpm")
|
||||
//if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits)
|
||||
//{
|
||||
// int idx = rtnstr.LastIndexOf(' ');
|
||||
// if (idx > 0)
|
||||
// {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// string lastunit = rtnstr.Substring(idx); // RO unit including preceeding space
|
||||
// int idx2 = rtnstr.IndexOf(lastunit);
|
||||
// int si = 0;
|
||||
// while (idx2 < idx)
|
||||
// {
|
||||
// sb.Append(rtnstr.Substring(si, idx2 - si));
|
||||
// si = idx2 + lastunit.Length;
|
||||
// idx2 = rtnstr.IndexOf(lastunit, si);
|
||||
// }
|
||||
// sb.Append(rtnstr.Substring(si));
|
||||
// rtnstr = sb.ToString();
|
||||
// }
|
||||
//}
|
||||
|
||||
if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits && prevValue != null)
|
||||
{
|
||||
string units = null;
|
||||
Match m = Regex.Match(prevValue, "[^0-9]");
|
||||
if (m.Success)
|
||||
{
|
||||
units = prevValue.Substring(m.Index);
|
||||
if (rtnstr.EndsWith(units))
|
||||
{
|
||||
rtnstr = rtnstr.Replace(units, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return rtnstr;
|
||||
}
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user