diff --git a/PROMS/DataLoader/Formats.cs b/PROMS/DataLoader/Formats.cs index 0939271a..348dde0e 100644 --- a/PROMS/DataLoader/Formats.cs +++ b/PROMS/DataLoader/Formats.cs @@ -41,8 +41,10 @@ namespace DataLoader { try { + StreamReader srf = new StreamReader(path); xd = new XmlDocument(); - xd.Load(path); + xd.Load(srf); + //xd.Load(path); fmtdata = xd.OuterXml; } catch(Exception ex) @@ -61,8 +63,10 @@ namespace DataLoader { try { + StreamReader sr = new StreamReader(path); XmlDocument xdg = new XmlDocument(); - xdg.Load(path); + xdg.Load(sr); + //xdg.Load(path); genmacdata = xdg.OuterXml; } catch (Exception ex) @@ -89,7 +93,15 @@ namespace DataLoader } // use the format name if base or non sub. If it's a sub, remove the "_". string fname = issub ? format.Replace("_", "") : format; - Format rec = Format.MakeFormat(parent, fname, nmattr, fmtdata, genmacdata, Dts, Userid); + Format rec = null; + try + { + rec = Format.MakeFormat(parent, fname, nmattr, fmtdata, genmacdata, Dts, Userid); + } + catch (Exception ex) + { + frmMain.AddError(ex, "AddFormatToDB-make format('{0}','{1}')", parent.Name, path); + } return rec; } public void LoadAllFormats() diff --git a/PROMS/fmtxml/FmtFileToXml.cs b/PROMS/fmtxml/FmtFileToXml.cs index 90f0428c..d28fb30b 100644 --- a/PROMS/fmtxml/FmtFileToXml.cs +++ b/PROMS/fmtxml/FmtFileToXml.cs @@ -117,7 +117,7 @@ public struct XtraFlgs #region xtraflags3 // from xtra_flag array 3 // public string DONTDOLINEAFTERENDMESS // not migrated: used in ano1 // public string ENDAFTERBOXEDSTEP // not migrated: used in ano1 - public string CheckOffOnAllSteps; + // public string CheckOffOnAllSteps; // not migrated - NOT USED // public string SPECIALCHANGEBARID // not migrated: used in sce // public string STEPTABBEFORENOTEANDSTEP // not migrated: used in ano1 public string DontBoxAC; @@ -465,40 +465,55 @@ public struct Procedure [Serializable] public struct CheckOffData { + public string Menu; + public string AllowSectEdit; + public string AllowStepEdit; public int UseCheckOffsIn; public sbyte CheckOffAdjustment; /* Format flags ... */ public string DropCheckOff; - public string CheckOffOnHLSOnly; //CheckoffOnHLSOnly + public string CheckOffOnHLSOnly; + public string SkipSpaces; /* end of format flags */ - public RightCheckOffBx [] RightCheckOffBoxList; + //public RightCheckOffBx [] RightCheckOffBoxList; + public Absolute [] LayoutList; public CheckOffHeader[] CheckOffHeaderList; public CheckOff [] CheckOffList; } +//[Serializable] +//public struct RightCheckOffBx +//{ +// public int Index; +// public int RightCheckOffBox; +//} [Serializable] -public struct RightCheckOffBx +public struct Absolute { - public int Index; - public int RightCheckOffBox; + public string RnoLevel; + public int Column; } [Serializable] public struct CheckOffHeader { public int Index; - public VE_Font Font; public string CheckOffHeading; + public VE_Font Font; } [Serializable] public struct CheckOff { public int Index; - public byte RightCheckOffChars; + public byte UIMark; + public string MenuItem; + public string ExcludeInSectMenu; + public string Macro; public int CheckOffWidAdjust; - public string RightCheckOffPrompt; + public int CheckOffXtraLines; } [Serializable] public struct ChangeBar { + public string DefaultCBLoc; public string ChangeBarMessage; public Int16 FixedChangeColumn; // really flags not columns (don't convert to points public Byte FixedAERChangeColumn; @@ -518,10 +533,10 @@ public struct ChangeBar [Flags] public enum E_ChangeBarMessage : uint { - DateAndUserId = 0, - RevNumber = 1, - UserId = 2, - Nothing = 3 + DateChgID = 0, + RevNum = 1, + ChgID = 2, + None = 3 } [Flags] public enum E_EMode : uint @@ -809,7 +824,6 @@ public struct Step public string SameLevel; // RNOSameLevel public string BoldHighLevel; // BoldHighLevelRNO public string OneLineBeforeTab; // OneLineBeforeNoteCautionTab - public string CheckOffOnAllSteps; public string BoxIt; // DontBoxAC public string Boxed; // BoxContinuousActions, BoxedSubsteps public string XLines_StepFix; @@ -919,7 +933,7 @@ public struct Layout public string AlwaysUpperCase; public string PageBreakAtTypeChange; public string AlignWithParentTab; - public string RtCheckOffGroups; + //public string RtCheckOffGroups; public string StepTypeWidthOverride; } [Serializable] @@ -935,11 +949,20 @@ public struct Tab public string RNOIdentEditWid; public string RNOIdentWid; public string Justify; // from tbstyle - None, CENTER, LEFT, RIGHT - public string CheckOff; // from tbstyle - None, LEFT, RIGHT + //public string CheckOff; // from tbstyle - None, LEFT, RIGHT public string UsePreviousStyle; + public COMacro[] MacroList; public VE_Font Font; } [Serializable] +public struct COMacro +{ + public string Name; + public string Macro; + public string Grouping; + public string NotInRNO; +} +[Serializable] public struct Box { public int Index; @@ -1096,7 +1119,7 @@ namespace fmtxml public static int CONTINUOUSCHANGEBARS = 0x8000; // XtraFlag[3] from 16-bit... - public static int CHECKOFFONALLSTEPS = 0x0004; + //public static int CHECKOFFONALLSTEPS = 0x0004; public static int DONTBOXAC = 0x0020; public static int USETOPCONTINUEMESSAGEATEND = 0x0080; public static int UPCASETRANAND = 0x2000; @@ -1454,7 +1477,7 @@ namespace fmtxml public bool HasBase; public FormatData MyFormat; public string MyPath; - public FmtFileToXml(FmtFileToXml gendata, string nm, string path) + public FmtFileToXml(FmtFileToXml gendata, string alias, string nm, string path) { //DateTime tStart = DateTime.Now; MyPath = path; @@ -1466,10 +1489,10 @@ namespace fmtxml BaseFormat = gendata.MyFormat; } BuildDictionaryText(); - fmtName = nm; + fmtName = alias; //if (fmtName.ToUpper() != "CPLS" && fmtName.ToUpper() != "BASE") return; //if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE") return; - //if (fmtName.ToUpper() != "HLP" && fmtName.ToUpper() != "BASE") return; + //if (fmtName.ToUpper() != "AEP" && fmtName.ToUpper() != "BASE") return; try { LoadFormatFile(nm + ".fmt", ref SubXtraFlags); @@ -1808,7 +1831,6 @@ namespace fmtxml } else if (i == 3) { - if ((flg & CHECKOFFONALLSTEPS) > 0) XtraFlags.CheckOffOnAllSteps = true.ToString(); if ((flg & DONTBOXAC) > 0) XtraFlags.DontBoxAC = true.ToString(); if ((flg & USETOPCONTINUEMESSAGEATEND) > 0) XtraFlags.UseTopContinueMessageAtEnd = true.ToString(); if ((flg & UPCASETRANAND) > 0) XtraFlags.UpcaseTranAnd = true.ToString(); @@ -2020,7 +2042,7 @@ namespace fmtxml return (i * 12); // row_in_points = input * 72/6, row = input * 12 } string _AlternateIndex = null; - + int[] rtCheckOffGroups = new int[MAXSTEPS + 1]; public bool ReadInFmtFile(ref FormatData fmtdata, ref XtraFlgs XtraFlags, string fname) { int[] tmpshort3 = new int[3]; @@ -2152,7 +2174,13 @@ namespace fmtxml { fmtdata.StepData[0].TabData.Font = st == null ? null : st.Copy(); fmtdata.StepData[0].TabData.Justify = st == null ? "None" : st.FontJustify; - fmtdata.StepData[0].TabData.CheckOff = st == null ? "None" : st.FontCheckOff; + if (st != null && st.FontCheckOff != "None") + { + if (fmtdata.StepData[0].TabData.MacroList==null) fmtdata.StepData[0].TabData.MacroList = new COMacro[1]; + fmtdata.StepData[0].TabData.MacroList[0].Name = "CHECKOFF"; + fmtdata.StepData[0].TabData.MacroList[0].Macro = "C22"; + if (rtCheckOffGroups[0]!=0) fmtdata.StepData[0].TabData.MacroList[0].Grouping=rtCheckOffGroups[0].ToString(); + } for (int j = 0; j < MAXSTEPS; j++) { if (Tabindx[j] == -1) @@ -2160,7 +2188,15 @@ namespace fmtxml fmtdata.StepData[j + 1].TabData.UsePreviousStyle = "True"; fmtdata.StepData[j+1].TabData.Font = st == null ? null : st.Copy(); fmtdata.StepData[j+1].TabData.Justify = st == null ? "None" : st.FontJustify; - fmtdata.StepData[j+1].TabData.CheckOff = st == null ? "None" : st.FontCheckOff; + //fmtdata.StepData[j+1].TabData.CheckOff = st == null ? "None" : st.FontCheckOff; + + if (st != null && st.FontCheckOff != "None") + { + fmtdata.StepData[j + 1].TabData.MacroList = new COMacro[1]; + fmtdata.StepData[j + 1].TabData.MacroList[0].Name = "CHECKOFF"; + fmtdata.StepData[j + 1].TabData.MacroList[0].Macro = st.FontCheckOff=="Right" ? "C22":"M20"; + if (rtCheckOffGroups[j + 1] != 0) fmtdata.StepData[j + 1].TabData.MacroList[0].Grouping = rtCheckOffGroups[j + 1].ToString(); + } } } } @@ -2170,7 +2206,14 @@ namespace fmtxml { fmtdata.StepData[j+1].TabData.Font = st == null ? null : st.Copy(); fmtdata.StepData[j+1].TabData.Justify = st == null ? "None" : st.FontJustify; - fmtdata.StepData[j+1].TabData.CheckOff = st == null ? "None" : st.FontCheckOff; + //fmtdata.StepData[j+1].TabData.CheckOff = st == null ? "None" : st.FontCheckOff; + if (st != null && st.FontCheckOff != "None") + { + fmtdata.StepData[j + 1].TabData.MacroList = new COMacro[1]; + fmtdata.StepData[j + 1].TabData.MacroList[0].Name = "CHECKOFF"; + fmtdata.StepData[j + 1].TabData.MacroList[0].Macro = st.FontCheckOff == "Right" ? "C22" : "M20"; + //if (rtCheckOffGroups[j + 1] != 0) fmtdata.StepData[j + 1].TabData.MacroList[0].Grouping = rtCheckOffGroups[j + 1]; + } } } } @@ -2285,18 +2328,22 @@ namespace fmtxml fmtdata.ProcData.CoverTitleLength = brFmt.ReadInt16(); fmtdata.ProcData.CheckOffData = new CheckOffData(); - - fmtdata.ProcData.CheckOffData.RightCheckOffBoxList = new RightCheckOffBx[4]; + // for the Base format, set the Default Change bar locations from hardcoded + // data in the 16-bit program: (ovrchgbr.c) + if (!HasBase) fmtdata.ProcData.ChangeBarData.DefaultCBLoc = "0,85,-85,-3"; + int[] rightCheckOffBox = new int[4]; for (int i = 0; i < 4; i++) { - fmtdata.ProcData.CheckOffData.RightCheckOffBoxList[i].Index = i; - fmtdata.ProcData.CheckOffData.RightCheckOffBoxList[i].RightCheckOffBox = brFmt.ReadInt16(); + rightCheckOffBox[i] = brFmt.ReadInt16(); } + int DefaultCheckOffType = (rightCheckOffBox[2] > 0) ? rightCheckOffBox[2] : rightCheckOffBox[3] >> 8; + fmtdata.ProcData.CheckOffData.AllowSectEdit = DefaultCheckOffType == 1 || (rightCheckOffBox[0] > 0 || rightCheckOffBox[1] > 0) ? "True" : "False"; + fmtdata.ProcData.CheckOffData.AllowStepEdit = DefaultCheckOffType>=1?"True":"False"; tmpshort = brFmt.ReadInt16(); // TwoCheckOffs fmtdata.ProcData.CheckOffData.CheckOffList = new CheckOff[MAXCHECKOFFS]; for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].Index = i; - for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].RightCheckOffChars = brFmt.ReadByte(); - for (int i = 0; i < MAXCHECKOFFS; i++) tmpbyte = brFmt.ReadByte(); // CheckOffXtraLines + for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].UIMark = brFmt.ReadByte(); + for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].CheckOffXtraLines = brFmt.ReadByte(); // CheckOffXtraLines for (int i = 0; i < MAXCHECKOFFS; i++) fmtdata.ProcData.CheckOffData.CheckOffList[i].CheckOffWidAdjust = (int)(ColToPoints(brFmt.ReadSByte())); for (int i = 0; i < MAXCHECKOFFS; i++) tmpbyte = brFmt.ReadByte(); // CheckOffFeatures fmtdata.ProcData.CheckOffData.CheckOffHeaderList = new CheckOffHeader[MAXCHKHEADINGS]; @@ -2348,8 +2395,23 @@ namespace fmtxml fmtdata.SectData.SectionTitleLength = brFmt.ReadInt16(); tmpshort = brFmt.ReadInt16(); - for (int i = 1; i < MAXSTEPS+1; i++) fmtdata.StepData[i].StepLayoutData.RtCheckOffGroups = (brFmt.ReadInt16()).ToString(); - + rtCheckOffGroups[0]=0; + for (int i = 1; i < MAXSTEPS+1; i++) rtCheckOffGroups[i] = (brFmt.ReadInt16()); + for (int i = 1; i < MAXSTEPS + 1; i++) + { + // if the grouping is > 0, then use the 'right check off' macro WHEN there + // are more than rtCheckOffGroups[i] of the step type. + if (rtCheckOffGroups[i] != 0) + { + if (fmtdata.StepData[i].TabData.MacroList == null) + { + fmtdata.StepData[i].TabData.MacroList = new COMacro[1]; + fmtdata.StepData[i].TabData.MacroList[0].Name = "CHECKOFF"; + fmtdata.StepData[i].TabData.MacroList[0].Macro = "C22"; + } + fmtdata.StepData[i].TabData.MacroList[0].Grouping = rtCheckOffGroups[i].ToString(); + } + } for (int i = 0; i < 100; i++) tmpshort = brFmt.ReadInt16(); // TypeGroups for (int i = 0; i < 20; i++) tmpshort = brFmt.ReadInt16(); // EnhancedSubTypes; @@ -2856,13 +2918,42 @@ namespace fmtxml // not used - SubScriptTheseChar arcnt++; + bool hasMenuItem=false; for (int i = 0; i < MAXCHECKOFFS; i++) { indx = offset[arcnt]; arcnt++; - if (indx > 0) fmtdata.ProcData.CheckOffData.CheckOffList[i].RightCheckOffPrompt = GetStringFromByte(input, indx); + if (indx > 0) + { + fmtdata.ProcData.CheckOffData.CheckOffList[i].MenuItem = GetStringFromByte(input, indx); + hasMenuItem = true; + } } + if (hasMenuItem) + { + fmtdata.ProcData.CheckOffData.Menu = "Checkoff"; + for (int i=0; i< MAXCHECKOFFS; i++) + if (i>1) fmtdata.ProcData.CheckOffData.CheckOffList[i].Macro = "C"+i.ToString(); + } + // add signoff menuitems which are Endabled/Disabled & also Menu + if (rightCheckOffBox[0] != 0 && rightCheckOffBox[1] != 0) + { + fmtdata.ProcData.CheckOffData.Menu = "Signoff"; + fmtdata.ProcData.CheckOffData.CheckOffList[0].Index = 0; + fmtdata.ProcData.CheckOffData.CheckOffList[0].MenuItem = "Enabled"; + fmtdata.ProcData.CheckOffData.CheckOffList[0].Macro = "C1"; + fmtdata.ProcData.CheckOffData.CheckOffList[1].Index = 1; + fmtdata.ProcData.CheckOffData.CheckOffList[1].MenuItem = "Disabled"; + if (rightCheckOffBox[0]==-2 && rightCheckOffBox[1]==-2) fmtdata.ProcData.CheckOffData.SkipSpaces="true"; + else + { + fmtdata.ProcData.CheckOffData.LayoutList[0].RnoLevel = "0"; + fmtdata.ProcData.CheckOffData.LayoutList[0].Column = rightCheckOffBox[0]; + fmtdata.ProcData.CheckOffData.LayoutList[0].RnoLevel = "1"; + fmtdata.ProcData.CheckOffData.LayoutList[0].Column = rightCheckOffBox[1]; + } + } for (int i = 0; i < MAXCHKHEADINGS; i++) { indx = offset[arcnt]; @@ -3074,9 +3165,12 @@ namespace fmtxml { // do format flags here - this will get yucky!!! #region StepFlags + int step = 0; + try + { for (int i = 0; i < MAXSTEPS+1; i++) { - + step = i; // Do base here if (i == 0) { @@ -3114,10 +3208,6 @@ namespace fmtxml if (XtraFlags.UseSmartTemplate == "True") fmtdata.StepData[i].UseSmartTemplate = "True"; else fmtdata.StepData[i].UseSmartTemplate = "False"; - // All High get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All High get this thru inheritance if (XtraFlags.BoxContinousActions == "True") fmtdata.StepData[i].Boxed = "True"; else fmtdata.StepData[i].Boxed = "False"; @@ -3165,11 +3255,6 @@ namespace fmtxml } else if (i == 4) // And { - - // All And get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All And get this thru inheritance if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; @@ -3180,11 +3265,6 @@ namespace fmtxml } else if (i == 5) // Or { - - // All Or get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All Or get this thru inheritance if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; @@ -3216,10 +3296,6 @@ namespace fmtxml if (XtraFlags.OneLineBeforeNoteCautionTab == "True") fmtdata.StepData[i].OneLineBeforeTab = "True"; else fmtdata.StepData[i].OneLineBeforeTab = "False"; - // All Cautions get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All Cautions get this thru inheritance if (XtraFlags.ReBoxCautNote == "True") fmtdata.StepData[i].Rebox = "True"; else fmtdata.StepData[i].Rebox = "False"; @@ -3294,10 +3370,6 @@ namespace fmtxml if (XtraFlags.OneLineBeforeNoteCautionTab == "True") fmtdata.StepData[i].OneLineBeforeTab = "True"; else fmtdata.StepData[i].OneLineBeforeTab = "False"; - // All Notes get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All Notes get this thru inheritance if (XtraFlags.ReBoxCautNote == "True") fmtdata.StepData[i].Rebox = "True"; else fmtdata.StepData[i].Rebox = "False"; @@ -3356,10 +3428,6 @@ namespace fmtxml } else if (i == 8) // Table { - // All Table get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All Table get this thru inheritance if (XtraFlags.SubTableGetSup1Level == "True") fmtdata.StepData[i].SubTableGetsUp1Level = "True"; else fmtdata.StepData[i].SubTableGetsUp1Level = "False"; @@ -3374,11 +3442,6 @@ namespace fmtxml } else if (i == 11) // EquipmentList { - - // All EquipmentList get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All EquipmentList get this thru inheritance if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; @@ -3389,10 +3452,6 @@ namespace fmtxml } else if (i == 12) // Title { - // All Title get this thru inheritance - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - // All Title get this thru inheritance if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; @@ -3411,9 +3470,6 @@ namespace fmtxml } else if (i == 17) // AccPages { - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; } @@ -3456,9 +3512,6 @@ namespace fmtxml } else if (i == 25) // Default { - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; } @@ -3570,9 +3623,6 @@ namespace fmtxml if (XtraFlags.UseRNOTypeInActable == "True") fmtdata.StepData[i].UseInAcTable = "True"; else fmtdata.StepData[i].UseInAcTable = "False"; - - if (XtraFlags.NoCheckOffsInRNO == "True") fmtdata.StepData[i].CheckOffs = "False"; - else fmtdata.StepData[i].CheckOffs = "True"; } else if (i == 41) // High5 { @@ -3585,9 +3635,6 @@ namespace fmtxml } else if (i == 44) // ContAcSequential { - if (XtraFlags.CheckOffOnAllSteps == "True") fmtdata.StepData[i].CheckOffOnAllSteps = "True"; - else fmtdata.StepData[i].CheckOffOnAllSteps = "False"; - if (XtraFlags.UnderlineAfterDashSpace == "True") fmtdata.StepData[i].UnderlineAfterDashSpace = "True"; else fmtdata.StepData[i].UnderlineAfterDashSpace = "False"; } @@ -3600,6 +3647,16 @@ namespace fmtxml else if (i == 47) // ContAcParagraph { } + if (fmtdata.StepData[i].TabData.MacroList != null) + { + if (XtraFlags.NoCheckOffsInRNO == "True") fmtdata.StepData[i].TabData.MacroList[0].NotInRNO = "True"; + else fmtdata.StepData[i].TabData.MacroList[0].NotInRNO = "False"; + } + } + } + catch (Exception ex) + { + Console.WriteLine("here"); } #endregion #region StepStructLayout @@ -4105,21 +4162,24 @@ namespace fmtxml FileInfo[] fis = di.GetFiles(substr); foreach (FileInfo fi in fis) { - //this.listBox1.Items.Add(fi.Name); - fmtName = fi.Name; - fnm = MyPath + @"\" + fi.Name; - brFmt = new BinaryReader(File.Open(fnm, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite)); - FormatData subdata = new FormatData(); - success = ReadInFmtFile(ref subdata, ref SubXtraFlags, fi.Name); + if (!Form1.Excluded(fi)) + { + //this.listBox1.Items.Add(fi.Name); + fmtName = fi.Name; + fnm = MyPath + @"\" + fi.Name; + brFmt = new BinaryReader(File.Open(fnm, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite)); + FormatData subdata = new FormatData(); + success = ReadInFmtFile(ref subdata, ref SubXtraFlags, fi.Name); //OutputStepFonts(fi.Name, subdata); - if (success) - { - DoStepInheritance(ref subdata.StepData); - } - // Now do entire format inheritance - then write out. - success = CompareParentSub(fmtdata, ref subdata); - success = CompareParentSub(BaseFormat, ref subdata); - success = WriteOutXml(subdata); + if (success) + { + DoStepInheritance(ref subdata.StepData); + } + // Now do entire format inheritance - then write out. + success = CompareParentSub(fmtdata, ref subdata); + success = CompareParentSub(BaseFormat, ref subdata); + success = WriteOutXml(subdata); + } } } MyFormat = fmtdata; @@ -4503,16 +4563,9 @@ namespace fmtxml // compare step data, step index by step index. This assumes that step data between // the two indices is the same. for (int i = 0; i < MAXSTEPS; i++) - //for (int i = 0; i > 0; i++) { Step mstp = mainFmt.StepData[i]; Step sstp = subFmt.StepData[i]; - //if (i > 0) // Don't inherit base font - //{ - // _LookForChange = true; - // subFmt.StepData[i].Font = FixInheritedFont(sstp.Font, mstp.Font);// Phase 1 - // _LookForChange = false; - //} if (mstp.StepLayoutData.ForeColor == sstp.StepLayoutData.ForeColor) subFmt.StepData[i].StepLayoutData.ForeColor = null; if (mstp.StepLayoutData.BackColor == sstp.StepLayoutData.BackColor) subFmt.StepData[i].StepLayoutData.BackColor = null; if (mstp.StepLayoutData.STExtraSpace == sstp.StepLayoutData.STExtraSpace) subFmt.StepData[i].StepLayoutData.STExtraSpace = null; @@ -4526,7 +4579,6 @@ namespace fmtxml if (mstp.StepLayoutData.AlwaysUpperCase == sstp.StepLayoutData.AlwaysUpperCase) subFmt.StepData[i].StepLayoutData.AlwaysUpperCase = null; if (mstp.StepLayoutData.PageBreakAtTypeChange == sstp.StepLayoutData.PageBreakAtTypeChange) subFmt.StepData[i].StepLayoutData.PageBreakAtTypeChange = null; if (mstp.StepLayoutData.AlignWithParentTab == sstp.StepLayoutData.AlignWithParentTab) subFmt.StepData[i].StepLayoutData.AlignWithParentTab = null; - if (mstp.StepLayoutData.RtCheckOffGroups == sstp.StepLayoutData.RtCheckOffGroups) subFmt.StepData[i].StepLayoutData.RtCheckOffGroups = null; if (mstp.StepLayoutData.StepTypeWidthOverride == sstp.StepLayoutData.StepTypeWidthOverride) subFmt.StepData[i].StepLayoutData.StepTypeWidthOverride = null; if (mstp.VertPos == sstp.VertPos) subFmt.StepData[i].VertPos = null; if (mstp.DoubleSpace != null && mstp.DoubleSpace == sstp.DoubleSpace) subFmt.StepData[i].DoubleSpace = "null"; @@ -4540,7 +4592,6 @@ namespace fmtxml if (mstp.SameLevel != null && mstp.SameLevel == sstp.SameLevel) subFmt.StepData[i].SameLevel = "null"; if (mstp.BoldHighLevel != null && mstp.BoldHighLevel == sstp.BoldHighLevel) subFmt.StepData[i].BoldHighLevel = "null"; if (mstp.OneLineBeforeTab != null && mstp.OneLineBeforeTab == sstp.OneLineBeforeTab) subFmt.StepData[i].OneLineBeforeTab = "null"; - if (mstp.CheckOffOnAllSteps != null && mstp.CheckOffOnAllSteps == sstp.DoubleSpace) subFmt.StepData[i].CheckOffOnAllSteps = "null"; if (mstp.BoxIt != null && mstp.BoxIt == sstp.BoxIt) subFmt.StepData[i].BoxIt = "null"; if (mstp.Boxed != null && mstp.Boxed == sstp.Boxed) subFmt.StepData[i].Boxed = "null"; if (mstp.XLines_StepFix != null && mstp.XLines_StepFix == sstp.XLines_StepFix) subFmt.StepData[i].XLines_StepFix = "null"; @@ -4601,7 +4652,6 @@ namespace fmtxml if (mstp.TabData.RNOIdentEditWid == sstp.TabData.RNOIdentEditWid) subFmt.StepData[i].TabData.RNOIdentEditWid = null; if (mstp.TabData.RNOIdentWid == sstp.TabData.RNOIdentWid) subFmt.StepData[i].TabData.RNOIdentWid = null; if (mstp.TabData.Justify == sstp.TabData.Justify) subFmt.StepData[i].TabData.Justify = null; - if (mstp.TabData.CheckOff == sstp.TabData.CheckOff) subFmt.StepData[i].TabData.CheckOff = null; } // box data... for (int i=0; i dicParents) diff --git a/PROMS/fmtxml/FmtToXml.cs b/PROMS/fmtxml/FmtToXml.cs index 4bb26e18..0d32c35e 100644 --- a/PROMS/fmtxml/FmtToXml.cs +++ b/PROMS/fmtxml/FmtToXml.cs @@ -60,6 +60,7 @@ public struct DocStyle // 3 - within each accessory document public bool IsStepSection; // using oldtonew, determine whether is step // section or word doc section (new to 32-bit) + public bool UseCheckOffs; // This was originally in fmt. Load fmt to get public int oldtonew; // Bits for converting from old to new // document style public short ContTopHLS; // Flag for including High Level step @@ -669,6 +670,8 @@ namespace fmtxml XslCompiledTransform xsl = FmtFileToXml.getTransform(Application.StartupPath + "\\TranslatePag.XSL"); string sResults = "fmt_xml\\" + lfmtname + "p.xml"; xsl.Transform(destfile, sResults); // Perform Transform + if (lfmtname == "GEN") + File.Copy(sResults, "fmt_xml\\BASEp.xml"); // Create BASE from GEN format } catch (Exception e) { @@ -770,7 +773,7 @@ namespace fmtxml dc.ContStyle = LoadVE_Font(); dc.EndFlag = brFmt.ReadInt16(); dc.EndStyle = LoadVE_Font(); - + dc.UseCheckOffs = UseCheckOffsIn(fname.Substring(0, fname.Length - 4), dc.oldtonew); // use the string offsets to read in the strings. int[] offst = new int[strings]; for (int j = 0; j < strings; j++) @@ -820,7 +823,16 @@ namespace fmtxml XslCompiledTransform xsl = FmtFileToXml.getTransform(Application.StartupPath + "\\TranslateDoc.XSL"); string sResults = "fmt_xml\\" + lfmtname + "d.xml"; xsl.Transform(destfile, sResults); // Perform Transform - } + xsl = FmtFileToXml.getTransform(Application.StartupPath + "\\removeFmtUseCO.XSL"); + //xsl.Load(Application.StartupPath + "\\removeempty.XSL"); + string sFormatResults = "fmt_xml\\" + lfmtname + "f.xml"; + string sResults2 = "fmt_xml\\" + lfmtname + "xf.xml"; + xsl.Transform(sFormatResults, sResults2); + File.Delete(sFormatResults); + File.Move(sResults2, sFormatResults); + if (lfmtname == "GEN") + File.Copy(sResults, "fmt_xml\\BASEd.xml"); // Create BASE from GEN format + } catch (Exception e) { Console.WriteLine(e.Message); @@ -828,6 +840,26 @@ namespace fmtxml } } + private bool UseCheckOffsIn(string p, int p_2) + { + try + { + XmlDocument xdoc = new XmlDocument(); + string path = "fmt_xml\\" + p + "f.xml"; + if (!File.Exists(path)) return false; + xdoc.Load("fmt_xml\\" + p + "f.xml"); + XmlNode useCO = xdoc.SelectSingleNode("FormatData/ProcData/CheckOffData/@UseCheckOffsIn"); + if (useCO == null) return false; + int iDoc = System.Convert.ToInt32(useCO.Value); + if ((p_2 & iDoc)>0) return true; + } + catch (Exception ex) + { + Console.WriteLine("here"); + } + return false; + } + private bool ConvertToSectType(int p) { if (((p & (int)E_OldToNewSteps.S0) != 0) || ((p & (int)E_OldToNewSteps.S1) != 0) || ((p & (int)E_OldToNewSteps.S2) != 0) ||