diff --git a/PROMS/fmtxml/FmtFileToXml.cs b/PROMS/fmtxml/FmtFileToXml.cs index 20b63a9c..0631d061 100644 --- a/PROMS/fmtxml/FmtFileToXml.cs +++ b/PROMS/fmtxml/FmtFileToXml.cs @@ -577,8 +577,8 @@ public struct StepSection public byte IndentToken; public byte NumberOfHighLevelSteps; public byte NumberOfSubStepTypes; - public Int16 [] TextTypeValue; - public string[] TextType; + //public Int16[] TextTypeValue; + //public string[] TextType; public string IdentB; public string[] UnderlineTerminate; public string [] ObserveNCString1; @@ -787,9 +787,9 @@ public struct Step public int Index; public string Type; public string ParentType; + public string Inactive; public string StepTypeColOverride; public string Sep; - public string AlternateName; public string Prefix; public string Suffix; public string UnderlineTheseChar; @@ -866,6 +866,8 @@ public struct Edit public string ForeColor; public string BackColor; public string AcTable; + public string Searchable; + public TypeMenu TypeMenu; } [Flags] // acceptence list for adding Tables, Cautions, Notes, Substeps, Next, Previous and RNO @@ -880,6 +882,22 @@ public enum E_AccStep : uint AddingPrev = 64 } [Serializable] +public struct TypeMenu +{ + public string InMenu; // bool - list in menu if step is in Normal (Left-side) column + public string RnoInMenu; // bool - list in menu if step is in RNO (right-side) column + public string MenuItem; // for migration, if alternatename or rnoalternate name, use it, otherwise it's type + public string RnoMenuItem; // for migration, if alternatename or rnoalternate name, use it, otherwise it's type + public string NoChgReason; // if not in any menu, list reason for User Interface + public string AlternateNameList; // put indices of alternate types in a list (string) + //public AlternateName[] AlternateNames; // during migration from 16-bit, this is textype values +} +//[Serializable] +//public struct AlternateName +//{ +// public string Type; // Step Types that can be included/mixed in the menu (caution/notes) +//} +[Serializable] public struct Print { public string ForeColor; @@ -1273,17 +1291,18 @@ namespace fmtxml #endregion // use the following to define which step the AlternateStepType data is associated with. // i.e. look in new.def to determine the #defines for the original step type associated - // with the name of the define. + // with the name of the define. Note that all have been incremented by 1 since these are + // indices into the step list and we introduced 'Base' at index 0. // (ALT_HIGH, ALT_CONTINUOUS, ALT_IMMEDIATE, ALT_LOSSOFAC, ALT_HIGH5) - private int[] altsteps = { 1, 8, 2, 17, 40 }; + private int[] altsteps = {2, 9, 3, 18, 41}; // before increment of 1: { 1, 8, 2, 17, 40 }; // use the following to define which step the AlternateSubType data is associated with. // (see above) (ALT_STANDARD, ALT_AND, ALT_OR, ALT_EQUIPMENTLIST, ALT_EQUIPMENTWBLANK, ALT_EXPLICITAND - private int[] altsubsteps = {0, 3, 4, 10, 13, 18, + private int[] altsubsteps = {1, 4, 5, 11, 14, 19, // before increment of 1: {0, 3, 4, 10, 13, 18, // ALT_IMPLICITOR, ALT_PARAGRAPH, ALT_EQUIPMENTOPT, ALT_EQUIPMENTOPTWBLANK, ALT_TITLEWITHTEXTRIGHT - 34, 23, 29, 30, 41, + 35, 24, 30, 31, 42, // before increment of 1: 34, 23, 29, 30, 41, // ALT_TITLEWITHTEXTBELOW, ALT_CONTACSEQUENTIAL, ALT_CONTACAND, ALT_CONTACOR, ALT_CONTACPARAGRAPH - 42, 43, 44, 45, 46}; + 43, 44, 45, 46, 47}; // before increment of 1: 42, 43, 44, 45, 46}; private string[] StepTypes = { "Base", "Substep","High","Immediate","And","Or","Caution","Note","Table","Continuous", @@ -1296,15 +1315,49 @@ namespace fmtxml "ContAcSequential","ContAcAnd","ContAcOr","ContAcParagraph" }; private string[] ParentTypes = { - "", "Base","Base","High","Base","Base","Base","Base","Base","High", - "Table","Base","Base","Title","EquipmentList","Title", + "", "Base","Base","High","Substep","Substep","Base","Base","Base","High", + "Table","Substep","Base","Title","EquipmentList","Title", "Title","Base","High","And","Caution","Caution", - "Note","Note","Base","Base","Note","Caution","Note","Caution", + "Note","Note","Substep","Substep","Note","Caution","Note","Caution", "EquipmentList","EquipmentWBlank","Note","AERTable","Table", - "Or","Table","Figure","Figure","AERFigure", - "Base","High","Title","Title", - "Base","And","Or","Paragraph" + "Or","Base","Figure","Figure","AERFigure", + "High","High","Title","Title", + "Substep","And","Or","Paragraph" }; + private string[] Inactive = { + "False", "False","False","False","False","False","False","False","False","False", + "False","False","False","True","False","True","True","True","False","False","False","False", + "False","False","False","True","False","False","False","False","False","False","False","False","False", + "False","False","False","False","False","False","False","False","False","False","False","False","False" + }; + private string[] Searchable = { + "False", "True", "True","True","True", "True", "True","True","True","True", + "True", "True", "False","False","True", "False","False","False","True","True","True","True", + "True","True","True","False","True","True","True","True","True","True","True","True","True", + "True","True","True","True","True","True","True","False","False","True","True","True","False" + }; + private string[] TypeMenuItem = { + "Base", "Substep", "Standard High Level Step","Immediate Action Step","AND", "OR", "Caution","Note","Centered Table","Continuous Action Step", + "AER Table", "Equipment List", "Title","Page Number","Equipment Preceded by Blank Line", "Procedure Number", + "Rev Number","Acc Pages","Boxed High Level Step","Explicit AND","Caution 1","Caution 2", + "Note 1","Note 2","Paragraph","Default","Note 3","Caution 3","Note 4","Caution 4", + "Optional Equipment List","Optional Equipment with Blank Line","Note 5","AER Table Without Border","Centered Table Without Border", + "Implicit OR","Centered","AER Figure","Centered Figure Without Border","AER Figure Without Border", + "RNO Type","Alternate High Level Step","Title With Text Right","Title With Text Below", + "Continuous Action Sequential","Continuous Action AND","Continuous Action OR","Continuous Action Paragraph" + }; + private string[] NoChangeTypeReason = { + "Base Type - No change at this level", null, null,null,null, null, null,null,null,null, + null, null, null,null,null, null,null,null,null,null,null,null,null,null,null,null,null,null,null,null, + null,null,null,null,null,null,null,null,null,null,"RNO - No change allowed",null,null,null, + null,null,null,null + }; + private string[] RnoInMenu = { + null, "True",null,null,"True","True",null,null,"True",null,"False","True",null,null,"True",null, + null,null,null,"True",null,null,null,null,"True",null,null,null,null,null,"True","True",null,"False","True", + "True","True","False","True","False","False",null,null,null,"True","True","True","True" + }; + /* * from the 16-bit code, the following step type attributes/strings were defined. This was found in \promnt\lib\edit\slectyp.c * High level types: @@ -1332,6 +1385,7 @@ namespace fmtxml * EQUIPMENTOPT,EQUIPMENTOPTWBLANK,CONTACSEQUENTIAL,CONTACAND,CONTACOR,CONTACPARAGRAPH,TITLEWITHTEXTRIGHT,TITLEWITHTEXTBELOW * */ + private string[] WinColors = { "black","blue","green","cyan","red","magenta", @@ -1408,7 +1462,8 @@ namespace fmtxml } BuildDictionaryText(); fmtName = nm; - //if (fmtName.ToUpper() != "FNPDEV" && fmtName.ToUpper() != "BASE") return; + //if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return; + //if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE") return; try { LoadFormatFile(nm + ".fmt", ref SubXtraFlags); @@ -2017,7 +2072,7 @@ namespace fmtxml { fmtdata.StepData[i].Type = StepTypes[i]; fmtdata.StepData[i].ParentType = ParentTypes[i]; - if (i>0)fmtdata.StepData[i].Font = LoadVE_Font(); + if (i > 0) fmtdata.StepData[i].Font = LoadVE_Font(); } fmtdata.StepData[0].Font = fmtdata.StepData[1].Font; for (int i = 1; i < MAXSTEPS+1; i++) @@ -2110,10 +2165,13 @@ namespace fmtxml for (int i = 1; i < MAXSTEPS + 1; i++) fmtdata.StepData[i].StepLayoutData.PageBreakAtTypeChange = (brFmt.ReadInt16()).ToString(); fmtdata.SectData.StepSectionData.StpSectLayData.LastLineToStartStep = RowToPoints(brFmt.ReadInt16()); - + /* To do TextTypeValue - not sure how this is used & where to store it, so temporarily read it in */ - fmtdata.SectData.StepSectionData.TextTypeValue = new Int16[10]; - for (int i = 0; i < 10; i++) fmtdata.SectData.StepSectionData.TextTypeValue[i] = brFmt.ReadInt16(); + //fmtdata.SectData.StepSectionData.TextTypeValue = new Int16[10]; + //for (int i = 0; i < 10; i++) fmtdata.SectData.StepSectionData.TextTypeValue[i] = brFmt.ReadInt16(); + + Int16[]TextTypeValue = new Int16[10]; + for (int i = 0; i < 10; i++) TextTypeValue[i] = brFmt.ReadInt16(); for (int i = 0; i < 10; i++) tmpint = brFmt.ReadInt32(); // DontPrintInSection - not used. @@ -2577,14 +2635,70 @@ namespace fmtxml // not used: xtitle[3][10] - skip 30 arcnt = arcnt + 30; - fmtdata.SectData.StepSectionData.TextType = new string[10]; - for (int i = 0; i < 10; i++) - { - indx = offset[arcnt]; - arcnt++; - if (indx > 0) fmtdata.SectData.StepSectionData.TextType[i] = GetStringFromByte(input, indx); - } + for (int i = 0; i < MAXSTEPS + 1; i++) + { + fmtdata.StepData[i].Inactive = Inactive[i]; + fmtdata.StepData[i].StepEditData.Searchable = Searchable[i]; + fmtdata.StepData[i].StepEditData.TypeMenu.MenuItem = TypeMenuItem[i]; + fmtdata.StepData[i].StepEditData.TypeMenu.InMenu = (fmtdata.StepData[i].Type == "RNOType" || fmtdata.StepData[i].Type == "Base") ? false.ToString() : true.ToString(); + // Set all caution/note 'InMenu' to false except basic caution/note, types 6 & 7. Use the AlternateNameList to set them to true. + if (i == 20 || i == 21 || i == 22 || i == 23 || i == 26 || i == 27 || i == 28 || i == 29 || i == 32) fmtdata.StepData[i].StepEditData.TypeMenu.InMenu = false.ToString(); + + fmtdata.StepData[i].StepEditData.TypeMenu.NoChgReason = NoChangeTypeReason[i]; + fmtdata.StepData[i].StepEditData.TypeMenu.RnoInMenu = RnoInMenu[i]; + if (fmtdata.StepData[i].Type == "Table" || fmtdata.StepData[i].Type == "Figure") + //{ + //fmtdata.StepData[i].StepEditData.TypeMenu.RnoInMenu = true.ToString(); + fmtdata.StepData[i].StepEditData.TypeMenu.RnoMenuItem = "With Border"; + //} + else if (fmtdata.StepData[i].Type == "BorderlessTable" || fmtdata.StepData[i].Type == "BorderlessFigure") + //{ + //fmtdata.StepData[i].StepEditData.TypeMenu.RnoInMenu = true.ToString(); + fmtdata.StepData[i].StepEditData.TypeMenu.RnoMenuItem = "Without Border"; + //} + //else if (fmtdata.StepData[i].Type == "AERTable" || fmtdata.StepData[i].Type == "BorderlessAERTable" || fmtdata.StepData[i].Type == "AERFigure" || fmtdata.StepData[i].Type == "BorderlessAERFigure") + // fmtdata.StepData[i].StepEditData.TypeMenu.RnoInMenu = false.ToString(); + } + // fmtdata.SectData.StepSectionData.TextType = new string[10]; + // Set up the text type fields - these are used to define what types of steps the current step + // can be changed to.. + string tmpalternateindx = null; + int [] tmparray={0,0,0,0,0,0,0,0,0,0}; + for (int i = 0; i < 10; i++) + { + + indx = offset[arcnt]; + arcnt++; + if (indx > 0) + { + string tmpstring = GetStringFromByte(input, indx); + // put this in the step data alternatename field. If there already is one. stop + // here for now to see this!. + if (fmtdata.StepData[TextTypeValue[i] + 1].StepEditData.TypeMenu.MenuItem != null && fmtdata.StepData[TextTypeValue[i] + 1].StepEditData.TypeMenu.MenuItem != tmpstring) + Console.WriteLine("different name, " + fmtdata.StepData[TextTypeValue[i] + 1].StepEditData.TypeMenu.MenuItem + ", " + tmpstring); + fmtdata.StepData[TextTypeValue[i]+1].StepEditData.TypeMenu.MenuItem = tmpstring; + + tmpalternateindx = (tmpalternateindx == null) ? fmtdata.StepData[TextTypeValue[i] + 1].Type : tmpalternateindx + "," + fmtdata.StepData[TextTypeValue[i] + 1].Type; + //fmtdata.SectData.StepSectionData.TextType[i] = GetStringFromByte(input, indx); + } + + } + if (tmpalternateindx != null) + { + // For any step types in the texttypevalue list, add the alternatename list: + for (int i = 0; i < 10; i++) + { + // this was only used for cautions/notes - so only add if texttypevalue isn't 0, 0 was substep and it + // was getting set for substeps, that can never have an alternate type - at least from + // format->xml migration. + if (TextTypeValue[i] != 0) + { + fmtdata.StepData[TextTypeValue[i] + 1].StepEditData.TypeMenu.AlternateNameList = tmpalternateindx; + fmtdata.StepData[TextTypeValue[i] + 1].StepEditData.TypeMenu.InMenu = true.ToString(); + } + } + } // not used, SectionsToPrint - 10; SectionNumberMask - 10; SectionsToPrintTitle - 10; // DocumentTitleExtensions - 10; DocumentFixFileExtensions - 10; @@ -2634,15 +2748,17 @@ namespace fmtxml { indx = offset[arcnt]; arcnt++; - if (indx > 0) fmtdata.StepData[altsteps[i]].AlternateName = GetStringFromByte(input, indx); - } - - for (int i = 0; i < 16; i++) - { - indx = offset[arcnt]; - arcnt++; - if (indx > 0) fmtdata.StepData[this.altsubsteps[i]].AlternateName = GetStringFromByte(input, indx); + if (indx > 0) fmtdata.StepData[TextTypeValue[i]].StepEditData.TypeMenu.MenuItem = GetStringFromByte(input, indx); } + string mytmp = null; + //KBR TODO: is this still needed???? + for (int i = 0; i < 16; i++) + { + indx = offset[arcnt]; + arcnt++; + // KBR TODO: - Not sure what to do here 11/11/08: if (indx > 0) fmtdata.StepData[this.altsubsteps[i]].AlternateName = GetStringFromByte(input, indx); + if (indx > 0) mytmp = GetStringFromByte(input, indx); + } indx = offset[arcnt]; arcnt++; @@ -2667,7 +2783,8 @@ namespace fmtxml { indx = offset[arcnt]; arcnt++; - if (indx > 0) fmtdata.StepData[i].UnderlineTheseChar = GetStringFromByte(input, indx); + if (indx > 0) + fmtdata.StepData[i].UnderlineTheseChar = GetStringFromByte(input, indx); } // not used - SubScriptTheseChar @@ -2849,7 +2966,7 @@ namespace fmtxml for (int i = 0; i < MAXSTEPS+1; i++) { - // Do base here, commented out for now - need to do one step at a time for my own sanity... + // Do base here if (i == 0) { // All types get this thru inheritance @@ -4241,7 +4358,7 @@ namespace fmtxml if (mstp.Sep == sstp.Sep) subFmt.StepData[i].Sep =null; if (mstp.Prefix == sstp.Prefix) subFmt.StepData[i].Prefix =null; if (mstp.Suffix == sstp.Suffix) subFmt.StepData[i].Suffix =null; - if (mstp.AlternateName == sstp.AlternateName) subFmt.StepData[i].AlternateName = null; + // KBR TODO if (mstp.AlternateName == sstp.AlternateName) subFmt.StepData[i].AlternateName = null; if (mstp.UnderlineTheseChar == sstp.UnderlineTheseChar) subFmt.StepData[i].UnderlineTheseChar = null; if (mstp.TabData.Font != null && sstp.TabData.Font != null) { @@ -4308,8 +4425,8 @@ namespace fmtxml if (msctlay.Separator.SeparatorLocation == ssctlay.Separator.SeparatorLocation) subFmt.SectData.StepSectionData.StpSectLayData.Separator.SeparatorLocation = 0; if (msctlay.LastLineToStartStep == ssctlay.LastLineToStartStep) subFmt.SectData.StepSectionData.StpSectLayData.LastLineToStartStep = 0; - for (int i=0; i<10; i++) - if (mainFmt.SectData.StepSectionData.TextTypeValue[i] == subFmt.SectData.StepSectionData.TextTypeValue[i]) mainFmt.SectData.StepSectionData.TextTypeValue[i] = 0; + //for (int i=0; i<10; i++) + // if (mainFmt.SectData.StepSectionData.TextTypeValue[i] == subFmt.SectData.StepSectionData.TextTypeValue[i]) mainFmt.SectData.StepSectionData.TextTypeValue[i] = 0; if (msctlay.LineDrawingOption == ssctlay.LineDrawingOption) subFmt.SectData.StepSectionData.StpSectLayData.LineDrawingOption = 0; if (msctlay.ColS == ssctlay.ColS) subFmt.SectData.StepSectionData.StpSectLayData.ColS = 0; @@ -4588,8 +4705,8 @@ namespace fmtxml if (mainFmt.PrintData.TopOfPageThing == subFmt.PrintData.TopOfPageThing) subFmt.PrintData.TopOfPageThing = null; - for (int i=0; i<10; i++) - if (msctstp.TextType[i] == ssctstp.TextType[i]) subFmt.SectData.StepSectionData.TextType[i]=null; + //for (int i=0; i<10; i++) + // if (msctstp.TextType[i] == ssctstp.TextType[i]) subFmt.SectData.StepSectionData.TextType[i]=null; //for (int i=0; i dicSteps = BuildStepDic(stpdata); @@ -4767,10 +4891,10 @@ namespace fmtxml } private void FixInheritance(ref Step step, Dictionary dicParents) { + if (CheckInheritedStr(new StepPartStr(StepPartInactive), step, dicParents)) step.Inactive = null; if (CheckInheritedStr(new StepPartStr(StepPartColOverride), step, dicParents)) step.StepTypeColOverride = null; if (CheckInheritedStr(new StepPartStr(StepPartSep), step, dicParents)) step.Sep = null; - if (CheckInheritedStr(new StepPartStr(StepPartAlternateName), step, dicParents)) step.AlternateName = null; - if (CheckInheritedStr(new StepPartStr(StepPartPrefix), step, dicParents)) step.Prefix = null; + if (CheckInheritedStr(new StepPartStr(StepPartPrefix), step, dicParents)) step.Prefix = null; if (CheckInheritedStr(new StepPartStr(StepPartSuffix), step, dicParents)) step.Suffix = null; if (CheckInheritedStr(new StepPartStr(StepPartUnderlineTheseChar), step, dicParents)) step.UnderlineTheseChar = null; if (CheckInheritedStr(new StepPartStr(StepPartVertPos), step, dicParents)) step.VertPos = null; @@ -4800,6 +4924,14 @@ namespace fmtxml if (CheckInheritedStr(new StepPartStr(StepPartEditForeColor), step, dicParents)) step.StepEditData.ForeColor = null; if (CheckInheritedStr(new StepPartStr(StepPartEditBackColor), step, dicParents)) step.StepEditData.BackColor = null; if (CheckInheritedStr(new StepPartStr(StepPartEditAcTable), step, dicParents)) step.StepEditData.AcTable = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditSearchable), step, dicParents)) step.StepEditData.Searchable = null; + // substructure - TypeMenu + if (CheckInheritedStr(new StepPartStr(StepPartEditTypeInMenu), step, dicParents)) step.StepEditData.TypeMenu.InMenu = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditTypeRnoInMenu), step, dicParents)) step.StepEditData.TypeMenu.RnoInMenu = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditTypeMenuItem), step, dicParents)) step.StepEditData.TypeMenu.MenuItem = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditTypeRnoMenuItem), step, dicParents)) step.StepEditData.TypeMenu.RnoMenuItem = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditTypeNoChg_Reason), step, dicParents)) step.StepEditData.TypeMenu.NoChgReason = null; + if (CheckInheritedStr(new StepPartStr(StepPartEditTypeAlternateNameList), step, dicParents)) step.StepEditData.TypeMenu.AlternateNameList = null; // substructure - StepPrintData if (CheckInheritedStr(new StepPartStr(StepPartPrintForeColor), step, dicParents)) step.StepEditData.ForeColor = null; if (CheckInheritedStr(new StepPartStr(StepPartPrintBackColor), step, dicParents)) step.StepEditData.BackColor = null; diff --git a/PROMS/fmtxml/TranslateFMT.XSL b/PROMS/fmtxml/TranslateFMT.XSL index 0e9fc20d..96c469f3 100644 Binary files a/PROMS/fmtxml/TranslateFMT.XSL and b/PROMS/fmtxml/TranslateFMT.XSL differ