This commit is contained in:
Kathy Ruffing 2011-08-24 11:51:11 +00:00
parent 0f98b74c9a
commit a19b72e4fe

View File

@ -295,6 +295,7 @@ namespace VEPROMS.CSLA.Library
public ItemInfo _RangeItem;
public bool _UsedRangeAncestor;
private string _Token;
public bool SectNumWithStepNum;
public string Token
{
get { return _Token; }
@ -329,8 +330,8 @@ namespace VEPROMS.CSLA.Library
int indx = str.IndexOf(' '); // 16 bit code only processes 1st occurance
if (indx > -1) // Not a while loop in 16 bit.
{ // (see \promsnt\lib\edit\gettran.c:TransitionCat)
str.Remove(indx, 1);
str.Insert(indx, @"\u160?");
str = str.Remove(indx, 1);
str = str.Insert(indx, @"\u160?");
}
}
return _Results.Append(str);
@ -418,11 +419,16 @@ namespace VEPROMS.CSLA.Library
int startIndex = 0;
int index = -1;
string prefix = null;
string prevToken = null;
bool lastAdded = false;
while ((index = tb._TransFormat.IndexOf("{", startIndex)) > -1)
{
string tmppref = prefix;
prefix = null;
if (index > startIndex) prefix = tb._TransFormat.Substring(startIndex, index - startIndex);
if (prefix == null) prevToken = null;
// if the last token did not add anything to the buffer, still want to put the text prefix in:
if (!lastAdded && prefix == null) prefix = tmppref;
if (startIndex == 0 && prefix != null && prefix.Length > 0)
{
tb.Append(prefix);
@ -430,6 +436,20 @@ namespace VEPROMS.CSLA.Library
}
int endtokn = tb._TransFormat.IndexOf("}", index);
string token = tb._TransFormat.Substring(index, endtokn - index + 1);
// we need to flag condition where the step number already has the section number in it. For example, Wolf Creek
// using WCN2, has some sections whose section number is 'D' and the step number is 'D1', or 'D2'. The resolved
// transition text was coming out as 'DD1'. The format's HLS tab format contains '{Section Prefix}' whose implementation
// adds the section number to the tab.
if (token.Contains("Sect Num") && tb._TransFormat.Length > endtokn + 1)
{
int nxtTokenS = tb._TransFormat.IndexOf("{", endtokn);
if (nxtTokenS > -1 && nxtTokenS == endtokn+1) // the {step} token has to immediately follow the section num token
{
int nxtTokenE = tb._TransFormat.IndexOf("}", nxtTokenS);
string nxtToken = tb._TransFormat.Substring(nxtTokenS, nxtTokenE - nxtTokenS + 1);
tb.SectNumWithStepNum = tb._ToItem.IsStep && nxtToken.Contains("Step") && tb._ToItem.MyHLS.FormatStepData.TabData.IdentEdit.Contains("{Section Prefix}");
}
}
if (token == "{.}" && tb._ToItem.ItemID == tb._RangeItem.ItemID)
{
startIndex = tb._TransFormat.Length; // skip the rest of the trans format
@ -447,6 +467,7 @@ namespace VEPROMS.CSLA.Library
else
tb.Append("\\" + token.Substring(0, token.Length - 1) + "\\}");
startIndex = endtokn + 1;
prevToken = token;
if (startIndex >= tb._TransFormat.Length) break;
}
if (startIndex < tb._TransFormat.Length) tb.Append(tb._TransFormat.Substring(startIndex, tb._TransFormat.Length - startIndex - 1));
@ -696,6 +717,7 @@ namespace VEPROMS.CSLA.Library
private static bool AddOptionalTranGetSectionNum(TransitionBuilder tb)
{
if (TranGetSectionItem(tb._FromItem).ItemID == TranGetSectionItem(tb._ToItem).ItemID) return false;
if (tb.SectNumWithStepNum) return false;
if (tb._ToItem.IsSection) return false;
tb.AppendPrefix();
string retstr = TranGetSectionNumber(tb._ToItem);
@ -717,6 +739,7 @@ namespace VEPROMS.CSLA.Library
private static bool AddTranGetSectionNumber(TransitionBuilder tb)
{
if (tb._TranType == 1 && tb._ToItem.ActiveSection.ItemID == tb._FromItem.ActiveSection.ItemID) return false;
if (tb.SectNumWithStepNum) return false;
if (tb._TranType == 0 && (tb._ToItem.IsSection || tb._ToItem.IsProcedure) && ((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone))
{
string tmpStr = tb.ToString();
@ -724,6 +747,15 @@ namespace VEPROMS.CSLA.Library
return true;
}
string retstr = TranGetSectionNumber(tb._ToItem);
if (retstr != null && retstr != "")
{
int indx = retstr.IndexOf(' '); // 16 bit code only processes 1st occurance
if (indx > -1) // Not a while loop in 16 bit.
{ // (see \promsnt\lib\edit\gettran.c:TransitionCat)
retstr = retstr.Remove(indx, 1);
retstr = retstr.Insert(indx, @"\u160?");
}
}
tb.AppendPrefix();
tb.ReplaceToken(retstr);
return (retstr != null && retstr != "");