This commit is contained in:
parent
2c62440347
commit
0b14d49c78
@ -269,6 +269,24 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool IsDefaultSection
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// check to see if ActiveParent is a section, if so it is a high level step
|
||||||
|
if (MyContent.Type / 10000 != 1) return false;
|
||||||
|
// get procedure section and then
|
||||||
|
ItemInfo parent = (ItemInfo)ActiveParent;
|
||||||
|
if (!parent.IsProcedure) return false;
|
||||||
|
ProcedureConfig pc = (ProcedureConfig)parent.MyConfig;
|
||||||
|
int sectstartid = -1;
|
||||||
|
string ss = pc == null ? null : pc.SectionStart;
|
||||||
|
if (ss != null) sectstartid = System.Convert.ToInt32(ss);
|
||||||
|
else return false;
|
||||||
|
if (ItemID == sectstartid) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
public bool IsProcedure
|
public bool IsProcedure
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -6,70 +6,110 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
public partial class TransitionInfo
|
public partial class TransitionInfo
|
||||||
{
|
{
|
||||||
|
private StringBuilder retstr;
|
||||||
|
private FormatData _MyFormatData = null;
|
||||||
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, ItemInfo toitem, ItemInfo rangeitem)
|
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, ItemInfo toitem, ItemInfo rangeitem)
|
||||||
{
|
{
|
||||||
StringBuilder retstr = new StringBuilder();
|
retstr = new StringBuilder();
|
||||||
// get the format of the transition string based on this transition's index into the TransData part of
|
// get the format of the transition string based on this transition's index into the TransData part of
|
||||||
// format....
|
// format....
|
||||||
string tranformat = fi.PlantFormat.FormatData.TransData.TransTypeList[TranType].TransFormat;
|
_MyFormatData = fi.PlantFormat.FormatData;
|
||||||
E_TransUI etm = (E_TransUI)fi.PlantFormat.FormatData.TransData.TransTypeList[TranType].TransUI;
|
string tranformat = _MyFormatData.TransData.TransTypeList[TranType].TransFormat;
|
||||||
|
E_TransUI etm = (E_TransUI)_MyFormatData.TransData.TransTypeList[TranType].TransUI;
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
string nontoken = null;
|
||||||
while ((index = tranformat.IndexOf("{", startIndex))>-1)
|
while ((index = tranformat.IndexOf("{", startIndex))>-1)
|
||||||
{
|
{
|
||||||
// Append any non-token text that preceeds the token.
|
if (index > startIndex) nontoken = tranformat.Substring(startIndex, index - startIndex);
|
||||||
string remstptext = null;
|
|
||||||
if (index > startIndex)
|
|
||||||
{
|
|
||||||
retstr.Append(tranformat.Substring(startIndex, index-startIndex));
|
|
||||||
remstptext = tranformat.Substring(startIndex, index-startIndex);
|
|
||||||
}
|
|
||||||
int endtokn = tranformat.IndexOf("}", index);
|
int endtokn = tranformat.IndexOf("}", index);
|
||||||
string token = tranformat.Substring(index, endtokn - index + 1);
|
string token = tranformat.Substring(index, endtokn - index + 1);
|
||||||
switch (token)
|
switch (token)
|
||||||
{
|
{
|
||||||
case "{Proc Num}":
|
case "{Proc Num}": // Coded for HLP
|
||||||
retstr.Append(toitem.MyProcedure.MyContent.Number);
|
AddTransitionProcNum(nontoken, toitem);
|
||||||
break;
|
break;
|
||||||
case "{Proc Title}":
|
case "{Proc Title}": // Coded for HLP
|
||||||
if (fi.PlantFormat.FormatData.XtraOptions("CapsTransitions"))
|
AddTransitionProcTitle(nontoken, toitem);
|
||||||
retstr.Append(toitem.MyProcedure.MyContent.Text.ToUpper());
|
|
||||||
else
|
|
||||||
retstr.Append(toitem.MyProcedure.MyContent.Text);
|
|
||||||
break;
|
break;
|
||||||
case "{First Step}": // TODO: LowerCaseTranNumber - lower case substep numbers in transitions
|
case "{First Step}": // TODO: For hlp: LowerCaseTranNumber - lower case substep numbers in transitions
|
||||||
// If we're on a step put out the step number.
|
// If we're on a step put out the step number.
|
||||||
ItemInfo secitm = TranGetSectionItem(toitem);
|
ItemInfo secitm = TranGetSectionItem(toitem);
|
||||||
if ((!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || toitem.MyContent.Type >20000)
|
if ((!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || toitem.MyContent.Type > 20000)
|
||||||
retstr.Append(toitem.Ordinal.ToString());
|
|
||||||
else // if the word 'step' or ',' preceeds this template & there is no step, remove it.
|
|
||||||
{
|
{
|
||||||
if (remstptext != null)
|
Append(nontoken, false);
|
||||||
{
|
Append(toitem.Ordinal.ToString(), true);
|
||||||
int len = remstptext.Length;
|
|
||||||
retstr.Remove(retstr.Length-len,len);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "{Last Step}": // TODO: TStepNoFlag, i.e. include step number in range items.
|
case "{Last Step}": // TODO: TStepNoFlag, i.e. include step number in range items.
|
||||||
retstr.Append(rangeitem.Ordinal.ToString());
|
Append(nontoken, false);
|
||||||
|
Append(rangeitem.Ordinal.ToString(), true);
|
||||||
break;
|
break;
|
||||||
case "{.}": // TODO: TStepNoFlag, i.e. include step number in range items.
|
case "{.}": // TODO: TStepNoFlag, i.e. include step number in range items.
|
||||||
retstr.Append("#"); // TODO: Intermediate Range.
|
Append(nontoken, false);
|
||||||
|
Append("#", true); // TODO: Intermediate Range.
|
||||||
break;
|
break;
|
||||||
case "{Sect Hdr}":
|
case "{Sect Hdr}":
|
||||||
retstr.Append(TranGetSectionHdr(toitem));
|
AddTranGetSectionHdr(nontoken, toitem);
|
||||||
break;
|
break;
|
||||||
case "{Sect Title}":
|
case "{Sect Title}":
|
||||||
retstr.Append(TranGetSectionTitle(toitem));
|
AddTranGetSectionTitle(nontoken, toitem);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
startIndex = endtokn+1;
|
startIndex = endtokn+1;
|
||||||
if (startIndex >= tranformat.Length) break;
|
if (startIndex >= tranformat.Length) break;
|
||||||
}
|
}
|
||||||
if (startIndex < tranformat.Length) retstr.Append(tranformat.Substring(startIndex, tranformat.Length - startIndex - 1));
|
if (startIndex < tranformat.Length) Append(tranformat.Substring(startIndex, tranformat.Length - startIndex - 1), false);
|
||||||
return (retstr.ToString());
|
return (retstr.ToString());
|
||||||
}
|
}
|
||||||
|
private void Append(string str, bool doflags)
|
||||||
|
{
|
||||||
|
if (str == null || str == "") return;
|
||||||
|
if (doflags && _MyFormatData.TransData.XchngTranSpForHard)
|
||||||
|
{
|
||||||
|
int indx = str.IndexOf(' ');
|
||||||
|
if (indx > -1)
|
||||||
|
{
|
||||||
|
str.Remove(indx, 1);
|
||||||
|
str.Insert(indx, @"\u160?");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retstr.Append(str);
|
||||||
|
}
|
||||||
|
private void AddTransitionProcTitle(string nontoken, ItemInfo toitem)
|
||||||
|
{
|
||||||
|
string parenstr = toitem.MyProcedure.MyContent.Text;
|
||||||
|
StringBuilder lretstr = new StringBuilder();
|
||||||
|
// LATER: For an else - Do I need to strip underlining here? See promsnt\lib\edit\gettran.c
|
||||||
|
if (parenstr != "<NO TITLE>" || _MyFormatData.ProcData.PrintNoTitle)
|
||||||
|
{
|
||||||
|
lretstr.Append(_MyFormatData.TransData.DelimiterForTransitionTitle);
|
||||||
|
lretstr.Append(_MyFormatData.TransData.CapsTransitions ? parenstr.ToUpper() :
|
||||||
|
_MyFormatData.TransData.Cap1stCharTrans ? CapFirstLetterOnly(parenstr, 0) :
|
||||||
|
parenstr);
|
||||||
|
lretstr.Append(_MyFormatData.TransData.DelimiterForTransitionTitle);
|
||||||
|
}
|
||||||
|
// LATER: if (DoSectionTransitions && GetSTepNO(TSeq1)) TransitionCat(AddCommaStep", Step"));
|
||||||
|
if (nontoken != null) Append(nontoken, false);
|
||||||
|
Append(lretstr.ToString(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CapFirstLetterOnly(string retstr, int p)
|
||||||
|
{
|
||||||
|
string lretstr = retstr;
|
||||||
|
// LATER: write code to capitalize first letter (active plants)
|
||||||
|
return lretstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTransitionProcNum(string nontoken, ItemInfo toitem)
|
||||||
|
{
|
||||||
|
string retstr = toitem.MyProcedure.MyContent.Number;
|
||||||
|
// LATER: start with UnitSpecific procedure number.
|
||||||
|
// LATER: Format Flag TruncateProcNmAfter1stSpace (dropped plants)
|
||||||
|
// LATER: Format Flag HardSpTranProcNumb (active plants)
|
||||||
|
if (nontoken != null) Append(nontoken, false);
|
||||||
|
Append(retstr, true);
|
||||||
|
}
|
||||||
// TODO: Section methods are not complete....
|
// TODO: Section methods are not complete....
|
||||||
private ItemInfo TranGetSectionItem(ItemInfo itminfo)
|
private ItemInfo TranGetSectionItem(ItemInfo itminfo)
|
||||||
{
|
{
|
||||||
@ -77,20 +117,42 @@ namespace VEPROMS.CSLA.Library
|
|||||||
while (tmpitm.MyContent.Type >= 20000) tmpitm = tmpitm.MyParent;
|
while (tmpitm.MyContent.Type >= 20000) tmpitm = tmpitm.MyParent;
|
||||||
return tmpitm;
|
return tmpitm;
|
||||||
}
|
}
|
||||||
private string TranGetSectionHdr(ItemInfo itminfo)
|
private void AddTranGetSectionHdr(string nontoken, ItemInfo itminfo)
|
||||||
|
{
|
||||||
|
// if this is a step section & the default section, just return
|
||||||
|
if (TranGetSectionItem(itminfo).IsDefaultSection) return;
|
||||||
|
StringBuilder retstr = new StringBuilder();
|
||||||
|
retstr.Append(TranGetSectionNumber(itminfo));
|
||||||
|
string txt = TranGetSectionTitle(itminfo);
|
||||||
|
if (retstr.Length>0 && txt.Length>0) retstr.Append(", ");
|
||||||
|
retstr.Append(txt);
|
||||||
|
Append(nontoken, false);
|
||||||
|
Append(retstr.ToString(), true);
|
||||||
|
}
|
||||||
|
private string TranGetSectionNumber(ItemInfo itminfo)
|
||||||
{
|
{
|
||||||
ItemInfo tmpitm = TranGetSectionItem(itminfo);
|
ItemInfo tmpitm = TranGetSectionItem(itminfo);
|
||||||
StringBuilder retstr = new StringBuilder();
|
return (tmpitm.MyContent.Number);
|
||||||
retstr.Append(tmpitm.MyContent.Number);
|
|
||||||
if (tmpitm.MyContent.Number != null && tmpitm.MyContent.Number != "" && tmpitm.MyContent.Text != null && tmpitm.MyContent.Text != "") retstr.Append(" ");
|
|
||||||
retstr.Append(tmpitm.MyContent.Text);
|
|
||||||
return (retstr.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string TranGetSectionTitle(ItemInfo itminfo)
|
private string TranGetSectionTitle(ItemInfo itminfo)
|
||||||
{
|
{
|
||||||
ItemInfo tmpitm = TranGetSectionItem(itminfo);
|
// LATER: Cap1stSectionTitle, CapFirstLetterOnly
|
||||||
return (tmpitm.MyContent.Text);
|
if (_MyFormatData.TransData.UseSecTitles)
|
||||||
|
{
|
||||||
|
ItemInfo tmpitm = TranGetSectionItem(itminfo);
|
||||||
|
return (tmpitm.MyContent.Text);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
private void AddTranGetSectionTitle(string nontoken, ItemInfo itminfo)
|
||||||
|
{
|
||||||
|
// LATER: Cap1stSectionTitle, CapFirstLetterOnly
|
||||||
|
if (_MyFormatData.TransData.UseSecTitles)
|
||||||
|
{
|
||||||
|
string txt = TranGetSectionTitle(itminfo);
|
||||||
|
if (txt.Length>0)Append(nontoken, false);
|
||||||
|
Append(txt, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public string PathTo
|
public string PathTo
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user