This commit is contained in:
Kathy Ruffing 2013-02-01 14:56:34 +00:00
parent 87956b4b42
commit 3679bcbae2

View File

@ -2294,12 +2294,31 @@ namespace VEPROMS.CSLA.Library
// If we have metasections AND... // If we have metasections AND...
// If the seqtabs for this given level does not get a section number, use the seqtab rather than // If the seqtabs for this given level does not get a section number, use the seqtab rather than
// the ident of the step: // the ident of the step:
bool useSubStepTabs = false; bool useSubStepTabs = false;
if (doMeta && IsHigh && !seqtabs[(localPrintLevel<0?0:localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")) useSubStepTabs = true; if (doMeta && IsHigh && !seqtabs[(localPrintLevel<0?0:localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")) useSubStepTabs = true;
// Check to be sure the parent tab should be included... If this sequential is within a note
// or caution or equipment list, don't use parent tab AND always start the numbering as a numeric
if (doMeta && IsSequential && (InNote() || InCaution() || MyParent.IsEquipmentList))
{
// if immediate parent is note, caution or equip, use numeric, otherwise use alpha.
localPrintLevel = 0;
int lv = 0;
ItemInfo ii = MyParent;
while (!ii.IsCaution && !ii.IsNote && !ii.IsEquipmentList)
{
lv++;
ii = ii.MyParent;
}
lv = lv % 2;
tbformat = (lv == 0) ? "{numeric}." : "{alpha}.";
}
if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1) if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1)
{ {
int itmp = (localPrintLevel + PrintBias) % seqtabs.Count; int itmp = (localPrintLevel + PrintBias) % seqtabs.Count;
if (!tbformat.Contains("C0")) if (!tbformat.Contains(@"{!C"))
tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc. tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc.
else else
tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat); tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat);
@ -2313,6 +2332,7 @@ namespace VEPROMS.CSLA.Library
// so that when the above code ran to reset the tab, it would crash because the // so that when the above code ran to reset the tab, it would crash because the
// printlevel was not recalculated. // printlevel was not recalculated.
PrintLevel = 0; PrintLevel = 0;
// If token includes 'Wpar', the parent tab prefix's the tab. // If token includes 'Wpar', the parent tab prefix's the tab.
if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1)) if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1))
{ {
@ -2327,9 +2347,12 @@ namespace VEPROMS.CSLA.Library
myparent = myparent.ActiveParent as ItemInfo; myparent = myparent.ActiveParent as ItemInfo;
} }
} }
else if (myparent.IsSection || myparent.IsHigh || myparent.IsSequential)
{
parentTab = myparent.MyTab.CleanText.Trim(); parentTab = myparent.MyTab.CleanText.Trim();
tbformat = parentTab + (parentTab.EndsWith(".") ? "" : ".") + tbformat.TrimStart(); tbformat = parentTab + (parentTab.EndsWith(".") ? "" : ".") + tbformat.TrimStart();
} }
}
if (tbformat.IndexOf("#2#") > -1 || tbformat.IndexOf("#1#") > -1) if (tbformat.IndexOf("#2#") > -1 || tbformat.IndexOf("#1#") > -1)
{ {
string ofst = tbformat.Substring(0, 3); string ofst = tbformat.Substring(0, 3);
@ -2362,12 +2385,12 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : ordinal.ToString().PadLeft(2)); tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString()); tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
tbformat = tbformat.Replace("{asterisk}", "*"); tbformat = tbformat.Replace("{asterisk}", "*");
if (tbformat.IndexOf("{!C0}") > -1) int macroindx = tbformat.IndexOf("{!C");
if (macroindx > -1)
{ {
cltext = cltext == null ? tbformat.Replace("{!C0}", "") : cltext.Replace("{!C0}", ""); cltext = cltext == null ? tbformat.Remove(macroindx, 5) : cltext.Remove(macroindx, 5);
cltext = cltext + " "; cltext = cltext + " ";
} }
// "{Null}" was introduced so that inheritance in format files could differentiate between an // "{Null}" was introduced so that inheritance in format files could differentiate between an
// empty string, and null. And also, so that if a tab was null but it's parent had text in the // empty string, and null. And also, so that if a tab was null but it's parent had text in the
// tab, don't inherit the parent's tab, use a null. // tab, don't inherit the parent's tab, use a null.
@ -2415,6 +2438,30 @@ namespace VEPROMS.CSLA.Library
_MyTab.CleanText = cltext != null ? cltext : tbformat; _MyTab.CleanText = cltext != null ? cltext : tbformat;
} }
private bool InCaution()
{
// walk up until procedure level and if finding a caution type, return true, otherwise false.
ItemInfo ii = this.MyParent;
while (ii != null && !ii.IsProcedure)
{
if (ii.IsCaution) return true;
ii = ii.MyParent;
}
return false;
}
private bool InNote()
{
// walk up until procedure level and if finding a note type, return true, otherwise false.
ItemInfo ii = this.MyParent;
while (ii != null && !ii.IsProcedure)
{
if (ii.IsNote) return true;
ii = ii.MyParent;
}
return false;
}
private string GetToken(string tbformat) private string GetToken(string tbformat)
{ {
int stindx = tbformat.IndexOf("{"); int stindx = tbformat.IndexOf("{");