For range transitions, don’t put ‘, Step’ in text twice if there is an optional section number

Added underline flag for transition text
Added support for underline flag for transition text and fixed bug where replace words that had underline on/off for ‘OR’ turned off underlining in transition text
If selectedindex for section list was -1, set to 0 and refresh the section list
This commit is contained in:
Kathy Ruffing 2014-03-10 12:44:48 +00:00
parent bedb5288a0
commit 7530ca00f3
4 changed files with 28 additions and 4 deletions

View File

@ -461,6 +461,11 @@ namespace VEPROMS.CSLA.Library
}
else if (_TranType == 4 && _ToItem.MoreThanOneStepSection())
{
if (!HasText && Prefix != null && Prefix.ToUpper().StartsWith(", STEP"))
{
_Prefix = null;
return;
}
_Results.Append(Prefix);
_Prefix = null;
}

View File

@ -5212,6 +5212,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _CapTranStep, "@CapTranStep");
}
}
private LazyLoad<bool> _Underline;
public bool Underline
{
get
{
return LazyLoad(ref _Underline, "@Underline");
}
}
private LazyLoad<bool> _TStepNoFlag;
public bool TStepNoFlag
{

View File

@ -482,6 +482,7 @@ namespace Volian.Controls.Library
}
private string DoTransitionAdjustments(string text, bool boldTran)
{
bool undtran = _MyItemInfo.ActiveFormat.PlantFormat.FormatData.TransData.Underline;
string strippedText = StaticStripRtfCommands(text);
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v \\u]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):[0-9]* ([0-9]*).*?\[END>");
MatchCollection matches = Regex.Matches(text, lookFor);
@ -516,10 +517,10 @@ namespace Volian.Controls.Library
// Use a "\x1" as a token to replace later. Insert the unicode char, whose length is
// more than 1 character was throwing of the regexp Matches index, so that the resulting
// string may have been incorrect.
retstr = beforeTran + (boldTran ? @"\b " : null) + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + (boldTran ? @"\b0" : null) + afterTran;
retstr = beforeTran + (boldTran ? @"\b " : null) + (undtran ? @"\ul " : null) + newvalue.Substring(0, indexLastSpace) + "\x1" + newvalue.Substring(indexLastSpace + 1) + (undtran ? @"\ulnone " : null) + (boldTran ? @"\b0" : null) + afterTran;
else
if (beforeTran.EndsWith(" "))
retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + (boldTran ? @"\b " : null) + newvalue + (boldTran ? @"\b0" : null) + afterTran;
retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + (boldTran ? @"\b " : null) + (undtran ? @"\ul " : null) + newvalue + (undtran? @"\ulnone ":null) + (boldTran ? @"\b0" : null) + afterTran;
else
Console.Write("");// Don't know where to put the Hard Space
}
@ -1829,7 +1830,16 @@ namespace Volian.Controls.Library
with = with.Replace(@"\b ","");
with = with.Replace(@"\b0 ","");
}
if (((_Font.Style & E_Style.Underline) == E_Style.Underline) && with.Contains(@"\ul "))
bool IsUnderline = (((_Font.Style & E_Style.Underline) == E_Style.Underline) && with.Contains(@"\ul "));
// handle where replace words replaces a string with 'underline on'string'underline off', for example Point Beach
// had replaced OR's turning underline off in the middle of a transition, "EOP-0 UNIT 1, RACTORE TRIP OR SAFETY INJECTION".
if (!IsUnderline)
{
int repidxst = text.LastIndexOf(@"\ul ", foundMatch.MyMatch.Index);
int repidxend = text.IndexOf(@"\ulnone", foundMatch.MyMatch.Index + foundMatch.MyMatch.Length);
if (repidxst > -1 && repidxend > -1 && repidxst < foundMatch.MyMatch.Index && repidxend > (foundMatch.MyMatch.Index + foundMatch.MyMatch.Length)) IsUnderline = true;
}
if (IsUnderline)
{
with = with.Replace(@"\ul ", "");
with = with.Replace(@"\ulnone ", "");

View File

@ -483,7 +483,8 @@ namespace Volian.Controls.Library
if (secitm.Sections != null && secitm.Sections.Count > 0) cbTranSectsFillIn(secitm.Sections[0], secstart, false);
secitm = (secitm.NextItem != null && secitm.NextItems.Count > 0 ? secitm.NextItems[0] : null);
}
if (cbTranSects.SelectedIndex == -1) cbTranSects.SelectedIndex = 0;
cbTranSects.Refresh();
}
private void cbTranProcsFillIn(ItemInfo prcitm)
{