This commit is contained in:
parent
3e2dfeb90f
commit
7e0da06b05
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
{
|
||||
|
@ -169,14 +169,14 @@ namespace fmtxml
|
||||
/*
|
||||
* The following svg group must be added for WCN2 for its box on the cover page:
|
||||
*
|
||||
<g id="B9">
|
||||
<rect x="25" y="-3" width="353" height="123" fill="none" stroke="black" stroke-width="1.2" />
|
||||
<line x1="25" y1="20" x2="378" y2="20" stroke-width="1.2" />
|
||||
<line x1="25" y1="45" x2="378" y2="45" stroke-width="1.2" />
|
||||
<line x1="25" y1="69" x2="378" y2="69" stroke-width="1.2" />
|
||||
<line x1="25" y1="93" x2="378" y2="93" stroke-width="1.2" />
|
||||
<line x1="285" y1="-5" x2="285" y2="118" stroke-width="1.2" />
|
||||
</g>
|
||||
<g id="B9">
|
||||
<rect x="4" y="-3" width="352.5" height="120" fill="none" stroke="black" stroke-width="1.2" />
|
||||
<line x1="4" y1="21" x2="355.5" y2="21" stroke-width="1.2" />
|
||||
<line x1="4" y1="45" x2="355.5" y2="45" stroke-width="1.2" />
|
||||
<line x1="4" y1="69" x2="355.5" y2="69" stroke-width="1.2" />
|
||||
<line x1="4" y1="93" x2="355.5" y2="93" stroke-width="1.2" />
|
||||
<line x1="263" y1="-3" x2="263" y2="118" stroke-width="1.2" />
|
||||
</g>
|
||||
*/
|
||||
public GenXmlToSvg(string nm, string resPath)
|
||||
{
|
||||
|
@ -19,9 +19,12 @@
|
||||
<xsl:apply-templates select="numberingsequence"/>
|
||||
<xsl:apply-templates select="IsStepSection"/>
|
||||
<xsl:apply-templates select="UseCheckOffs"/>
|
||||
<xsl:apply-templates select="oldtonew"/>
|
||||
<xsl:apply-templates select="pagestyle"/>
|
||||
<xsl:apply-templates select="dstyle|DocStructStyle|PTopRow|ContStyle|EndStyle|FinalMsg"/>
|
||||
<xsl:apply-templates select="oldtonew"/>
|
||||
<xsl:apply-templates select="CancelSectTitle"/>
|
||||
<xsl:apply-templates select="SpecialStepsFoldout"/>
|
||||
<xsl:apply-templates select="UndSpecialStepsFoldout"/>
|
||||
<xsl:apply-templates select="pagestyle"/>
|
||||
<xsl:apply-templates select="dstyle|DocStructStyle|TopMargin|ContStyle|EndStyle|FinalMsg"/>
|
||||
</DocStyle>
|
||||
</xsl:template>
|
||||
<xsl:template match="numberingsequence">
|
||||
@ -39,6 +42,21 @@
|
||||
<xsl:template match="oldtonew">
|
||||
<xsl:attribute name="OldToNew"><xsl:value-of select="."/></xsl:attribute>
|
||||
</xsl:template>
|
||||
<xsl:template match="CancelSectTitle">
|
||||
<xsl:attribute name="CancelSectTitle">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
<xsl:template match="SpecialStepsFoldout">
|
||||
<xsl:attribute name="SpecialStepsFoldout">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
<xsl:template match="UndSpecialStepsFoldout">
|
||||
<xsl:attribute name="UndSpecialStepsFoldout">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
<xsl:template match="dstyle">
|
||||
<xsl:if test="string-length(./FontFamily)+string-length(./FontSize)+string-length(./FontStyle)>0">
|
||||
<Font>
|
||||
@ -60,9 +78,9 @@
|
||||
</Font>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="PTopRow">
|
||||
<xsl:template match="TopMargin">
|
||||
<Layout>
|
||||
<xsl:attribute name="TopRow"><xsl:value-of select="."/></xsl:attribute>
|
||||
<xsl:attribute name="TopMargin"><xsl:value-of select="."/></xsl:attribute>
|
||||
<xsl:attribute name="FooterLength"><xsl:value-of select="..//FooterLen"/></xsl:attribute>
|
||||
<xsl:attribute name="PageLength"><xsl:value-of select="..//PageLength"/></xsl:attribute>
|
||||
<xsl:attribute name="PageWidth"><xsl:value-of select="..//PageWidth"/></xsl:attribute>
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user