Edit/Print tabs for Callaway Backgrounds

This commit is contained in:
Kathy Ruffing 2013-10-02 10:40:08 +00:00
parent cc188ce98f
commit 4b7c3ee5d8

View File

@ -2431,6 +2431,12 @@ namespace VEPROMS.CSLA.Library
}
int stepType = (int)(MyContent.Type % 10000);
string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint;
string tbformate = null; // need this for background documents, to generate tab for editing.
if (((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) &&
((IsHigh && FormatStepData.PageBreakOnStep) || (IsRNOPart && MyHLS.FormatStepData.PageBreakOnStep)))
tbformate = IsRNOPart ? MyHLS.FormatStepData.TabData.RNOIdentEdit : FormatStepData.TabData.IdentEdit;
if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL")
{
tbformat = FormatStepData.TabData.IdentEdit;
@ -2445,8 +2451,11 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.TrimStart(" ".ToCharArray());
}
if (tbformat.Contains("{LNK Step Num}"))
tbformat = tbformat.Replace("{LNK Step Num}", "STEP " + Ordinal.ToString() + ":");
tbformat = tbformat.Replace("{LNK Step Num}", Ordinal.ToString().PadLeft(2));
if (tbformate != null && tbformate.Contains("{LNK Step Num}"))
tbformate = tbformate.Replace("{LNK Step Num}", Ordinal.ToString());
}
// rno gets parent tab
if (IsRNOPart && FormatStepData.NumberSubs)
{
@ -2594,6 +2603,7 @@ namespace VEPROMS.CSLA.Library
string tmpsectpref = SectionPrefix(tbformat) ?? string.Empty;
if (ActiveSection.MyTab.CleanText != null && ActiveSection.MyTab.CleanText != "" && tmpsectpref != string.Empty) trimTabStart = true;
tbformat = tbformat.Replace("{Section Prefix}", SectionPrefix(tbformat));
if (tbformate != null) tbformate = tbformate.Replace("{Section Prefix}", SectionPrefix(tbformate));
}
int ordinal = Ordinal;
@ -2606,6 +2616,7 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.Replace("{roman}", roman.ToLower());
tbformat = tbformat.Replace("{ROMAN}", roman);
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
if (tbformate != null) tbformate = tbformate.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
if (tbformat.Contains("{asterisk}"))
{
@ -2668,12 +2679,12 @@ namespace VEPROMS.CSLA.Library
// also see if there is the 'pagelist' string in this tab:
HighLevelStepTabPageList = FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab) + tbformat;
_MyTab.AltPrintTab = newtab;
if (tbformate != null && tbformate != "") tbformat = tbformate;
}
}
_MyTab.Text = 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.
@ -3131,34 +3142,28 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region UseSmartTemplate
public int GetSmartTemplateIndex()
public int GetSmartTemplateTopLevelIndx()
{
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
int indx = 0;
// find the starting template in the list for the high level step type:
int highType = (int)MyHLS.MyContent.Type - 20001;
ItemInfo tmp = this;
while (!tmp.IsSection)
{
if (formatData.TopTemplateTypes.ContainsKey((int)tmp.MyContent.Type - 20001)) return formatData.TopTemplateTypes[(int)tmp.MyContent.Type - 20001];
tmp = tmp.MyParent;
}
return -1;
}
public int GetSmartTemplateIndex(int topIndx, int curStepType)
{
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
int indx = topIndx;
int curType = curStepType - 20001;
while (indx < formatData.Templates.Count)
{
// level of 0 starts a new group.
if (formatData.Templates[indx].level == 0)
{
indx++;
// now see if we're on the high level step type, if so, look under this one
// for the step type that we're on. If found return the index of it.
if (formatData.Templates[indx].type == highType)
{
if (MyHLS.ItemID == ItemID) return indx; // I'm on the HLS, return it.
indx++;
while (indx < formatData.Templates.Count && formatData.Templates[indx].level != 0)
{
if (formatData.Templates[indx].type == MyContent.Type - 20001)
return indx;
indx++;
}
}
}
else
indx++;
// now see if we're on the topType, if so, look under this one
// for the step type that we're on. If found return the index of it.
if (formatData.Templates[indx].type == curType) return indx;
indx++;
}
return -1; // didn't find this step type in the template width override list.
}