Calvert: for VALTYPE & STARTUP page list tokens, if there are no steps in section, check for 1st subsection steps

only change availability of notes/cautions if in the Calvert Alarm format when checking if IsInCalvertConditionResponse
This commit is contained in:
Kathy Ruffing 2014-12-05 15:22:47 +00:00
parent 27c8d89bed
commit 298354f4fd
2 changed files with 65 additions and 29 deletions

View File

@ -450,7 +450,8 @@ namespace Volian.Controls.Library
btnCMInsHLS.Enabled = btnCMInsRNO.Enabled = btnCMInsSubStps.Enabled = btnCMInsCaution.Enabled =
btnCMInsNote.Enabled = btnCMInsTable.Enabled = btnCMInsFigure.Enabled = allow;
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = allow && !MyItemInfo.IsInCalvertConditionResponse;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = allow && !MyItemInfo.IsInCalvertConditionResponse;
}
void MyFlexGrid_SelChange(object sender, EventArgs e)
@ -879,7 +880,8 @@ namespace Volian.Controls.Library
btnInsCaut.Enabled = true;
}
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = setting && !MyItemInfo.IsInCalvertConditionResponse;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = setting && !MyItemInfo.IsInCalvertConditionResponse;
}
private void SetButtonAndMenuEnabling(bool docontextmenus)
{
@ -1208,7 +1210,8 @@ namespace Volian.Controls.Library
btnInsTrans.Enabled = btnCMTransition.Enabled = btnInsRO.Enabled = btnCMRO.Enabled = true;
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = !MyItemInfo.IsInCalvertConditionResponse;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = !MyItemInfo.IsInCalvertConditionResponse;
_RibbonControl.Refresh(); // jsj- added this because Table Design ribbon tab grouping was not going away when not on a table step type
}

View File

@ -1575,38 +1575,51 @@ namespace Volian.Print.Library
plstr = plstr.Replace(token, HLSText);
break;
case "{VALTYPE}":
ItemInfo firstHigh = section.Steps[0];
int typ = (int)firstHigh.MyContent.Type - 20000;
switch (typ)
ItemInfo firstHigh = ValveGetFirstStep(section);
if (firstHigh != null)
{
case 2:
plstr = plstr.Replace(token, "VALVE");
break;
case 9:
plstr = plstr.Replace(token, "SWITCH");
break;
case 3:
plstr = plstr.Replace(token, "BREAKER");
break;
int typ = (int)firstHigh.MyContent.Type - 20000;
switch (typ)
{
case 2:
plstr = plstr.Replace(token, "VALVE");
break;
case 9:
plstr = plstr.Replace(token, "SWITCH");
break;
case 3:
plstr = plstr.Replace(token, "BREAKER");
break;
default:
plstr = plstr.Replace(token, "");
break;
}
}
else
plstr = plstr.Replace(token, "");
break;
case "{STARTUP}":
ItemInfo firstHighs = section.Steps[0];
int typs = (int)firstHighs.MyContent.Type - 20000;
switch (typs)
ItemInfo firstHighs = ValveGetFirstStep(section);
if (firstHighs != null)
{
case 2:
// the following test for OI-3A came from 16bit code:
if (section.MyProcedure.MyContent.Number.ToUpper().Equals("OI-3A"))
plstr = plstr.Replace(token, " SDC/");
else
plstr = plstr.Replace(token, "STARTUP/");
break;
case 9:
case 3:
plstr = plstr.Replace(token, "");
break;
int typs = (int)firstHighs.MyContent.Type - 20000;
switch (typs)
{
case 2:
// the following test for OI-3A came from 16bit code:
string num = section.MyProcedure.MyContent.Number.ToUpper().Replace(@"\U8209?", "-");
if (num.Equals("OI-3A"))
plstr = plstr.Replace(token, " SDC/");
else
plstr = plstr.Replace(token, "STARTUP/");
break;
default:
plstr = plstr.Replace(token, "");
break;
}
}
else
plstr = plstr.Replace(token, "");
break;
case "{PROCDES}":
ProcDescrList pdl = section.ActiveFormat.PlantFormat.FormatData.PrintData.ProcDescrList;
@ -1813,6 +1826,26 @@ namespace Volian.Print.Library
return retval;
}
private static ItemInfo ValveGetFirstStep(VEPROMS.CSLA.Library.SectionInfo section)
{
ItemInfo firstHigh = null;
if (section.Steps == null || section.Steps.Count == 0)
{
// see if there is a 1st subsection with a step. The formats must match
// if this is true, use that step. Otherwise just clear the token.
if (section.Sections != null && section.Sections.Count > 0 &&
section.Sections[0].Steps != null || section.Sections[0].Steps.Count != 0)
{
if (section.ActiveFormat.FormatID == section.Sections[0].ActiveFormat.FormatID &&
section.MyContent.Type == section.Sections[0].MyContent.Type)
firstHigh = section.Sections[0].Steps[0];
}
}
else
firstHigh = section.Steps[0];
return firstHigh;
}
private string GetAttachNum1()
{
int cnt = 0;