Adjustments for NSP EOP and AOP formats

Modified font inheritance logic and disable inheritance logic for PageList items – see comment in the code
This commit is contained in:
John Jenko 2013-02-12 17:46:57 +00:00
parent 3862704bc9
commit eba3b28c49
2 changed files with 137 additions and 23 deletions

View File

@ -108,6 +108,7 @@ namespace fmtxml
fmtdata.StepData[6].TabData.Bullet.Font.FontFamily = "Prestige Elite Tall";
fmtdata.StepData[6].TabData.Bullet.Font.FontSize = "10";
fmtdata.StepData[6].TabData.Bullet.Font.FontStyle = "None";
fmtdata.StepData[6].WidthOverride = "421";
// Note (original 16-bit font)
fmtdata.StepData[7].Font.FontFamily = "Prestige Elite Tall";
@ -121,6 +122,7 @@ namespace fmtxml
fmtdata.StepData[7].TabData.Bullet.Font.FontFamily = "Prestige Elite Tall";
fmtdata.StepData[7].TabData.Bullet.Font.FontSize = "10";
fmtdata.StepData[7].TabData.Bullet.Font.FontStyle = "None";
fmtdata.StepData[7].WidthOverride = "401";
//// Cautions use Arial Font for Tab (instead of Script) and
//// any bullets following the tab are at a different point size
@ -135,6 +137,7 @@ namespace fmtxml
//fmtdata.StepData[6].TabData.Bullet.Font.FontFamily = "Arial";
//fmtdata.StepData[6].TabData.Bullet.Font.FontSize = "10";
//fmtdata.StepData[6].TabData.Bullet.Font.FontStyle = "Bold";
//fmtdata.StepData[6].WidthOverride = 421;
////fmtdata.StepData[20] = fmtdata.StepData[6];
////fmtdata.StepData[20].Type = "Caution1";
@ -212,6 +215,7 @@ namespace fmtxml
//fmtdata.StepData[7].TabData.Ident = "Note ";
//fmtdata.StepData[7].TabData.RNOIdent = "Note ";
////fmtdata.StepData[7].TabData.IdentWid = "65.4";
//fmtdata.StepData[7].WidthOverride = 401;
////fmtdata.StepData[22] = fmtdata.StepData[7];
////fmtdata.StepData[22].Type = "Note1";
@ -323,6 +327,12 @@ namespace fmtxml
case "NSP.PAG":
AddNSPPage(ref pgstyles);
break;
case "NSPAB.PAG":
AddNSPABPage(ref pgstyles);
break;
case "NSPAB.Z01":
AddNSPABPage_Z01(ref pgstyles);
break;
case "SHE.PAG":
AddSHEPage(ref pgstyles);
break;
@ -373,6 +383,80 @@ namespace fmtxml
pgstyles.PgStyles[8].Items[1].Col = -16; // {HEADER1}
pgstyles.PgStyles[8].Items[5].Col = -16; // {BOX4}
}
private void AddNSPABPage(ref PageStyles pgstyles)
{
//Procedure Steps
//{PS-CONFSTATE}
pgstyles.PgStyles[0].Items[1].Col = 294;
//{COVERPROCTITLE}
pgstyles.PgStyles[0].Items[6].Col = 293;
//{EOPNUM}
pgstyles.PgStyles[0].Items[7].Col = 505;
//{REV}
pgstyles.PgStyles[0].Items[8].Col = 513;
//Page {PAGE} of {OF}
pgstyles.PgStyles[0].Items[9].Col = 513;
//{PS-CONFSTATE}
pgstyles.PgStyles[0].Items[10].Col = 287;
//Purpose and Entry
//{PS-CONFSTATE}
pgstyles.PgStyles[1].Items[1].Col = 287;
//{COVERPROCTITLE}
pgstyles.PgStyles[1].Items[5].Col = 293;
//{EOPNUM}
pgstyles.PgStyles[1].Items[6].Col = 505;
//{REV}
pgstyles.PgStyles[1].Items[7].Col = 513;
//Page {PAGE} of {OF}
pgstyles.PgStyles[1].Items[8].Col = 513;
//{PS-CONFSTATE}
pgstyles.PgStyles[1].Items[9].Col = 287;
//Cover Page
//{PS-CONFSTATE}
pgstyles.PgStyles[2].Items[1].Col = 250;
//{COVERPROCTITLE}
pgstyles.PgStyles[2].Items[6].Col = 249;
//{EOPNUM}
pgstyles.PgStyles[2].Items[7].Col = 511;
//{REV}
pgstyles.PgStyles[2].Items[8].Col = 513;
//Page {PAGE} of {OF}
pgstyles.PgStyles[2].Items[9].Col = 507;
//{PS-CONFSTATE}
pgstyles.PgStyles[2].Items[13].Col = 250;
}
private void AddNSPABPage_Z01(ref PageStyles pgstyles)
{
//Background Text - First Page
//{PS-CONFSTATE}
pgstyles.PgStyles[0].Items[1].Col = 294;
//{COVERPROCTITLE}
pgstyles.PgStyles[0].Items[5].Col = 292;
//{EOPNUM}
pgstyles.PgStyles[0].Items[6].Col = 505;
//{REV}
pgstyles.PgStyles[0].Items[7].Col = 513;
//Page {PAGE} of {OF}
pgstyles.PgStyles[0].Items[8].Col = 512;
//{PS-CONFSTATE}
pgstyles.PgStyles[0].Items[12].Col = 287; // 294;
//Background Text - Blank Page
//{PS-CONFSTATE}
pgstyles.PgStyles[1].Items[1].Col = 294;
//{COVERPROCTITLE}
pgstyles.PgStyles[1].Items[5].Col = 292;
//{EOPNUM}
pgstyles.PgStyles[1].Items[6].Col = 505;
//{REV}
pgstyles.PgStyles[1].Items[7].Col = 513;
//Page {PAGE} of {OF}
pgstyles.PgStyles[1].Items[8].Col = 512;
//{PS-CONFSTATE}
pgstyles.PgStyles[1].Items[10].Col = 287; // 294;
}
private void AddRGESam1Page(ref PageStyles pgstyles)
{
// CoverPage - add the Revision to the pagelist

View File

@ -651,7 +651,7 @@ namespace fmtxml
}
}
bool didLineDraw = false;
for (short i=0;i<numpgstyles;i++)
for (short i = 0; i < numpgstyles; i++)
{
PageStyle pg = new PageStyle();
pg.Index=i;
@ -738,7 +738,17 @@ namespace fmtxml
}
if (didNewPageStyle) pgs[numpgstyles] = AddPageStyles(fname);
brFmt.Close();
DoPSFontInherit(ref pgstyles);
// Don't do the font inheritance for the pagelist
// you can have multiple docsytles point/use the same pagelist,
// with each docstyle having different default font information.
// The DoPSFontInherit() was calucating the font inheritance based on the font
// set to the overall format, but the PROMS print module checks the docstyle default font
// In NSP's case, the overall format uses an Arial font, the pagelist item uses
// an Arial font, but the docstyle default font is Prestige Elite Tall.
// the results from DoPSFontInherit() kept only the font size and style for the pagelist item.
// the print module then ended up using Prestige Elite Tall instead of Arial for that pagelist item
// - jsj 02/11/13
//DoPSFontInherit(ref pgstyles);
AddPlantSpecific(fname, ref pgstyles);
// First serialize files based on the above - then use xsl to transform
@ -1340,40 +1350,60 @@ namespace fmtxml
}
return true;
}
private void CompareFonts(VE_Font parFont, ref VE_Font subFont)
private bool CompareFonts(VE_Font parFont, ref VE_Font subFont)
{
bool rtval = false;
if (parFont != null && subFont != null)
{
if (parFont.FontFamily == subFont.FontFamily) subFont.FontFamily = null;
if (parFont.FontSize == subFont.FontSize) subFont.FontSize = null;
if (parFont.FontStyle == subFont.FontStyle) subFont.FontStyle = null;
if (parFont.CPI == subFont.CPI) subFont.CPI = null;
}
}
private void DoPSFontInherit(ref PageStyles pagstyles)
{
for (int i=0; i<pagstyles.PgStyles.Length; i++)
{
for (int j = 0; j < pagstyles.PgStyles[i].Items.Length; j++)
if (parFont.FontFamily == subFont.FontFamily)
{
CompareFonts(DefPlantFont, ref pagstyles.PgStyles[i].Items[j].Style);
CompareFonts(DefBaseFont, ref pagstyles.PgStyles[i].Items[j].Style);
subFont.FontFamily = null;
rtval = true;
}
if (rtval && parFont.FontSize == subFont.FontSize)
{
subFont.FontSize = null;
}
if (rtval && parFont.FontStyle == subFont.FontStyle)
{
subFont.FontStyle = null;
}
if (rtval && parFont.CPI == subFont.CPI)
{
subFont.CPI = null;
}
}
return rtval;
}
//private void DoPSFontInherit(ref PageStyles pagstyles)
//{
// for (int i=0; i<pagstyles.PgStyles.Length; i++)
// {
// for (int j = 0; j < pagstyles.PgStyles[i].Items.Length; j++)
// {
// bool doInheritance;
// doInheritance = CompareFonts(DefPlantFont, ref pagstyles.PgStyles[i].Items[j].Style);
// if (doInheritance)
// CompareFonts(DefBaseFont, ref pagstyles.PgStyles[i].Items[j].Style);
// }
// }
//}
private void DoDSFontInherit(ref DocStyles docstyles)
{
// loop through all of the document styles. For each, check font inheritance
// for End Message Style, Continue Message Style & main document style.
for (int i=0; i<docstyles.DcStyles.Length; i++)
{
CompareFonts(docstyles.DcStyles[i].dstyle, ref docstyles.DcStyles[i].EndStyle);
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].EndStyle);
CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].EndStyle);
CompareFonts(docstyles.DcStyles[i].dstyle, ref docstyles.DcStyles[i].ContStyle);
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].ContStyle);
CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].ContStyle);
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].dstyle);
bool doInheritance;
doInheritance =CompareFonts(docstyles.DcStyles[i].dstyle, ref docstyles.DcStyles[i].EndStyle);
if (doInheritance)
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].EndStyle);
if (doInheritance)
CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].EndStyle);
if (doInheritance)
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].ContStyle);
if (doInheritance)
CompareFonts(DefPlantFont, ref docstyles.DcStyles[i].dstyle);
// The default font for the DocStyle only inherit from the Plant Format not from Base format
// This allows pagelist items to inherit from the section's default font setting when printing.
//CompareFonts(DefBaseFont, ref docstyles.DcStyles[i].dstyle);