Support for Inactive document styles

Change ‘Count’ to ‘MaxIndex’ for ‘vlnIndexedFormatList’
Add Inactive flag
This commit is contained in:
2015-07-20 14:28:22 +00:00
parent bd75e47b8b
commit a98f4998da
5 changed files with 68 additions and 42 deletions

View File

@@ -1485,7 +1485,7 @@ namespace VEPROMS.CSLA.Library
if ((int)MyContent.Type < 20000) return false;
int stepType = ((int)MyContent.Type) % 10000;
StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList;
if (stepType > sdlist.Count)
if (stepType > sdlist.MaxIndex)
{
Console.WriteLine("Error getting type - contentid = {0}", MyContent.ContentID);
return false;
@@ -1503,7 +1503,7 @@ namespace VEPROMS.CSLA.Library
if ((int)MyContent.Type < 20000) return false;
int stepType = ((int)MyContent.Type) % 10000;
StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList;
if (stepType > sdlist.Count)
if (stepType > sdlist.MaxIndex)
{
Console.WriteLine("Error getting type - contentid = {0}", MyContent.ContentID);
return false;
@@ -3024,8 +3024,14 @@ namespace VEPROMS.CSLA.Library
{
int typ = (int)ActiveSection.MyContent.Type;
int subtyp = typ % 10000;
if (subtyp >= ActiveFormat.PlantFormat.DocStyles.DocStyleList.Count) return ActiveFormat.PlantFormat.DocStyles.DocStyleList[0];
if (ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp] == null)
foreach (DocStyle ds in ActiveFormat.PlantFormat.DocStyles.DocStyleList)
{
if (ActiveSection.MyContent.ContentEntryCount > 0 && !ds.IsStepSection) return _MyDocStyle = ds;
else if (ds.IsStepSection) return _MyDocStyle = ds;
}
_MyDocStyle = ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp];
}
return _MyDocStyle;
}
@@ -3335,7 +3341,7 @@ namespace VEPROMS.CSLA.Library
// the ident of the step:
bool useSubStepTabs = false;
if (doMeta && IsHigh
&& !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")
&& !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.MaxIndex].TabToken.Contains("{numericWpar}")
&& tbformat.Contains("{")) useSubStepTabs = true;
// Check to be sure the parent tab should be included... If this sequential is within a note
@@ -3374,12 +3380,12 @@ namespace VEPROMS.CSLA.Library
else if (tbformat != null && tbformat != "" && myParentIdent == "")
localPrintLevel += 5;
}
int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.Count;
int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.MaxIndex;
if (!tbformat.Contains(@"{!C"))
tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc.
else
tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat);
string tbtoken = seqtabs[localPrintLevel % seqtabs.Count].TabToken; // seqstart in 16bit, number/letter
string tbtoken = seqtabs[localPrintLevel % seqtabs.MaxIndex].TabToken; // seqstart in 16bit, number/letter
// if the tab has a character before the token, trim the front of tab:
int br = tbformat.IndexOf("{");
@@ -3427,7 +3433,7 @@ namespace VEPROMS.CSLA.Library
// the following prevents the concatenation of parent tabs onto this once the indenting is
// past the number of seqtabs.
if (localPrintLevel < seqtabs.Count || (PrintLevel < seqtabs.Count && seqtabs[PrintLevel].TabToken.ToUpper().Contains("WPAR")))
if (localPrintLevel < seqtabs.MaxIndex || (PrintLevel < seqtabs.MaxIndex && seqtabs[PrintLevel].TabToken.ToUpper().Contains("WPAR")))
{
ItemInfo mpar = myparent;
while (mpar != null && !mpar.IsSection && !mpar.IsHigh && !mpar.IsSequential) mpar = (mpar.MyParent as ItemInfo);
@@ -4291,7 +4297,7 @@ namespace VEPROMS.CSLA.Library
{
// first check if format has checkoff data, including checkoffheaders.
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) _SectionCheckOffHeader = string.Empty;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) _SectionCheckOffHeader = string.Empty;
else
{
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
@@ -4312,8 +4318,8 @@ namespace VEPROMS.CSLA.Library
// To determine if the section has a checkoff...
// Section won't have checkoffs if there is no checkofflist, or
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.Count <= 0) return false;
if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return true;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.MaxIndex <= 0) return false;
if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) return true;
//if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return false;
// To find whether the step has a checkoff, first check that the section
@@ -4343,7 +4349,7 @@ namespace VEPROMS.CSLA.Library
private int SectionDefaultCheckOffIndex()
{
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.Count == 2) return 0; // if only two items, first is macro - use it.
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.MaxIndex == 2) return 0; // if only two items, first is macro - use it.
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
return sc.Section_CheckoffListSelection;
}
@@ -4388,7 +4394,7 @@ namespace VEPROMS.CSLA.Library
get
{
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.Count == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && pd.CheckOffData.CheckOffList.MaxIndex == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
return true; // if only two items, first is macro - use it.
return false;
}
@@ -6191,7 +6197,7 @@ namespace VEPROMS.CSLA.Library
// It returns a -1 if not set or none exist.
public int CheckOffHeadingIndex()
{
if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList == null || ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList.Count == 0) return -1;
if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList == null || ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList.MaxIndex == 0) return -1;
SectionConfig sc = MyConfig as SectionConfig;
if (sc == null) return -1;
return sc.Section_CheckoffHeaderSelection;