This commit is contained in:
@@ -49,7 +49,7 @@ public struct DocStyle
|
||||
public short Index;
|
||||
public short pagestyle; // Index into page style array
|
||||
public VE_Font dstyle; // 'Printer driver styles' for the entire document
|
||||
public float PTopRow; // First 'document text' row on printed page
|
||||
public float TopMargin; // First 'document text' row on printed page/ renamed to TopMargin
|
||||
public float FooterLen; // Number of lines required for footer
|
||||
public float LeftMargin; // Size of left margin
|
||||
public float PageLength;
|
||||
@@ -63,6 +63,9 @@ public struct DocStyle
|
||||
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 bool CancelSectTitle; // Was format flags CancelSecTitlesOnS1 & CancelSecTitlesOnS2
|
||||
public bool SpecialStepsFoldout; // Was format flag SpecialStepsFoldout - but put on E2 (was in 16bit code)
|
||||
public bool UndSpecialStepsFoldout; // Was format flag UndSpecialStepsFoldout - but put here on E2 only.
|
||||
public short ContTopHLS; // Flag for including High Level step
|
||||
// as part of top continue message.
|
||||
public float CTMargin; // Margin for top message
|
||||
@@ -481,6 +484,7 @@ namespace fmtxml
|
||||
{
|
||||
MyPath = path;
|
||||
fmtName = nm;
|
||||
//if (fmtName.ToUpper() != "OHLP" && fmtName.ToUpper() != "BASE" && fmtName.ToUpper() != "WCN2") return;
|
||||
try
|
||||
{
|
||||
// get the default base & plant files to use when figuring out inheritance.
|
||||
@@ -754,6 +758,17 @@ namespace fmtxml
|
||||
|
||||
// read in title.
|
||||
string fnm = MyPath + @"\" + fname;
|
||||
// construct format file name from this path.\
|
||||
string fmtFileName = fname;
|
||||
if (fname.Contains(".Y"))
|
||||
{
|
||||
// subformat - replace .Y with .X
|
||||
fmtFileName = MyPath + @"\" + fname.Replace(".Y", ".X");
|
||||
}
|
||||
else
|
||||
{
|
||||
fmtFileName = MyPath + @"\" + fname.Substring(0, fname.IndexOf(".")) + ".FMT";
|
||||
}
|
||||
if (fname == "CPL.Y01") Console.WriteLine(fname);
|
||||
brFmt = new BinaryReader(File.Open(fnm,System.IO.FileMode.Open,System.IO.FileAccess.ReadWrite,FileShare.ReadWrite));
|
||||
dcstyles.Name = GetAsciiString(brFmt);
|
||||
@@ -784,7 +799,7 @@ namespace fmtxml
|
||||
dcs[1].dstyle = dcs[0].dstyle.Copy();
|
||||
dcs[2].dstyle = dcs[0].dstyle.Copy();
|
||||
dcs[3].dstyle = dcs[0].dstyle.Copy();
|
||||
dcs[0].PTopRow = dcs[1].PTopRow = dcs[2].PTopRow = dcs[3].PTopRow = brFmt.ReadInt16();
|
||||
dcs[0].TopMargin = dcs[1].TopMargin = dcs[2].TopMargin = dcs[3].TopMargin = brFmt.ReadInt16();
|
||||
dcs[0].LeftMargin = dcs[1].LeftMargin = dcs[2].LeftMargin = dcs[3].LeftMargin = brFmt.ReadInt16();
|
||||
dcs[0].PageLength = brFmt.ReadInt16();
|
||||
dcs[1].PageLength = brFmt.ReadInt16();
|
||||
@@ -820,13 +835,14 @@ namespace fmtxml
|
||||
dc.pagestyle = brFmt.ReadInt16();
|
||||
uint tmpstyle = brFmt.ReadUInt32();
|
||||
dc.dstyle = new VE_Font(tmpstyle);
|
||||
dc.PTopRow = RowToPoints(brFmt.ReadInt16());
|
||||
dc.TopMargin = RowToPoints(brFmt.ReadInt16());
|
||||
dc.FooterLen = RowToPoints(brFmt.ReadInt16());
|
||||
dc.LeftMargin = ColToPoints(brFmt.ReadInt16(), tmpstyle);
|
||||
dc.PageLength = RowToPoints(brFmt.ReadInt16());
|
||||
dc.PageWidth = ColToPoints(brFmt.ReadInt16(), tmpstyle);
|
||||
dc.numberingsequence = brFmt.ReadInt16();
|
||||
dc.oldtonew = brFmt.ReadInt32();
|
||||
SetupDocStyleFromFmtFlags(ref dc, fmtFileName);
|
||||
dc.IsStepSection = ConvertToSectType(dc.oldtonew);
|
||||
dc.ContTopHLS = brFmt.ReadInt16();
|
||||
dc.CTMargin = RowToPoints(brFmt.ReadInt16());
|
||||
@@ -849,6 +865,11 @@ namespace fmtxml
|
||||
else dc.ContBottom = null;
|
||||
if (offst[2] != 0) dc.EndString = DoReplaceTokens(GetAsciiStringUntilNull(brFmt));
|
||||
else dc.EndString = null;
|
||||
if (dc.EndString == "")
|
||||
{
|
||||
dc.EndString = null;
|
||||
dc.EndFlag = 0;
|
||||
}
|
||||
if (offst[3] != 0) dc.FinalMsg = DoReplaceTokens(GetAsciiStringUntilNull(brFmt));
|
||||
else dc.FinalMsg = null;
|
||||
if (dc.ContTop == null && dc.ContBottom == null) dc.ContStyle = null;
|
||||
@@ -921,6 +942,63 @@ namespace fmtxml
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void SetupDocStyleFromFmtFlags(ref DocStyle dc, string fmtFileName)
|
||||
{
|
||||
int oldToNew = dc.oldtonew;
|
||||
BinaryReader brFmt = new BinaryReader(File.Open(fmtFileName, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, FileShare.ReadWrite));
|
||||
int[] tmpshort3 = new int[3];
|
||||
ArrayList stringoffsets = new ArrayList();
|
||||
byte tmpbyte;
|
||||
Int16 tmpshort;
|
||||
string tmpstr;
|
||||
try
|
||||
{
|
||||
tmpshort = brFmt.ReadInt16();
|
||||
tmpstr = fmtxml.FmtFileToXml.GetStringUntilNull(brFmt);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
tmpshort = brFmt.ReadInt16();
|
||||
tmpstr = fmtxml.FmtFileToXml.GetStringUntilNull(brFmt);
|
||||
}
|
||||
|
||||
short vnum = brFmt.ReadInt16(); // number of ints, etc.
|
||||
long posatints = brFmt.BaseStream.Position;
|
||||
long tstloc = vnum + posatints;
|
||||
tmpbyte = brFmt.ReadByte(); // FirstChar
|
||||
Int16[] xtraflag = new Int16[19];
|
||||
for (int i = 0; i < 19; i++)
|
||||
{
|
||||
xtraflag[i] = brFmt.ReadInt16();
|
||||
}
|
||||
dc.CancelSectTitle = CheckSectType(oldToNew, xtraflag);
|
||||
dc.SpecialStepsFoldout = GetSpecialStepsFoldout(oldToNew, xtraflag);
|
||||
dc.UndSpecialStepsFoldout = GetUndSpecialStepsFoldout(oldToNew, xtraflag);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Console.WriteLine("Didn't process docstyle");
|
||||
}
|
||||
}
|
||||
|
||||
private bool GetUndSpecialStepsFoldout(int oldToNew, Int16[] flg)
|
||||
{
|
||||
if (((oldToNew & (int)E_OldToNewSteps.E2) != 0) && ((flg[10] & fmtxml.FmtFileToXml.UNDSPECIALSTEPSFOLDOUT) > 0)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool GetSpecialStepsFoldout(int oldToNew, Int16[] flg)
|
||||
{
|
||||
if (((oldToNew & (int)E_OldToNewSteps.E2) != 0) && ((flg[7] & fmtxml.FmtFileToXml.SPECIALSTEPSFOLDOUT) > 0)) return true;
|
||||
return false;
|
||||
}
|
||||
private bool CheckSectType(int oldToNew, Int16[] flg)
|
||||
{
|
||||
if (((oldToNew & (int)E_OldToNewSteps.S2) != 0) && ((flg[6] & fmtxml.FmtFileToXml.CANCELSECTITLESONS2) > 0)) return true;
|
||||
if (((oldToNew & (int)E_OldToNewSteps.S1) != 0) && ((flg[7] & fmtxml.FmtFileToXml.CANCELSECTITLESONS1) > 0)) return true;
|
||||
if (((oldToNew & (int)E_OldToNewSteps.E0) != 0) && ((flg[11] & fmtxml.FmtFileToXml.CANCELSECTITLESONE0) > 0)) return true;
|
||||
if (((oldToNew & (int)E_OldToNewSteps.E2) != 0) && ((flg[11] & fmtxml.FmtFileToXml.CANCELSECTITLESONE2) > 0)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool ConvertToSectType(int p)
|
||||
{
|
||||
|
Reference in New Issue
Block a user